summaryrefslogtreecommitdiff
path: root/osxcrossbuild
diff options
context:
space:
mode:
authorNick White <git@njw.name>2022-02-23 16:40:02 +0000
committerNick White <git@njw.name>2022-02-23 16:40:02 +0000
commit7cf1d3a0d014a6a7f940262574c95260cbce5fc5 (patch)
tree55d9eaca21943c17ca70d13780399e8a82468dc6 /osxcrossbuild
parentcac42fb80ab31443dc507297b99c8704a397b2d8 (diff)
Add osxcrossbuild script to build a portable version on osx using osxcross
Diffstat (limited to 'osxcrossbuild')
-rwxr-xr-xosxcrossbuild24
1 files changed, 24 insertions, 0 deletions
diff --git a/osxcrossbuild b/osxcrossbuild
new file mode 100755
index 0000000..89bb50b
--- /dev/null
+++ b/osxcrossbuild
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+OPENSSL="$HOME/tmp/openssl-1.1.1m-universal"
+OSXCROSSBIN="$HOME/src/osxcross/target/bin"
+
+export PATH="$PATH:$OSXCROSSBIN"
+
+make clean || exit 1
+rm -f getgbook.amd64 getgbook.arm64
+
+make LDFLAGS="-lssl -lcrypto -L$OPENSSL" CC=o64-clang AR=x86_64-apple-darwin20.4-ar getgbook || exit 1
+x86_64-apple-darwin20.4-install_name_tool -change /usr/local/lib/libssl.1.1.dylib @executable_path/libssl.1.1.dylib getgbook
+x86_64-apple-darwin20.4-install_name_tool -change /usr/local/lib/libcrypto.1.1.dylib @executable_path/libcrypto.1.1.dylib getgbook || exit 1
+mv getgbook getgbook.amd64
+
+make clean || exit 1
+
+make LDFLAGS="-lssl -lcrypto -L$OPENSSL" CC=oa64-clang AR=x86_64-apple-darwin20.4-ar getgbook || exit 1
+arm64-apple-darwin20.4-install_name_tool -change /usr/local/lib/libssl.1.1.dylib @executable_path/libssl.1.1.dylib getgbook || exit 1
+arm64-apple-darwin20.4-install_name_tool -change /usr/local/lib/libcrypto.1.1.dylib @executable_path/libcrypto.1.1.dylib getgbook || exit 1
+mv getgbook getgbook.arm64
+
+lipo -create getgbook.amd64 getgbook.arm64 -output getgbook || exit 1
+rm getgbook.amd64 getgbook.arm64