ORIG_PWD="$(pwd)"
cd "$1"
LIGHTNING_PATH="$(pwd)"
-LIGHTNING_GIT="$(git describe --tag --dirty)"
+LIGHTNING_GIT="$(git describe --tag --dirty --abbrev=16)"
cd "$ORIG_PWD"
# Generate (and reasonably test) C bindings
git checkout lightning-c-bindings/src
git checkout lightning-c-bindings/include
-BINDINGS_GIT="$(git describe --tag --dirty)"
+BINDINGS_GIT="$(git describe --tag --dirty --abbrev=16)"
echo -e "#ifndef _LDK_HEADER_VER" > lightning-c-bindings/include/ldk_ver.h
echo -e "static inline int _ldk_strncmp(const char *s1, const char *s2, uint64_t n) {" >> lightning-c-bindings/include/ldk_ver.h
echo -e "\tif (n && *s1 != *s2) return 1;" >> lightning-c-bindings/include/ldk_ver.h
# Now that we've done our last non-LTO build, turn on LTO in CFLAGS as well
export BASE_CFLAGS="-ffile-prefix-map=$HOME/.cargo= -frandom-seed=42"
ENV_TARGET=$(rustc --version --verbose | grep host | awk '{ print $2 }' | sed 's/-/_/g')
-export CFLAGS_$ENV_TARGET="$BASE_CFLAGS -march=sandybridge -mcpu=sandybridge -mtune=sandybridge"
+case "$ENV_TARGET" in
+ "x86_64"*)
+ export RUSTFLAGS="$RUSTFLAGS -C target-cpu=sandybridge"
+ export CFLAGS_$ENV_TARGET="$BASE_CFLAGS -march=sandybridge -mcpu=sandybridge -mtune=sandybridge"
+ ;;
+ *)
+ # Assume this isn't targeted at another host and build for the host's CPU.
+ export RUSTFLAGS="$RUSTFLAGS -C target-cpu=native"
+ export CFLAGS_$ENV_TARGET="$BASE_CFLAGS -mcpu=native"
+ ;;
+esac
rm genbindings_path_map_test_file.c
cargo build