Skip to content

Instantly share code, notes, and snippets.

@thomcc
Last active August 8, 2018 23:58
Show Gist options
  • Save thomcc/0ee5b9cf5efcb0b13f09f8dc06266362 to your computer and use it in GitHub Desktop.
Save thomcc/0ee5b9cf5efcb0b13f09f8dc06266362 to your computer and use it in GitHub Desktop.
local build script for libloginsapi_ffi.so that i'm using for android. big hacks here.
#!/usr/bin/env fish
set -l target x86
set -l triple i686-linux-android
set -l appsvc_root $HOME/application-services
if not test -d $appsvc_root
# Otherwise we'll make a mess later when we mkdir -p
echo "No application services dir found at expected location"
exit 1
end
echo "Building lib"
env PATH=(string join ':' $PATH)":$ANDROID_NDK_TOOLCHAIN_DIR/$target-$ANDROID_NDK_API_VERSION/bin" \
SQLCIPHER_INCLUDE_DIR=$appsvc_root/libs/android/$target/sqlcipher/include \
SQLCIPHER_LIB_DIR=$appsvc_root/libs/android/$target/sqlcipher/lib \
OPENSSL_DIR=$appsvc_root/libs/android/$target/openssl \
cargo build --target $triple $argv
set -l sofile $appsvc_root/target/$triple/debug/libloginsapi_ffi.so
if contains -- --release $argv
set sofile $appsvc_root/target/$triple/release/libloginsapi_ffi.so
end
echo "Patching (NEEDED) in $sofile"
patchelf --replace-needed libsqlcipher.so.0 libsqlcipher.so $sofile
echo "Replacing logins-api/android/library/src/main/jniLibs/$target/libloginsapi_ffi.so"
mkdir -p $appsvc_root/logins-api/android/library/src/main/jniLibs/$target
cp $sofile $appsvc_root/logins-api/android/library/src/main/jniLibs/$target
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment