mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Merge pull request #12508 from ziglang/cmake-stage3
cmake: build stage3 by default
This commit is contained in:
commit
e69973bedd
27 changed files with 417 additions and 502 deletions
122
CMakeLists.txt
122
CMakeLists.txt
|
|
@ -12,7 +12,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/stage2" CACHE STRING
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/stage3" CACHE STRING
|
||||
"Directory to install zig to" FORCE)
|
||||
endif()
|
||||
|
||||
|
|
@ -65,6 +65,9 @@ if("${ZIG_VERSION}" STREQUAL "")
|
|||
endif()
|
||||
message(STATUS "Configuring zig version ${ZIG_VERSION}")
|
||||
|
||||
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL
|
||||
"Disable copying lib/ files to install prefix during the build phase")
|
||||
|
||||
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
|
||||
set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
|
||||
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")
|
|||
set(ZIG_CONFIG_ZIG_OUT "${CMAKE_BINARY_DIR}/config.zig")
|
||||
|
||||
# This is our shim which will be replaced by stage1.zig.
|
||||
set(ZIG0_SOURCES
|
||||
set(ZIG1_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/stage1/zig0.cpp"
|
||||
)
|
||||
|
||||
|
|
@ -373,9 +376,9 @@ set(ZIG_CPP_SOURCES
|
|||
# https://github.com/ziglang/zig/issues/6363
|
||||
"${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp"
|
||||
)
|
||||
# Needed because we use cmake, not the zig build system, to build zig1.o.
|
||||
# Needed because we use cmake, not the zig build system, to build zig2.o.
|
||||
# This list is generated by building zig and then clearing the zig-cache directory,
|
||||
# then manually running the build-obj command (see BUILD_ZIG1_ARGS), and then looking
|
||||
# then manually running the build-obj command (see BUILD_ZIG2_ARGS), and then looking
|
||||
# in the zig-cache directory for the compiler-generated list of zig file dependencies.
|
||||
set(ZIG_STAGE2_SOURCES
|
||||
"${ZIG_CONFIG_ZIG_OUT}"
|
||||
|
|
@ -942,40 +945,51 @@ if(MSVC OR MINGW)
|
|||
endif()
|
||||
|
||||
if("${ZIG_EXECUTABLE}" STREQUAL "")
|
||||
add_executable(zig0 ${ZIG0_SOURCES})
|
||||
set_target_properties(zig0 PROPERTIES
|
||||
add_executable(zig1 ${ZIG1_SOURCES})
|
||||
set_target_properties(zig1 PROPERTIES
|
||||
COMPILE_FLAGS ${EXE_CFLAGS}
|
||||
LINK_FLAGS ${EXE_LDFLAGS}
|
||||
)
|
||||
target_link_libraries(zig0 zigstage1)
|
||||
target_link_libraries(zig1 zigstage1)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(ZIG1_OBJECT "${CMAKE_BINARY_DIR}/zig1.obj")
|
||||
set(ZIG2_OBJECT "${CMAKE_BINARY_DIR}/zig2.obj")
|
||||
else()
|
||||
set(ZIG1_OBJECT "${CMAKE_BINARY_DIR}/zig1.o")
|
||||
set(ZIG2_OBJECT "${CMAKE_BINARY_DIR}/zig2.o")
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(ZIG1_RELEASE_ARG "")
|
||||
set(ZIG_RELEASE_ARG "")
|
||||
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
set(ZIG_RELEASE_ARG -Drelease)
|
||||
else()
|
||||
set(ZIG1_RELEASE_ARG -OReleaseFast --strip)
|
||||
set(ZIG_RELEASE_ARG -Drelease -Dstrip)
|
||||
endif()
|
||||
if(ZIG_SKIP_INSTALL_LIB_FILES)
|
||||
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files")
|
||||
else()
|
||||
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files=false")
|
||||
endif()
|
||||
if(ZIG_SINGLE_THREADED)
|
||||
set(ZIG1_SINGLE_THREADED_ARG "-fsingle-threaded")
|
||||
set(ZIG_SINGLE_THREADED_ARG "-fsingle-threaded")
|
||||
else()
|
||||
set(ZIG1_SINGLE_THREADED_ARG "")
|
||||
set(ZIG_SINGLE_THREADED_ARG "")
|
||||
endif()
|
||||
if(ZIG_STATIC)
|
||||
set(ZIG_STATIC_ARG "-Duse-zig-libcxx")
|
||||
else()
|
||||
set(ZIG_STATIC_ARG "")
|
||||
endif()
|
||||
|
||||
set(BUILD_ZIG1_ARGS
|
||||
set(BUILD_ZIG2_ARGS
|
||||
"src/stage1.zig"
|
||||
-target "${ZIG_TARGET_TRIPLE}"
|
||||
"-mcpu=${ZIG_TARGET_MCPU}"
|
||||
--name zig1
|
||||
--name zig2
|
||||
--zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
|
||||
"-femit-bin=${ZIG1_OBJECT}"
|
||||
"-femit-bin=${ZIG2_OBJECT}"
|
||||
-fcompiler-rt
|
||||
"${ZIG1_RELEASE_ARG}"
|
||||
"${ZIG1_SINGLE_THREADED_ARG}"
|
||||
${ZIG_SINGLE_THREADED_ARG}
|
||||
-target "${ZIG_TARGET_TRIPLE}"
|
||||
-mcpu "${ZIG_TARGET_MCPU}"
|
||||
-lc
|
||||
--pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"
|
||||
--pkg-end
|
||||
|
|
@ -985,68 +999,64 @@ set(BUILD_ZIG1_ARGS
|
|||
|
||||
if("${ZIG_EXECUTABLE}" STREQUAL "")
|
||||
add_custom_command(
|
||||
OUTPUT "${ZIG1_OBJECT}"
|
||||
COMMAND zig0 ${BUILD_ZIG1_ARGS}
|
||||
DEPENDS zig0 "${ZIG_STAGE2_SOURCES}"
|
||||
COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}"
|
||||
OUTPUT "${ZIG2_OBJECT}"
|
||||
COMMAND zig1 ${BUILD_ZIG2_ARGS}
|
||||
DEPENDS zig1 "${ZIG_STAGE2_SOURCES}"
|
||||
COMMENT STATUS "Building stage2 object ${ZIG2_OBJECT}"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
set(ZIG_EXECUTABLE "${zig_BINARY_DIR}/zig")
|
||||
if (WIN32)
|
||||
set(ZIG_EXECUTABLE "${ZIG_EXECUTABLE}.exe")
|
||||
set(ZIG_EXECUTABLE "${zig2_BINARY_DIR}/zig2.exe")
|
||||
else()
|
||||
set(ZIG_EXECUTABLE "${zig2_BINARY_DIR}/zig2")
|
||||
endif()
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT "${ZIG1_OBJECT}"
|
||||
COMMAND "${ZIG_EXECUTABLE}" "build-obj" ${BUILD_ZIG1_ARGS}
|
||||
OUTPUT "${ZIG2_OBJECT}"
|
||||
COMMAND "${ZIG_EXECUTABLE}" "build-obj" ${BUILD_ZIG2_ARGS}
|
||||
DEPENDS ${ZIG_STAGE2_SOURCES}
|
||||
COMMENT STATUS "Building self-hosted component ${ZIG1_OBJECT}"
|
||||
COMMENT STATUS "Building stage2 component ${ZIG2_OBJECT}"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# cmake won't let us configure an executable without C sources.
|
||||
add_executable(zig "${CMAKE_SOURCE_DIR}/src/stage1/empty.cpp" "${ZIG1_OBJECT}")
|
||||
add_executable(zig2 "${CMAKE_SOURCE_DIR}/src/stage1/empty.cpp" "${ZIG2_OBJECT}")
|
||||
|
||||
set_target_properties(zig PROPERTIES
|
||||
set_target_properties(zig2 PROPERTIES
|
||||
COMPILE_FLAGS ${EXE_CFLAGS}
|
||||
LINK_FLAGS ${EXE_LDFLAGS}
|
||||
)
|
||||
target_link_libraries(zig zigstage1)
|
||||
target_link_libraries(zig2 zigstage1)
|
||||
if(MSVC)
|
||||
target_link_libraries(zig ntdll.lib)
|
||||
target_link_libraries(zig2 ntdll.lib)
|
||||
elseif(MINGW)
|
||||
target_link_libraries(zig ntdll)
|
||||
target_link_libraries(zig2 ntdll)
|
||||
endif()
|
||||
|
||||
install(TARGETS zig DESTINATION bin)
|
||||
|
||||
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL
|
||||
"Disable copying lib/ files to install prefix during the build phase")
|
||||
|
||||
# Dummy install command so that the "install" target is not missing.
|
||||
# This is redundant from the "stage3" custom target below.
|
||||
if(NOT ZIG_SKIP_INSTALL_LIB_FILES)
|
||||
install(FILES "lib/compiler_rt.zig" DESTINATION "lib/zig")
|
||||
endif()
|
||||
|
||||
set(ZIG_INSTALL_ARGS "build"
|
||||
--zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
|
||||
"-Dlib-files-only"
|
||||
--prefix "${CMAKE_INSTALL_PREFIX}"
|
||||
"-Dconfig_h=${ZIG_CONFIG_H_OUT}"
|
||||
install
|
||||
"-Denable-llvm"
|
||||
"-Denable-stage1"
|
||||
${ZIG_RELEASE_ARG}
|
||||
${ZIG_STATIC_ARG}
|
||||
${ZIG_SKIP_INSTALL_LIB_FILES_ARG}
|
||||
${ZIG_SINGLE_THREADED_ARG}
|
||||
"-Dtarget=${ZIG_TARGET_TRIPLE}"
|
||||
"-Dcpu=${ZIG_TARGET_MCPU}"
|
||||
)
|
||||
|
||||
# CODE has no effect with Visual Studio build system generator, therefore
|
||||
# when using Visual Studio build system generator we resort to running
|
||||
# `zig build install` during the build phase.
|
||||
if(MSVC)
|
||||
add_custom_target(zig_install_lib_files ALL
|
||||
COMMAND zig ${ZIG_INSTALL_ARGS}
|
||||
DEPENDS zig
|
||||
add_custom_target(stage3 ALL
|
||||
COMMAND zig2 ${ZIG_INSTALL_ARGS}
|
||||
DEPENDS zig2
|
||||
COMMENT STATUS "Building stage3"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
else()
|
||||
get_target_property(zig_BINARY_DIR zig BINARY_DIR)
|
||||
install(CODE "set(zig_EXE \"${ZIG_EXECUTABLE}\")")
|
||||
install(CODE "set(ZIG_INSTALL_ARGS \"${ZIG_INSTALL_ARGS}\")")
|
||||
install(CODE "set(CMAKE_SOURCE_DIR \"${CMAKE_SOURCE_DIR}\")")
|
||||
install(SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,132 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
brew update && brew install ncurses s3cmd
|
||||
|
||||
ZIGDIR="$(pwd)"
|
||||
|
||||
HOST_ARCH="x86_64"
|
||||
HOST_TARGET="$HOST_ARCH-macos-none"
|
||||
HOST_MCPU="baseline"
|
||||
HOST_CACHE_BASENAME="zig+llvm+lld+clang-$HOST_TARGET-0.10.0-dev.2931+bdf3fa12f"
|
||||
HOST_PREFIX="$HOME/$HOST_CACHE_BASENAME"
|
||||
|
||||
ARCH="aarch64"
|
||||
TARGET="$ARCH-macos-none"
|
||||
MCPU="apple_a14"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.2931+bdf3fa12f"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
|
||||
JOBS="-j2"
|
||||
|
||||
rm -rf $HOST_PREFIX $PREFIX
|
||||
cd $HOME
|
||||
|
||||
wget -nv "https://ziglang.org/deps/$HOST_CACHE_BASENAME.tar.xz"
|
||||
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
||||
tar xf "$HOST_CACHE_BASENAME.tar.xz"
|
||||
tar xf "$CACHE_BASENAME.tar.xz"
|
||||
|
||||
cd $ZIGDIR
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
# Build host zig compiler in debug so that we can get the
|
||||
# current version when packaging
|
||||
|
||||
ZIG="$HOST_PREFIX/bin/zig"
|
||||
|
||||
export CC="$ZIG cc -target $HOST_TARGET -mcpu=$HOST_MCPU"
|
||||
export CXX="$ZIG c++ -target $HOST_TARGET -mcpu=$HOST_MCPU"
|
||||
|
||||
mkdir build.host
|
||||
cd build.host
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
|
||||
-DCMAKE_PREFIX_PATH="$HOST_PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$HOST_TARGET" \
|
||||
-DZIG_TARGET_MCPU="$HOST_MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_OMIT_STAGE2=ON
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
# Build zig compiler cross-compiled for arm64
|
||||
cd $ZIGDIR
|
||||
|
||||
ZIG="$ZIGDIR/build.host/release/bin/zig"
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_EXECUTABLE="$ZIG" \
|
||||
-DZIG_STATIC=ON
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
||||
mv ../LICENSE release/
|
||||
|
||||
# We do not run test suite but still need langref.
|
||||
mkdir -p release/docs
|
||||
$ZIG run ../doc/docgen.zig -- $ZIG ../doc/langref.html.in release/docs/langref.html
|
||||
|
||||
# Produce the experimental std lib documentation.
|
||||
mkdir -p release/docs/std
|
||||
$ZIG test ../lib/std/std.zig \
|
||||
--zig-lib-dir ../lib \
|
||||
-femit-docs=release/docs/std \
|
||||
-fno-emit-bin
|
||||
|
||||
mv release/bin/zig release/
|
||||
rmdir release/bin
|
||||
|
||||
VERSION=$(../build.host/release/bin/zig version)
|
||||
DIRNAME="zig-macos-$ARCH-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv release "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $TARBALL)
|
||||
|
||||
JSONFILE="macos-$GITBRANCH.json"
|
||||
touch $JSONFILE
|
||||
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
|
||||
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
||||
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
||||
|
||||
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-macos-$VERSION.json"
|
||||
|
||||
# `set -x` causes these variables to be mangled.
|
||||
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
|
||||
set +x
|
||||
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
||||
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
|
||||
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
|
||||
fi
|
||||
|
|
@ -34,6 +34,7 @@ git fetch --tags
|
|||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
|
|
@ -47,15 +48,6 @@ unset CXX
|
|||
|
||||
make $JOBS install
|
||||
|
||||
stage2/bin/zig build \
|
||||
--prefix stage3-release \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
-Denable-macos-sdk \
|
||||
-Dstatic-llvm \
|
||||
|
|
|
|||
|
|
@ -10,17 +10,6 @@ jobs:
|
|||
- script: ci/azure/macos_script
|
||||
name: main
|
||||
displayName: 'Build and test'
|
||||
- job: BuildMacOS_arm64
|
||||
pool:
|
||||
vmImage: 'macOS-11'
|
||||
timeoutInMinutes: 180
|
||||
steps:
|
||||
- task: DownloadSecureFile@1
|
||||
inputs:
|
||||
secureFile: s3cfg
|
||||
- script: ci/azure/macos_arm64_script
|
||||
name: main
|
||||
displayName: 'Build'
|
||||
- job: BuildWindows
|
||||
timeoutInMinutes: 360
|
||||
pool:
|
||||
|
|
@ -155,7 +144,6 @@ jobs:
|
|||
- job: OnMasterSuccess
|
||||
dependsOn:
|
||||
- BuildMacOS
|
||||
- BuildMacOS_arm64
|
||||
- BuildWindows
|
||||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
|
||||
strategy:
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# https://docs.drone.io/pipeline/docker/syntax/workspace/
|
||||
#
|
||||
# Drone automatically creates a temporary volume, known as your workspace,
|
||||
# where it clones your repository. The workspace is the current working
|
||||
# directory for each step in your pipeline.
|
||||
#
|
||||
# Because the workspace is a volume, filesystem changes are persisted between
|
||||
# pipeline steps. In other words, individual steps can communicate and share
|
||||
# state using the filesystem.
|
||||
#
|
||||
# Workspace volumes are ephemeral. They are created when the pipeline starts
|
||||
# and destroyed after the pipeline completes.
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
TRIPLEARCH="$(uname -m)"
|
||||
DISTDIR="$DRONE_WORKSPACE/dist"
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
|
@ -1,17 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# Probe CPU/brand details.
|
||||
# TODO: `lscpu` is changing package names in EDGE to `util-linux-misc`
|
||||
apk update
|
||||
apk add util-linux
|
||||
echo "lscpu:"
|
||||
lscpu | sed 's,^, : ,'
|
||||
ARCH="$(uname -m)"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
PREFIX="/deps/local"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
TARGET="$TRIPLEARCH-linux-musl"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
|
|
@ -30,8 +29,8 @@ cat <<'ENDFILE' >$PREFIX/bin/ranlib
|
|||
/deps/local/bin/zig ranlib $@
|
||||
ENDFILE
|
||||
|
||||
chmod +x $PREFIX/bin/ar
|
||||
chmod +x $PREFIX/bin/ranlib
|
||||
chmod +x "$PREFIX/bin/ar"
|
||||
chmod +x "$PREFIX/bin/ranlib"
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
|
|
@ -43,6 +42,7 @@ mkdir build
|
|||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_AR="$PREFIX/bin/ar" \
|
||||
-DCMAKE_RANLIB="$PREFIX/bin/ranlib" \
|
||||
|
|
@ -56,12 +56,3 @@ cmake .. \
|
|||
unset CC
|
||||
unset CXX
|
||||
samu install
|
||||
|
||||
stage2/bin/zig build \
|
||||
--prefix "$DISTDIR" \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
if [ -n "$DRONE_PULL_REQUEST" ]; then
|
||||
exit 0
|
||||
|
|
@ -12,16 +18,16 @@ pip3 install s3cmd
|
|||
|
||||
cd build
|
||||
|
||||
mv ../LICENSE "$DISTDIR/"
|
||||
mv ../zig-cache/langref.html "$DISTDIR/"
|
||||
mv "$DISTDIR/bin/zig" "$DISTDIR/"
|
||||
rmdir "$DISTDIR/bin"
|
||||
mv ../LICENSE "$INSTALL_PREFIX/"
|
||||
mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
|
||||
mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
|
||||
rmdir "$INSTALL_PREFIX/bin"
|
||||
|
||||
GITBRANCH="$DRONE_BRANCH"
|
||||
VERSION="$("$DISTDIR/zig" version)"
|
||||
DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"
|
||||
VERSION="$("$INSTALL_PREFIX/zig" version)"
|
||||
DIRNAME="zig-linux-$ARCH-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv "$DISTDIR" "$DIRNAME"
|
||||
mv "$INSTALL_PREFIX" "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
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
|
|||
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
||||
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
||||
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json"
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
|
||||
if [ "$GITBRANCH" = "master" ]; then
|
||||
# avoid leaking oauth token
|
||||
set +x
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-behavior -Dskip-non-native
|
||||
./build/zig build test-compiler-rt -Dskip-non-native
|
||||
./build/zig build test-fmt
|
||||
./build/zig build docs
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-behavior -Dskip-non-native
|
||||
$ZIG build test-compiler-rt -Dskip-non-native
|
||||
$ZIG build test-fmt
|
||||
$ZIG build docs
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build -Dskip-non-native # test building self-hosted without LLVM
|
||||
./build/zig build -Dskip-non-native test-cases
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build -Dskip-non-native # test building self-hosted without LLVM
|
||||
$ZIG build -Dskip-non-native test-cases
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-universal-libc -Dskip-non-native
|
||||
./build/zig build test-compare-output -Dskip-non-native
|
||||
./build/zig build test-standalone -Dskip-non-native -Dskip-release-safe
|
||||
./build/zig build test-stack-traces -Dskip-non-native
|
||||
./build/zig build test-cli -Dskip-non-native
|
||||
./build/zig build test-asm-link -Dskip-non-native
|
||||
./build/zig build test-translate-c -Dskip-non-native
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-universal-libc -Dskip-non-native
|
||||
$ZIG build test-compare-output -Dskip-non-native
|
||||
$ZIG build test-standalone -Dskip-non-native -Dskip-release-safe
|
||||
$ZIG build test-stack-traces -Dskip-non-native
|
||||
$ZIG build test-cli -Dskip-non-native
|
||||
$ZIG build test-asm-link -Dskip-non-native
|
||||
$ZIG build test-translate-c -Dskip-non-native
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
# Empirically, this takes about 55 minutes on the CI, and is the bottleneck
|
||||
# causing timeouts. So this is disabled in favor of running a smaller set
|
||||
# of ReleaseSmall std lib tests.
|
||||
# ./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native
|
||||
# $ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native
|
||||
|
||||
./build/zig test lib/std/std.zig -OReleaseSmall
|
||||
./build/zig test lib/std/std.zig -OReleaseSmall -lc
|
||||
$ZIG test lib/std/std.zig -OReleaseSmall
|
||||
$ZIG test lib/std/std.zig -OReleaseSmall -lc
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ export TERM=dumb
|
|||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=$PREFIX \
|
||||
|
|
@ -38,40 +40,38 @@ cmake .. \
|
|||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-GNinja
|
||||
samu install
|
||||
|
||||
# TODO: eliminate this workaround. Without this, zig does not end up passing
|
||||
# -isystem /usr/include when building libc++, resulting in #include <sys/endian.h>
|
||||
# "file not found" errors.
|
||||
stage2/bin/zig libc >libc.txt
|
||||
echo "include_dir=/usr/include" >>libc.txt
|
||||
echo "sys_include_dir=/usr/include" >>libc.txt
|
||||
echo "crt_dir=/usr/lib" >>libc.txt
|
||||
echo "msvc_lib_dir=" >>libc.txt
|
||||
echo "kernel32_lib_dir=" >>libc.txt
|
||||
echo "gcc_dir=" >>libc.txt
|
||||
ZIG_LIBC_TXT="$(pwd)/libc.txt"
|
||||
|
||||
ZIG_LIBC=libc.txt stage2/bin/zig build \
|
||||
--prefix stage3-release \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
ZIG_LIBC="$ZIG_LIBC_TXT" samu install
|
||||
|
||||
# Here we skip some tests to save time.
|
||||
stage3-release/bin/zig build test docs \
|
||||
stage3/bin/zig build test docs \
|
||||
-Dstatic-llvm \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dskip-stage1 \
|
||||
-Dskip-non-native
|
||||
|
||||
if [ -f ~/.s3cfg ]; then
|
||||
mv ../LICENSE stage3-release/
|
||||
mv ../zig-cache/langref.html stage3-release/
|
||||
mv stage3-release/bin/zig stage3-release/
|
||||
rmdir stage3-release/bin
|
||||
mv ../LICENSE stage3/
|
||||
mv ../zig-cache/langref.html stage3/
|
||||
mv stage3/bin/zig stage3/
|
||||
rmdir stage3/bin
|
||||
|
||||
GITBRANCH=$(basename $GITHUB_REF)
|
||||
VERSION=$(stage3-release/zig version)
|
||||
VERSION=$(stage3/zig version)
|
||||
DIRNAME="zig-freebsd-x86_64-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv stage3-release "$DIRNAME"
|
||||
mv stage3 "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
|
|
|||
20
ci/zinc/build_aarch64_macos
Executable file
20
ci/zinc/build_aarch64_macos
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
|
||||
TARGET="aarch64-macos-none"
|
||||
MCPU="apple_a14"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET"
|
||||
SEARCH_PREFIX="/deps/$TARGET"
|
||||
|
||||
"$RELEASE_STAGING/bin/zig" build \
|
||||
--prefix "$INSTALL_PREFIX" \
|
||||
--search-prefix "$SEARCH_PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Dmcpu="$MCPU" \
|
||||
-Denable-stage1
|
||||
10
ci/zinc/configure_git
Executable file
10
ci/zinc/configure_git
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake commands that follow.
|
||||
# This is in its own script because git does not support this command
|
||||
# being run concurrently with itself.
|
||||
git config core.abbrev 9
|
||||
|
|
@ -9,17 +9,33 @@ workspace:
|
|||
path: /workspace
|
||||
|
||||
steps:
|
||||
- name: test_stage3_debug
|
||||
image: ci/debian-amd64:11.1-8
|
||||
- name: configure_git
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/linux_test_stage3_debug.sh
|
||||
- ./ci/zinc/configure_git
|
||||
|
||||
- name: test_stage3_debug
|
||||
depends_on:
|
||||
- configure_git
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/linux_test_stage3_debug
|
||||
|
||||
- name: test_stage3_release
|
||||
image: ci/debian-amd64:11.1-8
|
||||
depends_on:
|
||||
- configure_git
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/linux_test_stage3_release.sh
|
||||
- ./ci/zinc/linux_test_stage3_release
|
||||
|
||||
- name: package
|
||||
- name: build_aarch64_macos
|
||||
depends_on:
|
||||
- test_stage3_release
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/build_aarch64_macos
|
||||
|
||||
- name: linux_package
|
||||
depends_on:
|
||||
- test_stage3_debug
|
||||
- test_stage3_release
|
||||
|
|
@ -28,13 +44,40 @@ steps:
|
|||
- master
|
||||
event:
|
||||
- push
|
||||
image: ci/debian-amd64:11.1-8
|
||||
image: ci/debian-amd64:11.1-9
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: AWS_SECRET_ACCESS_KEY
|
||||
commands:
|
||||
- ./ci/zinc/linux_package
|
||||
|
||||
- name: macos_package
|
||||
depends_on:
|
||||
- test_stage3_debug
|
||||
- build_aarch64_macos
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
image: ci/debian-amd64:11.1-9
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: AWS_SECRET_ACCESS_KEY
|
||||
commands:
|
||||
- ./ci/zinc/macos_package
|
||||
|
||||
- name: notify_lavahut
|
||||
depends_on:
|
||||
- macos_package
|
||||
- linux_package
|
||||
image: ci/debian-amd64:11.1-9
|
||||
environment:
|
||||
SRHT_OAUTH_TOKEN:
|
||||
from_secret: SRHT_OAUTH_TOKEN
|
||||
commands:
|
||||
- ./ci/zinc/linux_package.sh
|
||||
- ./ci/zinc/notify_lavahut
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# https://docs.drone.io/pipeline/docker/syntax/workspace/
|
||||
#
|
||||
# Drone automatically creates a temporary volume, known as your workspace,
|
||||
# where it clones your repository. The workspace is the current working
|
||||
# directory for each step in your pipeline.
|
||||
#
|
||||
# Because the workspace is a volume, filesystem changes are persisted between
|
||||
# pipeline steps. In other words, individual steps can communicate and share
|
||||
# state using the filesystem.
|
||||
#
|
||||
# Workspace volumes are ephemeral. They are created when the pipeline starts
|
||||
# and destroyed after the pipeline completes.
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
DEPS_LOCAL="/deps/local"
|
||||
WORKSPACE="$DRONE_WORKSPACE"
|
||||
|
||||
DEBUG_STAGING="$WORKSPACE/_debug/staging"
|
||||
RELEASE_STAGING="$WORKSPACE/_release/staging"
|
||||
|
||||
export PATH=$DEPS_LOCAL/bin:$PATH
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake commands that follow.
|
||||
git config core.abbrev 9
|
||||
|
|
@ -1,22 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/zinc/linux_base.sh
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
OS="linux"
|
||||
RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
|
||||
VERSION=$($RELEASE_STAGING/bin/zig version)
|
||||
BASENAME="zig-$OS-$ARCH-$VERSION"
|
||||
TARBALL="$BASENAME.tar.xz"
|
||||
|
||||
# This runs concurrently with the macos_package script, so it should not make
|
||||
# any changes to the filesystem that will cause problems for the other script.
|
||||
|
||||
cp -r "$RELEASE_STAGING" "$BASENAME"
|
||||
|
||||
# Remove the unnecessary bin dir in $prefix/bin/zig
|
||||
mv $RELEASE_STAGING/bin/zig $RELEASE_STAGING/
|
||||
rmdir $RELEASE_STAGING/bin
|
||||
mv $BASENAME/bin/zig $BASENAME/
|
||||
rmdir $BASENAME/bin
|
||||
|
||||
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
|
||||
mv $RELEASE_STAGING/lib/zig $RELEASE_STAGING/lib2
|
||||
rmdir $RELEASE_STAGING/lib
|
||||
mv $RELEASE_STAGING/lib2 $RELEASE_STAGING/lib
|
||||
mv $BASENAME/lib/zig $BASENAME/lib2
|
||||
rmdir $BASENAME/lib
|
||||
mv $BASENAME/lib2 $BASENAME/lib
|
||||
|
||||
VERSION=$($RELEASE_STAGING/zig version)
|
||||
BASENAME="zig-linux-$ARCH-$VERSION"
|
||||
TARBALL="$BASENAME.tar.xz"
|
||||
mv "$RELEASE_STAGING" "$BASENAME"
|
||||
tar cfJ "$TARBALL" "$BASENAME"
|
||||
ls -l "$TARBALL"
|
||||
|
||||
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $TARBALL)
|
||||
|
|
@ -31,15 +39,7 @@ echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
|
|||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
# Publish manifest.
|
||||
s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
|
||||
|
||||
# Avoid leaking oauth token.
|
||||
set +x
|
||||
|
||||
cd $WORKSPACE
|
||||
./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
|
||||
|
||||
set -x
|
||||
s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json"
|
||||
|
||||
# Explicit exit helps show last command duration.
|
||||
exit
|
||||
|
|
@ -1,11 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/zinc/linux_base.sh
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
DEPS_LOCAL="/deps/local"
|
||||
OLD_ZIG="$DEPS_LOCAL/bin/zig"
|
||||
TARGET="${ARCH}-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
export PATH=$DEPS_LOCAL/bin:$PATH
|
||||
|
||||
echo "building stage3-debug with zig version $($OLD_ZIG version)"
|
||||
|
||||
# Override the cache directories so that we don't clobber with the release
|
||||
|
|
@ -20,12 +25,11 @@ export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
|
|||
mkdir build-debug
|
||||
cd build-debug
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/stage3" \
|
||||
-DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_USE_LLVM_CONFIG=OFF \
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
|
|
@ -35,21 +39,17 @@ unset CXX
|
|||
|
||||
ninja install
|
||||
|
||||
cd $WORKSPACE
|
||||
|
||||
"$DEBUG_STAGING/bin/zig" build -p stage3 -Denable-stage1 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL"
|
||||
echo "Looking for non-conforming code formatting..."
|
||||
stage3/bin/zig fmt --check .. \
|
||||
--exclude ../test/cases/ \
|
||||
--exclude ../build-debug \
|
||||
--exclude ../build-release \
|
||||
--exclude "$ZIG_LOCAL_CACHE_DIR" \
|
||||
--exclude "$ZIG_GLOBAL_CACHE_DIR"
|
||||
|
||||
# simultaneously test building self-hosted without LLVM and with 32-bit arm
|
||||
stage3/bin/zig build -Dtarget=arm-linux-musleabihf
|
||||
|
||||
echo "Looking for non-conforming code formatting..."
|
||||
stage3/bin/zig fmt --check . \
|
||||
--exclude test/cases/ \
|
||||
--exclude build-debug \
|
||||
--exclude build-release \
|
||||
--exclude "$ZIG_LOCAL_CACHE_DIR" \
|
||||
--exclude "$ZIG_GLOBAL_CACHE_DIR"
|
||||
|
||||
stage3/bin/zig build test \
|
||||
-fqemu \
|
||||
-fwasmtime \
|
||||
58
ci/zinc/linux_test_stage3_release
Executable file
58
ci/zinc/linux_test_stage3_release
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
DEPS_LOCAL="/deps/local"
|
||||
RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
|
||||
OLD_ZIG="$DEPS_LOCAL/bin/zig"
|
||||
TARGET="${ARCH}-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
export PATH=$DEPS_LOCAL/bin:$PATH
|
||||
|
||||
echo "building stage3-release with zig version $($OLD_ZIG version)"
|
||||
|
||||
export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$RELEASE_STAGING" \
|
||||
-DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
"$RELEASE_STAGING/bin/zig" build test docs \
|
||||
-fqemu \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$DEPS_LOCAL"
|
||||
|
||||
# Produce the experimental std lib documentation.
|
||||
mkdir -p "$RELEASE_STAGING/docs/std"
|
||||
"$RELEASE_STAGING/bin/zig" test ../lib/std/std.zig \
|
||||
-femit-docs=$RELEASE_STAGING/docs/std \
|
||||
-fno-emit-bin
|
||||
|
||||
cp ../LICENSE $RELEASE_STAGING/
|
||||
cp ../zig-cache/langref.html $RELEASE_STAGING/docs/
|
||||
|
||||
# Look for HTML errors.
|
||||
tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html
|
||||
|
||||
# Explicit exit helps show last command duration.
|
||||
exit
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./ci/zinc/linux_base.sh
|
||||
|
||||
OLD_ZIG="$DEPS_LOCAL/bin/zig"
|
||||
TARGET="${ARCH}-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
echo "building stage3-release with zig version $($OLD_ZIG version)"
|
||||
|
||||
export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
mkdir build-release
|
||||
cd build-release
|
||||
STAGE2_PREFIX="$(pwd)/stage2"
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$STAGE2_PREFIX" \
|
||||
-DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-GNinja
|
||||
|
||||
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
|
||||
# so that installation and testing do not get affected by them.
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
ninja install
|
||||
|
||||
# Here we rebuild zig but this time using the Zig binary we just now produced to
|
||||
# build zig1.o rather than relying on the one built with stage0. See
|
||||
# https://github.com/ziglang/zig/issues/6830 for more details.
|
||||
cmake .. -DZIG_EXECUTABLE="$STAGE2_PREFIX/bin/zig"
|
||||
ninja install
|
||||
|
||||
# This is the binary we will distribute. We intentionally test this one in this
|
||||
# script. If any test failures occur, hopefully they also occur in the debug
|
||||
# version of this script for easier troubleshooting. This prevents distribution
|
||||
# of a Zig binary that passes tests in debug mode but has a miscompilation in
|
||||
# release mode.
|
||||
"$STAGE2_PREFIX/bin/zig" build \
|
||||
--prefix "$RELEASE_STAGING" \
|
||||
--search-prefix "$DEPS_LOCAL" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
||||
cd $WORKSPACE
|
||||
|
||||
ZIG="$RELEASE_STAGING/bin/zig"
|
||||
|
||||
$ZIG build test docs \
|
||||
-fqemu \
|
||||
-fwasmtime \
|
||||
-Dstatic-llvm \
|
||||
-Dtarget=native-native-musl \
|
||||
--search-prefix "$DEPS_LOCAL"
|
||||
|
||||
# Produce the experimental std lib documentation.
|
||||
mkdir -p "$RELEASE_STAGING/docs/std"
|
||||
$ZIG test lib/std/std.zig \
|
||||
--zig-lib-dir lib \
|
||||
-femit-docs=$RELEASE_STAGING/docs/std \
|
||||
-fno-emit-bin
|
||||
|
||||
cp LICENSE $RELEASE_STAGING/
|
||||
cp zig-cache/langref.html $RELEASE_STAGING/docs/
|
||||
|
||||
# Look for HTML errors.
|
||||
tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html
|
||||
|
||||
# Explicit exit helps show last command duration.
|
||||
exit
|
||||
49
ci/zinc/macos_package
Executable file
49
ci/zinc/macos_package
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="aarch64"
|
||||
OS=macos
|
||||
ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging"
|
||||
VERSION=$($ZIG_PREFIX/bin/zig version)
|
||||
TARGET="$ARCH-$OS-none"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET"
|
||||
BASENAME="zig-$OS-$ARCH-$VERSION"
|
||||
TARBALL="$BASENAME.tar.xz"
|
||||
|
||||
# This runs concurrently with the linux_package script, so it should not make
|
||||
# any changes to the filesystem that will cause problems for the other script.
|
||||
|
||||
# Remove the unnecessary bin dir in $prefix/bin/zig
|
||||
mv $INSTALL_PREFIX/bin/zig $INSTALL_PREFIX/
|
||||
rmdir $INSTALL_PREFIX/bin
|
||||
|
||||
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
|
||||
mv $INSTALL_PREFIX/lib/zig $INSTALL_PREFIX/lib2
|
||||
rmdir $INSTALL_PREFIX/lib
|
||||
mv $INSTALL_PREFIX/lib2 $INSTALL_PREFIX/lib
|
||||
|
||||
cp -r "$ZIG_PREFIX/docs" "$INSTALL_PREFIX/"
|
||||
cp "$ZIG_PREFIX/LICENSE" "$INSTALL_PREFIX/"
|
||||
|
||||
mv "$INSTALL_PREFIX" "$BASENAME"
|
||||
tar cfJ "$TARBALL" "$BASENAME"
|
||||
|
||||
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $TARBALL)
|
||||
|
||||
MANIFEST="manifest.json"
|
||||
touch $MANIFEST
|
||||
echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST
|
||||
echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST
|
||||
echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
|
||||
|
||||
# Publish artifact.
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
# Publish manifest.
|
||||
s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json"
|
||||
|
||||
# Explicit exit helps show last command duration.
|
||||
exit
|
||||
9
ci/zinc/notify_lavahut
Executable file
9
ci/zinc/notify_lavahut
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
set +x # Avoid leaking oauth token.
|
||||
set -e
|
||||
|
||||
ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging"
|
||||
VERSION=$($ZIG_PREFIX/bin/zig version)
|
||||
cd $DRONE_WORKSPACE
|
||||
./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
message("-- Installing: ${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
if(NOT EXISTS ${zig_EXE})
|
||||
message("::")
|
||||
message(":: ERROR: Executable not found")
|
||||
message(":: (execute_process)")
|
||||
message("::")
|
||||
message(":: executable: ${zig_EXE}")
|
||||
message("::")
|
||||
message(FATAL_ERROR)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${zig_EXE} ${ZIG_INSTALL_ARGS}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE _result
|
||||
)
|
||||
if(_result)
|
||||
message("::")
|
||||
message(":: ERROR: ${_result}")
|
||||
message(":: (execute_process)")
|
||||
|
||||
string(REPLACE ";" " " s_INSTALL_LIBSTAGE2_ARGS "${ZIG_INSTALL_ARGS}")
|
||||
message("::")
|
||||
message(":: argv: ${zig_EXE} ${s_INSTALL_LIBSTAGE2_ARGS}")
|
||||
|
||||
set(_args ${zig_EXE} ${ZIG_INSTALL_ARGS})
|
||||
list(LENGTH _args _len)
|
||||
math(EXPR _len "${_len} - 1")
|
||||
message("::")
|
||||
foreach(_i RANGE 0 ${_len})
|
||||
list(GET _args ${_i} _arg)
|
||||
message(":: argv[${_i}]: ${_arg}")
|
||||
endforeach()
|
||||
|
||||
message("::")
|
||||
message(FATAL_ERROR)
|
||||
endif()
|
||||
|
|
@ -43,7 +43,11 @@ pub const Header = extern struct {
|
|||
instructions_len: u32,
|
||||
string_bytes_len: u32,
|
||||
extra_len: u32,
|
||||
|
||||
/// We could leave this as padding, however it triggers a Valgrind warning because
|
||||
/// we read and write undefined bytes to the file system. This is harmless, but
|
||||
/// it's essentially free to have a zero field here and makes the warning go away,
|
||||
/// making it more likely that following Valgrind warnings will be taken seriously.
|
||||
unused: u32 = 0,
|
||||
stat_inode: std.fs.File.INode,
|
||||
stat_size: u64,
|
||||
stat_mtime: i128,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue