0
0
mirror of https://github.com/cjdelisle/cjdns synced 2025-10-05 16:22:54 +02:00
Files
cjdns/windows_do
wiryhatbox 575c54933a Make script safer with set -e
Quote variables

More portable
2024-07-04 23:53:26 +03:00

37 lines
1001 B
Bash
Executable File

#!/bin/sh
# OSX
# brew install mingw-w64
set -e
build() {
ARCH="$1"
# libuv
export CC="${ARCH}-w64-mingw32-gcc"
if ! command -v "$CC" > /dev/null; then
printf "%s" "Skipping build for $ARCH because $CC is not installed"
return
fi
if [ ! -d "$(rustc --target "${ARCH}-pc-windows-gnu" --print target-libdir)" ]; then
printf "%s" "Skipping build for $ARCH because rust target ${ARCH}-pc-windows-gnu is not installed"
printf "%s" "You can install it with rustup using: \`rustup target add ${ARCH}-pc-windows-gnu\`"
return
fi
# Used by cjdns libuv build
export AR="${ARCH}-w64-mingw32-ar"
export RANLIB="${ARCH}-w64-mingw32-gcc-ranlib"
export TARGET="${ARCH}-w64-mingw32"
# Used by cjdns nodejs build
export CROSS=1
export SYSTEM=win32
cargo build --release -vv --target="${ARCH}-pc-windows-gnu"
}
# build i686 - impossible because rust: https://github.com/rust-lang/rust/issues/12859
build x86_64