aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-02-10 00:10:27 -0800
committerBryan Newbold <bnewbold@archive.org>2021-02-10 00:10:27 -0800
commita2ce9d6586809a4fa4f2e441732c9bc4687375ec (patch)
tree8606ed41f253a0f7d69c2f713131406abdb2dc99
parentefdc17248cbf8336f28c377a301752604fb6db74 (diff)
downloadfatcat-cli-a2ce9d6586809a4fa4f2e441732c9bc4687375ec.tar.gz
fatcat-cli-a2ce9d6586809a4fa4f2e441732c9bc4687375ec.zip
cross-compilation helper scripts for macOS
-rwxr-xr-xextra/build_macos.sh26
-rwxr-xr-xextra/osxcross_setup.sh7
2 files changed, 33 insertions, 0 deletions
diff --git a/extra/build_macos.sh b/extra/build_macos.sh
new file mode 100755
index 0000000..5990436
--- /dev/null
+++ b/extra/build_macos.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+MACOS_TARGET="x86_64-apple-darwin"
+
+echo "Building target for platform ${MACOS_TARGET}"
+echo
+
+# Add osxcross toolchain to path
+export PATH="$(pwd)/osxcross/target/bin:$PATH"
+
+# Make libz-sys (git2-rs -> libgit2-sys -> libz-sys) build as a statically linked lib
+# This prevents the host zlib from being linked
+export LIBZ_SYS_STATIC=1
+
+# make libsodium happy
+export PKG_CONFIG_ALLOW_CROSS=1
+#export SODIUM_USE_PKG_CONFIG=1
+
+# Use Clang for C/C++ builds
+export CC=o64-clang
+export CXX=o64-clang++
+
+cargo build --release --target "${MACOS_TARGET}"
+
+echo
+echo Done
diff --git a/extra/osxcross_setup.sh b/extra/osxcross_setup.sh
new file mode 100755
index 0000000..c0ae94f
--- /dev/null
+++ b/extra/osxcross_setup.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+git clone https://github.com/tpoechtrager/osxcross
+cd osxcross
+wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
+mv MacOSX10.10.sdk.tar.xz tarballs/
+UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh