1
Fork 0
Commit Graph

508 Commits (73a9ceccfbd30598500d9462c109b70696ee667c)

Author SHA1 Message Date
Motiejus Jakštys 73a9ceccfb
revert "Re-license portions of the code to Apache 2.0" (#35)
This (partially) reverts commit dfdb1f2680
2023-04-19 20:23:25 -04:00
Motiejus Jakštys 4ddd3b7a62
Make Project Origin more prominent (#34)
The link to the historic email threads seems to be a good spot for it.
2023-04-19 20:22:48 -04:00
Zhongpeng Lin 041d7f26ab
Fixing the url template in readme (#27) 2023-03-24 14:10:17 -04:00
Jonathan Baker 477f3d3690
Fixed release URL in readme (#26) 2023-03-24 09:47:42 -04:00
Motiejus Jakštys 6d2ee8cad0 replace zopfli with encoding/gzip 2023-03-14 20:25:57 +02:00
Motiejus Jakštys d3a2d43356 releaser
This is a work in progress. Next steps:

1. Add instructions to the wiki.
2. Try the new tarball on a real repository.
3. Cut the actual release.

Test output for an upcoming `v1.0.2`:

    $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2
    INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured).
    INFO: Found 1 target...
    Target //tools/releaser:releaser up-to-date:
      bazel-bin/tools/releaser/releaser_/releaser
    INFO: Elapsed time: 1.978s, Critical Path: 1.81s
    INFO: 3 processes: 1 internal, 2 linux-sandbox.
    INFO: Build completed successfully, 3 total actions
    INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2
    Running pre-release checks:
    - SKIPPING: go update commands
    - gazelle
    - checking if repository is clean
    Creating tag v1.0.2
    Creating archive bazel-zig-cc-v1.0.2.tar
    Compressing bazel-zig-cc-v1.0.2.tar
    Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz
    Release boilerplate:
    -----
    load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

    http_archive(
        name = "bazel-zig-cc",
        sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270",
        urls = [
            "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz",
            "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz",
        ],
    )

    load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains")

    # Argument-free will pick reasonable defaults.
    zig_toolchains()

    # version, url_formats and host_platform_sha256 are can be set for those who
    # wish to control their Zig SDK version and where it is downloaded from
    zig_toolchains(
        version = "<...>",
        url_formats = [
            "https://example.org/zig/zig-{host_platform}-{version}.{_ext}",
        ],
        host_platform_sha256 = { ... },
    )
2023-03-14 20:25:57 +02:00
Motiejus Jakštys 4a42b46a99 launcher miscompilation workaround
Sometimes the launcher fails to compile with the following error
messsage:

```
error: FileNotFound
```

We cannot reproduce this in a controlled environment, but see it
happening in the wild often enough to receive repeated questions.

Since this has been escalated to Zig Software Foundation, the most
meaningful thing we can ask our users to do is apply a workaround and
wait. Let's do just that.
2023-03-14 13:52:13 +02:00
Motiejus Jakštys 5cccfb1ce1 move bin/ to tools/
The directories are not that different now. Also, clean up .bazelrc
2023-03-10 10:37:43 +02:00
Motiejus Jakštys 9b68f5ff1e
Add the mailing list archive (#8)
I will be shutting down ~motiejus/bazel-zig-cc@lists.sr.ht within days.
Now that comms are in Slack and github issues/PRs, let's add the
archive for historical reference.

It can be opened and read through like this:

  mutt -R -f mailing-list-archive.mbox
2023-03-08 09:16:22 -08:00
Motiejus Jakštys 3a204583f3
all commands: use /tmp/bazel-zig-cc (#6)
Different Bazel instances can share the zig cache all right.
2023-03-08 17:33:59 +02:00
Motiejus Jakštys f239f467a0
go mod tidy (#7) 2023-03-07 21:06:56 -08:00
Motiejus Jakštys 95ee5b0d3a
update README (#5)
- remove mentions of wine and aarch64
- contributions are now straightforward
- update maintainers (do we need this section at all?)
2023-03-07 06:15:51 +02:00
Motiejus Jakštys 3f4b4ef88e
remove contrib/ (#4)
dead code; our release and testing processes changed quite a
bit.
2023-03-06 07:37:32 -08:00
Motiejus Jakštys af9360366b
More CI (#3)
- ci only: use a separate zig cache dir for each run
- use `tools/bazel` everywhere.
- remove arm64 tests. They don't give enough value to be worth the
  brittle environment.
- remove windows execution, except for launcher. Ditto. I will probably
  bring them back.
2023-03-06 17:32:48 +02:00
Zhongpeng Lin fef28b9706 Enable Lint on CI (#2) 2023-03-06 11:46:02 +02:00
zplin a1b1be2303 Setup buildkite 2023-03-06 11:13:33 +02:00
Motiejus Jakštys e08cf8e6bf Update release notes for v1.0.1 2023-03-06 11:11:55 +02:00
Motiejus Jakštys b92dc6a533 release: sort the RC versions correctly 2023-03-06 11:11:44 +02:00
Motiejus Jakštys dfdb1f2680
Re-license portions of the code to Apache 2.0
Your old version of the software released under the old license can
still be used under the terms of the old license.

I have received the following statement from the past contributors
Luis Holanda, Jeremy Volkman and Fabian Hahn:

  I hereby confirm that I am the copyright holder or authorized by the
  copyright holder of this contribution. As such I hereby confirm that
  all contributions made to bazel-zig-cc by me or on behalf of me,
  hereby is licensed under the Apache 2.0 License
  [http://www.apache.org/licenses/LICENSE-2.0]. I am aware that my
  previous contributions will still be available under the MIT license
  as well. I confirm that I am aware of the bazel-zig-cc teams intention
  to release bazel-zig-cc under the Apache 2.0 License from release
  [1.0] and onwards, and that the bazel-zig-cc no longer will accept
  contributions made under the MIT and that any future submissions from
  myself will be considered to be licensed under Apache 2.0 unless I
  expressly state otherwise.

Copyright and re-licensing for Google and Uber employees has been
resolved internally.

Since not all contributors took action to re-license the code yet,
portions of bazel-zig-cc remain licensed as MIT.

I have started this project during my personal time with my personal
resources. I am now handing over all copyrights to this code to Uber
Technologies, Inc.
2023-03-06 11:05:13 +02:00
Motiejus Jakštys 9621da8ad6 zig sdk: use mirror.bazel.build
The current version of Zig SDK was uploaded to mirror.bazel.build via
https://github.com/bazelbuild/bazel/issues/17635 . Thanks Google!
2023-03-01 16:25:16 +02:00
Motiejus Jakštys 0d0441b9c7 ci/test: show how bad the artifact situation is 2023-02-24 12:41:32 +02:00
Motiejus Jakštys 4647e8436c launcher: remove --color=on 2023-02-24 12:01:49 +02:00
Motiejus Jakštys 28b46bfb96 ci/launcher: check fmt 2023-02-24 11:53:10 +02:00
Motiejus Jakštys 6ebe4747ae upgrade zig 2023-02-24 11:50:41 +02:00
Motiejus Jakštys 52b4f4b436 Merge branch 'motiejus_go1.20' 2023-02-24 11:43:00 +02:00
Motiejus Jakštys b4d067adbe launcher: support multi-for loop syntax
At the moment we need both old and new zig, so doing a way that's
compatible with both.
2023-02-23 09:50:53 +02:00
Motiejus Jakštys 53d89ba627 wip go 1.20 2023-02-10 15:44:56 +02:00
Motiejus Jakštys 0fd73783db ci/launcher: colors 2023-01-30 19:11:20 -08:00
Motiejus Jakštys 13a7d6800e ci/launcher: make it go faster 2023-01-30 19:08:30 -08:00
Motiejus Jakštys 11f7e1ad82 CI: fix tests 2023-01-30 18:01:01 -08:00
Motiejus Jakštys 90867df2b7 update README
- add more test commands
- add the Laurynas BazelCon talk
2023-01-30 17:18:11 -08:00
Motiejus Jakštys 3ba59fcb78 launcher: formatting
no real changes. Code looks a bit less ugly now.
2023-01-30 17:17:51 -08:00
Motiejus Jakštys f92ef2d8d4 Update release notes for v1.0.0 2023-01-24 10:58:51 +02:00
Motiejus Jakštys c03a602023 add gazelle to CI targets 2023-01-18 22:43:33 +02:00
Motiejus Jakštys 8d1e1c9fa6 res_search: fix for aarch64
On linux_aarch64 `res_search` is `__res_search@GLIBC_2.17`, which is
different from the x86_64 counterpart `__res_search@GLIBC_2.2.5`.

Also fix tests.
2023-01-18 22:39:35 +02:00
Motiejus Jakštys a47c7abc96 upgrade gazelle, add -lresolv
does not fix the test
2023-01-18 16:58:08 +02:00
Motiejus Jakštys 7b0de33070 work-around res_search on older glibcs
`res_search` became a proper symbol only in glibc 2.34. Until that it
was re-defined in headers, hitting the (in-)famous
https://github.com/ziglang/zig/issues/9485

glibc 2.34+:

    resolv/resolv.h:int             res_search (const char *, int, int, unsigned char *, int)

Old glibc:

    resolv/resolv.h:#define res_search              __res_search

Also, remove the toplevel includes, as they should never be included in
the first place: the headers are included explicitly when needed.
2023-01-18 15:45:47 +02:00
Motiejus Jakštys 90f6c07178 Merge branch 'motiejus_launcher_zig' 2023-01-03 12:55:00 +02:00
Motiejus Jakštys eced0109ca zig launcher: replace shell wrappers with a binary
Until now we needed to maintain two versions of the zig launcher: one
for Windows and one for everything else. This was problematic for two
reasons:
1. I do not know powershell and thus keep breaking the Windows wrapper
   all the time (see git history of Fabian fixing stuff that I broke).
2. This makes bazel-zig-cc dependent on the system shell, making it not
   really hermetic. So the recently added
   `--experimental_use_hermetic_linux_sandbox` does not work with
   bazel-zig-cc, unless we bind-mount a bunch of stuff: `/usr`, `/bin`,
   `/lib`, `/usr/lib:/lib`, `/usr/lib64:/lib64` and `/proc`.

Switching to a Zig-based wrapper solves both issues, and we can do this:

    bazel build "$@" \
        --experimental_use_hermetic_linux_sandbox \
        --sandbox_add_mount_pair=/proc \
        <...>

Zig itself still depends on `/proc` for `/proc/self/exe`, so we need to
keep that. I will look into reducing even that dependency separately.

Not all is nice and shiny though: this commit replaces ~80 LOC worth of
shell scripts wrappers with a singe ~300 LOC zig program, which is
arguably harder to understand. However, it is easier to change, at least
for me, because it's a single file with unit tests! Most importantly,
the gnarly code (which resolves paths and sets environment variables) is
cross-platform.

Thanks to Fabian Hahn for testing this on Windows and pointing out
errors.
2023-01-03 11:46:58 +02:00
Motiejus Jakštys 265644b3b0 license: copyright is owned by contributors.
Now that we have more than one contributor, it's fair be explicit about
it. I never asked for CLA and who owns the copyright has been clearly
documented in the README.

Note that this is not a policy change.
2022-12-23 23:45:21 +02:00
Motiejus Jakštys 872bf302b0 reduce number of zig tools
* cc: bazel supports only cpp
* wasm-ld: we do not support wasm here. Can be re-added with proper target config.
* coff: we use ld64.lld for some reason (I don't know enough about Windows to tell)

Also, now creating the tools where it makes sense to add for the target only.
2022-12-18 06:13:32 +02:00
Motiejus Jakštys bd243aad71 simplify zig wrapper
While the original intention to be "xdg-friendly" was honorable, it
never worked in practice. Bazel has a tendency to remove almost all
environment variables during the build, causing only the fallback to
remain (i.e. all zig's cache to be put to /tmp/bazel-zig-cc).

If we just accept the world as is, we can get rid of half of the shell
wrappers.
2022-12-18 05:51:55 +02:00
Jeremy Volkman cc8f113489 Use artifact_name_pattern to specify proper macos and windows artifact names.
On macos, dynamic libraries are generated as "libfoo.dylib".

On windows, executables end with ".exe", static libraries end with ".lib",
and dynamic libraries end with ".dll".
2022-12-18 05:29:04 +02:00
Jeremy Volkman 6ee01496be Use -mcpu=apple_m1 when targeting macos + aarch64 2022-12-18 05:12:24 +02:00
Jeremy Volkman cba7c5fcae Rename _target_darwin to _target_macos
This aligns with bazel's @platforms//os:macos
2022-12-18 05:11:05 +02:00
Jeremy Volkman 0db5d2d9e6 Adds supports_dynamic_linker feature
With this feature, cc_library generates a .so as well as a .a and the
"dynamic_library" output group is enabled.
2022-12-18 05:07:59 +02:00
Motiejus Jakštys 947402c843 bump zig to 0.11.0-dev.811+8ff9284c4
includes 8ff9284c46, a fix for cache poisoning when building glibc stubs
2022-12-15 22:10:09 +02:00
Motiejus Jakštys 775227fde2 Update release notes for v1.0.0-rc4 2022-12-14 14:54:41 +02:00
Motiejus Jakštys 79812dc567 includes: add `libcxxabi`
Otherwise v8 complains.
2022-12-14 00:02:23 +02:00
Motiejus Jakštys 66b9635ca8 lint 2022-12-13 18:26:56 +02:00