summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim De Clercq <maximdeclercq00@gmail.com>2022-01-23 15:10:42 +0100
committerMaxim De Clercq <maximdeclercq00@gmail.com>2022-01-23 15:58:19 +0100
commitfd67cd7450e33b97050372bdd13832828fa75458 (patch)
treea75ae31ecbd648bb7aab9240576e8e7d58382ccd
parentcd9902637ddf3f8e7711f01a5cf044725704e28a (diff)
downloadconduit-fd67cd7450e33b97050372bdd13832828fa75458.zip
feat: support targetting i686
-rw-r--r--.gitlab-ci.yml28
-rw-r--r--Cross.toml3
-rwxr-xr-xcross/build.sh6
3 files changed, 26 insertions, 11 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 993145a..b5a12f3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -37,7 +37,6 @@ variables:
- "rustup show && rustc --version && cargo --version" # Print version info for debugging
# If provided, bring in caching through sccache, which uses an external S3 endpoint to store compilation results:
- if [ -n "${SCCACHE_BIN_URL}" ]; then curl $SCCACHE_BIN_URL --output /sccache && chmod +x /sccache && export RUSTC_WRAPPER=/sccache; fi
- script:
# install cross-compiling prerequisites
- 'apt-get update && apt-get install -y docker.io && docker version' # install docker
- 'cargo install cross && cross --version' # install cross
@@ -46,16 +45,17 @@ variables:
- 'cp -r $CARGO_HOME/bin $SHARED_PATH/cargo'
- 'cp -r $RUSTUP_HOME $SHARED_PATH'
- 'export CARGO_HOME=$SHARED_PATH/cargo RUSTUP_HOME=$SHARED_PATH/rustup'
+ script:
# cross-compile conduit for target
- 'time ./cross/build.sh --locked --release'
- - 'cp "target/$TARGET/release/conduit" "conduit-$TARGET"'
+ - 'mv "target/$TARGET/release/conduit" "conduit-$TARGET"'
cache:
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
- - key: 'cargo-cache-$TARGET'
- paths:
- - $SHARED_PATH/cargo/registry/index
- - $SHARED_PATH/cargo/registry/cache
- - $SHARED_PATH/cargo/git/db
+ key: 'cargo-cache-$TARGET'
+ paths:
+ - $SHARED_PATH/cargo/registry/index
+ - $SHARED_PATH/cargo/registry/cache
+ - $SHARED_PATH/cargo/git/db
artifacts:
expire_in: never
@@ -82,6 +82,16 @@ build:release:cargo:x86_64-unknown-linux-musl:
- "conduit-x86_64-unknown-linux-musl"
expose_as: "Conduit for x86_64-unknown-linux-musl"
+build:release:cargo:i686-unknown-linux-musl:
+ extends: .build-cargo-shared-settings
+ variables:
+ TARGET: "i686-unknown-linux-musl"
+ artifacts:
+ name: "conduit-i686-unknown-linux-musl"
+ paths:
+ - "conduit-i686-unknown-linux-musl"
+ expose_as: "Conduit for i686-unknown-linux-musl"
+
build:release:cargo:arm-unknown-linux-musleabihf:
extends: .build-cargo-shared-settings
variables:
@@ -119,14 +129,14 @@ build:release:cargo:aarch64-unknown-linux-musl:
cache:
key: "build_cache--$TARGET--$CI_COMMIT_BRANCH--debug"
script:
- - "time cargo build --target $TARGET"
+ # cross-compile conduit for target
+ - 'time ./cross/build.sh --locked'
- 'mv "target/$TARGET/debug/conduit" "conduit-debug-$TARGET"'
artifacts:
expire_in: 4 weeks
build:debug:cargo:x86_64-unknown-linux-musl:
extends: ".cargo-debug-shared-settings"
- image: messense/rust-musl-cross:x86_64-musl
variables:
TARGET: "x86_64-unknown-linux-musl"
artifacts:
diff --git a/Cross.toml b/Cross.toml
index 491efcb..22c84b9 100644
--- a/Cross.toml
+++ b/Cross.toml
@@ -7,5 +7,8 @@ image = "rust-cross:arm-unknown-linux-musleabihf"
[target.armv7-unknown-linux-musleabihf]
image = "rust-cross:armv7-unknown-linux-musleabihf"
+[target.i686-unknown-linux-musl]
+image = "rust-cross:i686-unknown-linux-musl"
+
[target.x86_64-unknown-linux-musl]
image = "rust-cross:x86_64-unknown-linux-musl"
diff --git a/cross/build.sh b/cross/build.sh
index 4a6d449..24a2224 100755
--- a/cross/build.sh
+++ b/cross/build.sh
@@ -17,8 +17,10 @@ ENV TARGET_PREFIX="/usr/local/$(echo "${TARGET:?}" | sed -e 's/armv7/arm/' -e 's
# Make sure that cc-rs links libc/libstdc++ statically when cross-compiling
# See https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables for more information
ENV RUSTFLAGS="-L\$TARGET_PREFIX/lib" CXXSTDLIB="static=stdc++"
-# Forcefully linking against libatomic, libc and libgcc is required for arm32, otherwise symbols are missing
-$([[ $TARGET =~ arm ]] && echo 'ENV RUSTFLAGS="$RUSTFLAGS -Clink-arg=-lgcc -Clink-arg=-latomic -lstatic=c"')
+# Forcefully linking against libatomic and libgcc is required for arm32, otherwise symbols are missing
+$([[ $TARGET =~ arm ]] && echo 'ENV RUSTFLAGS="$RUSTFLAGS -Clink-arg=-lgcc -Clink-arg=-latomic"')
+# Forcefully linking against libc is required for 32-bit, otherwise symbols are missing
+$([[ $TARGET =~ arm|i686 ]] && echo 'ENV RUSTFLAGS="$RUSTFLAGS -lstatic=c"')
# Strip symbols while compiling in release mode
$([[ $@ =~ -r ]] && echo 'ENV RUSTFLAGS="$RUSTFLAGS -Clink-arg=-s"')