#995670 ITP: zig -- General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software

#995670#5
Date:
2021-10-03 21:18:59 UTC
From:
To:
* Package name    : ziglang
  Version         : 0.8.1
  Upstream Author : Andrew Kelley andrew@ziglang.org
* URL             : https://ziglang.org
* License         : MIT
  Programming Lang: Zig
  Description     : General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software

Zig is quickly become a new hot language, and there is growing demand for it
to be available in mainline repositories.

There is a ticket on the Zig repo: https://github.com/ziglang/zig/issues/7340
which requests for mainline packages to be available, and the upstream
maintainer replied that it is out of scope of their repository. I would like to
volunteer to package this and maintain it so it is available easily. Others are
making similar efforts in other distributions such as Fedora.

I also have a package which pulls the release and packs it using checkinstall
at https://github.com/compscidr/zig-deb which is currently hosted from a
3rd party gemfury repository.

For now I am happy to maintain myself, but would more than welcome anyone who
would like to form a pkg-zig team (unless people feel there is a more
appropriate team this could fit into. Co-maintainers are also welcome. I do
need a sponsor, this is my first time participating.

#995670#10
Date:
2021-10-05 00:20:09 UTC
From:
To:
Please make sure the package is built solely from the source from
scratch without any existing binaries using the upstream supported
bootstrap process:

https://github.com/ziglang/zig-bootstrap/

Personally, I think merging zig-bootstrap into the zig source repo
would make it easier for distros to use, but I hear upstream isn't
interested in that.

#995670#15
Date:
2021-10-09 19:34:02 UTC
From:
To:
Hi pabs,

Upstream is definitely interested in cooperating with Debian maintainers
to the benefit of our shared users :-)

I'm happy to discuss this suggestion. Here is some information to help
us sort this out:

  * zig-bootstrap contains copy+pasted upstream sources from
    - LLVM, LLD, Clang
      - There is currently 1 tiny patch to LLD's build script to adjust
an include directory to depend on something inside zig-bootstrap rather
than to an external directory
      - There are also some deleted files which is merely an attempt to
reduce tarball size; these could be restored to no harmful effect.
    - Zig (no patches)
    - zlib (no patches)

  * Apart from this, the *only* utility that zig-bootstrap provides is a
short build script, which does the following process:
    - Build LLVM, Clang, LLD, zlib, zig from source, for the host system
    - Using freshly built native zig, use `zig cc`/`zig c++` to rebuild
LLVM, Clang, LLD, zlib, and zig again, from source, for the target system

This is useful for upstream to provide portable binaries of Zig,
however, I suspect that there is a better strategy which is more
compatible with Debian's guidelines. In fact, I have been keeping
Debian-friendliness in mind since the very beginning. I suspect you will
actually find the main build process more amenable to packaging.

In the main upstream repository (https://github.com/ziglang/zig/), it is
a standard cmake build that I believe is already Debian-compatible. I am
guessing you found the zig-bootstrap repository because you wanted to
avoid depending on a zig binary to build zig; what you may not realize
is that the main zig repository *does not utilize a zig binary* to be
built. In fact, the main cmake build process does the following things:

  * Use the system C++ compiler to build zig0 executable using system
LLVM, LLD, Clang, zlib libraries
  * Use the freshly built zig0 executable to build zig1.o
  * Re-link some of the build artifacts, swapping in zig1.o, producing
the zig binary

I believe this is exactly what a Debian package wants, because you will
end up with a binary that
  * Uses the system LLVM, LLD, Clang, zlib libraries
  * Was built with the system C/C++ compiler and linker

I suggest to try out the main, standard way of building Zig and let me
know if you run into any trouble. I suspect the main issues will be:

  * deps/SoftFloat-3e is a vendored library. I would be happy to improve
the cmake build script to enable an option to prefer the system
SoftFloat library instead.

  * lib/libcxx, lib/libcxxabi, lib/libunwind, lib/tsan and lib/include
are copy+pasted (MIT-compatibly licensed) from other upstreams, and
there are quite a few patches and preprocessing which is part of the zig
development process. I am hoping that Debian can grant zig an exception
for these files and not require them to be built by a debian package.
These files are part of the "magic" that makes zig attractive in the
first place, and although these files may look like they should be
provided by other debian packages, I think if you examine closely you
will find that they are really derived works that are part of the zig
project.

I hope this helps. I am happy to work together on this :-)

