2017-12-12 04:34:59 +00:00
const std = @import ( " std " ) ;
2021-04-13 00:44:51 +01:00
const builtin = std . builtin ;
2017-04-19 06:13:15 +01:00
const tests = @import ( " test/tests.zig " ) ;
2017-12-12 04:34:59 +00:00
const BufMap = std . BufMap ;
const mem = std . mem ;
const ArrayList = std . ArrayList ;
const io = std . io ;
2019-05-26 18:17:34 +01:00
const fs = std . fs ;
2023-01-31 07:19:51 +00:00
const InstallDirectoryOptions = std . Build . InstallDirectoryOptions ;
2020-09-04 04:23:00 +01:00
const assert = std . debug . assert ;
2024-07-19 06:04:59 +01:00
const DevEnv = @import ( " src/dev.zig " ) . Env ;
2017-04-19 06:13:15 +01:00
2024-06-06 20:05:37 +01:00
const zig_version : std . SemanticVersion = . { . major = 0 , . minor = 14 , . patch = 0 } ;
2022-07-21 20:20:50 +01:00
const stack_size = 32 * 1024 * 1024 ;
2020-08-15 22:17:40 +01:00
2023-01-31 07:19:51 +00:00
pub fn build ( b : * std . Build ) ! void {
2022-12-01 23:34:15 +00:00
const only_c = b . option ( bool , " only-c " , " Translate the Zig compiler to C code, with only the C backend enabled " ) orelse false ;
2022-11-05 01:35:04 +00:00
const target = t : {
2024-05-03 04:20:41 +01:00
var default_target : std . Target . Query = . { } ;
2024-03-29 00:41:58 +00:00
default_target . ofmt = b . option ( std . Target . ObjectFormat , " ofmt " , " Object format to target " ) orelse if ( only_c ) . c else null ;
2022-11-05 01:35:04 +00:00
break : t b . standardTargetOptions ( . { . default_target = default_target } ) ;
} ;
2023-04-06 08:32:05 +01:00
2023-04-07 20:17:23 +01:00
const optimize = b . standardOptimizeOption ( . { } ) ;
2022-11-05 01:35:04 +00:00
2023-07-22 04:29:42 +01:00
const flat = b . option ( bool , " flat " , " Put files into the installation prefix in a manner suited for upstream distribution rather than a posix file system hierarchy standard " ) orelse false ;
2022-01-29 00:16:51 +00:00
const single_threaded = b . option ( bool , " single-threaded " , " Build artifacts that run in single threaded mode " ) ;
2021-09-16 21:09:32 +01:00
const use_zig_libcxx = b . option ( bool , " use-zig-libcxx " , " If libc++ is needed, use zig's bundled version, don't try to integrate with the system " ) orelse false ;
2017-10-21 22:31:06 +01:00
2022-11-05 01:35:04 +00:00
const test_step = b . step ( " test " , " Run all the tests " ) ;
2023-05-14 17:59:30 +01:00
const skip_install_lib_files = b . option ( bool , " no-lib " , " skip copying of lib/ files and langref to installation prefix. Useful for development " ) orelse false ;
2023-04-11 20:05:53 +01:00
const skip_install_langref = b . option ( bool , " no-langref " , " skip copying of langref to the installation prefix " ) orelse skip_install_lib_files ;
2024-03-07 05:35:48 +00:00
const std_docs = b . option ( bool , " std-docs " , " include standard library autodocs " ) orelse false ;
2023-06-12 22:02:59 +01:00
const no_bin = b . option ( bool , " no-bin " , " skip emitting compiler binary " ) orelse false ;
2024-10-12 05:27:30 +01:00
const enable_superhtml = b . option ( bool , " enable-superhtml " , " Check langref output HTML validity " ) orelse false ;
2022-11-05 01:35:04 +00:00
2024-04-25 01:41:47 +01:00
const langref_file = generateLangRef ( b ) ;
2023-03-10 21:22:54 +00:00
const install_langref = b . addInstallFileWithDir ( langref_file , . prefix , " doc/langref.html " ) ;
2024-10-12 05:27:30 +01:00
const check_langref = superHtmlCheck ( b , langref_file ) ;
if ( enable_superhtml ) install_langref . step . dependOn ( check_langref ) ;
const check_autodocs = superHtmlCheck ( b , b . path ( " lib/docs/index.html " ) ) ;
if ( enable_superhtml ) {
2024-06-17 04:03:14 +01:00
test_step . dependOn ( check_langref ) ;
2024-10-12 05:27:30 +01:00
test_step . dependOn ( check_autodocs ) ;
2024-06-17 04:03:14 +01:00
}
2023-04-11 20:05:53 +01:00
if ( ! skip_install_langref ) {
2023-03-10 05:12:36 +00:00
b . getInstallStep ( ) . dependOn ( & install_langref . step ) ;
}
2017-11-07 08:22:27 +00:00
2024-03-07 05:51:38 +00:00
const autodoc_test = b . addObject ( . {
. name = " std " ,
2024-04-11 22:02:47 +01:00
. root_source_file = b . path ( " lib/std/std.zig " ) ,
2023-07-22 04:29:42 +01:00
. target = target ,
2024-04-11 22:02:47 +01:00
. zig_lib_dir = b . path ( " lib " ) ,
2024-03-07 05:51:38 +00:00
. optimize = . Debug ,
2023-07-22 04:29:42 +01:00
} ) ;
const install_std_docs = b . addInstallDirectory ( . {
2023-07-24 05:13:58 +01:00
. source_dir = autodoc_test . getEmittedDocs ( ) ,
2023-07-22 04:29:42 +01:00
. install_dir = . prefix ,
. install_subdir = " doc/std " ,
} ) ;
2024-06-17 08:09:40 +01:00
//if (enable_tidy) install_std_docs.step.dependOn(check_autodocs);
2024-03-07 05:35:48 +00:00
if ( std_docs ) {
2023-07-22 04:29:42 +01:00
b . getInstallStep ( ) . dependOn ( & install_std_docs . step ) ;
}
if ( flat ) {
b . installFile ( " LICENSE " , " LICENSE " ) ;
2023-07-23 23:51:13 +01:00
b . installFile ( " README.md " , " README.md " ) ;
2023-07-22 04:29:42 +01:00
}
const langref_step = b . step ( " langref " , " Build and install the language reference " ) ;
langref_step . dependOn ( & install_langref . step ) ;
const std_docs_step = b . step ( " std-docs " , " Build and install the standard library documentation " ) ;
std_docs_step . dependOn ( & install_std_docs . step ) ;
const docs_step = b . step ( " docs " , " Build and install documentation " ) ;
docs_step . dependOn ( langref_step ) ;
docs_step . dependOn ( std_docs_step ) ;
2017-11-07 08:22:27 +00:00
2021-04-24 21:39:26 +01:00
const skip_debug = b . option ( bool , " skip-debug " , " Main test suite skips debug builds " ) orelse false ;
2018-07-11 19:09:05 +01:00
const skip_release = b . option ( bool , " skip-release " , " Main test suite skips release builds " ) orelse false ;
2018-09-12 19:50:26 +01:00
const skip_release_small = b . option ( bool , " skip-release-small " , " Main test suite skips release-small builds " ) orelse skip_release ;
const skip_release_fast = b . option ( bool , " skip-release-fast " , " Main test suite skips release-fast builds " ) orelse skip_release ;
const skip_release_safe = b . option ( bool , " skip-release-safe " , " Main test suite skips release-safe builds " ) orelse skip_release ;
2019-05-15 02:21:59 +01:00
const skip_non_native = b . option ( bool , " skip-non-native " , " Main test suite skips non-native builds " ) orelse false ;
2019-09-22 04:55:56 +01:00
const skip_libc = b . option ( bool , " skip-libc " , " Main test suite skips tests that link libc " ) orelse false ;
2022-06-01 22:05:58 +01:00
const skip_single_threaded = b . option ( bool , " skip-single-threaded " , " Main test suite skips tests that are single-threaded " ) orelse false ;
2024-03-05 01:26:41 +00:00
const skip_translate_c = b . option ( bool , " skip-translate-c " , " Main test suite skips translate-c tests " ) orelse false ;
2021-04-15 07:10:51 +01:00
const skip_run_translated_c = b . option ( bool , " skip-run-translated-c " , " Main test suite skips run-translated-c tests " ) orelse false ;
2017-10-21 22:31:06 +01:00
2019-07-14 08:06:20 +01:00
const only_install_lib_files = b . option ( bool , " lib-files-only " , " Only install library files " ) orelse false ;
2022-02-16 20:50:47 +00:00
2020-12-08 00:23:17 +00:00
const static_llvm = b . option ( bool , " static-llvm " , " Disable integration with system-installed LLVM, Clang, LLD, and libc++ " ) orelse false ;
2022-11-01 03:29:55 +00:00
const enable_llvm = b . option ( bool , " enable-llvm " , " Build self-hosted compiler with LLVM backend enabled " ) orelse static_llvm ;
2021-09-01 06:50:10 +01:00
const llvm_has_m68k = b . option (
bool ,
" llvm-has-m68k " ,
" Whether LLVM has the experimental target m68k enabled " ,
) orelse false ;
const llvm_has_csky = b . option (
bool ,
" llvm-has-csky " ,
" Whether LLVM has the experimental target csky enabled " ,
) orelse false ;
const llvm_has_arc = b . option (
bool ,
" llvm-has-arc " ,
" Whether LLVM has the experimental target arc enabled " ,
) orelse false ;
2023-01-26 23:33:40 +00:00
const llvm_has_xtensa = b . option (
bool ,
" llvm-has-xtensa " ,
" Whether LLVM has the experimental target xtensa enabled " ,
) orelse false ;
2023-08-18 10:57:12 +01:00
const enable_ios_sdk = b . option ( bool , " enable-ios-sdk " , " Run tests requiring presence of iOS SDK and frameworks " ) orelse false ;
2023-08-18 11:05:13 +01:00
const enable_macos_sdk = b . option ( bool , " enable-macos-sdk " , " Run tests requiring presence of macOS SDK and frameworks " ) orelse enable_ios_sdk ;
2022-11-28 21:04:42 +00:00
const enable_symlinks_windows = b . option ( bool , " enable-symlinks-windows " , " Run tests requiring presence of symlinks on Windows " ) orelse false ;
2020-07-04 02:15:01 +01:00
const config_h_path_option = b . option ( [ ] const u8 , " config_h " , " Path to the generated config.h " ) ;
2020-04-06 18:07:19 +01:00
2021-04-17 02:58:27 +01:00
if ( ! skip_install_lib_files ) {
2023-07-22 04:29:42 +01:00
b . installDirectory ( . {
2024-04-11 22:02:47 +01:00
. source_dir = b . path ( " lib " ) ,
2023-07-22 04:29:42 +01:00
. install_dir = if ( flat ) . prefix else . lib ,
. install_subdir = if ( flat ) " lib " else " zig " ,
2021-04-17 02:58:27 +01:00
. exclude_extensions = & [ _ ] [ ] const u8 {
2022-12-18 23:28:30 +00:00
// exclude files from lib/std/compress/testdata
2022-01-09 01:12:00 +00:00
" .gz " ,
2021-04-17 02:58:27 +01:00
" .z.0 " ,
" .z.9 " ,
2024-02-29 05:37:11 +00:00
" .zst.3 " ,
" .zst.19 " ,
2021-04-17 02:58:27 +01:00
" rfc1951.txt " ,
2022-01-09 01:12:00 +00:00
" rfc1952.txt " ,
2023-01-21 08:10:47 +00:00
" rfc8478.txt " ,
2024-02-14 21:34:13 +00:00
// exclude files from lib/std/compress/flate/testdata
2022-01-09 01:12:00 +00:00
" .expect " ,
" .expect-noinput " ,
" .golden " ,
" .input " ,
" compress-e.txt " ,
" compress-gettysburg.txt " ,
" compress-pi.txt " ,
" rfc1951.txt " ,
2023-02-02 19:59:56 +00:00
// exclude files from lib/std/compress/lzma/testdata
" .lzma " ,
2023-01-23 19:46:40 +00:00
// exclude files from lib/std/compress/xz/testdata
" .xz " ,
2022-01-09 01:12:00 +00:00
// exclude files from lib/std/tz/
2021-12-31 17:17:49 +00:00
" .tzif " ,
2024-01-13 00:51:44 +00:00
// exclude files from lib/std/tar/testdata
" .tar " ,
2022-01-09 01:12:00 +00:00
// others
" README.md " ,
2021-04-17 02:58:27 +01:00
} ,
2021-05-19 01:18:42 +01:00
. blank_extensions = & [ _ ] [ ] const u8 {
" test.zig " ,
} ,
2021-04-17 02:58:27 +01:00
} ) ;
}
2017-10-21 22:31:06 +01:00
2020-09-08 19:15:32 +01:00
if ( only_install_lib_files )
return ;
2023-03-16 19:41:46 +00:00
const entitlements = b . option ( [ ] const u8 , " entitlements " , " Path to entitlements file for hot-code swapping without sudo on macOS " ) ;
2020-09-17 01:17:37 +01:00
const tracy = b . option ( [ ] const u8 , " tracy " , " Enable Tracy integration. Supply path to Tracy source " ) ;
2022-10-27 02:17:49 +01:00
const tracy_callstack = b . option ( bool , " tracy-callstack " , " Include callstack information with Tracy data. Does nothing if -Dtracy is not provided " ) orelse ( tracy ! = null ) ;
const tracy_allocation = b . option ( bool , " tracy-allocation " , " Include allocation information with Tracy data. Does nothing if -Dtracy is not provided " ) orelse ( tracy ! = null ) ;
2022-01-23 20:10:39 +00:00
const force_gpa = b . option ( bool , " force-gpa " , " Force the compiler to use GeneralPurposeAllocator " ) orelse false ;
2022-12-01 23:34:15 +00:00
const link_libc = b . option ( bool , " force-link-libc " , " Force self-hosted compiler to link libc " ) orelse ( enable_llvm or only_c ) ;
2022-10-05 11:22:10 +01:00
const sanitize_thread = b . option ( bool , " sanitize-thread " , " Enable thread-sanitization " ) orelse false ;
2022-11-05 01:35:04 +00:00
const strip = b . option ( bool , " strip " , " Omit debug information " ) ;
2024-07-17 01:26:41 +01:00
const valgrind = b . option ( bool , " valgrind " , " Enable valgrind integration " ) ;
2023-03-08 13:21:33 +00:00
const pie = b . option ( bool , " pie " , " Produce a Position Independent Executable " ) ;
2022-06-09 23:33:04 +01:00
const value_tracing = b . option ( bool , " value-tracing " , " Enable extra state tracking to help troubleshoot bugs in the compiler (using the std.debug.Trace API) " ) orelse false ;
2020-09-17 01:17:37 +01:00
2021-05-04 04:42:36 +01:00
const mem_leak_frames : u32 = b . option ( u32 , " mem-leak-frames " , " How many stack frames to print when a memory leak occurs. Tests get 2x this amount. " ) orelse blk : {
2022-11-05 01:35:04 +00:00
if ( strip = = true ) break : blk @as ( u32 , 0 ) ;
2023-01-31 04:39:43 +00:00
if ( optimize ! = . Debug ) break : blk 0 ;
2021-05-04 04:42:36 +01:00
break : blk 4 ;
} ;
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
const exe = addCompilerStep ( b , . {
. optimize = optimize ,
. target = target ,
. strip = strip ,
2024-07-17 01:26:41 +01:00
. valgrind = valgrind ,
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
. sanitize_thread = sanitize_thread ,
. single_threaded = single_threaded ,
} ) ;
2023-03-08 13:21:33 +00:00
exe . pie = pie ;
2023-03-16 19:41:46 +00:00
exe . entitlements = entitlements ;
2023-04-25 14:57:43 +01:00
2023-05-17 04:00:47 +01:00
exe . build_id = b . option (
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
std . zig . BuildId ,
2023-05-17 04:00:47 +01:00
" build-id " ,
" Request creation of '.note.gnu.build-id' section " ,
) ;
2023-04-25 14:57:43 +01:00
2023-09-14 22:49:30 +01:00
if ( no_bin ) {
b . getInstallStep ( ) . dependOn ( & exe . step ) ;
} else {
2023-08-02 23:19:26 +01:00
const install_exe = b . addInstallArtifact ( exe , . {
. dest_dir = if ( flat ) . { . override = . prefix } else . default ,
} ) ;
2023-07-22 04:29:42 +01:00
b . getInstallStep ( ) . dependOn ( & install_exe . step ) ;
}
2022-12-01 23:34:15 +00:00
2023-04-14 00:44:45 +01:00
test_step . dependOn ( & exe . step ) ;
2022-02-16 20:50:47 +00:00
2023-12-05 23:09:07 +00:00
if ( target . result . os . tag = = . windows and target . result . abi = = . gnu ) {
2021-09-16 22:51:29 +01:00
// LTO is currently broken on mingw, this can be removed when it's fixed.
exe . want_lto = false ;
}
2023-11-05 14:28:40 +00:00
const use_llvm = b . option ( bool , " use-llvm " , " Use the llvm backend " ) ;
exe . use_llvm = use_llvm ;
exe . use_lld = use_llvm ;
2021-08-27 00:53:23 +01:00
const exe_options = b . addOptions ( ) ;
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
exe . root_module . addOptions ( " build_options " , exe_options ) ;
2021-08-27 00:53:23 +01:00
exe_options . addOption ( u32 , " mem_leak_frames " , mem_leak_frames ) ;
exe_options . addOption ( bool , " skip_non_native " , skip_non_native ) ;
exe_options . addOption ( bool , " have_llvm " , enable_llvm ) ;
2021-09-01 06:50:10 +01:00
exe_options . addOption ( bool , " llvm_has_m68k " , llvm_has_m68k ) ;
exe_options . addOption ( bool , " llvm_has_csky " , llvm_has_csky ) ;
exe_options . addOption ( bool , " llvm_has_arc " , llvm_has_arc ) ;
2023-01-26 23:33:40 +00:00
exe_options . addOption ( bool , " llvm_has_xtensa " , llvm_has_xtensa ) ;
2022-01-23 20:10:39 +00:00
exe_options . addOption ( bool , " force_gpa " , force_gpa ) ;
2024-07-19 06:04:59 +01:00
exe_options . addOption ( DevEnv , " dev " , b . option ( DevEnv , " dev " , " Build a compiler with a reduced feature set for development of specific features " ) orelse if ( only_c ) . bootstrap else . full ) ;
2021-08-27 00:53:23 +01:00
2020-09-08 19:15:32 +01:00
if ( link_libc ) {
exe . linkLibC ( ) ;
}
2023-01-31 04:39:43 +00:00
const is_debug = optimize = = . Debug ;
2024-03-01 15:46:48 +00:00
const enable_debug_extensions = b . option ( bool , " debug-extensions " , " Enable commands and options useful for debugging the compiler " ) orelse is_debug ;
2022-02-01 04:11:41 +00:00
const enable_logging = b . option ( bool , " log " , " Enable debug logging with --debug-log " ) orelse is_debug ;
2021-10-14 12:50:10 +01:00
const enable_link_snapshots = b . option ( bool , " link-snapshot " , " Whether to enable linker state snapshots " ) orelse false ;
2020-09-08 19:15:32 +01:00
const opt_version_string = b . option ( [ ] const u8 , " version-string " , " Override Zig version string. Default is to find out with git. " ) ;
2022-12-01 23:34:15 +00:00
const version_slice = if ( opt_version_string ) | version | version else v : {
2022-02-03 22:27:01 +00:00
if ( ! std . process . can_spawn ) {
std . debug . print ( " error: version info cannot be retrieved from git. Zig version must be provided using -Dversion-string \n " , . { } ) ;
std . process . exit ( 1 ) ;
}
2022-02-16 20:50:47 +00:00
const version_string = b . fmt ( " {d}.{d}.{d} " , . { zig_version . major , zig_version . minor , zig_version . patch } ) ;
2020-09-08 19:15:32 +01:00
var code : u8 = undefined ;
2023-10-19 21:36:11 +01:00
const git_describe_untrimmed = b . runAllowFail ( & [ _ ] [ ] const u8 {
2023-12-18 21:43:07 +00:00
" git " ,
" -C " ,
b . build_root . path orelse " . " ,
" describe " ,
" --match " ,
" *.*.* " ,
" --tags " ,
" --abbrev=9 " ,
2020-09-08 19:15:32 +01:00
} , & code , . Ignore ) catch {
break : v version_string ;
} ;
2021-01-02 04:01:51 +00:00
const git_describe = mem . trim ( u8 , git_describe_untrimmed , " \n \r " ) ;
switch ( mem . count ( u8 , git_describe , " - " ) ) {
0 = > {
2022-10-31 17:24:38 +00:00
// Tagged release version (e.g. 0.10.0).
2021-01-02 04:01:51 +00:00
if ( ! mem . eql ( u8 , git_describe , version_string ) ) {
2020-11-26 12:28:38 +00:00
std . debug . print ( " Zig version '{s}' does not match Git tag '{s}' \n " , . { version_string , git_describe } ) ;
2021-01-02 04:01:51 +00:00
std . process . exit ( 1 ) ;
}
break : v version_string ;
} ,
2 = > {
2022-10-31 17:24:38 +00:00
// Untagged development build (e.g. 0.10.0-dev.2025+ecf0050a9).
2023-05-05 02:15:50 +01:00
var it = mem . splitScalar ( u8 , git_describe , '-' ) ;
2022-07-25 20:04:30 +01:00
const tagged_ancestor = it . first ( ) ;
const commit_height = it . next ( ) . ? ;
const commit_id = it . next ( ) . ? ;
2021-01-02 04:01:51 +00:00
2023-02-21 17:39:22 +00:00
const ancestor_ver = try std . SemanticVersion . parse ( tagged_ancestor ) ;
2021-01-02 04:01:51 +00:00
if ( zig_version . order ( ancestor_ver ) ! = . gt ) {
std . debug . print ( " Zig version '{}' must be greater than tagged ancestor '{}' \n " , . { zig_version , ancestor_ver } ) ;
std . process . exit ( 1 ) ;
}
// Check that the commit hash is prefixed with a 'g' (a Git convention).
if ( commit_id . len < 1 or commit_id [ 0 ] ! = 'g' ) {
2020-11-26 12:28:38 +00:00
std . debug . print ( " Unexpected `git describe` output: {s} \n " , . { git_describe } ) ;
2021-01-02 04:01:51 +00:00
break : v version_string ;
}
// The version is reformatted in accordance with the https://semver.org specification.
2020-11-26 12:28:38 +00:00
break : v b . fmt ( " {s}-dev.{s}+{s} " , . { version_string , commit_height , commit_id [ 1 . . ] } ) ;
2021-01-02 04:01:51 +00:00
} ,
else = > {
2020-11-26 12:28:38 +00:00
std . debug . print ( " Unexpected `git describe` output: {s} \n " , . { git_describe } ) ;
2021-01-02 04:01:51 +00:00
break : v version_string ;
} ,
2020-09-08 19:15:32 +01:00
}
} ;
2022-12-01 23:34:15 +00:00
const version = try b . allocator . dupeZ ( u8 , version_slice ) ;
exe_options . addOption ( [ : 0 ] const u8 , " version " , version ) ;
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
2022-02-16 20:50:47 +00:00
if ( enable_llvm ) {
2022-07-16 01:25:38 +01:00
const cmake_cfg = if ( static_llvm ) null else blk : {
if ( findConfigH ( b , config_h_path_option ) ) | config_h_path | {
const file_contents = fs . cwd ( ) . readFileAlloc ( b . allocator , config_h_path , max_config_h_bytes ) catch unreachable ;
break : blk parseConfigH ( b , file_contents ) ;
} else {
std . log . warn ( " config.h could not be located automatically. Consider providing it explicitly via \" -Dconfig_h \" " , . { } ) ;
break : blk null ;
}
} ;
2022-02-16 20:50:47 +00:00
if ( cmake_cfg ) | cfg | {
// Inside this code path, we have to coordinate with system packaged LLVM, Clang, and LLD.
// That means we also have to rely on stage1 compiled c++ files. We parse config.h to find
// the information passed on to us from cmake.
if ( cfg . cmake_prefix_path . len > 0 ) {
2023-05-05 02:05:40 +01:00
var it = mem . tokenizeScalar ( u8 , cfg . cmake_prefix_path , ';' ) ;
2022-10-11 16:16:27 +01:00
while ( it . next ( ) ) | path | {
b . addSearchPrefix ( path ) ;
}
2022-02-16 20:50:47 +00:00
}
try addCmakeCfgOptionsToExe ( b , cfg , exe , use_zig_libcxx ) ;
} else {
// Here we are -Denable-llvm but no cmake integration.
2022-11-13 08:42:51 +00:00
try addStaticLlvmOptionsToExe ( exe ) ;
2022-02-16 20:50:47 +00:00
}
2023-12-05 23:09:07 +00:00
if ( target . result . os . tag = = . windows ) {
compiler: rework type resolution, fully resolve all types
I'm so sorry.
This commit was just meant to be making all types fully resolve by
queueing resolution at the moment of their creation. Unfortunately, a
lot of dominoes ended up falling. Here's what happened:
* I added a work queue job to fully resolve a type.
* I realised that from here we could eliminate `Sema.types_to_resolve`
if we made function codegen a separate job. This is desirable for
simplicity of both spec and implementation.
* This led to a new AIR traversal to detect whether any required type is
unresolved. If a type in the AIR failed to resolve, then we can't run
codegen.
* Because full type resolution now occurs by the work queue job, a bug
was exposed whereby error messages for type resolution were associated
with the wrong `Decl`, resulting in duplicate error messages when the
type was also resolved "by" its owner `Decl` (which really *all*
resolution should be done on).
* A correct fix for this requires using a different `Sema` when
performing type resolution: we need a `Sema` owned by the type. Also
note that this fix is necessary for incremental compilation.
* This means a whole bunch of functions no longer need to take `Sema`s.
* First-order effects: `resolveTypeFields`, `resolveTypeLayout`, etc
* Second-order effects: `Type.abiAlignmentAdvanced`, `Value.orderAgainstZeroAdvanced`, etc
The end result of this is, in short, a more correct compiler and a
simpler language specification. This regressed a few error notes in the
test cases, but nothing that seems worth blocking this change.
Oh, also, I ripped out the old code in `test/src/Cases.zig` which
introduced a dependency on `Compilation`. This dependency was
problematic at best, and this code has been unused for a while. When we
re-enable incremental test cases, we must rewrite their executor to use
the compiler server protocol.
2024-07-04 05:00:32 +01:00
// LLVM depends on networking as of version 18.
exe . linkSystemLibrary ( " ws2_32 " ) ;
2024-04-30 00:57:40 +01:00
compiler: rework type resolution, fully resolve all types
I'm so sorry.
This commit was just meant to be making all types fully resolve by
queueing resolution at the moment of their creation. Unfortunately, a
lot of dominoes ended up falling. Here's what happened:
* I added a work queue job to fully resolve a type.
* I realised that from here we could eliminate `Sema.types_to_resolve`
if we made function codegen a separate job. This is desirable for
simplicity of both spec and implementation.
* This led to a new AIR traversal to detect whether any required type is
unresolved. If a type in the AIR failed to resolve, then we can't run
codegen.
* Because full type resolution now occurs by the work queue job, a bug
was exposed whereby error messages for type resolution were associated
with the wrong `Decl`, resulting in duplicate error messages when the
type was also resolved "by" its owner `Decl` (which really *all*
resolution should be done on).
* A correct fix for this requires using a different `Sema` when
performing type resolution: we need a `Sema` owned by the type. Also
note that this fix is necessary for incremental compilation.
* This means a whole bunch of functions no longer need to take `Sema`s.
* First-order effects: `resolveTypeFields`, `resolveTypeLayout`, etc
* Second-order effects: `Type.abiAlignmentAdvanced`, `Value.orderAgainstZeroAdvanced`, etc
The end result of this is, in short, a more correct compiler and a
simpler language specification. This regressed a few error notes in the
test cases, but nothing that seems worth blocking this change.
Oh, also, I ripped out the old code in `test/src/Cases.zig` which
introduced a dependency on `Compilation`. This dependency was
problematic at best, and this code has been unused for a while. When we
re-enable incremental test cases, we must rewrite their executor to use
the compiler server protocol.
2024-07-04 05:00:32 +01:00
exe . linkSystemLibrary ( " version " ) ;
exe . linkSystemLibrary ( " uuid " ) ;
exe . linkSystemLibrary ( " ole32 " ) ;
2022-12-07 09:50:49 +00:00
}
2022-02-16 20:50:47 +00:00
}
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
const semver = try std . SemanticVersion . parse ( version ) ;
2021-08-27 00:53:23 +01:00
exe_options . addOption ( std . SemanticVersion , " semver " , semver ) ;
2020-09-08 19:15:32 +01:00
2024-03-01 15:46:48 +00:00
exe_options . addOption ( bool , " enable_debug_extensions " , enable_debug_extensions ) ;
2021-08-27 00:53:23 +01:00
exe_options . addOption ( bool , " enable_logging " , enable_logging ) ;
2021-10-14 12:50:10 +01:00
exe_options . addOption ( bool , " enable_link_snapshots " , enable_link_snapshots ) ;
2021-08-27 00:53:23 +01:00
exe_options . addOption ( bool , " enable_tracy " , tracy ! = null ) ;
2021-10-31 14:12:36 +00:00
exe_options . addOption ( bool , " enable_tracy_callstack " , tracy_callstack ) ;
2021-10-31 14:16:59 +00:00
exe_options . addOption ( bool , " enable_tracy_allocation " , tracy_allocation ) ;
2022-06-09 23:33:04 +01:00
exe_options . addOption ( bool , " value_tracing " , value_tracing ) ;
2020-09-08 19:15:32 +01:00
if ( tracy ) | tracy_path | {
2023-07-19 09:49:34 +01:00
const client_cpp = b . pathJoin (
2022-10-27 02:17:49 +01:00
& [ _ ] [ ] const u8 { tracy_path , " public " , " TracyClient.cpp " } ,
2023-07-19 09:49:34 +01:00
) ;
2021-09-16 22:51:29 +01:00
// On mingw, we need to opt into windows 7+ to get some features required by tracy.
2023-12-05 23:09:07 +00:00
const tracy_c_flags : [ ] const [ ] const u8 = if ( target . result . os . tag = = . windows and target . result . abi = = . gnu )
2021-09-16 22:51:29 +01:00
& [ _ ] [ ] const u8 { " -DTRACY_ENABLE=1 " , " -fno-sanitize=undefined " , " -D_WIN32_WINNT=0x601 " }
else
& [ _ ] [ ] const u8 { " -DTRACY_ENABLE=1 " , " -fno-sanitize=undefined " } ;
2023-07-30 07:57:52 +01:00
exe . addIncludePath ( . { . cwd_relative = tracy_path } ) ;
exe . addCSourceFile ( . { . file = . { . cwd_relative = client_cpp } , . flags = tracy_c_flags } ) ;
2020-09-17 01:17:37 +01:00
if ( ! enable_llvm ) {
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
exe . root_module . linkSystemLibrary ( " c++ " , . { . use_pkg_config = . no } ) ;
2020-09-17 01:17:37 +01:00
}
2020-09-08 19:15:32 +01:00
exe . linkLibC ( ) ;
2021-09-16 22:51:29 +01:00
2023-12-05 23:09:07 +00:00
if ( target . result . os . tag = = . windows ) {
2021-09-16 22:51:29 +01:00
exe . linkSystemLibrary ( " dbghelp " ) ;
exe . linkSystemLibrary ( " ws2_32 " ) ;
}
2020-09-08 19:15:32 +01:00
}
2024-02-25 13:04:06 +00:00
const test_filters = b . option ( [ ] const [ ] const u8 , " test-filter " , " Skip tests that do not match any filter " ) orelse & [ 0 ] [ ] const u8 { } ;
2024-08-13 22:59:50 +01:00
const test_target_filters = b . option ( [ ] const [ ] const u8 , " test-target-filter " , " Skip tests whose target triple do not match any filter " ) orelse & [ 0 ] [ ] const u8 { } ;
2024-08-13 23:14:02 +01:00
const test_slow_targets = b . option ( bool , " test-slow-targets " , " Enable running module tests for targets that have a slow compiler backend " ) orelse false ;
2017-04-19 06:13:15 +01:00
2022-05-13 22:30:43 +01:00
const test_cases_options = b . addOptions ( ) ;
re-enable test-cases and get them all passing
Instead of using `zig test` to build a special version of the compiler
that runs all the test-cases, the zig build system is now used as much
as possible - all with the basic steps found in the standard library.
For incremental compilation tests (the ones that look like foo.0.zig,
foo.1.zig, foo.2.zig, etc.), a special version of the compiler is
compiled into a utility executable called "check-case" which checks
exactly one sequence of incremental updates in an independent
subprocess. Previously, all incremental and non-incremental test cases
were done in the same test runner process.
The compile error checking code is now simpler, but also a bit
rudimentary, and so it additionally makes sure that the actual compile
errors do not include *extra* messages, and it makes sure that the
actual compile errors output in the same order as expected. It is also
based on the "ends-with" property of each line rather than the previous
logic, which frankly I didn't want to touch with a ten-meter pole. The
compile error test cases have been updated to pass in light of these
differences.
Previously, 'error' mode with 0 compile errors was used to shoehorn in a
different kind of test-case - one that only checks if a piece of code
compiles without errors. Now there is a 'compile' mode of test-cases,
and 'error' must be only used when there are greater than 0 errors.
link test cases are updated to omit the target object format argument
when calling checkObject since that is no longer needed.
The test/stage2 directory is removed; the 2 files within are moved to be
directly in the test/ directory.
2023-03-10 01:22:51 +00:00
test_cases_options . addOption ( bool , " enable_tracy " , false ) ;
2024-03-01 15:46:48 +00:00
test_cases_options . addOption ( bool , " enable_debug_extensions " , enable_debug_extensions ) ;
2022-05-13 22:30:43 +01:00
test_cases_options . addOption ( bool , " enable_logging " , enable_logging ) ;
test_cases_options . addOption ( bool , " enable_link_snapshots " , enable_link_snapshots ) ;
test_cases_options . addOption ( bool , " skip_non_native " , skip_non_native ) ;
test_cases_options . addOption ( bool , " have_llvm " , enable_llvm ) ;
test_cases_options . addOption ( bool , " llvm_has_m68k " , llvm_has_m68k ) ;
test_cases_options . addOption ( bool , " llvm_has_csky " , llvm_has_csky ) ;
test_cases_options . addOption ( bool , " llvm_has_arc " , llvm_has_arc ) ;
2023-01-26 23:33:40 +00:00
test_cases_options . addOption ( bool , " llvm_has_xtensa " , llvm_has_xtensa ) ;
multi-thread `zig build test-cases`
Instead of always using std.testing.allocator, the test harness now follows
the same logic as self-hosted for choosing an allocator - that is - it
uses C allocator when linking libc, std.testing.allocator otherwise, and
respects `-Dforce-gpa` to override the decision. I did this because
I found GeneralPurposeAllocator to be prohibitively slow when doing
multi-threading, even in the context of a debug build.
There is now a second thread pool which is used to spawn each
test case. The stage2 tests are passed the first thread pool. If it were
only multi-threading the stage1 tests then we could use the same thread
pool for everything. However, the problem with this strategy with stage2
is that stage2 wants to spawn tasks and then call wait() on the main
thread. If we use the same thread pool for everything, we get a deadlock
because all the threads end up all hanging at wait() and nothing is
getting done. So we use our second thread pool to simulate a "process pool"
of sorts.
I spent most of the time working on this commit scratching my head trying
to figure out why I was getting ETXTBSY when spawning the test cases.
Turns out it's a fundamental Unix design flaw, already a known, unsolved
issue by Go and Java maintainers:
https://github.com/golang/go/issues/22315
https://bugs.openjdk.org/browse/JDK-8068370
With this change, the following command, executed on my laptop, went from
6m24s to 1m44s:
```
stage1/bin/zig build test-cases -fqemu -fwasmtime -Denable-llvm
```
closes #11818
2022-06-14 02:59:52 +01:00
test_cases_options . addOption ( bool , " force_gpa " , force_gpa ) ;
2024-02-02 00:40:36 +00:00
test_cases_options . addOption ( bool , " enable_qemu " , b . enable_qemu ) ;
test_cases_options . addOption ( bool , " enable_wine " , b . enable_wine ) ;
test_cases_options . addOption ( bool , " enable_wasmtime " , b . enable_wasmtime ) ;
test_cases_options . addOption ( bool , " enable_rosetta " , b . enable_rosetta ) ;
test_cases_options . addOption ( bool , " enable_darling " , b . enable_darling ) ;
2022-05-13 22:30:43 +01:00
test_cases_options . addOption ( u32 , " mem_leak_frames " , mem_leak_frames * 2 ) ;
2022-06-09 23:33:04 +01:00
test_cases_options . addOption ( bool , " value_tracing " , value_tracing ) ;
2024-02-02 00:40:36 +00:00
test_cases_options . addOption ( ? [ ] const u8 , " glibc_runtimes_dir " , b . glibc_runtimes_dir ) ;
2022-12-01 23:34:15 +00:00
test_cases_options . addOption ( [ : 0 ] const u8 , " version " , version ) ;
2022-05-13 22:30:43 +01:00
test_cases_options . addOption ( std . SemanticVersion , " semver " , semver ) ;
2024-02-25 13:04:06 +00:00
test_cases_options . addOption ( [ ] const [ ] const u8 , " test_filters " , test_filters ) ;
2024-07-19 06:04:59 +01:00
test_cases_options . addOption ( DevEnv , " dev " , if ( only_c ) . bootstrap else . core ) ;
2020-08-04 23:32:16 +01:00
2023-08-09 19:39:34 +01:00
var chosen_opt_modes_buf : [ 4 ] builtin . OptimizeMode = undefined ;
2018-09-12 19:50:26 +01:00
var chosen_mode_index : usize = 0 ;
2021-04-24 21:39:26 +01:00
if ( ! skip_debug ) {
2023-08-09 19:39:34 +01:00
chosen_opt_modes_buf [ chosen_mode_index ] = builtin . OptimizeMode . Debug ;
2021-04-24 21:39:26 +01:00
chosen_mode_index + = 1 ;
}
2018-09-12 19:50:26 +01:00
if ( ! skip_release_safe ) {
2023-08-09 19:39:34 +01:00
chosen_opt_modes_buf [ chosen_mode_index ] = builtin . OptimizeMode . ReleaseSafe ;
2018-09-12 19:50:26 +01:00
chosen_mode_index + = 1 ;
}
if ( ! skip_release_fast ) {
2023-08-09 19:39:34 +01:00
chosen_opt_modes_buf [ chosen_mode_index ] = builtin . OptimizeMode . ReleaseFast ;
2018-09-12 19:50:26 +01:00
chosen_mode_index + = 1 ;
}
if ( ! skip_release_small ) {
2023-08-09 19:39:34 +01:00
chosen_opt_modes_buf [ chosen_mode_index ] = builtin . OptimizeMode . ReleaseSmall ;
2018-09-12 19:50:26 +01:00
chosen_mode_index + = 1 ;
}
2023-01-31 04:39:43 +00:00
const optimization_modes = chosen_opt_modes_buf [ 0 . . chosen_mode_index ] ;
2017-11-07 08:22:27 +00:00
2024-06-17 03:31:59 +01:00
const fmt_include_paths = & . { " lib " , " src " , " test " , " tools " , " build.zig " , " build.zig.zon " } ;
2023-09-12 22:19:16 +01:00
const fmt_exclude_paths = & . { " test/cases " } ;
zig build: many enhancements related to parallel building
Rework std.Build.Step to have an `owner: *Build` field. This
simplified the implementation of installation steps, as well as provided
some much-needed common API for the new parallelized build system.
--verbose is now defined very concretely: it prints to stderr just
before spawning a child process.
Child process execution is updated to conform to the new
parallel-friendly make() function semantics.
DRY up the failWithCacheError handling code. It now integrates properly
with the step graph instead of incorrectly dumping to stderr and calling
process exit.
In the main CLI, fix `zig fmt` crash when there are no errors and stdin
is used.
Deleted steps:
* EmulatableRunStep - this entire thing can be removed in favor of a
flag added to std.Build.RunStep called `skip_foreign_checks`.
* LogStep - this doesn't really fit with a multi-threaded build runner
and is effectively superseded by the new build summary output.
build runner:
* add -fsummary and -fno-summary to override the default behavior,
which is to print a summary if any of the build steps fail.
* print the dep prefix when emitting error messages for steps.
std.Build.FmtStep:
* This step now supports exclude paths as well as a check flag.
* The check flag decides between two modes, modify mode, and check
mode. These can be used to update source files in place, or to fail
the build, respectively.
Zig's own build.zig:
* The `test-fmt` step will do all the `zig fmt` checking that we expect
to be done. Since the `test` step depends on this one, we can simply
remove the explicit call to `zig fmt` in the CI.
* The new `fmt` step will actually perform `zig fmt` and update source
files in place.
std.Build.RunStep:
* expose max_stdio_size is a field (previously an unchangeable
hard-coded value).
* rework the API. Instead of configuring each stream independently,
there is a `stdio` field where you can choose between
`infer_from_args`, `inherit`, or `check`. These determine whether the
RunStep is considered to have side-effects or not. The previous
field, `condition` is gone.
* when stdio mode is set to `check` there is a slice of any number of
checks to make, which include things like exit code, stderr matching,
or stdout matching.
* remove the ill-defined `print` field.
* when adding an output arg, it takes the opportunity to give itself a
better name.
* The flag `skip_foreign_checks` is added. If this is true, a RunStep
which is configured to check the output of the executed binary will
not fail the build if the binary cannot be executed due to being for
a foreign binary to the host system which is running the build graph.
Command-line arguments such as -fqemu and -fwasmtime may affect
whether a binary is detected as foreign, as well as system
configuration such as Rosetta (macOS) and binfmt_misc (Linux).
- This makes EmulatableRunStep no longer needed.
* Fix the child process handling to properly integrate with the new
bulid API and to avoid deadlocks in stdout/stderr streams by polling
if necessary.
std.Build.RemoveDirStep now uses the open build_root directory handle
instead of an absolute path.
2023-03-02 05:56:37 +00:00
const do_fmt = b . addFmt ( . {
. paths = fmt_include_paths ,
. exclude_paths = fmt_exclude_paths ,
} ) ;
2024-06-17 03:31:59 +01:00
b . step ( " fmt " , " Modify source files in place to have conforming formatting " ) . dependOn ( & do_fmt . step ) ;
2021-05-13 10:03:44 +01:00
2024-06-17 03:31:59 +01:00
const check_fmt = b . step ( " test-fmt " , " Check source files having conforming formatting " ) ;
check_fmt . dependOn ( & b . addFmt ( . {
re-enable test-cases and get them all passing
Instead of using `zig test` to build a special version of the compiler
that runs all the test-cases, the zig build system is now used as much
as possible - all with the basic steps found in the standard library.
For incremental compilation tests (the ones that look like foo.0.zig,
foo.1.zig, foo.2.zig, etc.), a special version of the compiler is
compiled into a utility executable called "check-case" which checks
exactly one sequence of incremental updates in an independent
subprocess. Previously, all incremental and non-incremental test cases
were done in the same test runner process.
The compile error checking code is now simpler, but also a bit
rudimentary, and so it additionally makes sure that the actual compile
errors do not include *extra* messages, and it makes sure that the
actual compile errors output in the same order as expected. It is also
based on the "ends-with" property of each line rather than the previous
logic, which frankly I didn't want to touch with a ten-meter pole. The
compile error test cases have been updated to pass in light of these
differences.
Previously, 'error' mode with 0 compile errors was used to shoehorn in a
different kind of test-case - one that only checks if a piece of code
compiles without errors. Now there is a 'compile' mode of test-cases,
and 'error' must be only used when there are greater than 0 errors.
link test cases are updated to omit the target object format argument
when calling checkObject since that is no longer needed.
The test/stage2 directory is removed; the 2 files within are moved to be
directly in the test/ directory.
2023-03-10 01:22:51 +00:00
. paths = fmt_include_paths ,
. exclude_paths = fmt_exclude_paths ,
. check = true ,
} ) . step ) ;
2024-06-17 03:31:59 +01:00
test_step . dependOn ( check_fmt ) ;
2021-05-13 10:03:44 +01:00
re-enable test-cases and get them all passing
Instead of using `zig test` to build a special version of the compiler
that runs all the test-cases, the zig build system is now used as much
as possible - all with the basic steps found in the standard library.
For incremental compilation tests (the ones that look like foo.0.zig,
foo.1.zig, foo.2.zig, etc.), a special version of the compiler is
compiled into a utility executable called "check-case" which checks
exactly one sequence of incremental updates in an independent
subprocess. Previously, all incremental and non-incremental test cases
were done in the same test runner process.
The compile error checking code is now simpler, but also a bit
rudimentary, and so it additionally makes sure that the actual compile
errors do not include *extra* messages, and it makes sure that the
actual compile errors output in the same order as expected. It is also
based on the "ends-with" property of each line rather than the previous
logic, which frankly I didn't want to touch with a ten-meter pole. The
compile error test cases have been updated to pass in light of these
differences.
Previously, 'error' mode with 0 compile errors was used to shoehorn in a
different kind of test-case - one that only checks if a piece of code
compiles without errors. Now there is a 'compile' mode of test-cases,
and 'error' must be only used when there are greater than 0 errors.
link test cases are updated to omit the target object format argument
when calling checkObject since that is no longer needed.
The test/stage2 directory is removed; the 2 files within are moved to be
directly in the test/ directory.
2023-03-10 01:22:51 +00:00
const test_cases_step = b . step ( " test-cases " , " Run the main compiler test cases " ) ;
compiler: rework type resolution, fully resolve all types
I'm so sorry.
This commit was just meant to be making all types fully resolve by
queueing resolution at the moment of their creation. Unfortunately, a
lot of dominoes ended up falling. Here's what happened:
* I added a work queue job to fully resolve a type.
* I realised that from here we could eliminate `Sema.types_to_resolve`
if we made function codegen a separate job. This is desirable for
simplicity of both spec and implementation.
* This led to a new AIR traversal to detect whether any required type is
unresolved. If a type in the AIR failed to resolve, then we can't run
codegen.
* Because full type resolution now occurs by the work queue job, a bug
was exposed whereby error messages for type resolution were associated
with the wrong `Decl`, resulting in duplicate error messages when the
type was also resolved "by" its owner `Decl` (which really *all*
resolution should be done on).
* A correct fix for this requires using a different `Sema` when
performing type resolution: we need a `Sema` owned by the type. Also
note that this fix is necessary for incremental compilation.
* This means a whole bunch of functions no longer need to take `Sema`s.
* First-order effects: `resolveTypeFields`, `resolveTypeLayout`, etc
* Second-order effects: `Type.abiAlignmentAdvanced`, `Value.orderAgainstZeroAdvanced`, etc
The end result of this is, in short, a more correct compiler and a
simpler language specification. This regressed a few error notes in the
test cases, but nothing that seems worth blocking this change.
Oh, also, I ripped out the old code in `test/src/Cases.zig` which
introduced a dependency on `Compilation`. This dependency was
problematic at best, and this code has been unused for a while. When we
re-enable incremental test cases, we must rewrite their executor to use
the compiler server protocol.
2024-07-04 05:00:32 +01:00
try tests . addCases ( b , test_cases_step , test_filters , target , . {
2024-03-05 01:26:41 +00:00
. skip_translate_c = skip_translate_c ,
. skip_run_translated_c = skip_run_translated_c ,
} , . {
2023-07-31 14:43:29 +01:00
. enable_llvm = enable_llvm ,
. llvm_has_m68k = llvm_has_m68k ,
. llvm_has_csky = llvm_has_csky ,
. llvm_has_arc = llvm_has_arc ,
. llvm_has_xtensa = llvm_has_xtensa ,
} ) ;
2023-04-14 00:44:45 +01:00
test_step . dependOn ( test_cases_step ) ;
zig build: many enhancements related to parallel building
Rework std.Build.Step to have an `owner: *Build` field. This
simplified the implementation of installation steps, as well as provided
some much-needed common API for the new parallelized build system.
--verbose is now defined very concretely: it prints to stderr just
before spawning a child process.
Child process execution is updated to conform to the new
parallel-friendly make() function semantics.
DRY up the failWithCacheError handling code. It now integrates properly
with the step graph instead of incorrectly dumping to stderr and calling
process exit.
In the main CLI, fix `zig fmt` crash when there are no errors and stdin
is used.
Deleted steps:
* EmulatableRunStep - this entire thing can be removed in favor of a
flag added to std.Build.RunStep called `skip_foreign_checks`.
* LogStep - this doesn't really fit with a multi-threaded build runner
and is effectively superseded by the new build summary output.
build runner:
* add -fsummary and -fno-summary to override the default behavior,
which is to print a summary if any of the build steps fail.
* print the dep prefix when emitting error messages for steps.
std.Build.FmtStep:
* This step now supports exclude paths as well as a check flag.
* The check flag decides between two modes, modify mode, and check
mode. These can be used to update source files in place, or to fail
the build, respectively.
Zig's own build.zig:
* The `test-fmt` step will do all the `zig fmt` checking that we expect
to be done. Since the `test` step depends on this one, we can simply
remove the explicit call to `zig fmt` in the CI.
* The new `fmt` step will actually perform `zig fmt` and update source
files in place.
std.Build.RunStep:
* expose max_stdio_size is a field (previously an unchangeable
hard-coded value).
* rework the API. Instead of configuring each stream independently,
there is a `stdio` field where you can choose between
`infer_from_args`, `inherit`, or `check`. These determine whether the
RunStep is considered to have side-effects or not. The previous
field, `condition` is gone.
* when stdio mode is set to `check` there is a slice of any number of
checks to make, which include things like exit code, stderr matching,
or stdout matching.
* remove the ill-defined `print` field.
* when adding an output arg, it takes the opportunity to give itself a
better name.
* The flag `skip_foreign_checks` is added. If this is true, a RunStep
which is configured to check the output of the executed binary will
not fail the build if the binary cannot be executed due to being for
a foreign binary to the host system which is running the build graph.
Command-line arguments such as -fqemu and -fwasmtime may affect
whether a binary is detected as foreign, as well as system
configuration such as Rosetta (macOS) and binfmt_misc (Linux).
- This makes EmulatableRunStep no longer needed.
* Fix the child process handling to properly integrate with the new
bulid API and to avoid deadlocks in stdout/stderr streams by polling
if necessary.
std.Build.RemoveDirStep now uses the open build_root directory handle
instead of an absolute path.
2023-03-02 05:56:37 +00:00
2024-08-13 23:22:58 +01:00
const test_modules_step = b . step ( " test-modules " , " Run the per-target module tests " ) ;
test_modules_step . dependOn ( tests . addModuleTests ( b , . {
2024-02-25 13:04:06 +00:00
. test_filters = test_filters ,
2024-08-13 22:59:50 +01:00
. test_target_filters = test_target_filters ,
2024-08-13 23:14:02 +01:00
. test_slow_targets = test_slow_targets ,
2023-03-06 07:27:46 +00:00
. root_src = " test/behavior.zig " ,
. name = " behavior " ,
. desc = " Run the behavior tests " ,
. optimize_modes = optimization_modes ,
2024-02-20 09:15:10 +00:00
. include_paths = & . { } ,
2023-03-06 07:27:46 +00:00
. skip_single_threaded = skip_single_threaded ,
. skip_non_native = skip_non_native ,
. skip_libc = skip_libc ,
. max_rss = 1 * 1024 * 1024 * 1024 ,
} ) ) ;
2024-08-13 23:22:58 +01:00
test_modules_step . dependOn ( tests . addModuleTests ( b , . {
2024-02-25 13:04:06 +00:00
. test_filters = test_filters ,
2024-08-13 22:59:50 +01:00
. test_target_filters = test_target_filters ,
2024-08-13 23:14:02 +01:00
. test_slow_targets = test_slow_targets ,
2024-02-20 09:15:10 +00:00
. root_src = " test/c_import.zig " ,
. name = " c-import " ,
. desc = " Run the @cImport tests " ,
. optimize_modes = optimization_modes ,
. include_paths = & . { " test/c_import " } ,
. skip_single_threaded = true ,
. skip_non_native = skip_non_native ,
. skip_libc = skip_libc ,
} ) ) ;
2024-08-13 23:22:58 +01:00
test_modules_step . dependOn ( tests . addModuleTests ( b , . {
2024-02-25 13:04:06 +00:00
. test_filters = test_filters ,
2024-08-13 22:59:50 +01:00
. test_target_filters = test_target_filters ,
2024-08-13 23:14:02 +01:00
. test_slow_targets = test_slow_targets ,
2023-03-06 07:27:46 +00:00
. root_src = " lib/compiler_rt.zig " ,
. name = " compiler-rt " ,
. desc = " Run the compiler_rt tests " ,
. optimize_modes = optimization_modes ,
2024-02-20 09:15:10 +00:00
. include_paths = & . { } ,
2023-03-06 07:27:46 +00:00
. skip_single_threaded = true ,
. skip_non_native = skip_non_native ,
. skip_libc = true ,
2024-06-02 08:10:35 +01:00
. no_builtin = true ,
2023-03-06 07:27:46 +00:00
} ) ) ;
2024-08-13 23:22:58 +01:00
test_modules_step . dependOn ( tests . addModuleTests ( b , . {
2024-02-25 13:04:06 +00:00
. test_filters = test_filters ,
2024-08-13 22:59:50 +01:00
. test_target_filters = test_target_filters ,
2024-08-13 23:14:02 +01:00
. test_slow_targets = test_slow_targets ,
2023-03-06 07:27:46 +00:00
. root_src = " lib/c.zig " ,
. name = " universal-libc " ,
. desc = " Run the universal libc tests " ,
. optimize_modes = optimization_modes ,
2024-02-20 09:15:10 +00:00
. include_paths = & . { } ,
2023-03-06 07:27:46 +00:00
. skip_single_threaded = true ,
. skip_non_native = skip_non_native ,
. skip_libc = true ,
2024-06-02 08:10:35 +01:00
. no_builtin = true ,
2023-03-06 07:27:46 +00:00
} ) ) ;
2021-04-30 22:41:28 +01:00
2024-08-13 23:22:58 +01:00
test_modules_step . dependOn ( tests . addModuleTests ( b , . {
2024-02-25 13:04:06 +00:00
. test_filters = test_filters ,
2024-08-13 22:59:50 +01:00
. test_target_filters = test_target_filters ,
2024-08-13 23:14:02 +01:00
. test_slow_targets = test_slow_targets ,
2023-03-06 07:27:46 +00:00
. root_src = " lib/std/std.zig " ,
. name = " std " ,
. desc = " Run the standard library tests " ,
. optimize_modes = optimization_modes ,
2024-02-20 09:15:10 +00:00
. include_paths = & . { } ,
2023-03-06 07:27:46 +00:00
. skip_single_threaded = skip_single_threaded ,
. skip_non_native = skip_non_native ,
. skip_libc = skip_libc ,
2023-06-23 17:12:39 +01:00
// I observed a value of 4572626944 on the M2 CI.
. max_rss = 5029889638 ,
2023-03-06 07:27:46 +00:00
} ) ) ;
2022-12-01 23:34:15 +00:00
2024-08-13 23:22:58 +01:00
test_step . dependOn ( test_modules_step ) ;
test_step . dependOn ( tests . addCompareOutputTests ( b , test_filters , optimization_modes ) ) ;
test_step . dependOn ( tests . addStandaloneTests (
b ,
optimization_modes ,
enable_macos_sdk ,
enable_ios_sdk ,
enable_symlinks_windows ,
) ) ;
test_step . dependOn ( tests . addCAbiTests ( b , skip_non_native , skip_release ) ) ;
test_step . dependOn ( tests . addLinkTests ( b , enable_macos_sdk , enable_ios_sdk , enable_symlinks_windows ) ) ;
test_step . dependOn ( tests . addStackTraceTests ( b , test_filters , optimization_modes ) ) ;
test_step . dependOn ( tests . addCliTests ( b ) ) ;
test_step . dependOn ( tests . addAssembleAndLinkTests ( b , test_filters , optimization_modes ) ) ;
2024-08-06 16:22:37 +01:00
if ( tests . addDebuggerTests ( b , . {
. test_filters = test_filters ,
. gdb = b . option ( [ ] const u8 , " gdb " , " path to gdb binary " ) ,
. lldb = b . option ( [ ] const u8 , " lldb " , " path to lldb binary " ) ,
. optimize_modes = optimization_modes ,
. skip_single_threaded = skip_single_threaded ,
. skip_non_native = skip_non_native ,
. skip_libc = skip_libc ,
} ) ) | test_debugger_step | test_step . dependOn ( test_debugger_step ) ;
2024-08-13 23:22:58 +01:00
2022-12-01 23:34:15 +00:00
try addWasiUpdateStep ( b , version ) ;
re-enable test-cases and get them all passing
Instead of using `zig test` to build a special version of the compiler
that runs all the test-cases, the zig build system is now used as much
as possible - all with the basic steps found in the standard library.
For incremental compilation tests (the ones that look like foo.0.zig,
foo.1.zig, foo.2.zig, etc.), a special version of the compiler is
compiled into a utility executable called "check-case" which checks
exactly one sequence of incremental updates in an independent
subprocess. Previously, all incremental and non-incremental test cases
were done in the same test runner process.
The compile error checking code is now simpler, but also a bit
rudimentary, and so it additionally makes sure that the actual compile
errors do not include *extra* messages, and it makes sure that the
actual compile errors output in the same order as expected. It is also
based on the "ends-with" property of each line rather than the previous
logic, which frankly I didn't want to touch with a ten-meter pole. The
compile error test cases have been updated to pass in light of these
differences.
Previously, 'error' mode with 0 compile errors was used to shoehorn in a
different kind of test-case - one that only checks if a piece of code
compiles without errors. Now there is a 'compile' mode of test-cases,
and 'error' must be only used when there are greater than 0 errors.
link test cases are updated to omit the target object format argument
when calling checkObject since that is no longer needed.
The test/stage2 directory is removed; the 2 files within are moved to be
directly in the test/ directory.
2023-03-10 01:22:51 +00:00
2024-01-08 01:41:26 +00:00
const update_mingw_step = b . step ( " update-mingw " , " Update zig's bundled mingw " ) ;
const opt_mingw_src_path = b . option ( [ ] const u8 , " mingw-src " , " path to mingw-w64 source directory " ) ;
if ( opt_mingw_src_path ) | mingw_src_path | {
2024-08-13 22:38:02 +01:00
const update_mingw_exe = b . addExecutable ( . {
. name = " update_mingw " ,
. target = b . graph . host ,
. root_source_file = b . path ( " tools/update_mingw.zig " ) ,
} ) ;
const update_mingw_run = b . addRunArtifact ( update_mingw_exe ) ;
update_mingw_run . addDirectoryArg ( b . path ( " lib " ) ) ;
2024-01-08 01:41:26 +00:00
update_mingw_run . addDirectoryArg ( . { . cwd_relative = mingw_src_path } ) ;
2024-08-13 22:38:02 +01:00
update_mingw_step . dependOn ( & update_mingw_run . step ) ;
2024-01-08 01:41:26 +00:00
} else {
2024-08-13 22:38:02 +01:00
update_mingw_step . dependOn ( & b . addFail ( " The -Dmingw-src=... option is required for this step " ) . step ) ;
2024-01-08 01:41:26 +00:00
}
2024-08-20 18:09:23 +01:00
const test_incremental_step = b . step ( " test-incremental " , " Run the incremental compilation test cases " ) ;
try tests . addIncrementalTests ( b , test_incremental_step ) ;
test_step . dependOn ( test_incremental_step ) ;
2022-12-01 23:34:15 +00:00
}
2023-01-31 07:19:51 +00:00
fn addWasiUpdateStep ( b : * std . Build , version : [ : 0 ] const u8 ) ! void {
2022-12-01 23:34:15 +00:00
const semver = try std . SemanticVersion . parse ( version ) ;
2024-05-03 04:20:41 +01:00
var target_query : std . Target . Query = . {
2022-12-01 23:34:15 +00:00
. cpu_arch = . wasm32 ,
. os_tag = . wasi ,
} ;
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
target_query . cpu_features_add . addFeature ( @intFromEnum ( std . Target . wasm . Feature . bulk_memory ) ) ;
2022-12-01 23:34:15 +00:00
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
const exe = addCompilerStep ( b , . {
. optimize = . ReleaseSmall ,
. target = b . resolveTargetQuery ( target_query ) ,
} ) ;
2022-12-01 23:34:15 +00:00
const exe_options = b . addOptions ( ) ;
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
exe . root_module . addOptions ( " build_options " , exe_options ) ;
2022-12-01 23:34:15 +00:00
exe_options . addOption ( u32 , " mem_leak_frames " , 0 ) ;
exe_options . addOption ( bool , " have_llvm " , false ) ;
exe_options . addOption ( bool , " force_gpa " , false ) ;
exe_options . addOption ( [ : 0 ] const u8 , " version " , version ) ;
exe_options . addOption ( std . SemanticVersion , " semver " , semver ) ;
2024-03-01 15:46:48 +00:00
exe_options . addOption ( bool , " enable_debug_extensions " , false ) ;
2022-12-01 23:34:15 +00:00
exe_options . addOption ( bool , " enable_logging " , false ) ;
exe_options . addOption ( bool , " enable_link_snapshots " , false ) ;
exe_options . addOption ( bool , " enable_tracy " , false ) ;
exe_options . addOption ( bool , " enable_tracy_callstack " , false ) ;
exe_options . addOption ( bool , " enable_tracy_allocation " , false ) ;
exe_options . addOption ( bool , " value_tracing " , false ) ;
2024-07-19 06:04:59 +01:00
exe_options . addOption ( DevEnv , " dev " , . bootstrap ) ;
2022-12-01 23:34:15 +00:00
2023-03-17 07:52:35 +00:00
const run_opt = b . addSystemCommand ( & . {
" wasm-opt " ,
" -Oz " ,
" --enable-bulk-memory " ,
" --enable-sign-ext " ,
} ) ;
2022-12-01 23:34:15 +00:00
run_opt . addArtifactArg ( exe ) ;
run_opt . addArg ( " -o " ) ;
2024-04-11 22:02:47 +01:00
run_opt . addFileArg ( b . path ( " stage1/zig1.wasm " ) ) ;
2022-12-01 23:34:15 +00:00
2024-07-10 05:47:26 +01:00
const copy_zig_h = b . addUpdateSourceFiles ( ) ;
2024-04-11 22:02:47 +01:00
copy_zig_h . addCopyFileToSource ( b . path ( " lib/zig.h " ) , " stage1/zig.h " ) ;
2023-02-21 01:52:26 +00:00
2022-12-09 23:33:32 +00:00
const update_zig1_step = b . step ( " update-zig1 " , " Update stage1/zig1.wasm " ) ;
update_zig1_step . dependOn ( & run_opt . step ) ;
2023-02-21 01:52:26 +00:00
update_zig1_step . dependOn ( & copy_zig_h . step ) ;
2022-12-01 23:34:15 +00:00
}
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
const AddCompilerStepOptions = struct {
2023-01-31 04:39:43 +00:00
optimize : std . builtin . OptimizeMode ,
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
target : std . Build . ResolvedTarget ,
strip : ? bool = null ,
2024-07-17 01:26:41 +01:00
valgrind : ? bool = null ,
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
sanitize_thread : ? bool = null ,
single_threaded : ? bool = null ,
} ;
fn addCompilerStep ( b : * std . Build , options : AddCompilerStepOptions ) * std . Build . Step . Compile {
2023-01-31 04:39:43 +00:00
const exe = b . addExecutable ( . {
. name = " zig " ,
2024-04-11 22:02:47 +01:00
. root_source_file = b . path ( " src/main.zig " ) ,
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
. target = options . target ,
. optimize = options . optimize ,
2024-11-05 04:03:31 +00:00
. max_rss = 7_800_000_000 ,
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
. strip = options . strip ,
. sanitize_thread = options . sanitize_thread ,
. single_threaded = options . single_threaded ,
2024-09-01 04:59:24 +01:00
. code_model = switch ( options . target . result . cpu . arch ) {
// NB:
// For loongarch, LLVM supports only small, medium and large
// code model. If we don't explicitly specify the code model,
// the default value `small' will be used.
//
// Since zig binary itself is relatively large, using a `small'
// code model will cause
//
// relocation R_LARCH_B26 out of range
//
// error when linking a loongarch64 zig binary.
//
// Here we explicitly set code model to `medium' to avoid this
// error.
. loongarch64 = > . medium ,
else = > . default ,
} ,
2023-01-31 04:39:43 +00:00
} ) ;
2024-07-17 01:26:41 +01:00
exe . root_module . valgrind = options . valgrind ;
2022-12-01 23:34:15 +00:00
exe . stack_size = stack_size ;
2023-11-15 09:30:26 +00:00
2023-11-03 05:05:13 +00:00
const aro_module = b . createModule ( . {
2024-04-11 22:02:47 +01:00
. root_source_file = b . path ( " lib/compiler/aro/aro.zig " ) ,
2024-02-28 05:06:11 +00:00
} ) ;
const aro_translate_c_module = b . createModule ( . {
2024-04-11 22:02:47 +01:00
. root_source_file = b . path ( " lib/compiler/aro_translate_c.zig " ) ,
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
. imports = & . {
2023-11-15 09:30:26 +00:00
. {
2024-02-28 05:06:11 +00:00
. name = " aro " ,
. module = aro_module ,
2023-11-15 09:30:26 +00:00
} ,
} ,
2023-09-29 11:06:49 +01:00
} ) ;
2023-11-03 05:05:13 +00:00
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
exe . root_module . addImport ( " aro " , aro_module ) ;
2024-02-28 05:06:11 +00:00
exe . root_module . addImport ( " aro_translate_c " , aro_translate_c_module ) ;
2022-12-01 23:34:15 +00:00
return exe ;
2017-04-19 06:13:15 +01:00
}
2017-12-12 04:34:59 +00:00
2021-01-03 15:48:52 +00:00
const exe_cflags = [ _ ] [ ] const u8 {
2023-01-29 19:57:24 +00:00
" -std=c++17 " ,
2021-01-03 15:48:52 +00:00
" -D__STDC_CONSTANT_MACROS " ,
" -D__STDC_FORMAT_MACROS " ,
" -D__STDC_LIMIT_MACROS " ,
" -D_GNU_SOURCE " ,
" -fno-exceptions " ,
" -fno-rtti " ,
2024-05-14 15:48:19 +01:00
" -fno-stack-protector " ,
" -fvisibility-inlines-hidden " ,
2024-04-29 05:20:57 +01:00
" -Wno-type-limits " ,
2021-01-03 15:48:52 +00:00
" -Wno-missing-braces " ,
" -Wno-comment " ,
} ;
fn addCmakeCfgOptionsToExe (
2023-01-31 07:19:51 +00:00
b : * std . Build ,
2021-01-03 15:48:52 +00:00
cfg : CMakeConfig ,
2023-05-03 09:49:55 +01:00
exe : * std . Build . Step . Compile ,
2021-09-16 21:09:32 +01:00
use_zig_libcxx : bool ,
2021-01-03 15:48:52 +00:00
) ! void {
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
if ( exe . rootModuleTarget ( ) . isDarwin ( ) ) {
2023-01-02 03:43:09 +00:00
// useful for package maintainers
exe . headerpad_max_install_names = true ;
}
2023-07-30 07:57:52 +01:00
exe . addObjectFile ( . { . cwd_relative = b . pathJoin ( & [ _ ] [ ] const u8 {
2021-01-03 15:48:52 +00:00
cfg . cmake_binary_dir ,
" zigcpp " ,
2022-12-07 08:44:15 +00:00
b . fmt ( " {s}{s}{s} " , . {
cfg . cmake_static_library_prefix ,
" zigcpp " ,
cfg . cmake_static_library_suffix ,
} ) ,
2023-07-19 09:49:34 +01:00
} ) } ) ;
2021-01-03 15:48:52 +00:00
assert ( cfg . lld_include_dir . len ! = 0 ) ;
2023-07-30 07:57:52 +01:00
exe . addIncludePath ( . { . cwd_relative = cfg . lld_include_dir } ) ;
exe . addIncludePath ( . { . cwd_relative = cfg . llvm_include_dir } ) ;
exe . addLibraryPath ( . { . cwd_relative = cfg . llvm_lib_dir } ) ;
2021-01-03 15:48:52 +00:00
addCMakeLibraryList ( exe , cfg . clang_libraries ) ;
addCMakeLibraryList ( exe , cfg . lld_libraries ) ;
addCMakeLibraryList ( exe , cfg . llvm_libraries ) ;
2021-09-16 21:09:32 +01:00
if ( use_zig_libcxx ) {
exe . linkLibCpp ( ) ;
} else {
// System -lc++ must be used because in this code path we are attempting to link
// against system-provided LLVM, Clang, LLD.
2023-01-06 05:57:08 +00:00
const need_cpp_includes = true ;
const static = cfg . llvm_linkage = = . static ;
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
const lib_suffix = if ( static ) exe . rootModuleTarget ( ) . staticLibSuffix ( ) [ 1 . . ] else exe . rootModuleTarget ( ) . dynamicLibSuffix ( ) [ 1 . . ] ;
switch ( exe . rootModuleTarget ( ) . os . tag ) {
2023-01-03 00:18:33 +00:00
. linux = > {
2023-09-01 15:04:26 +01:00
// First we try to link against the detected libcxx name. If that doesn't work, we fall
// back to -lc++ and cross our fingers.
addCxxKnownPath ( b , cfg , exe , b . fmt ( " lib{s}.{s} " , . { cfg . system_libcxx , lib_suffix } ) , " " , need_cpp_includes ) catch | err | switch ( err ) {
error . RequiredLibraryNotFound = > {
exe . linkLibCpp ( ) ;
} ,
else = > | e | return e ,
} ;
2023-01-03 00:18:33 +00:00
exe . linkSystemLibrary ( " unwind " ) ;
} ,
2024-05-09 14:04:13 +01:00
. ios , . macos , . watchos , . tvos , . visionos = > {
2023-01-12 01:05:14 +00:00
exe . linkLibCpp ( ) ;
2023-01-03 00:18:33 +00:00
} ,
2023-01-15 18:10:19 +00:00
. windows = > {
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
if ( exe . rootModuleTarget ( ) . abi ! = . msvc ) exe . linkLibCpp ( ) ;
2023-01-15 18:10:19 +00:00
} ,
2023-01-03 00:18:33 +00:00
. freebsd = > {
2023-01-06 05:57:08 +00:00
if ( static ) {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libgcc_eh.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
} else {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
}
2023-01-03 00:18:33 +00:00
} ,
. openbsd = > {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libc++abi.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
} ,
2023-01-06 05:57:08 +00:00
. netbsd , . dragonfly = > {
if ( static ) {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libstdc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libgcc_eh.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
} else {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libstdc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
}
2023-01-03 00:18:33 +00:00
} ,
2023-10-01 13:09:14 +01:00
. solaris , . illumos = > {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libstdc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libgcc_eh.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
2023-09-26 22:59:24 +01:00
} ,
2024-04-08 02:19:12 +01:00
. haiku = > {
try addCxxKnownPath ( b , cfg , exe , b . fmt ( " libstdc++.{s} " , . { lib_suffix } ) , null , need_cpp_includes ) ;
} ,
2023-01-03 00:18:33 +00:00
else = > { } ,
2021-09-16 21:09:32 +01:00
}
2021-01-03 15:48:52 +00:00
}
if ( cfg . dia_guids_lib . len ! = 0 ) {
2023-07-30 07:57:52 +01:00
exe . addObjectFile ( . { . cwd_relative = cfg . dia_guids_lib } ) ;
2021-01-03 15:48:52 +00:00
}
}
2023-05-03 09:49:55 +01:00
fn addStaticLlvmOptionsToExe ( exe : * std . Build . Step . Compile ) ! void {
2021-01-03 15:48:52 +00:00
// Adds the Zig C++ sources which both stage1 and stage2 need.
//
// We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
// in a dependency on llvm::cfg::Update<llvm::BasicBlock*>::dump() which is
// unavailable when LLVM is compiled in Release mode.
const zig_cpp_cflags = exe_cflags + + [ _ ] [ ] const u8 { " -DNDEBUG=1 " } ;
2023-10-10 19:29:26 +01:00
exe . addCSourceFiles ( . {
. files = & zig_cpp_sources ,
. flags = & zig_cpp_cflags ,
} ) ;
2021-01-03 15:48:52 +00:00
for ( clang_libs ) | lib_name | {
exe . linkSystemLibrary ( lib_name ) ;
}
for ( lld_libs ) | lib_name | {
exe . linkSystemLibrary ( lib_name ) ;
}
for ( llvm_libs ) | lib_name | {
exe . linkSystemLibrary ( lib_name ) ;
}
2021-10-02 20:58:16 +01:00
exe . linkSystemLibrary ( " z " ) ;
2022-11-13 08:42:51 +00:00
exe . linkSystemLibrary ( " zstd " ) ;
2022-11-08 07:14:39 +00:00
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
if ( exe . rootModuleTarget ( ) . os . tag ! = . windows or exe . rootModuleTarget ( ) . abi ! = . msvc ) {
2022-11-08 07:14:39 +00:00
// This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
exe . linkSystemLibrary ( " c++ " ) ;
}
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
if ( exe . rootModuleTarget ( ) . os . tag = = . windows ) {
2022-11-08 07:14:39 +00:00
exe . linkSystemLibrary ( " version " ) ;
exe . linkSystemLibrary ( " uuid " ) ;
exe . linkSystemLibrary ( " ole32 " ) ;
}
2021-01-03 15:48:52 +00:00
}
2020-12-08 00:23:17 +00:00
fn addCxxKnownPath (
2023-01-31 07:19:51 +00:00
b : * std . Build ,
2020-12-08 00:23:17 +00:00
ctx : CMakeConfig ,
2023-05-03 09:49:55 +01:00
exe : * std . Build . Step . Compile ,
2020-12-08 00:23:17 +00:00
objname : [ ] const u8 ,
errtxt : ? [ ] const u8 ,
need_cpp_includes : bool ,
) ! void {
2022-02-03 22:27:01 +00:00
if ( ! std . process . can_spawn )
return error . RequiredLibraryNotFound ;
2023-10-16 21:49:27 +01:00
2024-02-16 05:01:46 +00:00
const path_padded = run : {
var args = std . ArrayList ( [ ] const u8 ) . init ( b . allocator ) ;
try args . append ( ctx . cxx_compiler ) ;
var it = std . mem . tokenizeAny ( u8 , ctx . cxx_compiler_arg1 , & std . ascii . whitespace ) ;
while ( it . next ( ) ) | arg | try args . append ( arg ) ;
try args . append ( b . fmt ( " -print-file-name={s} " , . { objname } ) ) ;
break : run b . run ( args . items ) ;
} ;
2023-05-05 02:05:40 +01:00
var tokenizer = mem . tokenizeAny ( u8 , path_padded , " \r \n " ) ;
2022-03-27 19:05:42 +01:00
const path_unpadded = tokenizer . next ( ) . ? ;
2020-12-08 00:23:17 +00:00
if ( mem . eql ( u8 , path_unpadded , objname ) ) {
if ( errtxt ) | msg | {
2021-11-30 07:13:07 +00:00
std . debug . print ( " {s} " , . { msg } ) ;
2020-12-08 00:23:17 +00:00
} else {
2021-11-30 07:13:07 +00:00
std . debug . print ( " Unable to determine path to {s} \n " , . { objname } ) ;
2020-12-08 00:23:17 +00:00
}
return error . RequiredLibraryNotFound ;
}
2024-11-17 05:55:09 +00:00
// By default, explicit library paths are not checked for being linker scripts,
// but libc++ may very well be one, so force all inputs to be checked when passing
// an explicit path to libc++.
exe . allow_so_scripts = true ;
2023-07-30 07:57:52 +01:00
exe . addObjectFile ( . { . cwd_relative = path_unpadded } ) ;
2020-12-08 00:23:17 +00:00
// TODO a way to integrate with system c++ include files here
2022-10-27 02:17:49 +01:00
// c++ -E -Wp,-v -xc++ /dev/null
2020-12-08 00:23:17 +00:00
if ( need_cpp_includes ) {
// I used these temporarily for testing something but we obviously need a
// more general purpose solution here.
2022-10-27 02:17:49 +01:00
//exe.addIncludePath("/nix/store/2lr0fc0ak8rwj0k8n3shcyz1hz63wzma-gcc-11.3.0/include/c++/11.3.0");
//exe.addIncludePath("/nix/store/2lr0fc0ak8rwj0k8n3shcyz1hz63wzma-gcc-11.3.0/include/c++/11.3.0/x86_64-unknown-linux-gnu");
2020-12-08 00:23:17 +00:00
}
}
2023-05-03 09:49:55 +01:00
fn addCMakeLibraryList ( exe : * std . Build . Step . Compile , list : [ ] const u8 ) void {
2023-05-05 02:05:40 +01:00
var it = mem . tokenizeScalar ( u8 , list , ';' ) ;
2020-12-08 00:23:17 +00:00
while ( it . next ( ) ) | lib | {
if ( mem . startsWith ( u8 , lib , " -l " ) ) {
exe . linkSystemLibrary ( lib [ " -l " . len . . ] ) ;
zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.
The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.
* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
`std.Build.Module.addCMacro` is provided.
- remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
- use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
- use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
Along with other fields, those unspecified options will be inherited
from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
to get the host target.
2023-12-03 04:51:34 +00:00
} else if ( exe . rootModuleTarget ( ) . os . tag = = . windows and
mem . endsWith ( u8 , lib , " .lib " ) and ! fs . path . isAbsolute ( lib ) )
{
2023-01-04 07:18:51 +00:00
exe . linkSystemLibrary ( lib [ 0 . . lib . len - " .lib " . len ] ) ;
2020-12-08 00:23:17 +00:00
} else {
2023-07-30 07:57:52 +01:00
exe . addObjectFile ( . { . cwd_relative = lib } ) ;
2020-12-08 00:23:17 +00:00
}
}
}
const CMakeConfig = struct {
2024-02-19 04:34:32 +00:00
llvm_linkage : std . builtin . LinkMode ,
2020-12-08 00:23:17 +00:00
cmake_binary_dir : [ ] const u8 ,
cmake_prefix_path : [ ] const u8 ,
2022-12-07 08:44:15 +00:00
cmake_static_library_prefix : [ ] const u8 ,
cmake_static_library_suffix : [ ] const u8 ,
2020-12-08 00:23:17 +00:00
cxx_compiler : [ ] const u8 ,
2023-10-16 21:49:27 +01:00
cxx_compiler_arg1 : [ ] const u8 ,
2020-12-08 00:23:17 +00:00
lld_include_dir : [ ] const u8 ,
lld_libraries : [ ] const u8 ,
clang_libraries : [ ] const u8 ,
2022-10-12 23:11:46 +01:00
llvm_lib_dir : [ ] const u8 ,
llvm_include_dir : [ ] const u8 ,
2020-12-08 00:23:17 +00:00
llvm_libraries : [ ] const u8 ,
dia_guids_lib : [ ] const u8 ,
2023-09-01 15:04:26 +01:00
system_libcxx : [ ] const u8 ,
2020-12-08 00:23:17 +00:00
} ;
const max_config_h_bytes = 1 * 1024 * 1024 ;
2023-01-31 07:19:51 +00:00
fn findConfigH ( b : * std . Build , config_h_path_option : ? [ ] const u8 ) ? [ ] const u8 {
2022-07-16 01:25:38 +01:00
if ( config_h_path_option ) | path | {
var config_h_or_err = fs . cwd ( ) . openFile ( path , . { } ) ;
if ( config_h_or_err ) | * file | {
file . close ( ) ;
return path ;
} else | _ | {
std . log . err ( " Could not open provided config.h: \" {s} \" " , . { path } ) ;
2024-03-19 05:39:59 +00:00
std . process . exit ( 1 ) ;
2022-07-16 01:25:38 +01:00
}
}
2024-02-01 22:44:44 +00:00
var check_dir = fs . path . dirname ( b . graph . zig_exe ) . ? ;
2022-07-16 01:25:38 +01:00
while ( true ) {
var dir = fs . cwd ( ) . openDir ( check_dir , . { } ) catch unreachable ;
defer dir . close ( ) ;
// Check if config.h is present in dir
var config_h_or_err = dir . openFile ( " config.h " , . { } ) ;
if ( config_h_or_err ) | * file | {
file . close ( ) ;
return fs . path . join (
b . allocator ,
& [ _ ] [ ] const u8 { check_dir , " config.h " } ,
) catch unreachable ;
} else | e | switch ( e ) {
error . FileNotFound = > { } ,
else = > unreachable ,
}
// Check if we reached the source root by looking for .git, and bail if so
var git_dir_or_err = dir . openDir ( " .git " , . { } ) ;
if ( git_dir_or_err ) | * git_dir | {
git_dir . close ( ) ;
return null ;
} else | _ | { }
// Otherwise, continue search in the parent directory
const new_check_dir = fs . path . dirname ( check_dir ) ;
if ( new_check_dir = = null or mem . eql ( u8 , new_check_dir . ? , check_dir ) ) {
return null ;
}
check_dir = new_check_dir . ? ;
2023-11-26 09:18:13 +00:00
}
2022-07-16 01:25:38 +01:00
}
2020-12-08 00:23:17 +00:00
2023-01-31 07:19:51 +00:00
fn parseConfigH ( b : * std . Build , config_h_text : [ ] const u8 ) ? CMakeConfig {
2020-12-08 00:23:17 +00:00
var ctx : CMakeConfig = . {
2022-07-23 17:02:51 +01:00
. llvm_linkage = undefined ,
2020-12-08 00:23:17 +00:00
. cmake_binary_dir = undefined ,
. cmake_prefix_path = undefined ,
2022-12-07 08:44:15 +00:00
. cmake_static_library_prefix = undefined ,
. cmake_static_library_suffix = undefined ,
2020-12-08 00:23:17 +00:00
. cxx_compiler = undefined ,
2023-10-16 21:49:27 +01:00
. cxx_compiler_arg1 = " " ,
2020-12-08 00:23:17 +00:00
. lld_include_dir = undefined ,
. lld_libraries = undefined ,
. clang_libraries = undefined ,
2022-10-12 23:11:46 +01:00
. llvm_lib_dir = undefined ,
. llvm_include_dir = undefined ,
2020-12-08 00:23:17 +00:00
. llvm_libraries = undefined ,
. dia_guids_lib = undefined ,
2023-09-01 15:04:26 +01:00
. system_libcxx = undefined ,
2020-12-08 00:23:17 +00:00
} ;
const mappings = [ _ ] struct { prefix : [ ] const u8 , field : [ ] const u8 } {
. {
. prefix = " #define ZIG_CMAKE_BINARY_DIR " ,
. field = " cmake_binary_dir " ,
} ,
. {
. prefix = " #define ZIG_CMAKE_PREFIX_PATH " ,
. field = " cmake_prefix_path " ,
} ,
2022-12-07 08:44:15 +00:00
. {
. prefix = " #define ZIG_CMAKE_STATIC_LIBRARY_PREFIX " ,
. field = " cmake_static_library_prefix " ,
} ,
. {
. prefix = " #define ZIG_CMAKE_STATIC_LIBRARY_SUFFIX " ,
. field = " cmake_static_library_suffix " ,
} ,
2020-12-08 00:23:17 +00:00
. {
. prefix = " #define ZIG_CXX_COMPILER " ,
. field = " cxx_compiler " ,
} ,
2023-10-16 21:49:27 +01:00
. {
. prefix = " #define ZIG_CXX_COMPILER_ARG1 " ,
. field = " cxx_compiler_arg1 " ,
} ,
2020-12-08 00:23:17 +00:00
. {
. prefix = " #define ZIG_LLD_INCLUDE_PATH " ,
. field = " lld_include_dir " ,
} ,
. {
. prefix = " #define ZIG_LLD_LIBRARIES " ,
. field = " lld_libraries " ,
} ,
. {
. prefix = " #define ZIG_CLANG_LIBRARIES " ,
. field = " clang_libraries " ,
} ,
. {
. prefix = " #define ZIG_LLVM_LIBRARIES " ,
. field = " llvm_libraries " ,
} ,
. {
. prefix = " #define ZIG_DIA_GUIDS_LIB " ,
. field = " dia_guids_lib " ,
} ,
2022-10-12 23:11:46 +01:00
. {
. prefix = " #define ZIG_LLVM_INCLUDE_PATH " ,
. field = " llvm_include_dir " ,
} ,
. {
. prefix = " #define ZIG_LLVM_LIB_PATH " ,
. field = " llvm_lib_dir " ,
} ,
2023-09-01 15:04:26 +01:00
. {
. prefix = " #define ZIG_SYSTEM_LIBCXX " ,
. field = " system_libcxx " ,
} ,
2022-07-23 17:02:51 +01:00
// .prefix = ZIG_LLVM_LINK_MODE parsed manually below
2020-12-08 00:23:17 +00:00
} ;
2023-05-05 02:05:40 +01:00
var lines_it = mem . tokenizeAny ( u8 , config_h_text , " \r \n " ) ;
2020-12-08 00:23:17 +00:00
while ( lines_it . next ( ) ) | line | {
inline for ( mappings ) | mapping | {
if ( mem . startsWith ( u8 , line , mapping . prefix ) ) {
2023-05-05 02:15:50 +01:00
var it = mem . splitScalar ( u8 , line , '"' ) ;
2022-07-25 20:04:30 +01:00
_ = it . first ( ) ; // skip the stuff before the quote
2020-12-08 00:23:17 +00:00
const quoted = it . next ( ) . ? ; // the stuff inside the quote
2023-10-16 21:49:27 +01:00
const trimmed = mem . trim ( u8 , quoted , " " ) ;
@field ( ctx , mapping . field ) = toNativePathSep ( b , trimmed ) ;
2020-12-08 00:23:17 +00:00
}
}
2022-07-23 17:02:51 +01:00
if ( mem . startsWith ( u8 , line , " #define ZIG_LLVM_LINK_MODE " ) ) {
2023-05-05 02:15:50 +01:00
var it = mem . splitScalar ( u8 , line , '"' ) ;
2022-07-23 17:02:51 +01:00
_ = it . next ( ) . ? ; // skip the stuff before the quote
const quoted = it . next ( ) . ? ; // the stuff inside the quote
ctx . llvm_linkage = if ( mem . eql ( u8 , quoted , " shared " ) ) . dynamic else . static ;
}
2020-12-08 00:23:17 +00:00
}
return ctx ;
}
2023-01-31 07:19:51 +00:00
fn toNativePathSep ( b : * std . Build , s : [ ] const u8 ) [ ] u8 {
2021-11-30 07:13:07 +00:00
const duplicated = b . allocator . dupe ( u8 , s ) catch unreachable ;
2020-12-08 00:23:17 +00:00
for ( duplicated ) | * byte | switch ( byte . * ) {
'/' = > byte . * = fs . path . sep ,
else = > { } ,
} ;
return duplicated ;
}
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
const zig_cpp_sources = [ _ ] [ ] const u8 {
// These are planned to stay even when we are self-hosted.
" src/zig_llvm.cpp " ,
" src/zig_clang.cpp " ,
2021-06-06 01:33:16 +01:00
" src/zig_llvm-ar.cpp " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" src/zig_clang_driver.cpp " ,
" src/zig_clang_cc1_main.cpp " ,
" src/zig_clang_cc1as_main.cpp " ,
2018-07-11 01:18:43 +01:00
} ;
2020-04-04 16:57:28 +01:00
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
const clang_libs = [ _ ] [ ] const u8 {
" clangFrontendTool " ,
" clangCodeGen " ,
" clangFrontend " ,
" clangDriver " ,
" clangSerialization " ,
" clangSema " ,
" clangStaticAnalyzerFrontend " ,
" clangStaticAnalyzerCheckers " ,
" clangStaticAnalyzerCore " ,
" clangAnalysis " ,
" clangASTMatchers " ,
" clangAST " ,
" clangParse " ,
" clangSema " ,
2024-04-26 07:04:36 +01:00
" clangAPINotes " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" clangBasic " ,
" clangEdit " ,
" clangLex " ,
" clangARCMigrate " ,
" clangRewriteFrontend " ,
" clangRewrite " ,
" clangCrossTU " ,
" clangIndex " ,
" clangToolingCore " ,
2022-08-03 01:14:19 +01:00
" clangExtractAPI " ,
" clangSupport " ,
2024-09-05 17:07:10 +01:00
" clangInstallAPI " ,
" clangAST " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
} ;
const lld_libs = [ _ ] [ ] const u8 {
" lldMinGW " ,
" lldELF " ,
" lldCOFF " ,
" lldWasm " ,
2022-07-04 02:41:43 +01:00
" lldMachO " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" lldCommon " ,
} ;
// This list can be re-generated with `llvm-config --libfiles` and then
// reformatting using your favorite text editor. Note we do not execute
2021-04-15 18:58:53 +01:00
// `llvm-config` here because we are cross compiling. Also omit LLVMTableGen
// from these libs.
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
const llvm_libs = [ _ ] [ ] const u8 {
" LLVMWindowsManifest " ,
2021-04-15 18:43:39 +01:00
" LLVMXRay " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMLibDriver " ,
" LLVMDlltoolDriver " ,
2024-04-25 22:12:55 +01:00
" LLVMTextAPIBinaryReader " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMCoverage " ,
2021-04-15 18:43:39 +01:00
" LLVMLineEditor " ,
2024-09-05 17:07:10 +01:00
" LLVMSandboxIR " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMXCoreDisassembler " ,
" LLVMXCoreCodeGen " ,
" LLVMXCoreDesc " ,
" LLVMXCoreInfo " ,
2022-07-04 02:41:43 +01:00
" LLVMX86TargetMCA " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMX86Disassembler " ,
" LLVMX86AsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMX86CodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMX86Desc " ,
" LLVMX86Info " ,
" LLVMWebAssemblyDisassembler " ,
2021-04-15 18:43:39 +01:00
" LLVMWebAssemblyAsmParser " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMWebAssemblyCodeGen " ,
2021-10-02 20:40:07 +01:00
" LLVMWebAssemblyUtils " ,
2023-08-12 06:33:20 +01:00
" LLVMWebAssemblyDesc " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMWebAssemblyInfo " ,
2022-07-04 02:41:43 +01:00
" LLVMVEDisassembler " ,
" LLVMVEAsmParser " ,
" LLVMVECodeGen " ,
" LLVMVEDesc " ,
" LLVMVEInfo " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMSystemZDisassembler " ,
" LLVMSystemZAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMSystemZCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMSystemZDesc " ,
" LLVMSystemZInfo " ,
" LLVMSparcDisassembler " ,
" LLVMSparcAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMSparcCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMSparcDesc " ,
" LLVMSparcInfo " ,
2023-01-29 20:12:13 +00:00
" LLVMRISCVTargetMCA " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMRISCVDisassembler " ,
" LLVMRISCVAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMRISCVCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMRISCVDesc " ,
" LLVMRISCVInfo " ,
" LLVMPowerPCDisassembler " ,
" LLVMPowerPCAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMPowerPCCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMPowerPCDesc " ,
" LLVMPowerPCInfo " ,
" LLVMNVPTXCodeGen " ,
" LLVMNVPTXDesc " ,
" LLVMNVPTXInfo " ,
" LLVMMSP430Disassembler " ,
" LLVMMSP430AsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMMSP430CodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMMSP430Desc " ,
" LLVMMSP430Info " ,
" LLVMMipsDisassembler " ,
" LLVMMipsAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMMipsCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMMipsDesc " ,
" LLVMMipsInfo " ,
2023-01-29 20:12:13 +00:00
" LLVMLoongArchDisassembler " ,
" LLVMLoongArchAsmParser " ,
" LLVMLoongArchCodeGen " ,
" LLVMLoongArchDesc " ,
" LLVMLoongArchInfo " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMLanaiDisassembler " ,
" LLVMLanaiCodeGen " ,
" LLVMLanaiAsmParser " ,
" LLVMLanaiDesc " ,
" LLVMLanaiInfo " ,
" LLVMHexagonDisassembler " ,
" LLVMHexagonCodeGen " ,
" LLVMHexagonAsmParser " ,
" LLVMHexagonDesc " ,
" LLVMHexagonInfo " ,
" LLVMBPFDisassembler " ,
" LLVMBPFAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMBPFCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMBPFDesc " ,
" LLVMBPFInfo " ,
" LLVMAVRDisassembler " ,
" LLVMAVRAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMAVRCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMAVRDesc " ,
" LLVMAVRInfo " ,
" LLVMARMDisassembler " ,
" LLVMARMAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMARMCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMARMDesc " ,
" LLVMARMUtils " ,
" LLVMARMInfo " ,
2022-07-04 02:41:43 +01:00
" LLVMAMDGPUTargetMCA " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMAMDGPUDisassembler " ,
" LLVMAMDGPUAsmParser " ,
2021-04-15 18:43:39 +01:00
" LLVMAMDGPUCodeGen " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMAMDGPUDesc " ,
" LLVMAMDGPUUtils " ,
" LLVMAMDGPUInfo " ,
" LLVMAArch64Disassembler " ,
2021-04-15 18:43:39 +01:00
" LLVMAArch64AsmParser " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMAArch64CodeGen " ,
2021-04-15 18:43:39 +01:00
" LLVMAArch64Desc " ,
" LLVMAArch64Utils " ,
" LLVMAArch64Info " ,
2024-04-25 22:12:55 +01:00
" LLVMOrcDebugging " ,
2021-04-15 18:43:39 +01:00
" LLVMOrcJIT " ,
2023-01-29 20:12:13 +00:00
" LLVMWindowsDriver " ,
2021-04-15 18:43:39 +01:00
" LLVMMCJIT " ,
" LLVMJITLink " ,
" LLVMInterpreter " ,
" LLVMExecutionEngine " ,
" LLVMRuntimeDyld " ,
2021-10-02 20:40:07 +01:00
" LLVMOrcTargetProcess " ,
" LLVMOrcShared " ,
" LLVMDWP " ,
2023-01-29 20:12:13 +00:00
" LLVMDebugInfoLogicalView " ,
2021-04-15 18:43:39 +01:00
" LLVMDebugInfoGSYM " ,
" LLVMOption " ,
" LLVMObjectYAML " ,
2022-08-03 00:57:32 +01:00
" LLVMObjCopy " ,
2021-04-15 18:43:39 +01:00
" LLVMMCA " ,
" LLVMMCDisassembler " ,
" LLVMLTO " ,
" LLVMPasses " ,
2024-04-25 22:12:55 +01:00
" LLVMHipStdPar " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMCFGuard " ,
2021-04-15 18:43:39 +01:00
" LLVMCoroutines " ,
" LLVMipo " ,
" LLVMVectorize " ,
" LLVMLinker " ,
" LLVMInstrumentation " ,
" LLVMFrontendOpenMP " ,
2024-04-25 22:12:55 +01:00
" LLVMFrontendOffloading " ,
2021-04-15 18:43:39 +01:00
" LLVMFrontendOpenACC " ,
2023-01-29 20:12:13 +00:00
" LLVMFrontendHLSL " ,
2024-04-25 22:12:55 +01:00
" LLVMFrontendDriver " ,
2021-04-15 18:43:39 +01:00
" LLVMExtensions " ,
2023-01-29 20:12:13 +00:00
" LLVMDWARFLinkerParallel " ,
2024-04-25 22:12:55 +01:00
" LLVMDWARFLinkerClassic " ,
2021-04-15 18:43:39 +01:00
" LLVMDWARFLinker " ,
2024-09-05 17:07:10 +01:00
" LLVMCodeGenData " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMGlobalISel " ,
2021-04-15 18:43:39 +01:00
" LLVMMIRParser " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMAsmPrinter " ,
2021-04-15 18:43:39 +01:00
" LLVMSelectionDAG " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMCodeGen " ,
2023-08-12 06:33:20 +01:00
" LLVMTarget " ,
2023-01-29 20:12:13 +00:00
" LLVMObjCARCOpts " ,
2023-08-12 06:33:20 +01:00
" LLVMCodeGenTypes " ,
2023-01-29 20:12:13 +00:00
" LLVMIRPrinter " ,
2021-04-15 18:43:39 +01:00
" LLVMInterfaceStub " ,
" LLVMFileCheck " ,
" LLVMFuzzMutate " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMScalarOpts " ,
" LLVMInstCombine " ,
" LLVMAggressiveInstCombine " ,
" LLVMTransformUtils " ,
" LLVMBitWriter " ,
" LLVMAnalysis " ,
" LLVMProfileData " ,
2022-08-03 00:57:32 +01:00
" LLVMSymbolize " ,
2023-08-12 06:33:20 +01:00
" LLVMDebugInfoBTF " ,
2022-08-03 00:57:32 +01:00
" LLVMDebugInfoPDB " ,
" LLVMDebugInfoMSF " ,
2022-07-04 02:41:43 +01:00
" LLVMDebugInfoDWARF " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMObject " ,
" LLVMTextAPI " ,
" LLVMMCParser " ,
2023-01-29 20:12:13 +00:00
" LLVMIRReader " ,
" LLVMAsmParser " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMMC " ,
" LLVMDebugInfoCodeView " ,
2021-04-15 18:43:39 +01:00
" LLVMBitReader " ,
2022-08-03 00:57:32 +01:00
" LLVMFuzzerCLI " ,
2021-04-15 18:43:39 +01:00
" LLVMCore " ,
" LLVMRemarks " ,
" LLVMBitstreamReader " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMBinaryFormat " ,
2023-01-29 20:12:13 +00:00
" LLVMTargetParser " ,
ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:
* The cmake path. Requirements: cmake, system C++ compiler, system
LLVM, LLD, Clang libraries, compiled by the system C++ compiler.
* The zig path. Requirements: a zig installation, system LLVM, LLD,
Clang libraries, compiled by the zig installation.
Note that the former can be used to now take the latter path.
Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.
cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.
`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.
build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.
Zig build system addBuildOption supports a couple new types.
The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-05 04:33:29 +00:00
" LLVMSupport " ,
" LLVMDemangle " ,
} ;
2024-04-25 01:41:47 +01:00
fn generateLangRef ( b : * std . Build ) std . Build . LazyPath {
const doctest_exe = b . addExecutable ( . {
. name = " doctest " ,
. root_source_file = b . path ( " tools/doctest.zig " ) ,
2024-06-13 13:00:22 +01:00
. target = b . graph . host ,
2024-04-25 01:41:47 +01:00
. optimize = . Debug ,
} ) ;
var dir = b . build_root . handle . openDir ( " doc/langref " , . { . iterate = true } ) catch | err | {
2024-07-12 00:26:04 +01:00
std . debug . panic ( " unable to open '{}doc/langref' directory: {s} " , . {
b . build_root , @errorName ( err ) ,
} ) ;
2024-04-25 01:41:47 +01:00
} ;
defer dir . close ( ) ;
var wf = b . addWriteFiles ( ) ;
var it = dir . iterateAssumeFirstIteration ( ) ;
while ( it . next ( ) catch @panic ( " failed to read dir " ) ) | entry | {
if ( std . mem . startsWith ( u8 , entry . name , " . " ) or entry . kind ! = . file )
continue ;
const out_basename = b . fmt ( " {s}.out " , . { std . fs . path . stem ( entry . name ) } ) ;
const cmd = b . addRunArtifact ( doctest_exe ) ;
cmd . addArgs ( & . {
" --zig " , b . graph . zig_exe ,
// TODO: enhance doctest to use "--listen=-" rather than operating
// in a temporary directory
" --cache-root " , b . cache_root . path orelse " . " ,
} ) ;
2024-07-12 00:26:04 +01:00
cmd . addArgs ( & . { " --zig-lib-dir " , b . fmt ( " {} " , . { b . graph . zig_lib_directory } ) } ) ;
2024-04-25 01:41:47 +01:00
cmd . addArgs ( & . { " -i " } ) ;
cmd . addFileArg ( b . path ( b . fmt ( " doc/langref/{s} " , . { entry . name } ) ) ) ;
cmd . addArgs ( & . { " -o " } ) ;
_ = wf . addCopyFile ( cmd . addOutputFileArg ( out_basename ) , out_basename ) ;
}
const docgen_exe = b . addExecutable ( . {
. name = " docgen " ,
. root_source_file = b . path ( " tools/docgen.zig " ) ,
2024-06-13 13:00:22 +01:00
. target = b . graph . host ,
2024-04-25 01:41:47 +01:00
. optimize = . Debug ,
} ) ;
const docgen_cmd = b . addRunArtifact ( docgen_exe ) ;
docgen_cmd . addArgs ( & . { " --code-dir " } ) ;
docgen_cmd . addDirectoryArg ( wf . getDirectory ( ) ) ;
docgen_cmd . addFileArg ( b . path ( " doc/langref.html.in " ) ) ;
return docgen_cmd . addOutputFileArg ( " langref.html " ) ;
}
2024-06-17 04:03:14 +01:00
2024-10-12 05:27:30 +01:00
fn superHtmlCheck ( b : * std . Build , html_file : std . Build . LazyPath ) * std . Build . Step {
const run_superhtml = b . addSystemCommand ( & . {
" superhtml " , " check " ,
2024-06-17 04:03:14 +01:00
} ) ;
2024-10-12 05:27:30 +01:00
run_superhtml . addFileArg ( html_file ) ;
run_superhtml . expectExitCode ( 0 ) ;
return & run_superhtml . step ;
2024-06-17 04:03:14 +01:00
}