# build a docker image with native deps img="$PROJECT_NAME/cross-build:$TARGET" target=${TARGET^^} docker build -t "$img" -< Cross.toml [target.$TARGET] image = "$img" EOF # linker wrapper script - see rust issue #36710 cat < linker #!/bin/bash -eux args=() for arg in "\$@"; do if [[ \$arg = *"Bdynamic"* ]]; then : elif [[ \$arg = *"crti.o"* ]]; then args+=("\$arg" "\$($TARGET_CXX --print-file-name crtbeginT.o)" "-Bstatic") elif [[ \$arg = *"crtn.o"* ]]; then args+=("-lgcc" "-lgcc_eh" "-lc" "\$($TARGET_CXX --print-file-name crtend.o)" "\$arg") else args+=("\$arg") fi done # shell out to the real linker "$TARGET_CXX" "\${args[@]}" EOF chmod +x linker # override for static linking cat <> .cargo/config [target.$TARGET.botan-2] rustc-link-search = ["native=$PREFIX/lib"] rustc-link-lib = ["static=botan-2", "static=stdc++"] EOF