1
Commit Graph

46 Commits

Author SHA1 Message Date
Motiejus Jakštys
27fe6c9ffb wip macos
motiejus@mtwork:/code/bazel-zig-cc$ bazel build  --spawn_strategy=local  --platforms @zig_sdk//libc_aware/platform:macos_aarch64_sdk.13.1 test/c:which_libc
    INFO: Analyzed target //test/c:which_libc (0 packages loaded, 0 targets configured).
    INFO: Found 1 target...
    Target //test/c:which_libc up-to-date:
      bazel-bin/test/c/which_libc
    INFO: Elapsed time: 0.071s, Critical Path: 0.00s
    INFO: 1 process: 1 internal.
    INFO: Build completed successfully, 1 total action
    motiejus@mtwork:/code/bazel-zig-cc$ file bazel-bin/test/c/which_libc
    bazel-bin/test/c/which_libc: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
    motiejus@mtwork:/code/bazel-zig-cc$
2023-03-29 13:22:10 +03: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
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
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
9eaebe0ad2 rules_go: cherry-pick a gorace workaround 2022-11-30 21:10:08 +02:00
Motiejus Jakštys
6bd588c07b upgrade to zig 0.11.0-dev.324+f61c5f3f5
includes a zig upstream fix for absolute directories: https://github.com/ziglang/zig/issues/13050
2022-11-29 13:51:57 +02:00
Motiejus Jakštys
557b726d62 shellcheck 2022-10-13 12:48:43 +03:00
Motiejus Jakštys
c5e3c25015 tests: add linux_arm64_musl, simplify BUILD 2022-10-03 16:24:59 +03:00
Motiejus Jakštys
c9d2442143 tests: remove linux_amd64_gnu.2.31
It does not add anything beyond linux_amd64_gnu.2.28.
2022-10-03 06:48:12 +03:00
Motiejus Jakštys
79674a1d96 replace /usr/bin/env sh with /bin/sh
/bin/sh exists in NixOS and in fact is the only file in `/bin`:

    $ docker run -ti --rm nixos/nix ls /bin /usr/bin
    /bin:
    sh

    /usr/bin:
    env

More context in
https://lists.sr.ht/~motiejus/bazel-zig-cc/%3CCAFVMu-pvNx%2BpeQYdge_fvmSGrHDmn78VmoYwTxkDgMjbzfVAwQ%40mail.gmail.com%3E
2022-08-30 09:21:27 +03:00
Luis Holanda
c4125cf13b Support NixOS and others non-FHS Linux distros
As it expects Bash to be at `/bin/bash`, the current implementation
fails to execute on NixOS, given that there bash is in a non-standard
path (i.g. `/nix/store/<hash>-bash-interactive-<version>/bin/bash`).

This patch specifically changes `/bin/bash` paths to use `/usr/bin/env bash`,
which should give the correct path in every Unix system.

Signed-off-by: Luis Holanda <luiscmholanda@gmail.com>
2022-07-28 12:44:57 -07:00
Motiejus Jakštys
3ac217e2cc windows tests: move tests, get rid of wine-binfmt
This removes all other Bazel test commands, so all tests can be again
tested with `bazel test ...`.

Also, fixes linux-arm64 glibc tests. Until now they've worked only in
CI. Now they work everywhere I tried.
2022-06-06 10:33:46 +03:00
Fabian Hahn
6f2ae838cd added Windows target testing 2022-06-02 05:27:22 +03:00
Motiejus Jakštys
9ce21b5276 [zig ld] --gc-sections workaround + tests
`zig cc` emits `--gc-sections` for the linker, which is incompatbile
with what CGo thinks about linking.

This commit adds a workaround: it will add `--no-gc-sections` to the
linking step if the command is not specified (falling back to the
default behavior of gcc/clang).

Related: https://github.com/golang/go/issues/52690
2022-05-05 13:36:58 +03:00
Motiejus Jakštys
418b589ed2 example transitions only change platforms, leave toolchains for WORKSPACE 2022-04-18 12:40:17 +03:00
Motiejus Jakštys
0c02a827ae README prose, the way I understand it 2022-04-18 11:42:13 +03:00
laurynasl
4d65b80903 Add libc constraint and libc aware toolchains
- Also get rid of @bazel_skylib dependency
2022-04-14 14:29:06 +00:00
laurynasl
7a81e2a129 Restructure tests to all run in bazel
- add rules to run tests for a specific platform
- use downloaded buildifier
- move lint to a script
- rename ci tasks
- stop running under qemu-aarch64-static as it doesn't do anything
2022-04-14 10:47:02 +00:00
Motiejus Jakštys
8d110a392a fcntl64 test
Refs https://github.com/ziglang/zig/issues/9485
2022-02-05 16:28:20 +02:00
Motiejus Jakštys
ebbf499208 move golang tests to its own directory
this prepares for more test binaries.
2022-02-03 15:24:26 +02:00
Motiejus Jakštys
5631c7e2b6 build everything under //test/... and remove duplicate test binaries 2022-02-03 14:58:42 +02:00
Motiejus Jakštys
1cd04478b7 rename/fix the package 2022-01-28 15:57:22 +02:00
Motiejus Jakštys
f19927ac17 remove sqlite from dependencies
racy `zig cc` is no longer a thing. Good time to make tests faster.
2022-01-28 15:50:33 +02:00
Motiejus Jakštys
3d8cc9c38c add unit test 2022-01-28 15:49:24 +02:00
Motiejus Jakštys
47f1b10370 add unit test 2022-01-28 14:40:03 +02:00
Motiejus Jakštys
19c7d77ac0 [test] remove DataDog/zstd
only one test cgo dependency is quite enough
2021-11-07 12:39:34 +02:00
Motiejus Jakštys
f50493ca72 move go_binary_override to rules_go
also, do not ignore the user's gc_linkopts.
2021-11-07 12:39:34 +02:00
Mantas Jonaitis
523943bd35 2021-11-05 19:29:07 +02:00
Motiejus Jakštys
37953e9cd3 add some C dependencies
this stresses the toolchain more.
2021-07-21 15:02:04 +03:00
a3606b7404 register only gnu toolchain by default
musl can be specified with --extra_toolchains.
2021-06-19 16:32:07 +03:00
18b43049c1 remove redundant target 2021-06-16 14:44:57 +03:00
39535dadc5 add macos support
+ buildifier
2021-06-16 12:44:16 +03:00
61491dac5e rename libc name; comment out default toolchain 2021-06-10 16:12:50 +03:00
4bd7b30f65 change @com_github_ziglang_zig to @zig_sdk 2021-06-10 09:34:59 +03:00
b826ad9439 downgrade glibc to 2.19 and update README 2021-06-07 23:17:19 +03:00
6ed6563a37 musl-static 2021-06-07 23:00:32 +03:00
c449706594 split go and c examples 2021-06-07 22:56:15 +03:00
d3af35cbc6 gazelle works now 2021-06-07 22:52:29 +03:00
5860621c80 add cgo example; fix zig url 2021-06-07 22:33:34 +03:00
c96a2f4260 rename files 2021-06-07 22:22:18 +03:00
e590d4f567 point to correct paths; upgrade zig to 0.8 2021-06-07 22:10:33 +03:00
d461cf1dcc remove nonessential stuff
- rules_docker
- boost
... and their deps.
2021-06-03 18:53:09 +03:00
Adam Bouhenguel
2195fb6941 Initial commit with minimal examples 2021-04-09 15:05:01 -07:00