Commit Graph

7 Commits (129a4fb251f8eab22eacf219fbf81006baec3251)

Author SHA1 Message Date
Andrew Kelley 9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley dbe4d72bcf
separate std.Target and std.zig.CrossTarget
Zig now supports a more fine-grained sense of what is native and what is
not. Some examples:

This is now allowed:
-target native

Different OS but native CPU, default Windows C ABI:
-target native-windows
This could be useful for example when running in Wine.

Different CPU but native OS, native C ABI.
-target x86_64-native -mcpu=skylake

Different C ABI but otherwise native target:
-target native-native-musl
-target native-native-gnu

Lots of breaking changes to related std lib APIs.
Calls to getOs() will need to be changed to getOsTag().
Calls to getArch() will need to be changed to getCpuArch().

Usage of Target.Cross and Target.Native need to be updated to use
CrossTarget API.

`std.build.Builder.standardTargetOptions` is changed to accept its
parameters as a struct with default values. It now has the ability to
specify a whitelist of targets allowed, as well as the default target.
Rather than two different ways of collecting the target, it's now always
a string that is validated, and prints helpful diagnostics for invalid
targets. This feature should now be actually useful, and contributions
welcome to further improve the user experience.

`std.build.LibExeObjStep.setTheTarget` is removed.
`std.build.LibExeObjStep.setTarget` is updated to take a CrossTarget
parameter.

`std.build.LibExeObjStep.setTargetGLibC` is removed. glibc versions are
handled in the CrossTarget API and can be specified with the `-target`
triple.

`std.builtin.Version` gains a `format` method.
2020-02-28 14:51:54 -05:00
Andrew Kelley 87b9e744dd
update std lib to new Target API 2020-02-28 14:51:54 -05:00
Andrew Kelley 4e4ba6c3e1
test harness: show annotated case name when translate-c test fails 2020-01-07 13:40:17 -05:00
Andrew Kelley 0a9daeb37e
Merge branch 'cc-work' of https://github.com/LemonBoy/zig into LemonBoy-cc-work 2020-01-06 14:07:56 -05:00
Andrew Kelley a690a5085d
rework and improve some of the zig build steps
* `RunStep` moved to lib/std/build/run.zig and gains ability to compare
   output and exit code against expected values. Multiple redundant
   locations in the test harness code are replaced to use `RunStep`.
 * `WriteFileStep` moved to lib/std/build/write_file.zig and gains
   ability to write more than one file into the cache directory, for
   when the files need to be relative to each other. This makes
   usage of `WriteFileStep` no longer problematic when parallelizing
   zig build.
 * Added `CheckFileStep`, which can be used to validate that the output
   of another step produced a valid file. Multiple redundant locations
   in the test harness code are replaced to use `CheckFileStep`.
 * Added `TranslateCStep`. This exposes `zig translate-c` to the build
   system, which is likely to be rarely useful by most Zig users;
   however Zig's own test suite uses it both for translate-c tests and
   for run-translated-c tests.
 * Refactored ad-hoc code to handle source files coming from multiple
   kinds of sources, into `std.build.FileSource`.
 * Added `std.build.Builder.addExecutableFromWriteFileStep`.
 * Added `std.build.Builder.addExecutableSource`.
 * Added `std.build.Builder.addWriteFiles`.
 * Added `std.build.Builder.addTranslateC`.
 * Added `std.build.LibExeObjStep.addCSourceFileSource`.
 * Added `std.build.LibExeObjStep.addAssemblyFileFromWriteFileStep`.
 * Added `std.build.LibExeObjStep.addAssemblyFileSource`.
 * Exposed `std.fs.base64_encoder`.
2020-01-05 02:19:22 -05:00
Andrew Kelley 695c8f756b
add test harness for "run translated C" tests 2020-01-03 00:26:12 -05:00