239 Commits

Author SHA1 Message Date
Lee Cannon
ede47d49eb
Print enum values for build options in help output (#9650) 2021-08-30 21:39:02 -04:00
Lee Cannon
311797f686
Rework build system build_options API (#9623)
* rework `build_options` to integrate with the FileSource abstraction
* support mapping as an arbitrarily named package
* support mapping to multiple different artifacts
* use hash of contents for options filename
2021-08-26 19:53:23 -04:00
Andrew Kelley
d29871977f remove redundant license headers from zig standard library
We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.

Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
2021-08-24 12:25:09 -07:00
Takeshi Yoneda
bbb96e112c build: allow specifying -mexec-model flag.
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-08-21 14:45:42 +03:00
Tom Maenan Read Cutting
0cecdca6a2 Resolve order-of-call dependencies in build.zig 2021-08-20 13:11:19 +03:00
Ryan Liptak
2f6dbaa0ea fs.Dir.walk: Do not close the initial dir during/after walking it
Closing the initial directory was unexpected to me, and does not mesh very well with how the rest of the Dir API works.

Fixes #9556
2021-08-20 10:02:54 +03:00
Jakub Konka
049ff45430 macho: add basic support for building iOS binaries
* ensure we correctly transfer `-iwithsysroot` and
  `-iframeworkwithsysroot` flags with values from `build.zig` and that
  they are correctly transferred forward to `zig cc`
* try to look for `libSystem.tbd` in the provided syslibroot - one
  caveat that the user will have to specify library search paths too
2021-08-10 13:40:39 +02:00
Ryan Liptak
d31352ee85 Update all usages of mem.split/mem.tokenize for generic version 2021-08-06 02:01:47 -07:00
Matt Knight
2f9e498c6f add build dependency when linkerscript is a generated file 2021-07-28 18:10:53 -04:00
Ominitay
c1285a1bbe Move fs.Walker to fs.Dir.Walker
fs.Walker has been replaced with fs.Dir.Walker. Paths of entries
returned are relative to the Dir.
2021-07-28 21:39:36 +03:00
Andrew Kelley
a8e8927c49 fix old references to verbose-ir to be verbose-air 2021-07-27 18:33:49 -07:00
Lee Cannon
c234d4790e
Add option to hide build command on compilation error to build_runner (#8513)
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2021-07-27 21:30:53 -04:00
Jarred Sumner
ba71b96fe6 Add zld.id to list of files to skip 2021-07-27 07:54:25 +02:00
Isaac Freund
f9171bf542
std/build: add --sysroot general option 2021-06-25 19:13:43 +02:00
Jacob G-W
9fffffb07b fix code broken from previous commit 2021-06-21 17:03:03 -07:00
Isaac Freund
db08d4c3d6 zig build: add --libc general option
This new option sets a default libc paths file to be used for all
LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.

This is required to allow users to cross compile projects linking system
libraries without needing to patch the build.zig.
2021-06-15 08:01:26 +03:00
Andrew Kelley
193c529b8c CLI: rename --override-lib-dir to --zig-lib-dir
This breaking change disambiguates between overriding the lib dir when
performing an installation with the Zig Build System, and overriding the
lib dir that the Zig installation itself uses.
2021-06-14 11:33:27 -07:00
Jan200101
5a4249fa25 specify the output lib, exe and include paths with flags 2021-06-14 20:26:54 +03:00
Veikka Tuominen
2b2efa24d0 std.build: don't default to static linkage 2021-06-12 14:23:07 +03:00
Andrew Kelley
da4081fe21 cleanups to previous commit
* fix a merge conflict discovered upon rebasing latest master
 * rename Target.Cpu.Feature.Set.subSet to isSuperSetOf
 * convert a comment into an assert
2021-06-11 14:01:13 -07:00
Edward Dean
7ba175cd8b Add CPU feature check to standardTargetOptions
If there is a mismatch of CPU features provided
compared to the whitelist, then will fail the build and
print what the expected CPU model is and the feature
set for the model. Also prints what features need to be
removed.
2021-06-11 13:32:28 -07:00
Ellis Trisk-Grove
ba7bfe949e std.build.InstallDir: make dupe() a public function
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2021-06-11 20:24:56 +03:00
Asa Zeren
6cc8845802 Change defineCMacro to take separate name and value arugments
Before this change, when one or more of name or value are not known at
comptime, build.zig files must allocate and do the concatanation, which can be
cumbersome, and also adds a redundant allocation when name and value are
slices. The new version only does a single allocation directly in the builder's
allocator to concatonate name and value.

The origional behavior is available in defineCMacroRaw, for use in situations
such as parseing c compiler arguments.

Additionally, several places have been updated to use the new funtions.
2021-06-11 20:18:19 +03:00
Veikka Tuominen
4b72b0560d make remaining enums in build.zig snake_case 2021-06-11 16:01:30 +03:00
Felix (xq) Queißner
1c1ea2baa7 Code quality improvements to GeneratedFile, and manual implementation of Builder.addObjectSource. 2021-06-11 10:43:52 +03:00
Felix (xq) Queißner
98941cf27c Makes output path stuff more sane. 2021-06-11 10:43:38 +03:00
Felix (xq) Queißner
27bd0971bb Changes to .path instead of .getPathFn. Changes LibExeObjStep to also provide FileSource. 2021-06-11 10:39:50 +03:00
Felix (xq) Queißner
07acb1ccc9 Changes createExecutable parameter is_dynamic to a enum to make code more readable . 2021-06-11 10:38:57 +03:00
Felix (xq) Queißner
56cb0b5ca0 Moves files to file-global struct layout. 2021-06-11 10:33:27 +03:00
Felix (xq) Queißner
8501bb04ad Adds a lot of missing dupes, some more snakes. 2021-06-11 10:33:26 +03:00
Felix (xq) Queißner
4ed567d12e Adds more FileSources everywhere. 2021-06-11 10:33:26 +03:00
Felix (xq) Queißner
437f81aa9a Starts to replace special cases in std.build.FileSource. 2021-06-11 10:33:10 +03:00
Tom Maenan Read Cutting
c822a0b59f Add linkLibCpp helper to LibExeObjStep 2021-06-08 21:14:26 +03:00
LemonBoy
734a5cd6d1 build: Avoid using undefined variables
Closes #9013
Closes #8928
Closes #7991
2021-06-06 19:57:07 -04:00
Martin Wickham
fc9430f567 Breaking hash map changes for 0.8.0
- hash/eql functions moved into a Context object
- *Context functions pass an explicit context
- *Adapted functions pass specialized keys and contexts
- new getPtr() function returns a pointer to value
- remove functions renamed to fetchRemove
- new remove functions return bool
- removeAssertDiscard deleted, use assert(remove(...)) instead
- Keys and values are stored in separate arrays
- Entry is now {*K, *V}, the new KV is {K, V}
- BufSet/BufMap functions renamed to match other set/map types
- fixed iterating-while-modifying bug in src/link/C.zig
2021-06-03 17:02:16 -05:00
Jakub Konka
c0aa9292ba
build: allow specifying rpaths explicitly (#8912)
It currently looks like that if the user links in a dylib using
`lib_or_exe.linkSystemLibrary`, and the linked lib doesn't have
a hardcoded path in its description load command but rather it
allows for any runtime path via `@rpath`, then it is not possible
to specify the runtime path explicitly using the build system.
2021-05-27 21:01:32 -04:00
Andrew Kelley
667236668f build.zig: blank out "*test.zig" files instead of omit
Now that `@import` of a non-existent file name is a compile error, the
Zig installation needs to include files that end with test.zig. However
we still want to avoid bloat in the installation size, so we blank them
out instead of omitting them entirely.

Now AstGen of the full standard library can complete successfully on a
Zig installation rather than erroring out with file not found.
2021-05-18 17:18:42 -07:00
Andrew Kelley
597082adf4 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * build.zig
 * src/Compilation.zig
 * src/codegen/spirv/spec.zig
 * src/link/SpirV.zig
 * test/stage2/darwin.zig
   - this one might be problematic; start.zig looks for `main` in the
     root source file, not `_main`. Not sure why there is an underscore
     there in master branch.
2021-05-15 21:44:38 -07:00
Jakub Konka
402264ab0e Add experimental Darling support for cross testing macOS
* for cross testing stage2 tests, we use `darling shell` command
  since the path to the tested binary is relative to cwd
* for the `zig test` command, we simply use `darling` since the
  path to the binary is absolute
2021-05-13 20:31:33 +02:00
Andrew Kelley
1ab3dff846 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Need the latest commit which fixes std and behavior tests for cross
compiled glibcs.
2021-05-12 20:37:40 -07:00
Andrew Kelley
799d1f0d36 build system: fix wrong glibc dir passed to qemu for i386
Without this, and with `-Denable-qemu -Denable-foreign-glibc`,
i386-linux-gnu tests failed because the `-L` path passed to qemu
was "i386-linux-gnu" (nonexistent) rather than "i686-linux-gnu".

Fixes std lib and behavior tests when using these options to enable
test coverage with cross compiled glibcs.
2021-05-12 20:34:54 -07:00
Andrew Kelley
5619ce2406 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * doc/langref.html.in
 * lib/std/enums.zig
 * lib/std/fmt.zig
 * lib/std/hash/auto_hash.zig
 * lib/std/math.zig
 * lib/std/mem.zig
 * lib/std/meta.zig
 * test/behavior/alignof.zig
 * test/behavior/bitcast.zig
 * test/behavior/bugs/1421.zig
 * test/behavior/cast.zig
 * test/behavior/ptrcast.zig
 * test/behavior/type_info.zig
 * test/behavior/vector.zig

Master branch added `try` to a bunch of testing function calls, and some
lines also had changed how to refer to the native architecture and other
`@import("builtin")` stuff.
2021-05-08 14:45:21 -07:00
Veikka Tuominen
fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
Andrew Kelley
dc28f5c3ec Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
	lib/std/crypto/25519/field.zig
	lib/std/crypto/poly1305.zig

I had resolved those by removing `comptime` but master branch decided to
make the parameters `comptime`.

This also pulls in the updated default `zig build` install directory.
2021-04-30 23:13:17 -07:00
Isaac Freund
5079d11b21
std/build: change default install prefix to zig-out
Currently the default install prefix is $BUILD_ROOT/zig-cache,
but mixing cache and artifacts makes little sense. Instead make
$BUILD_ROOT/zig-out the default.
2021-04-29 23:58:45 +02:00
Andrew Kelley
e86cee258c Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
In particular I wanted the change that makes `suspend;` illegal in the
parser.
2021-04-24 10:44:41 -07:00
Isaac Freund
8e6865c8ee std/build: fix linker_allow_shlib_undefined
The relevant flags were renamed in 01a1365 but updating std.build
was overlooked.
2021-04-17 15:17:54 +02:00
daurnimator
99e7ba24b1 Add LibExeObjStep.linker_allow_shlib_undefined field to set --allow-shlib-undefined 2021-04-16 22:51:51 +02:00
Andrew Kelley
429cd2b5dd std: change @import("builtin") to std.builtin 2021-04-15 19:06:39 -07:00
Andrew Kelley
a38042e3ac ci: windows: proper flags to zig build 2021-04-15 02:02:36 -07:00