151 Commits

Author SHA1 Message Date
Jakub Konka
b7c3ebcb9e Rely on ZIG_SYSTEM_LINKER_HACK instead of input flags 2020-11-06 11:34:51 +01:00
Jakub Konka
e0e3ceac19 Re-enable system linker hack
It is now possible to force linking with system linker `ld` instead
of the LLVM `lld` linker when building natively on the target. This
can be done at each stage by specifying `--system-linker-hack` flag,
and can be useful on platforms where `lld` fails to operate properly
such as macOS 11 Big Sur on ARM64 where every binary/dylib is expected
to be codesigned.

Some example invocations for each stage of compilation of Zig
toolchain:

```
cmake .. -DCMAKE_PREFIX_PATH=/path/to/llvm -DSYSTEM_LINKER_HACK=1
```

```
build/zig build test --system-linker-hack
```

```
build/zig build --prefix $(pwd)/stage2 -Denable-llvm
--system-linker-hack
```

```
build/zig build-exe hello.zig --system-linker-hack
```
2020-11-05 18:35:51 +01:00
Travis
f51ccf0d1f panic when empty string passed as dest_rel_path to addInstallFileWithDir
causes the creation of a file instead of the directory that's meant to
be created
2020-10-29 15:22:39 -04:00
wozeparrot
32e65c3f96
make addBuildOption append type (#6801)
* add addBuildOption test
2020-10-29 15:16:47 -04:00
xackus
2ee79f149b std: reference more declarations in std.build 2020-10-22 17:44:23 -04:00
frmdstryr
52879b50d9 Update enable-valgrind flag to fvalgrind 2020-10-21 22:41:11 -04:00
Jakub Konka
b28992de71 Disable build.zig tests on WASI since rely on cwd()
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-18 18:20:43 +02:00
Robin Voetter
3d857f7808 add addPackage test 2020-10-18 13:35:24 +02:00
Robin Voetter
29c580304b Fix invalid call to dupePkg in build.zig 2020-10-18 13:20:19 +02:00
Jesse Rudolph
e821a57683 add Builder.dupePkg()
mimics the duplication of strings in `Builder` for `Pkg`. This
ensures the lifetime of the memory backing strings in a `Pkg`
struct and the `Pkg.dependencies` slice is not shorter than the
`Builder` that the data is associated with.
2020-10-17 22:35:36 -04:00
Vexu
e8ca1b254d
std: remove renderStringLiteral in favor of std.fmt specifier 2020-10-17 23:20:38 +03:00
Vexu
2c294676b5
use new format specifier in translate-c and std lib 2020-10-17 10:27:19 +03:00
Tadeo Kondrak
e892ee17e6 std: move std.meta.refAllDecls to std.testing 2020-10-15 20:34:22 -04:00
Isaac Freund
f01c3150c1
std/build: support --color 2020-10-13 20:06:03 +02:00
Timon Kruiper
e94a06ac29 Build.zig: Skip copying files that are used internally by the compiler
Before this it was trying to copy all the files from the zig-cache dir
to the output dir, but in the current compiler architecture the cache
dir is also used for internal compiler files.
2020-10-05 00:31:21 -04:00
Andrew Kelley
33bc1ebe37 build system: implement computeOutFilenames using std.zig.binNameAlloc
See #6552 #6553 #6483

Also fixes a regression introduced in
1d777e99588be047ec4d7650f048b043d6e52da0 of not converting an integer to
a string for a command line parameter.
2020-10-04 20:10:47 -07:00
Andrew Kelley
1d777e9958 add --image-base support
Based on #6121 by Jay Petacat.
2020-10-04 17:59:44 -07:00
Alexandros Naskos
55eb7c16c0
Merge pull request #6494 from IridescentRose/emit-reloc-patch
Emit reloc patch
2020-10-02 17:00:47 +03:00
Nathan
84b6d2a80a Resolved additional formatting issues. 2020-10-01 18:03:34 -04:00
Nathan
5e3ce11b18 Resolve name and format issues. 2020-10-01 17:47:32 -04:00
Nathan Bourgeois
4566b27373 Patch in emit relocs support 2020-10-01 17:04:04 -04:00
markfirmware
1296e4a857
Update build.zig 2020-10-01 15:27:08 -04:00
markfirmware
8acfcf4e0d
Update build.zig
Fixes #6477
2020-10-01 13:15:35 -04:00
Andrew Kelley
f69650a478 update wasm to use ".o.wasm" extension for objects
This is convenient for debugging purposes, as well as simplifying the
caching system since executable basenames will not conflict with their
corresponding object files.
2020-09-29 17:01:05 -07:00
Andrew Kelley
750b00c642 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 00:27:48 -07:00
Andrew Kelley
30dfdfdbd0 fix a round of regressions in this branch
* Don't try to generate C header files yet since it will only cause a
   crash saying the feature is unimplemented.
 * Rename the CLI options for release modes to use the `-O` prefix to
   match C compiler precedent. Options are now `-ODebug`,
   `-OReleaseFast`, `-OReleaseSafe`, `-OReleaseSmall`. The optimization
   mode matches the enum tags of std.builtin.Mode. It is planned to, at
   some point, rename std.builtin.Mode to std.builtin.OptimizationMode
   and modify the tags to be lower case to match the style convention.
   - Update build.zig code to support this new CLI.
 * update std.zig.binNameAlloc to support an optional Version and update
   the implementation to correctly deal with dynamic library version
   suffixes.
2020-09-24 23:50:15 -07:00
Josh Wolfe
1a8669eada build.zig: addBuildOptionArtifact 2020-09-25 01:53:38 -04:00
Andrew Kelley
7964341c76 zig build: update to use new --version flag instead of legacy flags 2020-09-24 22:18:53 -07:00
Andrew Kelley
c0b774fbc6 stage2: support passing extra C flags to C source files
closes #3508
2020-09-23 10:22:44 -07:00
Andrew Kelley
0638a020cf stage2: implement --pkg-begin and --pkg-end CLI args 2020-09-22 23:00:33 -07:00
Andrew Kelley
c2b1cd7c45 stage2: implement zig build
As part of this:

 * add std.process.cleanExit. closes #6395
   - use it in several places
 * adjust the alignment of text in `zig build --help` menu
 * Cache: support the concept of "unhit" so that we properly keep track
   of the cache when we find out using the secondary hash that the cache
   "hit" was actually a miss. Use this to fix false negatives of caching
   of stage1 build artifacts.
 * fix not deleting the symlink hash for stage1 build artifacts causing
   false positives.
 * implement support for Package arguments in stage1 build artifacts
 * update and add missing usage text
 * add --override-lib-dir and --enable-cache CLI options
   - `--enable-cache` takes the place of `--cache on`
 * CLI supports -femit-bin=foo combined with --enable-cache to do an
   "update file" operation. --enable-cache without that argument
   will build the output into a cache directory and then print the path
   to stdout (matching master branch behavior).
 * errors surfacing from main() now print "error: Foo" instead of
   "error: error.Foo".
2020-09-22 22:18:19 -07:00
zenith391
4fbf9f7f79 Add "emit_docs" field to LibExeObjStep. 2020-09-19 00:39:43 +03:00
Andrew Kelley
42c32dbc7b
Merge pull request #6315 from ifreund/optional-shlib-version
std, stage1: make shared library versioning optional
2020-09-11 16:07:13 -04:00
Isaac Freund
0a76a9bd73
std, stage1: make shared library versioning optional
This commit changes the behavior of stage1 to emit libfoo.so instead
of libfoo.so.0.0.0 when none of the --ver-major, --ver-minor, or
--ver-patch flags are set.

It also makes it possible to create unversioned shared libraries
using the zig build system, changing the version parameter of
addSharedLibrary() to a tagged union.
2020-09-11 10:46:37 +02:00
Isaac Freund
68bf29c31e std: allow overriding install dir of artifacts
This is necessary when, for example, writing a PAM module which should
be installed to lib/security/module_name.so.
2020-09-11 04:32:36 -04:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vincent Rischmann
b0846b6ecb builder: implement integer options 2020-08-19 17:41:43 -04:00
Andrew Kelley
f23fb3087b zig build: fix addBuildOption for []const u8 and ?[]const u8 2020-08-04 22:55:45 -07:00
Andrew Kelley
c594f8dc26 stage2 tests: support the -Denable-qemu options and friends 2020-08-04 15:32:16 -07:00
Andrew Kelley
edfede575c self-hosted: add build option for log scopes
Now you can enable a set of log scopes by passing -Dlog=<scope>
2020-08-03 21:56:21 -07:00
S0urc3C0de
5ae88e919b Add rdynamic option to build.zig 2020-08-02 17:50:06 +00:00
Sam Tebbs
0d31877444
Print } as format argument in enum build option (#5953)
Co-authored-by: Veikka Tuominen <git@vexu.eu>
Co-authored-by: Joachim Schmidt <joachim.schmidt557@outlook.com>
2020-07-31 11:37:40 +03:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
Andrew Kelley
289eab9177
Merge pull request #5786 from ziglang/std-hash-map
reimplement std.HashMap
2020-07-05 21:12:20 +00:00
Andrew Kelley
632acffcbd update std lib to new hash map API 2020-07-05 21:11:42 +00:00
joachimschmidt557
0ae1157e45 std.mem.dupe is deprecated, move all references in std
Replaced all occurences of std.mem.dupe in stdlib with
Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-07-04 21:40:06 +03:00
heidezomp
672b4d5c24 zig build --help: Consistent capitalization/punctuation 2020-07-04 13:00:53 +00:00
Andrew Kelley
6938245fcc Merge remote-tracking branch 'origin/master' into zig-ast-to-zir 2020-06-22 23:22:17 -04:00
Andrew Kelley
c9a0ec25e0 self-hosted: add Tracy integration
This tool helps give an intuitive picture of performance. This will help
us understand where to improve the code.
2020-06-18 21:55:37 -04:00
Vexu
caaa26c9f0 reference emit_raw in std lib tests 2020-06-18 20:17:53 -04:00