Warm regards,
Andrew

#995670#20
Date:
2021-10-09 20:02:31 UTC
From:
To:
So far I have a working build from the main zig repo for amd64, using the
llvm, clang and lld from the debian repos (although this is only possible
in sid because version 12 isn't present in the stable releases).
I've been doing it via docker to ensure a clean build environment:
https://github.com/compscidr/zig-deb/tree/debian-pkg/debian-pkg

It generates all of the needed files, and sings the package according to
guides I've been following from the mentors / maintainers websites.

I think I have figured out how to also produce cross-compiled packages for
other arches using pbuilder, but I'll have to abandon my docker approach
since it doesn't seem to work well with it. Planning on abandoning the
docker approach and using a debian VM in virtualbox (I typically use
Ubuntu).

I'm guessing in order to work in non-sid debian, I'll have to pull in the
actual llvm, lld, and clang sources like the bootstrap repo does. I'm
guessing these also need to be packaged in the debian source package too?

One thing I haven't tried is just using zig itself to do the cross
compiling.

Andrew, happy to work with you on this, if you like instead of dev-ing this
in my own repo, I can make a branch in either the main zig repo, or the
bootstrap repo - whichever you'd prefer. Also happy to jump on a quick call
to discuss.

Jason

#995670#25
Date:
2022-01-19 01:31:29 UTC
From:
To:
Hi,

I just discovered this ITP bug report. I have also started working on
making a zig Debian package. So far I've been able to generate a zig
0.9.0 package on bullseye after backporting llvm-13 from testing.

I had not originally planned for this to be an official package for
Debian, I just wanted a working zig on my system so that I could compile
(and package) the river wayland compositor.

I thought I should speak up in case I can be of some help with the
official packaging efforts.

You can find my package at https://github.com/NickHastings/zig-debian
and https://mentors.debian.net/package/zig/

Regards,

Nick.

#995670#34
Date:
2022-06-02 20:32:36 UTC
From:
To:
Hi,

Jason, you would have to provide a source package (.dsc + referenced files) somewhere,
which is a complete thing for Debian folks. This is the condition to find a sponsor.
I have not looked at your approach because it is unfamiliar.

I have had a look at what Nick provided and this seems to be reasonable enough to take a closer look.
The build log looks like you took the approach that Andrew described.

Jason, would you be willing to hand over the ITP to Nick so that we can make zig happen for bookworm?
Nick, in case Jason does not reply in three weeks please take this over and address this ITP with your changelog.

Thanks,
Bastian

#995670#39
Date:
2022-06-02 20:41:20 UTC
From:
To:
Yes no problem!
#995670#44
Date:
2022-06-02 20:47:28 UTC
From:
To:
Okay then; Nick, please file a RFS on sponsorship-requests when you have provided an upload with the changelog addition.
#995670#51
Date:
2022-06-03 00:06:26 UTC
From:
To:
Hi Bastian,

thanks for taking an interest in this and getting it moving along.

* Bastian Germann <bage@debian.org> [220603 05:47]:

I've updated the changelog and uploaded again to m.d.n.
https://mentors.debian.net/package/zig/

I can file an RFS on the sponsorship-requests list, but I'm a slightly
unsure because https://mentors.debian.net/sponsors/rfs-howto/ describes
a different way to do this. It says to file a new bug against the
sponsorship-requests pseudo-package.

Can you please confirm which is the correct or best way to do this?

Thanks,

Nick.

#995670#56
Date:
2022-06-03 00:09:54 UTC
From:
To:
Am 03.06.22 um 02:06 schrieb Nick Hastings:

There is no difference between my suggestion and the mentors template.
Yes, sponsorship-requests is a pseudo package and I meant exactly that.

#995670#63
Date:
2022-08-10 18:53:24 UTC
From:
To:
 Hello, what's the current status of the Zig package for the Debian
official repository ?

#995670#68
Date:
2022-08-11 00:01:26 UTC
From:
To:
Hi,

* Henrique Almeida <hdante@gmail.com> [220811 03:57]:

I've filed a request for a sponsor
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012286

Other than not have a sponsor, the two main issues I see are:

1. Some of the post build tests fail.
Checking on zig issues and IRC it seems not so unusual for some tests to
fail in certain situations. I'm not sure how worthwhile it is chasing
down these issues before zig reaches 1.0.0.

2. The copyright file.
With so much bundled source code from different projects it's quite
challenging to write a correct copyright file. I've put considerable
time into this, but it is horribly tedious and boring work. Without a
sponsor to get zig into Debian I could just be completely wasting my
time.

Cheers,

Nick.

#995670#75
Date:
2022-12-02 17:40:47 UTC
From:
To:
The package got removed from mentors.
Nick, do you still have time to work on it? If not please make this a RFP.

#995670#80
Date:
2022-12-03 23:55:38 UTC
From:
To:
Hi Bastian,

* Bastian Germann <bage@debian.org> [221203 02:45]:

Yes, no one sponsored it.

I think I have time. Zig 0.10.0 was just released and I'm updating the
package for it. Hope to upload to mentors soon.

I think the biggest problem is still the copyright file. I tried using
scancode but it seems that d/copyright output option is still a work in
progress.

Without a sponsor the package can't enter Debian so I don't want to
spend the many tedious hours required to manually produce a correct
copyright file if it will not be used. If/when there is indication that
someone may sponsor this package I can look to put more time/effort into
the d/copyright.

Regards,

Nick.

#995670#85
Date:
2022-12-04 00:02:35 UTC
From:
To:
Am 04.12.22 um 00:55 schrieb Nick Hastings:

With the copyright in place I will sponsor it. Please notify me when you think you have represented the applicable
licenses completely and I will review it.

#995670#90
Date:
2022-12-05 02:06:48 UTC
From:
To:
Hi Bastian,

* Bastian Germann <bage@debian.org> [221204 09:02]:

Many thanks for stepping forward for this.

I started looking at the copyright again and have some questions. I'm
not sure if the discussion should continue here in this bug report or if
it is better to take it "offline" to be just with you as the potential
sponsor.

Thanks,

Nick.

#995670#95
Date:
2022-12-05 23:26:35 UTC
From:
To:
Hi,

I did some more work on the copyright file, I think it may be ready to
be reviewed. The package is now again at
https://mentors.debian.net/package/zig/

I looked at updating to Zig 0.10.0 (released Oct 31). However, there are
significant changes to the build between 0.9.1 and 0.10.0.  Release
notes are at https://ziglang.org/download/0.10.0/release-notes.html

Zig 0.9.1 simply built a Zig compiler using the system provided compiler
and libraries. This new release attempts to do a self hosted build.
Details are at
https://ziglang.org/download/0.10.0/release-notes.html#Self-Hosted-Compiler

There are three stages to the 0.10.0 build. As I understand them, they
are:

1. Build a zig compiler using system compilers and libraries (similar to
   0.9.1).

2. Use the zig compiler from stage 1 to build a zig compiler from zig
   bundled libraries.

3. Repeat stage 2 using the zig compiler in produced in stage 2.

Attempting this on Debian unstable (and also on bullseye with backported
llvm-15) resulted in a failure at stage 2. It seems the build was not
able to find a particular header file. There may be other problems too,
but I did not investigate further.

The release notes actually suggest waiting until Zig 0.10.1 or Zig
0.11.0 before upgrading from 0.9.1. It seems there will be even larger
changes to the build system for Zig 0.11.0 so I'm not sure how much
effort upstream will be put into fixing build related issues in 0.10.0.

So, at this point I think it may be best to wait for the next release
before attempting to update this package.

Regards,

Nick.

#995670#100
Date:
2023-06-19 21:38:01 UTC
From:
To:
Hey folks o/,

What's the status of this ITP? It seems like Nick is pulling a
considerable amount of work himself. I would personally love to see Zig
in the Debian archives so I am ready to volunteer some of my time
towards the effort.

I feel we can move the work for this package to salsa if no one has any
issues.

Best,
Abraham

#995670#105
Date:
2023-06-19 23:18:31 UTC
From:
To:
Hi,

* Abraham Raji <work@abrahamr.in> [230620 06:38]:

I filed an RFS bug
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012286
There was some progress and some interest from a potential sponsor but
it seems that the copyright file has become a road block.

My zig package is up to date with the current version of zig 0.10.1 and
this version of zig can bootstrap. However, it seems that the next
planned release of zig will not be able to bootstrap (in the usual
sense). See for example https://ziglang.org/news/goodbye-cpp/

Cheers,

Nick.

#995670#110
Date:
2023-06-19 23:37:03 UTC
From:
To:
* Nick Hastings <nicholaschastings@gmail.com> [230620 08:18]:

While that statement is true, the link is clearly not the intended one.
https://salsa.debian.org/nickh/zig

Nick.

#995670#115
Date:
2023-06-20 07:52:46 UTC
From:
To:
What exactly is the roadblock? Is it just a matter of going through each
of the files and adding the entries? Or is there a licensing issue here?
Asking because for the first we can always try and get more people to
help out.

 > My package is on salsa: https://github.com/NickHastings/zig-debian

I have created a zig-team namespace on salsa and I've invited you there.
We can move the packaging work there as it will make it easier for
potential contributors to find it.

Also is there any particular reason you are only committing the debian
directory?

- Abraham

#995670#120
Date:
2023-06-20 08:24:48 UTC
From:
To:
Hi,

* Abraham Raji <work@abrahamr.in> [230620 16:53]:

As far as I know the d/copyright file covers everything.

I don't think there is a licensing issue.

It is the specifics of the d/copyright file I produced. Please see the
RFS bug for details.

That would be nice.


I joined it.

That is all that exists in the repo. Builds are done by downloading the
source with uscan with the info from the d/watch file. I did try to look
into keeping upstream in the same repo but I didn't find a clear path
forward. So I just stuck with what I am currently doing since it works
and from the documentation I have read is not "incorrect". If you could
recommend specific documentation for this I can have a look.

Cheers,

Nick.

#995670#125
Date:
2023-06-20 08:37:47 UTC
From:
To:
Will take a look. Thanks.

Great let's get the zig package there.
a sample ruby package for reference[0]. The approach is to keep the
upstream files and tar ball deltas in separate branches (upstream and
pristine-tar). The tooling makes maintaining this pretty seamless.
Please take a look at these page for more information:
- https://wiki.debian.org/SimplePackagingTutorial
- https://wiki.abrahamraji.in/simple-packaging-tutorial.html

[0]: https://salsa.debian.org/ruby-team/atig

Best,
Abraham

#995670#130
Date:
2023-06-20 09:20:08 UTC
From:
To:
Hi,

* Abraham Raji <work@abrahamr.in> [230620 17:37]:

Done.

I see. I'll  try to have a look.

I'm familiar with this level of packaging.

IIRC when I tried to look at a "proper" packaging work flow using git
there did not appear to be a "correct" way to do it. Multiple different
approaches only quite briefly documented. Perhaps without much
information about why particular things were done, and seemingly to
expecting knowledge of the other approaches.

Cheers,

Nick.

#995670#135
Date:
2023-06-20 13:55:19 UTC
From:
To:
In Debian there is no one correct way of doing things. It's just a
matter of taste and preferences. The git packaging conventions used by
the ruby team are tried and tested and in my opinion pretty elegant.

Anyways this seems like a good start.

Best,
Abraham

#995670#140
Date:
2023-06-21 06:05:48 UTC
From:
To:
I think this might be what you are looking for:
https://dep-team.pages.debian.net/deps/dep14/

Best,
Abraham

#995670#145
Date:
2024-01-17 02:37:40 UTC
From:
To:
Hi Nick,

Are you still working on the zig package?
I'd be happy to help you fix any problems that remain.

Kind regards,
Maytham

#995670#152
Date:
2024-01-20 04:58:47 UTC
From:
To:
Hi,

* Maytham Alsudany <maytha8thedev@gmail.com> [240117 11:37]:

I updated the package to Zig 0.10.1. The RFS bug still still open.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012286

I'll likely not even try packaging 0.11 or newer until it can once again
bootstrap. However I don't expect that to happen anytime soon.

Nick.

#995670#157
Date:
2024-01-20 05:25:19 UTC
From:
To:
Hi Nick,

You should probably try to ping bage and ask them to have a look at your RFS
once more. Software written in Zig keeps popping up, for example, wayprompt.

Kind regards,
Maytham

#995670#162
Date:
2024-11-29 23:00:22 UTC
From:
To:
You can do it like OpenJDK does.

First, package 0.10.x which can be bootstrapped from C with
just the included code. Get that accepted.

Then, package a newer version which has Build-Depends: zig
(build-depending on itself) and uses the already-accepted
0.10.x to build the newer version (completely skipping the
new webassembly-based “bootstrapping” method).

If 0.10.x cannot build the then-latest zig version, choose
any older one that *can*, then get that accepted, then continue
raising the versions until you reach at the current one.

This will then only be a problem for bootstrapping new
architectures but once it’s in on one architecture, as it
supports cross-compiling, that can also be used to cross-
bootstrap it instead.

Additionally, once it’s in, it can be used to recreate the
webassembly stage compiler which *THEN* can be used for
bootstrapping on other architectures. (Incidentally, iff
the webassembly stage as built by the compiler as packaged
in Debian is bytewise identical to the one provided by up‐
stream, it can also be used, but that needs checking and
talking with ftpmasters first. But for that, you first have
to succeed with the normal bootstrapping.)

bye,
//mirabilos

PS: Googlemail is unsuitable for FOSS collaboration. I fully
    expect this eMail to not reach Googlemail users and/or
    their replies to not always reach me. Please get a proper
    eMail provider if you plan to work with FOSS.

#995670#167
Date:
2025-01-02 09:32:45 UTC
From:
To:
Hello Alex, hello Matt,

I wanted to share that I have also attempted to build the Ly package in
Debian SID. During the build process, I discovered that the Zig
programming language is required for successful compilation.

However, ziglang itself is currently listed under WNPP:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995670

Despite this hurdle, I still believe it would be fantastic to have the
Ly package included in the distribution.

Best regards, JK

#995670#172
Date:
2025-01-14 11:44:52 UTC
From:
To:
block 1092863 by 995670
block 1091469 by 995670
thanks

#995670#183
Date:
2025-01-15 07:03:13 UTC
From:
To:
if you've got packaging dependent on zig, or want to help beta
test zig on debian, there are packages available here:

https://salsa.debian.org/nickblack/zig/-/jobs/6923961/artifacts/download

alternatively, you can add the apt source:

 deb http://dsscaw.com/repos/apt/debian unstable main

i'll push packages here as they change.

i've just successfully built ghostty using
-Doptimize=ReleaseFast with these packages, and things seem to
be more or less working.

#995670#188
Date:
2025-01-16 09:10:29 UTC
From:
To:
I haven't looked at the actual packaging yet, but it builds my local
hello world program, so looking good!

#995670#193
Date:
2025-01-19 17:45:24 UTC
From:
To:
we're now running the compiler's unit tests as part of our
build. i've renamed zig zig0.13, and am installing it so that
multiple versions can coexist. i've created a new native
package, zig-default, which deps on zig0.13 and installs
toplevel symlinks. i've submitted a MR for the minisign support
in devscripts. i'm going to go ahead and upload to NEW.

#995670#200
Date:
2025-05-26 08:50:29 UTC
From:
To:
Hi Nick et al,

Thanks for your work on this!

I am curious about the current status here. I cannot find zig0.13/zig0.14
in the NEW queue. And it doesn't look like they are in experimental either.

#995670#207
Date:
2026-05-26 11:43:10 UTC
From:
To:
I have uploaded a package that's ready for review:
https://mentors.debian.net/package/zig/

RFS: https://bugs.debian.org/1137329

#995670#212
Date:
2026-06-11 21:07:00 UTC
From:
To:
Hey all,

Just to increase the awareness on this there is already a zig package available in Ubuntu.

I see the version 0.16 is available in PPA[1] and zig0.15 [2] is already available, that said
I didn’t check how the packaging is done there so I cannot really comment on about its
compatibility with dfsg but I think they can be referenced and can be used as stepping
stone at the least.

Best

[1] https://launchpad.net/~pushkarnk/+archive/ubuntu/zig0.16
[2] https://launchpad.net/ubuntu/+source/zig0.15