Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rust binding to bundle sqlcipher for swift #915

Merged
merged 7 commits into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions bindings_ffi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ PROJECT_NAME = xmtpv3
# Simulator config
ARCHS_IOS = x86_64-apple-ios aarch64-apple-ios-sim
ARCHS_MAC = x86_64-apple-darwin aarch64-apple-darwin
# Not used
# ARCHS_MACCATALYST = x86_64-apple-ios-macabi aarch64-apple-ios-macabi
LIB=libxmtpv3.a
JAR_DIR=$(shell pwd)/tests/jar
SQLCIPHER_DIR=$(shell pwd)/sqlcipher
SQLCIPHER_LIB=$(SQLCIPHER_DIR)/.libs/libsqlcipher.a
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
GIT_COMMIT_HASH=$(shell git log -1 --pretty=format:"%h")
GIT_COMMIT_DATE=$(shell TZ=UTC git log -1 --date=iso-local --pretty=format:"%ad")
Expand All @@ -28,22 +28,30 @@ download-toolchains:
rustup target add $(ARCHS_MAC)
rustup target add aarch64-apple-ios

download-sqlcipher:
git clone https://github.com/sqlcipher/sqlcipher.git $(SQLCIPHER_DIR)

build-sqlcipher:
cd $(SQLCIPHER_DIR) && \
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" && \
make

all: framework

libxmtp-version:
echo "Version: $(GIT_COMMIT_HASH)\nBranch: $(GIT_BRANCH)\nDate: $(GIT_COMMIT_DATE)" > libxmtp-version.txt

$(ARCHS_IOS): %:
$(ARCHS_IOS): %: build-sqlcipher
cross build --target $@ --target-dir ./target --release --no-default-features
mkdir -p build/$@
mv target/$@/release/$(LIB) build/$@/$(LIB)

$(ARCHS_MAC): %:
$(ARCHS_MAC): %: build-sqlcipher
cross build --target $@ --target-dir ./target --release --no-default-features
mkdir -p build/$@
mv target/$@/release/$(LIB) build/$@/$(LIB)

aarch64-apple-ios:
aarch64-apple-ios: build-sqlcipher
cross build --target $@ --target-dir ./target --release
mkdir -p build/$@
mv target/$@/release/$(LIB) build/$@/$(LIB)
Expand Down Expand Up @@ -85,4 +93,4 @@ swift: libxmtp-version

swiftlocal: libxmtpv3.a swift framework

.PHONY: $(ARCHS_IOS) $(ARCHS_MAC) framework all aarch64-apple-ios install-jar echo-jar download-toolchains swift lipo
.PHONY: $(ARCHS_IOS) $(ARCHS_MAC) framework all aarch64-apple-ios install-jar echo-jar download-toolchains swift lipo download-sqlcipher build-sqlcipher
Loading