| author | |
| committer | |
| log | e69973beddcd8a42dbc7ebcfb96187e5a6f61b61 |
| tree | 61d3360ed907d41f641be96f560d8f0a1fb713fd |
| parent | 9cca6728e58351bb34cc7f4880481350a279fede |
| parent | 532cfb65e018c216972cb50a82c7a0379934c8cc |
| signature |
cmake: build stage3 by default29 files changed, 487 insertions(+), 572 deletions(-)
CMakeLists.txt+76-66| ... | @@ -12,7 +12,7 @@ if(NOT CMAKE_BUILD_TYPE) | ... | @@ -12,7 +12,7 @@ if(NOT CMAKE_BUILD_TYPE) |
| 12 | endif() | 12 | endif() |
| 13 | 13 | ||
| 14 | if(NOT CMAKE_INSTALL_PREFIX) | 14 | if(NOT CMAKE_INSTALL_PREFIX) |
| 15 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/stage2" CACHE STRING | 15 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/stage3" CACHE STRING |
| 16 | "Directory to install zig to" FORCE) | 16 | "Directory to install zig to" FORCE) |
| 17 | endif() | 17 | endif() |
| 18 | 18 | ||
| ... | @@ -65,6 +65,9 @@ if("${ZIG_VERSION}" STREQUAL "") | ... | @@ -65,6 +65,9 @@ if("${ZIG_VERSION}" STREQUAL "") |
| 65 | endif() | 65 | endif() |
| 66 | message(STATUS "Configuring zig version ${ZIG_VERSION}") | 66 | message(STATUS "Configuring zig version ${ZIG_VERSION}") |
| 67 | 67 | ||
| 68 | set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL | ||
| 69 | "Disable copying lib/ files to install prefix during the build phase") | ||
| 70 | |||
| 68 | set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)") | 71 | set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)") |
| 69 | set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries") | 72 | set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries") |
| 70 | set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries") | 73 | set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries") |
| ... | @@ -333,7 +336,7 @@ set(ZIG_CONFIG_H_OUT "${CMAKE_BINARY_DIR}/config.h") | ... | @@ -333,7 +336,7 @@ set(ZIG_CONFIG_H_OUT "${CMAKE_BINARY_DIR}/config.h") |
| 333 | set(ZIG_CONFIG_ZIG_OUT "${CMAKE_BINARY_DIR}/config.zig") | 336 | set(ZIG_CONFIG_ZIG_OUT "${CMAKE_BINARY_DIR}/config.zig") |
| 334 | 337 | ||
| 335 | # This is our shim which will be replaced by stage1.zig. | 338 | # This is our shim which will be replaced by stage1.zig. |
| 336 | set(ZIG0_SOURCES | 339 | set(ZIG1_SOURCES |
| 337 | "${CMAKE_SOURCE_DIR}/src/stage1/zig0.cpp" | 340 | "${CMAKE_SOURCE_DIR}/src/stage1/zig0.cpp" |
| 338 | ) | 341 | ) |
| 339 | 342 | ||
| ... | @@ -373,9 +376,9 @@ set(ZIG_CPP_SOURCES | ... | @@ -373,9 +376,9 @@ set(ZIG_CPP_SOURCES |
| 373 | # https://github.com/ziglang/zig/issues/6363 | 376 | # https://github.com/ziglang/zig/issues/6363 |
| 374 | "${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp" | 377 | "${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp" |
| 375 | ) | 378 | ) |
| 376 | # Needed because we use cmake, not the zig build system, to build zig1.o. | 379 | # Needed because we use cmake, not the zig build system, to build zig2.o. |
| 377 | # This list is generated by building zig and then clearing the zig-cache directory, | 380 | # This list is generated by building zig and then clearing the zig-cache directory, |
| 378 | # then manually running the build-obj command (see BUILD_ZIG1_ARGS), and then looking | 381 | # then manually running the build-obj command (see BUILD_ZIG2_ARGS), and then looking |
| 379 | # in the zig-cache directory for the compiler-generated list of zig file dependencies. | 382 | # in the zig-cache directory for the compiler-generated list of zig file dependencies. |
| 380 | set(ZIG_STAGE2_SOURCES | 383 | set(ZIG_STAGE2_SOURCES |
| 381 | "${ZIG_CONFIG_ZIG_OUT}" | 384 | "${ZIG_CONFIG_ZIG_OUT}" |
| ... | @@ -942,40 +945,51 @@ if(MSVC OR MINGW) | ... | @@ -942,40 +945,51 @@ if(MSVC OR MINGW) |
| 942 | endif() | 945 | endif() |
| 943 | 946 | ||
| 944 | if("${ZIG_EXECUTABLE}" STREQUAL "") | 947 | if("${ZIG_EXECUTABLE}" STREQUAL "") |
| 945 | add_executable(zig0 ${ZIG0_SOURCES}) | 948 | add_executable(zig1 ${ZIG1_SOURCES}) |
| 946 | set_target_properties(zig0 PROPERTIES | 949 | set_target_properties(zig1 PROPERTIES |
| 947 | COMPILE_FLAGS ${EXE_CFLAGS} | 950 | COMPILE_FLAGS ${EXE_CFLAGS} |
| 948 | LINK_FLAGS ${EXE_LDFLAGS} | 951 | LINK_FLAGS ${EXE_LDFLAGS} |
| 949 | ) | 952 | ) |
| 950 | target_link_libraries(zig0 zigstage1) | 953 | target_link_libraries(zig1 zigstage1) |
| 951 | endif() | 954 | endif() |
| 952 | 955 | ||
| 953 | if(MSVC) | 956 | if(MSVC) |
| 954 | set(ZIG1_OBJECT "${CMAKE_BINARY_DIR}/zig1.obj") | 957 | set(ZIG2_OBJECT "${CMAKE_BINARY_DIR}/zig2.obj") |
| 955 | else() | 958 | else() |
| 956 | set(ZIG1_OBJECT "${CMAKE_BINARY_DIR}/zig1.o") | 959 | set(ZIG2_OBJECT "${CMAKE_BINARY_DIR}/zig2.o") |
| 957 | endif() | 960 | endif() |
| 958 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | 961 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
| 959 | set(ZIG1_RELEASE_ARG "") | 962 | set(ZIG_RELEASE_ARG "") |
| 963 | elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") | ||
| 964 | set(ZIG_RELEASE_ARG -Drelease) | ||
| 960 | else() | 965 | else() |
| 961 | set(ZIG1_RELEASE_ARG -OReleaseFast --strip) | 966 | set(ZIG_RELEASE_ARG -Drelease -Dstrip) |
| 967 | endif() | ||
| 968 | if(ZIG_SKIP_INSTALL_LIB_FILES) | ||
| 969 | set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files") | ||
| 970 | else() | ||
| 971 | set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files=false") | ||
| 962 | endif() | 972 | endif() |
| 963 | if(ZIG_SINGLE_THREADED) | 973 | if(ZIG_SINGLE_THREADED) |
| 964 | set(ZIG1_SINGLE_THREADED_ARG "-fsingle-threaded") | 974 | set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded") |
| 975 | else() | ||
| 976 | set(ZIG_SINGLE_THREADED_ARG "") | ||
| 977 | endif() | ||
| 978 | if(ZIG_STATIC) | ||
| 979 | set(ZIG_STATIC_ARG "-Duse-zig-libcxx") | ||
| 965 | else() | 980 | else() |
| 966 | set(ZIG1_SINGLE_THREADED_ARG "") | 981 | set(ZIG_STATIC_ARG "") |
| 967 | endif() | 982 | endif() |
| 968 | 983 | ||
| 969 | set(BUILD_ZIG1_ARGS | 984 | set(BUILD_ZIG2_ARGS |
| 970 | "src/stage1.zig" | 985 | "src/stage1.zig" |
| 971 | -target "${ZIG_TARGET_TRIPLE}" | 986 | --name zig2 |
| 972 | "-mcpu=${ZIG_TARGET_MCPU}" | ||
| 973 | --name zig1 | ||
| 974 | --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib" | 987 | --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib" |
| 975 | "-femit-bin=${ZIG1_OBJECT}" | 988 | "-femit-bin=${ZIG2_OBJECT}" |
| 976 | -fcompiler-rt | 989 | -fcompiler-rt |
| 977 | "${ZIG1_RELEASE_ARG}" | 990 | ${ZIG_SINGLE_THREADED_ARG} |
| 978 | "${ZIG1_SINGLE_THREADED_ARG}" | 991 | -target "${ZIG_TARGET_TRIPLE}" |
| 992 | -mcpu "${ZIG_TARGET_MCPU}" | ||
| 979 | -lc | 993 | -lc |
| 980 | --pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}" | 994 | --pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}" |
| 981 | --pkg-end | 995 | --pkg-end |
| ... | @@ -985,68 +999,64 @@ set(BUILD_ZIG1_ARGS | ... | @@ -985,68 +999,64 @@ set(BUILD_ZIG1_ARGS |
| 985 | 999 | ||
| 986 | if("${ZIG_EXECUTABLE}" STREQUAL "") | 1000 | if("${ZIG_EXECUTABLE}" STREQUAL "") |
| 987 | add_custom_command( | 1001 | add_custom_command( |
| 988 | OUTPUT "${ZIG1_OBJECT}" | 1002 | OUTPUT "${ZIG2_OBJECT}" |
| 989 | COMMAND zig0 ${BUILD_ZIG1_ARGS} | 1003 | COMMAND zig1 ${BUILD_ZIG2_ARGS} |
| 990 | DEPENDS zig0 "${ZIG_STAGE2_SOURCES}" | 1004 | DEPENDS zig1 "${ZIG_STAGE2_SOURCES}" |
| 991 | COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}" | 1005 | COMMENT STATUS "Building stage2 object ${ZIG2_OBJECT}" |
| 992 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | 1006 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" |
| 993 | ) | 1007 | ) |
| 994 | set(ZIG_EXECUTABLE "${zig_BINARY_DIR}/zig") | ||
| 995 | if (WIN32) | 1008 | if (WIN32) |
| 996 | set(ZIG_EXECUTABLE "${ZIG_EXECUTABLE}.exe") | 1009 | set(ZIG_EXECUTABLE "${zig2_BINARY_DIR}/zig2.exe") |
| 1010 | else() | ||
| 1011 | set(ZIG_EXECUTABLE "${zig2_BINARY_DIR}/zig2") | ||
| 997 | endif() | 1012 | endif() |
| 998 | else() | 1013 | else() |
| 999 | add_custom_command( | 1014 | add_custom_command( |
| 1000 | OUTPUT "${ZIG1_OBJECT}" | 1015 | OUTPUT "${ZIG2_OBJECT}" |
| 1001 | COMMAND "${ZIG_EXECUTABLE}" "build-obj" ${BUILD_ZIG1_ARGS} | 1016 | COMMAND "${ZIG_EXECUTABLE}" "build-obj" ${BUILD_ZIG2_ARGS} |
| 1002 | DEPENDS ${ZIG_STAGE2_SOURCES} | 1017 | DEPENDS ${ZIG_STAGE2_SOURCES} |
| 1003 | COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}" | 1018 | COMMENT STATUS "Building stage2 component ${ZIG2_OBJECT}" |
| 1004 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | 1019 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" |
| 1005 | ) | 1020 | ) |
| 1006 | endif() | 1021 | endif() |
| 1007 | 1022 | ||
| 1008 | # cmake won't let us configure an executable without C sources. | 1023 | # cmake won't let us configure an executable without C sources. |
| 1009 | add_executable(zig "${CMAKE_SOURCE_DIR}/src/stage1/empty.cpp" "${ZIG1_OBJECT}") | 1024 | add_executable(zig2 "${CMAKE_SOURCE_DIR}/src/stage1/empty.cpp" "${ZIG2_OBJECT}") |
| 1010 | 1025 | ||
| 1011 | set_target_properties(zig PROPERTIES | 1026 | set_target_properties(zig2 PROPERTIES |
| 1012 | COMPILE_FLAGS ${EXE_CFLAGS} | 1027 | COMPILE_FLAGS ${EXE_CFLAGS} |
| 1013 | LINK_FLAGS ${EXE_LDFLAGS} | 1028 | LINK_FLAGS ${EXE_LDFLAGS} |
| 1014 | ) | 1029 | ) |
| 1015 | target_link_libraries(zig zigstage1) | 1030 | target_link_libraries(zig2 zigstage1) |
| 1016 | if(MSVC) | 1031 | if(MSVC) |
| 1017 | target_link_libraries(zig ntdll.lib) | 1032 | target_link_libraries(zig2 ntdll.lib) |
| 1018 | elseif(MINGW) | 1033 | elseif(MINGW) |
| 1019 | target_link_libraries(zig ntdll) | 1034 | target_link_libraries(zig2 ntdll) |
| 1020 | endif() | 1035 | endif() |
| 1021 | 1036 | ||
| 1022 | install(TARGETS zig DESTINATION bin) | 1037 | # Dummy install command so that the "install" target is not missing. |
| 1023 | 1038 | # This is redundant from the "stage3" custom target below. | |
| 1024 | set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL | ||
| 1025 | "Disable copying lib/ files to install prefix during the build phase") | ||
| 1026 | |||
| 1027 | if(NOT ZIG_SKIP_INSTALL_LIB_FILES) | 1039 | if(NOT ZIG_SKIP_INSTALL_LIB_FILES) |
| 1028 | set(ZIG_INSTALL_ARGS "build" | 1040 | install(FILES "lib/compiler_rt.zig" DESTINATION "lib/zig") |
| 1029 | --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib" | ||
| 1030 | "-Dlib-files-only" | ||
| 1031 | --prefix "${CMAKE_INSTALL_PREFIX}" | ||
| 1032 | "-Dconfig_h=${ZIG_CONFIG_H_OUT}" | ||
| 1033 | install | ||
| 1034 | ) | ||
| 1035 | |||
| 1036 | # CODE has no effect with Visual Studio build system generator, therefore | ||
| 1037 | # when using Visual Studio build system generator we resort to running | ||
| 1038 | # `zig build install` during the build phase. | ||
| 1039 | if(MSVC) | ||
| 1040 | add_custom_target(zig_install_lib_files ALL | ||
| 1041 | COMMAND zig ${ZIG_INSTALL_ARGS} | ||
| 1042 | DEPENDS zig | ||
| 1043 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | ||
| 1044 | ) | ||
| 1045 | else() | ||
| 1046 | get_target_property(zig_BINARY_DIR zig BINARY_DIR) | ||
| 1047 | install(CODE "set(zig_EXE \"${ZIG_EXECUTABLE}\")") | ||
| 1048 | install(CODE "set(ZIG_INSTALL_ARGS \"${ZIG_INSTALL_ARGS}\")") | ||
| 1049 | install(CODE "set(CMAKE_SOURCE_DIR \"${CMAKE_SOURCE_DIR}\")") | ||
| 1050 | install(SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake) | ||
| 1051 | endif() | ||
| 1052 | endif() | 1041 | endif() |
| 1042 | |||
| 1043 | set(ZIG_INSTALL_ARGS "build" | ||
| 1044 | --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib" | ||
| 1045 | --prefix "${CMAKE_INSTALL_PREFIX}" | ||
| 1046 | "-Dconfig_h=${ZIG_CONFIG_H_OUT}" | ||
| 1047 | "-Denable-llvm" | ||
| 1048 | "-Denable-stage1" | ||
| 1049 | ${ZIG_RELEASE_ARG} | ||
| 1050 | ${ZIG_STATIC_ARG} | ||
| 1051 | ${ZIG_SKIP_INSTALL_LIB_FILES_ARG} | ||
| 1052 | ${ZIG_SINGLE_THREADED_ARG} | ||
| 1053 | "-Dtarget=${ZIG_TARGET_TRIPLE}" | ||
| 1054 | "-Dcpu=${ZIG_TARGET_MCPU}" | ||
| 1055 | ) | ||
| 1056 | |||
| 1057 | add_custom_target(stage3 ALL | ||
| 1058 | COMMAND zig2 ${ZIG_INSTALL_ARGS} | ||
| 1059 | DEPENDS zig2 | ||
| 1060 | COMMENT STATUS "Building stage3" | ||
| 1061 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | ||
| 1062 | ) |
ci/azure/macos_arm64_script deleted-132| ... | @@ -1,132 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | brew update && brew install ncurses s3cmd | ||
| 7 | |||
| 8 | ZIGDIR="$(pwd)" | ||
| 9 | |||
| 10 | HOST_ARCH="x86_64" | ||
| 11 | HOST_TARGET="$HOST_ARCH-macos-none" | ||
| 12 | HOST_MCPU="baseline" | ||
| 13 | HOST_CACHE_BASENAME="zig+llvm+lld+clang-$HOST_TARGET-0.10.0-dev.2931+bdf3fa12f" | ||
| 14 | HOST_PREFIX="$HOME/$HOST_CACHE_BASENAME" | ||
| 15 | |||
| 16 | ARCH="aarch64" | ||
| 17 | TARGET="$ARCH-macos-none" | ||
| 18 | MCPU="apple_a14" | ||
| 19 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.2931+bdf3fa12f" | ||
| 20 | PREFIX="$HOME/$CACHE_BASENAME" | ||
| 21 | |||
| 22 | JOBS="-j2" | ||
| 23 | |||
| 24 | rm -rf $HOST_PREFIX $PREFIX | ||
| 25 | cd $HOME | ||
| 26 | |||
| 27 | wget -nv "https://ziglang.org/deps/$HOST_CACHE_BASENAME.tar.xz" | ||
| 28 | wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" | ||
| 29 | tar xf "$HOST_CACHE_BASENAME.tar.xz" | ||
| 30 | tar xf "$CACHE_BASENAME.tar.xz" | ||
| 31 | |||
| 32 | cd $ZIGDIR | ||
| 33 | |||
| 34 | # Make the `zig version` number consistent. | ||
| 35 | # This will affect the cmake command below. | ||
| 36 | git config core.abbrev 9 | ||
| 37 | git fetch --unshallow || true | ||
| 38 | git fetch --tags | ||
| 39 | |||
| 40 | # Build host zig compiler in debug so that we can get the | ||
| 41 | # current version when packaging | ||
| 42 | |||
| 43 | ZIG="$HOST_PREFIX/bin/zig" | ||
| 44 | |||
| 45 | export CC="$ZIG cc -target $HOST_TARGET -mcpu=$HOST_MCPU" | ||
| 46 | export CXX="$ZIG c++ -target $HOST_TARGET -mcpu=$HOST_MCPU" | ||
| 47 | |||
| 48 | mkdir build.host | ||
| 49 | cd build.host | ||
| 50 | cmake .. \ | ||
| 51 | -DCMAKE_INSTALL_PREFIX="$(pwd)/release" \ | ||
| 52 | -DCMAKE_PREFIX_PATH="$HOST_PREFIX" \ | ||
| 53 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 54 | -DZIG_TARGET_TRIPLE="$HOST_TARGET" \ | ||
| 55 | -DZIG_TARGET_MCPU="$HOST_MCPU" \ | ||
| 56 | -DZIG_STATIC=ON \ | ||
| 57 | -DZIG_OMIT_STAGE2=ON | ||
| 58 | |||
| 59 | unset CC | ||
| 60 | unset CXX | ||
| 61 | |||
| 62 | make $JOBS install | ||
| 63 | |||
| 64 | # Build zig compiler cross-compiled for arm64 | ||
| 65 | cd $ZIGDIR | ||
| 66 | |||
| 67 | ZIG="$ZIGDIR/build.host/release/bin/zig" | ||
| 68 | |||
| 69 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 70 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 71 | |||
| 72 | mkdir build | ||
| 73 | cd build | ||
| 74 | cmake .. \ | ||
| 75 | -DCMAKE_INSTALL_PREFIX="$(pwd)/release" \ | ||
| 76 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | ||
| 77 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 78 | -DZIG_TARGET_TRIPLE="$TARGET" \ | ||
| 79 | -DZIG_TARGET_MCPU="$MCPU" \ | ||
| 80 | -DZIG_EXECUTABLE="$ZIG" \ | ||
| 81 | -DZIG_STATIC=ON | ||
| 82 | |||
| 83 | unset CC | ||
| 84 | unset CXX | ||
| 85 | |||
| 86 | make $JOBS install | ||
| 87 | |||
| 88 | if [ "${BUILD_REASON}" != "PullRequest" ]; then | ||
| 89 | mv ../LICENSE release/ | ||
| 90 | |||
| 91 | # We do not run test suite but still need langref. | ||
| 92 | mkdir -p release/docs | ||
| 93 | $ZIG run ../doc/docgen.zig -- $ZIG ../doc/langref.html.in release/docs/langref.html | ||
| 94 | |||
| 95 | # Produce the experimental std lib documentation. | ||
| 96 | mkdir -p release/docs/std | ||
| 97 | $ZIG test ../lib/std/std.zig \ | ||
| 98 | --zig-lib-dir ../lib \ | ||
| 99 | -femit-docs=release/docs/std \ | ||
| 100 | -fno-emit-bin | ||
| 101 | |||
| 102 | mv release/bin/zig release/ | ||
| 103 | rmdir release/bin | ||
| 104 | |||
| 105 | VERSION=$(../build.host/release/bin/zig version) | ||
| 106 | DIRNAME="zig-macos-$ARCH-$VERSION" | ||
| 107 | TARBALL="$DIRNAME.tar.xz" | ||
| 108 | mv release "$DIRNAME" | ||
| 109 | tar cfJ "$TARBALL" "$DIRNAME" | ||
| 110 | |||
| 111 | mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg" | ||
| 112 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 113 | |||
| 114 | SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1) | ||
| 115 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 116 | |||
| 117 | JSONFILE="macos-$GITBRANCH.json" | ||
| 118 | touch $JSONFILE | ||
| 119 | echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | ||
| 120 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | ||
| 121 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | ||
| 122 | |||
| 123 | s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE" | ||
| 124 | s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-macos-$VERSION.json" | ||
| 125 | |||
| 126 | # `set -x` causes these variables to be mangled. | ||
| 127 | # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html | ||
| 128 | set +x | ||
| 129 | echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" | ||
| 130 | echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" | ||
| 131 | echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" | ||
| 132 | fi | ||
ci/azure/macos_script+1-9| ... | @@ -34,6 +34,7 @@ git fetch --tags | ... | @@ -34,6 +34,7 @@ git fetch --tags |
| 34 | mkdir build | 34 | mkdir build |
| 35 | cd build | 35 | cd build |
| 36 | cmake .. \ | 36 | cmake .. \ |
| 37 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | ||
| 37 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | 38 | -DCMAKE_PREFIX_PATH="$PREFIX" \ |
| 38 | -DCMAKE_BUILD_TYPE=Release \ | 39 | -DCMAKE_BUILD_TYPE=Release \ |
| 39 | -DZIG_TARGET_TRIPLE="$TARGET" \ | 40 | -DZIG_TARGET_TRIPLE="$TARGET" \ |
| ... | @@ -47,15 +48,6 @@ unset CXX | ... | @@ -47,15 +48,6 @@ unset CXX |
| 47 | 48 | ||
| 48 | make $JOBS install | 49 | make $JOBS install |
| 49 | 50 | ||
| 50 | stage2/bin/zig build \ | ||
| 51 | --prefix stage3-release \ | ||
| 52 | --search-prefix "$PREFIX" \ | ||
| 53 | -Dstatic-llvm \ | ||
| 54 | -Drelease \ | ||
| 55 | -Dstrip \ | ||
| 56 | -Dtarget="$TARGET" \ | ||
| 57 | -Denable-stage1 | ||
| 58 | |||
| 59 | stage3-release/bin/zig build test docs \ | 51 | stage3-release/bin/zig build test docs \ |
| 60 | -Denable-macos-sdk \ | 52 | -Denable-macos-sdk \ |
| 61 | -Dstatic-llvm \ | 53 | -Dstatic-llvm \ |
ci/azure/pipelines.yml-12| ... | @@ -10,17 +10,6 @@ jobs: | ... | @@ -10,17 +10,6 @@ jobs: |
| 10 | - script: ci/azure/macos_script | 10 | - script: ci/azure/macos_script |
| 11 | name: main | 11 | name: main |
| 12 | displayName: 'Build and test' | 12 | displayName: 'Build and test' |
| 13 | - job: BuildMacOS_arm64 | ||
| 14 | pool: | ||
| 15 | vmImage: 'macOS-11' | ||
| 16 | timeoutInMinutes: 180 | ||
| 17 | steps: | ||
| 18 | - task: DownloadSecureFile@1 | ||
| 19 | inputs: | ||
| 20 | secureFile: s3cfg | ||
| 21 | - script: ci/azure/macos_arm64_script | ||
| 22 | name: main | ||
| 23 | displayName: 'Build' | ||
| 24 | - job: BuildWindows | 13 | - job: BuildWindows |
| 25 | timeoutInMinutes: 360 | 14 | timeoutInMinutes: 360 |
| 26 | pool: | 15 | pool: |
| ... | @@ -155,7 +144,6 @@ jobs: | ... | @@ -155,7 +144,6 @@ jobs: |
| 155 | - job: OnMasterSuccess | 144 | - job: OnMasterSuccess |
| 156 | dependsOn: | 145 | dependsOn: |
| 157 | - BuildMacOS | 146 | - BuildMacOS |
| 158 | - BuildMacOS_arm64 | ||
| 159 | - BuildWindows | 147 | - BuildWindows |
| 160 | condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | 148 | condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) |
| 161 | strategy: | 149 | strategy: |
ci/drone/linux_script_base deleted-22| ... | @@ -1,22 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # https://docs.drone.io/pipeline/docker/syntax/workspace/ | ||
| 4 | # | ||
| 5 | # Drone automatically creates a temporary volume, known as your workspace, | ||
| 6 | # where it clones your repository. The workspace is the current working | ||
| 7 | # directory for each step in your pipeline. | ||
| 8 | # | ||
| 9 | # Because the workspace is a volume, filesystem changes are persisted between | ||
| 10 | # pipeline steps. In other words, individual steps can communicate and share | ||
| 11 | # state using the filesystem. | ||
| 12 | # | ||
| 13 | # Workspace volumes are ephemeral. They are created when the pipeline starts | ||
| 14 | # and destroyed after the pipeline completes. | ||
| 15 | |||
| 16 | set -x | ||
| 17 | set -e | ||
| 18 | |||
| 19 | TRIPLEARCH="$(uname -m)" | ||
| 20 | DISTDIR="$DRONE_WORKSPACE/dist" | ||
| 21 | |||
| 22 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
ci/drone/linux_script_build+10-19| ... | @@ -1,17 +1,16 @@ | ... | @@ -1,17 +1,16 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | # Probe CPU/brand details. | 6 | ARCH="$(uname -m)" |
| 6 | # TODO: `lscpu` is changing package names in EDGE to `util-linux-misc` | 7 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 7 | apk update | 8 | |
| 8 | apk add util-linux | 9 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" |
| 9 | echo "lscpu:" | ||
| 10 | lscpu | sed 's,^, : ,' | ||
| 11 | 10 | ||
| 12 | PREFIX="/deps/local" | 11 | PREFIX="/deps/local" |
| 13 | ZIG="$PREFIX/bin/zig" | 12 | ZIG="$PREFIX/bin/zig" |
| 14 | TARGET="$TRIPLEARCH-linux-musl" | 13 | TARGET="$ARCH-linux-musl" |
| 15 | MCPU="baseline" | 14 | MCPU="baseline" |
| 16 | 15 | ||
| 17 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | 16 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" |
| ... | @@ -30,8 +29,8 @@ cat <<'ENDFILE' >$PREFIX/bin/ranlib | ... | @@ -30,8 +29,8 @@ cat <<'ENDFILE' >$PREFIX/bin/ranlib |
| 30 | /deps/local/bin/zig ranlib $@ | 29 | /deps/local/bin/zig ranlib $@ |
| 31 | ENDFILE | 30 | ENDFILE |
| 32 | 31 | ||
| 33 | chmod +x $PREFIX/bin/ar | 32 | chmod +x "$PREFIX/bin/ar" |
| 34 | chmod +x $PREFIX/bin/ranlib | 33 | chmod +x "$PREFIX/bin/ranlib" |
| 35 | 34 | ||
| 36 | # Make the `zig version` number consistent. | 35 | # Make the `zig version` number consistent. |
| 37 | # This will affect the cmake command below. | 36 | # This will affect the cmake command below. |
| ... | @@ -43,6 +42,7 @@ mkdir build | ... | @@ -43,6 +42,7 @@ mkdir build |
| 43 | cd build | 42 | cd build |
| 44 | cmake .. \ | 43 | cmake .. \ |
| 45 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | 44 | -DCMAKE_PREFIX_PATH="$PREFIX" \ |
| 45 | -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \ | ||
| 46 | -DCMAKE_BUILD_TYPE=Release \ | 46 | -DCMAKE_BUILD_TYPE=Release \ |
| 47 | -DCMAKE_AR="$PREFIX/bin/ar" \ | 47 | -DCMAKE_AR="$PREFIX/bin/ar" \ |
| 48 | -DCMAKE_RANLIB="$PREFIX/bin/ranlib" \ | 48 | -DCMAKE_RANLIB="$PREFIX/bin/ranlib" \ |
| ... | @@ -56,12 +56,3 @@ cmake .. \ | ... | @@ -56,12 +56,3 @@ cmake .. \ |
| 56 | unset CC | 56 | unset CC |
| 57 | unset CXX | 57 | unset CXX |
| 58 | samu install | 58 | samu install |
| 59 | |||
| 60 | stage2/bin/zig build \ | ||
| 61 | --prefix "$DISTDIR" \ | ||
| 62 | --search-prefix "$PREFIX" \ | ||
| 63 | -Dstatic-llvm \ | ||
| 64 | -Drelease \ | ||
| 65 | -Dstrip \ | ||
| 66 | -Dtarget="$TARGET" \ | ||
| 67 | -Denable-stage1 |
ci/drone/linux_script_finalize+15-9| ... | @@ -1,6 +1,12 @@ | ... | @@ -1,6 +1,12 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 5 | |||
| 6 | ARCH="$(uname -m)" | ||
| 7 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" | ||
| 8 | |||
| 9 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
| 4 | 10 | ||
| 5 | if [ -n "$DRONE_PULL_REQUEST" ]; then | 11 | if [ -n "$DRONE_PULL_REQUEST" ]; then |
| 6 | exit 0 | 12 | exit 0 |
| ... | @@ -12,16 +18,16 @@ pip3 install s3cmd | ... | @@ -12,16 +18,16 @@ pip3 install s3cmd |
| 12 | 18 | ||
| 13 | cd build | 19 | cd build |
| 14 | 20 | ||
| 15 | mv ../LICENSE "$DISTDIR/" | 21 | mv ../LICENSE "$INSTALL_PREFIX/" |
| 16 | mv ../zig-cache/langref.html "$DISTDIR/" | 22 | mv ../zig-cache/langref.html "$INSTALL_PREFIX/" |
| 17 | mv "$DISTDIR/bin/zig" "$DISTDIR/" | 23 | mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/" |
| 18 | rmdir "$DISTDIR/bin" | 24 | rmdir "$INSTALL_PREFIX/bin" |
| 19 | 25 | ||
| 20 | GITBRANCH="$DRONE_BRANCH" | 26 | GITBRANCH="$DRONE_BRANCH" |
| 21 | VERSION="$("$DISTDIR/zig" version)" | 27 | VERSION="$("$INSTALL_PREFIX/zig" version)" |
| 22 | DIRNAME="zig-linux-$TRIPLEARCH-$VERSION" | 28 | DIRNAME="zig-linux-$ARCH-$VERSION" |
| 23 | TARBALL="$DIRNAME.tar.xz" | 29 | TARBALL="$DIRNAME.tar.xz" |
| 24 | mv "$DISTDIR" "$DIRNAME" | 30 | mv "$INSTALL_PREFIX" "$DIRNAME" |
| 25 | tar cfJ "$TARBALL" "$DIRNAME" | 31 | tar cfJ "$TARBALL" "$DIRNAME" |
| 26 | 32 | ||
| 27 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | 33 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ |
| ... | @@ -35,7 +41,7 @@ echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | ... | @@ -35,7 +41,7 @@ echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE |
| 35 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | 41 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE |
| 36 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | 42 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE |
| 37 | 43 | ||
| 38 | s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json" | 44 | s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json" |
| 39 | if [ "$GITBRANCH" = "master" ]; then | 45 | if [ "$GITBRANCH" = "master" ]; then |
| 40 | # avoid leaking oauth token | 46 | # avoid leaking oauth token |
| 41 | set +x | 47 | set +x |
ci/drone/test_linux_behavior+10-5| ... | @@ -1,8 +1,13 @@ | ... | @@ -1,8 +1,13 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ./build/zig build test-behavior -Dskip-non-native | 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 6 | ./build/zig build test-compiler-rt -Dskip-non-native | 7 | ZIG="$INSTALL_PREFIX/bin/zig" |
| 7 | ./build/zig build test-fmt | 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" |
| 8 | ./build/zig build docs | 9 | |
| 10 | $ZIG build test-behavior -Dskip-non-native | ||
| 11 | $ZIG build test-compiler-rt -Dskip-non-native | ||
| 12 | $ZIG build test-fmt | ||
| 13 | $ZIG build docs |
ci/drone/test_linux_cases+8-3| ... | @@ -1,6 +1,11 @@ | ... | @@ -1,6 +1,11 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ./build/zig build -Dskip-non-native # test building self-hosted without LLVM | 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 6 | ./build/zig build -Dskip-non-native test-cases | 7 | ZIG="$INSTALL_PREFIX/bin/zig" |
| 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
| 9 | |||
| 10 | $ZIG build -Dskip-non-native # test building self-hosted without LLVM | ||
| 11 | $ZIG build -Dskip-non-native test-cases |
ci/drone/test_linux_misc+13-8| ... | @@ -1,11 +1,16 @@ | ... | @@ -1,11 +1,16 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ./build/zig build test-universal-libc -Dskip-non-native | 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 6 | ./build/zig build test-compare-output -Dskip-non-native | 7 | ZIG="$INSTALL_PREFIX/bin/zig" |
| 7 | ./build/zig build test-standalone -Dskip-non-native -Dskip-release-safe | 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" |
| 8 | ./build/zig build test-stack-traces -Dskip-non-native | 9 | |
| 9 | ./build/zig build test-cli -Dskip-non-native | 10 | $ZIG build test-universal-libc -Dskip-non-native |
| 10 | ./build/zig build test-asm-link -Dskip-non-native | 11 | $ZIG build test-compare-output -Dskip-non-native |
| 11 | ./build/zig build test-translate-c -Dskip-non-native | 12 | $ZIG build test-standalone -Dskip-non-native -Dskip-release-safe |
| 13 | $ZIG build test-stack-traces -Dskip-non-native | ||
| 14 | $ZIG build test-cli -Dskip-non-native | ||
| 15 | $ZIG build test-asm-link -Dskip-non-native | ||
| 16 | $ZIG build test-translate-c -Dskip-non-native |
ci/drone/test_linux_std_Debug+7-2| ... | @@ -1,5 +1,10 @@ | ... | @@ -1,5 +1,10 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ./build/zig build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native | 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 7 | ZIG="$INSTALL_PREFIX/bin/zig" | ||
| 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
| 9 | |||
| 10 | $ZIG build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native |
ci/drone/test_linux_std_ReleaseFast+7-2| ... | @@ -1,5 +1,10 @@ | ... | @@ -1,5 +1,10 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded | 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 7 | ZIG="$INSTALL_PREFIX/bin/zig" | ||
| 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
| 9 | |||
| 10 | $ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded |
ci/drone/test_linux_std_ReleaseSafe+7-2| ... | @@ -1,5 +1,10 @@ | ... | @@ -1,5 +1,10 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ./build/zig build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded | 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" |
| 7 | ZIG="$INSTALL_PREFIX/bin/zig" | ||
| 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
| 9 | |||
| 10 | $ZIG build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded |
ci/drone/test_linux_std_ReleaseSmall+9-4| ... | @@ -1,11 +1,16 @@ | ... | @@ -1,11 +1,16 @@ |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | . ./ci/drone/linux_script_base | 3 | set -x |
| 4 | set -e | ||
| 5 | |||
| 6 | INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release" | ||
| 7 | ZIG="$INSTALL_PREFIX/bin/zig" | ||
| 8 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
| 4 | 9 | ||
| 5 | # Empirically, this takes about 55 minutes on the CI, and is the bottleneck | 10 | # Empirically, this takes about 55 minutes on the CI, and is the bottleneck |
| 6 | # causing timeouts. So this is disabled in favor of running a smaller set | 11 | # causing timeouts. So this is disabled in favor of running a smaller set |
| 7 | # of ReleaseSmall std lib tests. | 12 | # of ReleaseSmall std lib tests. |
| 8 | # ./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native | 13 | # $ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native |
| 9 | 14 | ||
| 10 | ./build/zig test lib/std/std.zig -OReleaseSmall | 15 | $ZIG test lib/std/std.zig -OReleaseSmall |
| 11 | ./build/zig test lib/std/std.zig -OReleaseSmall -lc | 16 | $ZIG test lib/std/std.zig -OReleaseSmall -lc |
ci/srht/freebsd_script+17-17| ... | @@ -31,6 +31,8 @@ export TERM=dumb | ... | @@ -31,6 +31,8 @@ export TERM=dumb |
| 31 | 31 | ||
| 32 | mkdir build | 32 | mkdir build |
| 33 | cd build | 33 | cd build |
| 34 | |||
| 35 | |||
| 34 | cmake .. \ | 36 | cmake .. \ |
| 35 | -DCMAKE_BUILD_TYPE=Release \ | 37 | -DCMAKE_BUILD_TYPE=Release \ |
| 36 | -DCMAKE_PREFIX_PATH=$PREFIX \ | 38 | -DCMAKE_PREFIX_PATH=$PREFIX \ |
| ... | @@ -38,40 +40,38 @@ cmake .. \ | ... | @@ -38,40 +40,38 @@ cmake .. \ |
| 38 | -DZIG_TARGET_MCPU="$MCPU" \ | 40 | -DZIG_TARGET_MCPU="$MCPU" \ |
| 39 | -DZIG_STATIC=ON \ | 41 | -DZIG_STATIC=ON \ |
| 40 | -GNinja | 42 | -GNinja |
| 41 | samu install | ||
| 42 | 43 | ||
| 43 | # TODO: eliminate this workaround. Without this, zig does not end up passing | 44 | # TODO: eliminate this workaround. Without this, zig does not end up passing |
| 44 | # -isystem /usr/include when building libc++, resulting in #include <sys/endian.h> | 45 | # -isystem /usr/include when building libc++, resulting in #include <sys/endian.h> |
| 45 | # "file not found" errors. | 46 | # "file not found" errors. |
| 46 | stage2/bin/zig libc >libc.txt | 47 | echo "include_dir=/usr/include" >>libc.txt |
| 48 | echo "sys_include_dir=/usr/include" >>libc.txt | ||
| 49 | echo "crt_dir=/usr/lib" >>libc.txt | ||
| 50 | echo "msvc_lib_dir=" >>libc.txt | ||
| 51 | echo "kernel32_lib_dir=" >>libc.txt | ||
| 52 | echo "gcc_dir=" >>libc.txt | ||
| 53 | ZIG_LIBC_TXT="$(pwd)/libc.txt" | ||
| 47 | 54 | ||
| 48 | ZIG_LIBC=libc.txt stage2/bin/zig build \ | 55 | ZIG_LIBC="$ZIG_LIBC_TXT" samu install |
| 49 | --prefix stage3-release \ | ||
| 50 | --search-prefix "$PREFIX" \ | ||
| 51 | -Dstatic-llvm \ | ||
| 52 | -Drelease \ | ||
| 53 | -Dstrip \ | ||
| 54 | -Dtarget="$TARGET" \ | ||
| 55 | -Denable-stage1 | ||
| 56 | 56 | ||
| 57 | # Here we skip some tests to save time. | 57 | # Here we skip some tests to save time. |
| 58 | stage3-release/bin/zig build test docs \ | 58 | stage3/bin/zig build test docs \ |
| 59 | -Dstatic-llvm \ | 59 | -Dstatic-llvm \ |
| 60 | --search-prefix "$PREFIX" \ | 60 | --search-prefix "$PREFIX" \ |
| 61 | -Dskip-stage1 \ | 61 | -Dskip-stage1 \ |
| 62 | -Dskip-non-native | 62 | -Dskip-non-native |
| 63 | 63 | ||
| 64 | if [ -f ~/.s3cfg ]; then | 64 | if [ -f ~/.s3cfg ]; then |
| 65 | mv ../LICENSE stage3-release/ | 65 | mv ../LICENSE stage3/ |
| 66 | mv ../zig-cache/langref.html stage3-release/ | 66 | mv ../zig-cache/langref.html stage3/ |
| 67 | mv stage3-release/bin/zig stage3-release/ | 67 | mv stage3/bin/zig stage3/ |
| 68 | rmdir stage3-release/bin | 68 | rmdir stage3/bin |
| 69 | 69 | ||
| 70 | GITBRANCH=$(basename $GITHUB_REF) | 70 | GITBRANCH=$(basename $GITHUB_REF) |
| 71 | VERSION=$(stage3-release/zig version) | 71 | VERSION=$(stage3/zig version) |
| 72 | DIRNAME="zig-freebsd-x86_64-$VERSION" | 72 | DIRNAME="zig-freebsd-x86_64-$VERSION" |
| 73 | TARBALL="$DIRNAME.tar.xz" | 73 | TARBALL="$DIRNAME.tar.xz" |
| 74 | mv stage3-release "$DIRNAME" | 74 | mv stage3 "$DIRNAME" |
| 75 | tar cfJ "$TARBALL" "$DIRNAME" | 75 | tar cfJ "$TARBALL" "$DIRNAME" |
| 76 | 76 | ||
| 77 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | 77 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ |
ci/zinc/build_aarch64_macos created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging" | ||
| 7 | TARGET="aarch64-macos-none" | ||
| 8 | MCPU="apple_a14" | ||
| 9 | INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET" | ||
| 10 | SEARCH_PREFIX="/deps/$TARGET" | ||
| 11 | |||
| 12 | "$RELEASE_STAGING/bin/zig" build \ | ||
| 13 | --prefix "$INSTALL_PREFIX" \ | ||
| 14 | --search-prefix "$SEARCH_PREFIX" \ | ||
| 15 | -Dstatic-llvm \ | ||
| 16 | -Drelease \ | ||
| 17 | -Dstrip \ | ||
| 18 | -Dtarget="$TARGET" \ | ||
| 19 | -Dmcpu="$MCPU" \ | ||
| 20 | -Denable-stage1 | ||
ci/zinc/configure_git created+10| ... | @@ -0,0 +1,10 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | # Make the `zig version` number consistent. | ||
| 7 | # This will affect the cmake commands that follow. | ||
| 8 | # This is in its own script because git does not support this command | ||
| 9 | # being run concurrently with itself. | ||
| 10 | git config core.abbrev 9 | ||
ci/zinc/drone.yml+50-7| ... | @@ -9,17 +9,33 @@ workspace: | ... | @@ -9,17 +9,33 @@ workspace: |
| 9 | path: /workspace | 9 | path: /workspace |
| 10 | 10 | ||
| 11 | steps: | 11 | steps: |
| 12 | - name: configure_git | ||
| 13 | image: ci/debian-amd64:11.1-9 | ||
| 14 | commands: | ||
| 15 | - ./ci/zinc/configure_git | ||
| 16 | |||
| 12 | - name: test_stage3_debug | 17 | - name: test_stage3_debug |
| 13 | image: ci/debian-amd64:11.1-8 | 18 | depends_on: |
| 19 | - configure_git | ||
| 20 | image: ci/debian-amd64:11.1-9 | ||
| 14 | commands: | 21 | commands: |
| 15 | - ./ci/zinc/linux_test_stage3_debug.sh | 22 | - ./ci/zinc/linux_test_stage3_debug |
| 16 | 23 | ||
| 17 | - name: test_stage3_release | 24 | - name: test_stage3_release |
| 18 | image: ci/debian-amd64:11.1-8 | 25 | depends_on: |
| 26 | - configure_git | ||
| 27 | image: ci/debian-amd64:11.1-9 | ||
| 19 | commands: | 28 | commands: |
| 20 | - ./ci/zinc/linux_test_stage3_release.sh | 29 | - ./ci/zinc/linux_test_stage3_release |
| 21 | 30 | ||
| 22 | - name: package | 31 | - name: build_aarch64_macos |
| 32 | depends_on: | ||
| 33 | - test_stage3_release | ||
| 34 | image: ci/debian-amd64:11.1-9 | ||
| 35 | commands: | ||
| 36 | - ./ci/zinc/build_aarch64_macos | ||
| 37 | |||
| 38 | - name: linux_package | ||
| 23 | depends_on: | 39 | depends_on: |
| 24 | - test_stage3_debug | 40 | - test_stage3_debug |
| 25 | - test_stage3_release | 41 | - test_stage3_release |
| ... | @@ -28,13 +44,40 @@ steps: | ... | @@ -28,13 +44,40 @@ steps: |
| 28 | - master | 44 | - master |
| 29 | event: | 45 | event: |
| 30 | - push | 46 | - push |
| 31 | image: ci/debian-amd64:11.1-8 | 47 | image: ci/debian-amd64:11.1-9 |
| 48 | environment: | ||
| 49 | AWS_ACCESS_KEY_ID: | ||
| 50 | from_secret: AWS_ACCESS_KEY_ID | ||
| 51 | AWS_SECRET_ACCESS_KEY: | ||
| 52 | from_secret: AWS_SECRET_ACCESS_KEY | ||
| 53 | commands: | ||
| 54 | - ./ci/zinc/linux_package | ||
| 55 | |||
| 56 | - name: macos_package | ||
| 57 | depends_on: | ||
| 58 | - test_stage3_debug | ||
| 59 | - build_aarch64_macos | ||
| 60 | when: | ||
| 61 | branch: | ||
| 62 | - master | ||
| 63 | event: | ||
| 64 | - push | ||
| 65 | image: ci/debian-amd64:11.1-9 | ||
| 32 | environment: | 66 | environment: |
| 33 | AWS_ACCESS_KEY_ID: | 67 | AWS_ACCESS_KEY_ID: |
| 34 | from_secret: AWS_ACCESS_KEY_ID | 68 | from_secret: AWS_ACCESS_KEY_ID |
| 35 | AWS_SECRET_ACCESS_KEY: | 69 | AWS_SECRET_ACCESS_KEY: |
| 36 | from_secret: AWS_SECRET_ACCESS_KEY | 70 | from_secret: AWS_SECRET_ACCESS_KEY |
| 71 | commands: | ||
| 72 | - ./ci/zinc/macos_package | ||
| 73 | |||
| 74 | - name: notify_lavahut | ||
| 75 | depends_on: | ||
| 76 | - macos_package | ||
| 77 | - linux_package | ||
| 78 | image: ci/debian-amd64:11.1-9 | ||
| 79 | environment: | ||
| 37 | SRHT_OAUTH_TOKEN: | 80 | SRHT_OAUTH_TOKEN: |
| 38 | from_secret: SRHT_OAUTH_TOKEN | 81 | from_secret: SRHT_OAUTH_TOKEN |
| 39 | commands: | 82 | commands: |
| 40 | - ./ci/zinc/linux_package.sh | 83 | - ./ci/zinc/notify_lavahut |
ci/zinc/linux_base.sh deleted-31| ... | @@ -1,31 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # https://docs.drone.io/pipeline/docker/syntax/workspace/ | ||
| 4 | # | ||
| 5 | # Drone automatically creates a temporary volume, known as your workspace, | ||
| 6 | # where it clones your repository. The workspace is the current working | ||
| 7 | # directory for each step in your pipeline. | ||
| 8 | # | ||
| 9 | # Because the workspace is a volume, filesystem changes are persisted between | ||
| 10 | # pipeline steps. In other words, individual steps can communicate and share | ||
| 11 | # state using the filesystem. | ||
| 12 | # | ||
| 13 | # Workspace volumes are ephemeral. They are created when the pipeline starts | ||
| 14 | # and destroyed after the pipeline completes. | ||
| 15 | |||
| 16 | set -x | ||
| 17 | set -e | ||
| 18 | |||
| 19 | ARCH="$(uname -m)" | ||
| 20 | |||
| 21 | DEPS_LOCAL="/deps/local" | ||
| 22 | WORKSPACE="$DRONE_WORKSPACE" | ||
| 23 | |||
| 24 | DEBUG_STAGING="$WORKSPACE/_debug/staging" | ||
| 25 | RELEASE_STAGING="$WORKSPACE/_release/staging" | ||
| 26 | |||
| 27 | export PATH=$DEPS_LOCAL/bin:$PATH | ||
| 28 | |||
| 29 | # Make the `zig version` number consistent. | ||
| 30 | # This will affect the cmake commands that follow. | ||
| 31 | git config core.abbrev 9 | ||
ci/zinc/linux_package created+45| ... | @@ -0,0 +1,45 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | ARCH="$(uname -m)" | ||
| 7 | OS="linux" | ||
| 8 | RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging" | ||
| 9 | VERSION=$($RELEASE_STAGING/bin/zig version) | ||
| 10 | BASENAME="zig-$OS-$ARCH-$VERSION" | ||
| 11 | TARBALL="$BASENAME.tar.xz" | ||
| 12 | |||
| 13 | # This runs concurrently with the macos_package script, so it should not make | ||
| 14 | # any changes to the filesystem that will cause problems for the other script. | ||
| 15 | |||
| 16 | cp -r "$RELEASE_STAGING" "$BASENAME" | ||
| 17 | |||
| 18 | # Remove the unnecessary bin dir in $prefix/bin/zig | ||
| 19 | mv $BASENAME/bin/zig $BASENAME/ | ||
| 20 | rmdir $BASENAME/bin | ||
| 21 | |||
| 22 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig | ||
| 23 | mv $BASENAME/lib/zig $BASENAME/lib2 | ||
| 24 | rmdir $BASENAME/lib | ||
| 25 | mv $BASENAME/lib2 $BASENAME/lib | ||
| 26 | |||
| 27 | tar cfJ "$TARBALL" "$BASENAME" | ||
| 28 | |||
| 29 | SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) | ||
| 30 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 31 | |||
| 32 | MANIFEST="manifest.json" | ||
| 33 | touch $MANIFEST | ||
| 34 | echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST | ||
| 35 | echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST | ||
| 36 | echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST | ||
| 37 | |||
| 38 | # Publish artifact. | ||
| 39 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 40 | |||
| 41 | # Publish manifest. | ||
| 42 | s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json" | ||
| 43 | |||
| 44 | # Explicit exit helps show last command duration. | ||
| 45 | exit | ||
ci/zinc/linux_package.sh deleted-45| ... | @@ -1,45 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./ci/zinc/linux_base.sh | ||
| 4 | |||
| 5 | # Remove the unnecessary bin dir in $prefix/bin/zig | ||
| 6 | mv $RELEASE_STAGING/bin/zig $RELEASE_STAGING/ | ||
| 7 | rmdir $RELEASE_STAGING/bin | ||
| 8 | |||
| 9 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig | ||
| 10 | mv $RELEASE_STAGING/lib/zig $RELEASE_STAGING/lib2 | ||
| 11 | rmdir $RELEASE_STAGING/lib | ||
| 12 | mv $RELEASE_STAGING/lib2 $RELEASE_STAGING/lib | ||
| 13 | |||
| 14 | VERSION=$($RELEASE_STAGING/zig version) | ||
| 15 | BASENAME="zig-linux-$ARCH-$VERSION" | ||
| 16 | TARBALL="$BASENAME.tar.xz" | ||
| 17 | mv "$RELEASE_STAGING" "$BASENAME" | ||
| 18 | tar cfJ "$TARBALL" "$BASENAME" | ||
| 19 | ls -l "$TARBALL" | ||
| 20 | |||
| 21 | SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) | ||
| 22 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 23 | |||
| 24 | MANIFEST="manifest.json" | ||
| 25 | touch $MANIFEST | ||
| 26 | echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST | ||
| 27 | echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST | ||
| 28 | echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST | ||
| 29 | |||
| 30 | # Publish artifact. | ||
| 31 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 32 | |||
| 33 | # Publish manifest. | ||
| 34 | s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json" | ||
| 35 | |||
| 36 | # Avoid leaking oauth token. | ||
| 37 | set +x | ||
| 38 | |||
| 39 | cd $WORKSPACE | ||
| 40 | ./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN" | ||
| 41 | |||
| 42 | set -x | ||
| 43 | |||
| 44 | # Explicit exit helps show last command duration. | ||
| 45 | exit | ||
ci/zinc/linux_test_stage3_debug created+61| ... | @@ -0,0 +1,61 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | ARCH="$(uname -m)" | ||
| 7 | DEPS_LOCAL="/deps/local" | ||
| 8 | OLD_ZIG="$DEPS_LOCAL/bin/zig" | ||
| 9 | TARGET="${ARCH}-linux-musl" | ||
| 10 | MCPU="baseline" | ||
| 11 | |||
| 12 | export PATH=$DEPS_LOCAL/bin:$PATH | ||
| 13 | |||
| 14 | echo "building stage3-debug with zig version $($OLD_ZIG version)" | ||
| 15 | |||
| 16 | # Override the cache directories so that we don't clobber with the release | ||
| 17 | # testing script which is running concurrently and in the same directory. | ||
| 18 | # Normally we want processes to cooperate, but in this case we want them isolated. | ||
| 19 | export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-cache-local-debug" | ||
| 20 | export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-cache-global-debug" | ||
| 21 | |||
| 22 | export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 23 | export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 24 | |||
| 25 | mkdir build-debug | ||
| 26 | cd build-debug | ||
| 27 | cmake .. \ | ||
| 28 | -DCMAKE_INSTALL_PREFIX="$(pwd)/stage3" \ | ||
| 29 | -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ | ||
| 30 | -DCMAKE_BUILD_TYPE=Debug \ | ||
| 31 | -DZIG_STATIC=ON \ | ||
| 32 | -DZIG_USE_LLVM_CONFIG=OFF \ | ||
| 33 | -GNinja | ||
| 34 | |||
| 35 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | ||
| 36 | # so that installation and testing do not get affected by them. | ||
| 37 | unset CC | ||
| 38 | unset CXX | ||
| 39 | |||
| 40 | ninja install | ||
| 41 | |||
| 42 | echo "Looking for non-conforming code formatting..." | ||
| 43 | stage3/bin/zig fmt --check .. \ | ||
| 44 | --exclude ../test/cases/ \ | ||
| 45 | --exclude ../build-debug \ | ||
| 46 | --exclude ../build-release \ | ||
| 47 | --exclude "$ZIG_LOCAL_CACHE_DIR" \ | ||
| 48 | --exclude "$ZIG_GLOBAL_CACHE_DIR" | ||
| 49 | |||
| 50 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | ||
| 51 | stage3/bin/zig build -Dtarget=arm-linux-musleabihf | ||
| 52 | |||
| 53 | stage3/bin/zig build test \ | ||
| 54 | -fqemu \ | ||
| 55 | -fwasmtime \ | ||
| 56 | -Dstatic-llvm \ | ||
| 57 | -Dtarget=native-native-musl \ | ||
| 58 | --search-prefix "$DEPS_LOCAL" | ||
| 59 | |||
| 60 | # Explicit exit helps show last command duration. | ||
| 61 | exit | ||
ci/zinc/linux_test_stage3_debug.sh deleted-61| ... | @@ -1,61 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./ci/zinc/linux_base.sh | ||
| 4 | |||
| 5 | OLD_ZIG="$DEPS_LOCAL/bin/zig" | ||
| 6 | TARGET="${ARCH}-linux-musl" | ||
| 7 | MCPU="baseline" | ||
| 8 | |||
| 9 | echo "building stage3-debug with zig version $($OLD_ZIG version)" | ||
| 10 | |||
| 11 | # Override the cache directories so that we don't clobber with the release | ||
| 12 | # testing script which is running concurrently and in the same directory. | ||
| 13 | # Normally we want processes to cooperate, but in this case we want them isolated. | ||
| 14 | export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-cache-local-debug" | ||
| 15 | export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-cache-global-debug" | ||
| 16 | |||
| 17 | export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 18 | export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 19 | |||
| 20 | mkdir build-debug | ||
| 21 | cd build-debug | ||
| 22 | cmake .. \ | ||
| 23 | -DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \ | ||
| 24 | -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ | ||
| 25 | -DCMAKE_BUILD_TYPE=Debug \ | ||
| 26 | -DZIG_TARGET_TRIPLE="$TARGET" \ | ||
| 27 | -DZIG_TARGET_MCPU="$MCPU" \ | ||
| 28 | -DZIG_STATIC=ON \ | ||
| 29 | -GNinja | ||
| 30 | |||
| 31 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | ||
| 32 | # so that installation and testing do not get affected by them. | ||
| 33 | unset CC | ||
| 34 | unset CXX | ||
| 35 | |||
| 36 | ninja install | ||
| 37 | |||
| 38 | cd $WORKSPACE | ||
| 39 | |||
| 40 | "$DEBUG_STAGING/bin/zig" build -p stage3 -Denable-stage1 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL" | ||
| 41 | |||
| 42 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | ||
| 43 | stage3/bin/zig build -Dtarget=arm-linux-musleabihf | ||
| 44 | |||
| 45 | echo "Looking for non-conforming code formatting..." | ||
| 46 | stage3/bin/zig fmt --check . \ | ||
| 47 | --exclude test/cases/ \ | ||
| 48 | --exclude build-debug \ | ||
| 49 | --exclude build-release \ | ||
| 50 | --exclude "$ZIG_LOCAL_CACHE_DIR" \ | ||
| 51 | --exclude "$ZIG_GLOBAL_CACHE_DIR" | ||
| 52 | |||
| 53 | stage3/bin/zig build test \ | ||
| 54 | -fqemu \ | ||
| 55 | -fwasmtime \ | ||
| 56 | -Dstatic-llvm \ | ||
| 57 | -Dtarget=native-native-musl \ | ||
| 58 | --search-prefix "$DEPS_LOCAL" | ||
| 59 | |||
| 60 | # Explicit exit helps show last command duration. | ||
| 61 | exit | ||
ci/zinc/linux_test_stage3_release created+58| ... | @@ -0,0 +1,58 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | ARCH="$(uname -m)" | ||
| 7 | DEPS_LOCAL="/deps/local" | ||
| 8 | RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging" | ||
| 9 | OLD_ZIG="$DEPS_LOCAL/bin/zig" | ||
| 10 | TARGET="${ARCH}-linux-musl" | ||
| 11 | MCPU="baseline" | ||
| 12 | |||
| 13 | export PATH=$DEPS_LOCAL/bin:$PATH | ||
| 14 | |||
| 15 | echo "building stage3-release with zig version $($OLD_ZIG version)" | ||
| 16 | |||
| 17 | export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 18 | export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 19 | |||
| 20 | mkdir build-release | ||
| 21 | cd build-release | ||
| 22 | cmake .. \ | ||
| 23 | -DCMAKE_INSTALL_PREFIX="$RELEASE_STAGING" \ | ||
| 24 | -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ | ||
| 25 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 26 | -DZIG_TARGET_TRIPLE="$TARGET" \ | ||
| 27 | -DZIG_TARGET_MCPU="$MCPU" \ | ||
| 28 | -DZIG_STATIC=ON \ | ||
| 29 | -GNinja | ||
| 30 | |||
| 31 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | ||
| 32 | # so that installation and testing do not get affected by them. | ||
| 33 | unset CC | ||
| 34 | unset CXX | ||
| 35 | |||
| 36 | ninja install | ||
| 37 | |||
| 38 | "$RELEASE_STAGING/bin/zig" build test docs \ | ||
| 39 | -fqemu \ | ||
| 40 | -fwasmtime \ | ||
| 41 | -Dstatic-llvm \ | ||
| 42 | -Dtarget=native-native-musl \ | ||
| 43 | --search-prefix "$DEPS_LOCAL" | ||
| 44 | |||
| 45 | # Produce the experimental std lib documentation. | ||
| 46 | mkdir -p "$RELEASE_STAGING/docs/std" | ||
| 47 | "$RELEASE_STAGING/bin/zig" test ../lib/std/std.zig \ | ||
| 48 | -femit-docs=$RELEASE_STAGING/docs/std \ | ||
| 49 | -fno-emit-bin | ||
| 50 | |||
| 51 | cp ../LICENSE $RELEASE_STAGING/ | ||
| 52 | cp ../zig-cache/langref.html $RELEASE_STAGING/docs/ | ||
| 53 | |||
| 54 | # Look for HTML errors. | ||
| 55 | tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html | ||
| 56 | |||
| 57 | # Explicit exit helps show last command duration. | ||
| 58 | exit | ||
ci/zinc/linux_test_stage3_release.sh deleted-78| ... | @@ -1,78 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./ci/zinc/linux_base.sh | ||
| 4 | |||
| 5 | OLD_ZIG="$DEPS_LOCAL/bin/zig" | ||
| 6 | TARGET="${ARCH}-linux-musl" | ||
| 7 | MCPU="baseline" | ||
| 8 | |||
| 9 | echo "building stage3-release with zig version $($OLD_ZIG version)" | ||
| 10 | |||
| 11 | export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU" | ||
| 12 | export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU" | ||
| 13 | |||
| 14 | mkdir build-release | ||
| 15 | cd build-release | ||
| 16 | STAGE2_PREFIX="$(pwd)/stage2" | ||
| 17 | cmake .. \ | ||
| 18 | -DCMAKE_INSTALL_PREFIX="$STAGE2_PREFIX" \ | ||
| 19 | -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ | ||
| 20 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 21 | -DZIG_TARGET_TRIPLE="$TARGET" \ | ||
| 22 | -DZIG_TARGET_MCPU="$MCPU" \ | ||
| 23 | -DZIG_STATIC=ON \ | ||
| 24 | -GNinja | ||
| 25 | |||
| 26 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | ||
| 27 | # so that installation and testing do not get affected by them. | ||
| 28 | unset CC | ||
| 29 | unset CXX | ||
| 30 | |||
| 31 | ninja install | ||
| 32 | |||
| 33 | # Here we rebuild zig but this time using the Zig binary we just now produced to | ||
| 34 | # build zig1.o rather than relying on the one built with stage0. See | ||
| 35 | # https://github.com/ziglang/zig/issues/6830 for more details. | ||
| 36 | cmake .. -DZIG_EXECUTABLE="$STAGE2_PREFIX/bin/zig" | ||
| 37 | ninja install | ||
| 38 | |||
| 39 | # This is the binary we will distribute. We intentionally test this one in this | ||
| 40 | # script. If any test failures occur, hopefully they also occur in the debug | ||
| 41 | # version of this script for easier troubleshooting. This prevents distribution | ||
| 42 | # of a Zig binary that passes tests in debug mode but has a miscompilation in | ||
| 43 | # release mode. | ||
| 44 | "$STAGE2_PREFIX/bin/zig" build \ | ||
| 45 | --prefix "$RELEASE_STAGING" \ | ||
| 46 | --search-prefix "$DEPS_LOCAL" \ | ||
| 47 | -Dstatic-llvm \ | ||
| 48 | -Drelease \ | ||
| 49 | -Dstrip \ | ||
| 50 | -Dtarget="$TARGET" \ | ||
| 51 | -Denable-stage1 | ||
| 52 | |||
| 53 | cd $WORKSPACE | ||
| 54 | |||
| 55 | ZIG="$RELEASE_STAGING/bin/zig" | ||
| 56 | |||
| 57 | $ZIG build test docs \ | ||
| 58 | -fqemu \ | ||
| 59 | -fwasmtime \ | ||
| 60 | -Dstatic-llvm \ | ||
| 61 | -Dtarget=native-native-musl \ | ||
| 62 | --search-prefix "$DEPS_LOCAL" | ||
| 63 | |||
| 64 | # Produce the experimental std lib documentation. | ||
| 65 | mkdir -p "$RELEASE_STAGING/docs/std" | ||
| 66 | $ZIG test lib/std/std.zig \ | ||
| 67 | --zig-lib-dir lib \ | ||
| 68 | -femit-docs=$RELEASE_STAGING/docs/std \ | ||
| 69 | -fno-emit-bin | ||
| 70 | |||
| 71 | cp LICENSE $RELEASE_STAGING/ | ||
| 72 | cp zig-cache/langref.html $RELEASE_STAGING/docs/ | ||
| 73 | |||
| 74 | # Look for HTML errors. | ||
| 75 | tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html | ||
| 76 | |||
| 77 | # Explicit exit helps show last command duration. | ||
| 78 | exit | ||
ci/zinc/macos_package created+49| ... | @@ -0,0 +1,49 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | ARCH="aarch64" | ||
| 7 | OS=macos | ||
| 8 | ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging" | ||
| 9 | VERSION=$($ZIG_PREFIX/bin/zig version) | ||
| 10 | TARGET="$ARCH-$OS-none" | ||
| 11 | INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET" | ||
| 12 | BASENAME="zig-$OS-$ARCH-$VERSION" | ||
| 13 | TARBALL="$BASENAME.tar.xz" | ||
| 14 | |||
| 15 | # This runs concurrently with the linux_package script, so it should not make | ||
| 16 | # any changes to the filesystem that will cause problems for the other script. | ||
| 17 | |||
| 18 | # Remove the unnecessary bin dir in $prefix/bin/zig | ||
| 19 | mv $INSTALL_PREFIX/bin/zig $INSTALL_PREFIX/ | ||
| 20 | rmdir $INSTALL_PREFIX/bin | ||
| 21 | |||
| 22 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig | ||
| 23 | mv $INSTALL_PREFIX/lib/zig $INSTALL_PREFIX/lib2 | ||
| 24 | rmdir $INSTALL_PREFIX/lib | ||
| 25 | mv $INSTALL_PREFIX/lib2 $INSTALL_PREFIX/lib | ||
| 26 | |||
| 27 | cp -r "$ZIG_PREFIX/docs" "$INSTALL_PREFIX/" | ||
| 28 | cp "$ZIG_PREFIX/LICENSE" "$INSTALL_PREFIX/" | ||
| 29 | |||
| 30 | mv "$INSTALL_PREFIX" "$BASENAME" | ||
| 31 | tar cfJ "$TARBALL" "$BASENAME" | ||
| 32 | |||
| 33 | SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) | ||
| 34 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 35 | |||
| 36 | MANIFEST="manifest.json" | ||
| 37 | touch $MANIFEST | ||
| 38 | echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST | ||
| 39 | echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST | ||
| 40 | echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST | ||
| 41 | |||
| 42 | # Publish artifact. | ||
| 43 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 44 | |||
| 45 | # Publish manifest. | ||
| 46 | s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json" | ||
| 47 | |||
| 48 | # Explicit exit helps show last command duration. | ||
| 49 | exit | ||
ci/zinc/notify_lavahut created+9| ... | @@ -0,0 +1,9 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set +x # Avoid leaking oauth token. | ||
| 4 | set -e | ||
| 5 | |||
| 6 | ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging" | ||
| 7 | VERSION=$($ZIG_PREFIX/bin/zig version) | ||
| 8 | cd $DRONE_WORKSPACE | ||
| 9 | ./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN" | ||
cmake/install.cmake deleted-37| ... | @@ -1,37 +0,0 @@ | ||
| 1 | message("-- Installing: ${CMAKE_INSTALL_PREFIX}/lib") | ||
| 2 | |||
| 3 | if(NOT EXISTS ${zig_EXE}) | ||
| 4 | message("::") | ||
| 5 | message(":: ERROR: Executable not found") | ||
| 6 | message(":: (execute_process)") | ||
| 7 | message("::") | ||
| 8 | message(":: executable: ${zig_EXE}") | ||
| 9 | message("::") | ||
| 10 | message(FATAL_ERROR) | ||
| 11 | endif() | ||
| 12 | |||
| 13 | execute_process(COMMAND ${zig_EXE} ${ZIG_INSTALL_ARGS} | ||
| 14 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
| 15 | RESULT_VARIABLE _result | ||
| 16 | ) | ||
| 17 | if(_result) | ||
| 18 | message("::") | ||
| 19 | message(":: ERROR: ${_result}") | ||
| 20 | message(":: (execute_process)") | ||
| 21 | |||
| 22 | string(REPLACE ";" " " s_INSTALL_LIBSTAGE2_ARGS "${ZIG_INSTALL_ARGS}") | ||
| 23 | message("::") | ||
| 24 | message(":: argv: ${zig_EXE} ${s_INSTALL_LIBSTAGE2_ARGS}") | ||
| 25 | |||
| 26 | set(_args ${zig_EXE} ${ZIG_INSTALL_ARGS}) | ||
| 27 | list(LENGTH _args _len) | ||
| 28 | math(EXPR _len "${_len} - 1") | ||
| 29 | message("::") | ||
| 30 | foreach(_i RANGE 0 ${_len}) | ||
| 31 | list(GET _args ${_i} _arg) | ||
| 32 | message(":: argv[${_i}]: ${_arg}") | ||
| 33 | endforeach() | ||
| 34 | |||
| 35 | message("::") | ||
| 36 | message(FATAL_ERROR) | ||
| 37 | endif() | ||
src/Zir.zig+5-1| ... | @@ -43,7 +43,11 @@ pub const Header = extern struct { | ... | @@ -43,7 +43,11 @@ pub const Header = extern struct { |
| 43 | instructions_len: u32, | 43 | instructions_len: u32, |
| 44 | string_bytes_len: u32, | 44 | string_bytes_len: u32, |
| 45 | extra_len: u32, | 45 | extra_len: u32, |
| 46 | 46 | /// We could leave this as padding, however it triggers a Valgrind warning because | |
| 47 | /// we read and write undefined bytes to the file system. This is harmless, but | ||
| 48 | /// it's essentially free to have a zero field here and makes the warning go away, | ||
| 49 | /// making it more likely that following Valgrind warnings will be taken seriously. | ||
| 50 | unused: u32 = 0, | ||
| 47 | stat_inode: std.fs.File.INode, | 51 | stat_inode: std.fs.File.INode, |
| 48 | stat_size: u64, | 52 | stat_size: u64, |
| 49 | stat_mtime: i128, | 53 | stat_mtime: i128, |