### Motivation Mac Catalyst builds stopped working when `cc-rs` got updated by dependabot in the `rust-mbedtls` dependency of `mobilecoin` and `libmobilecoin`. ### In this PR * Update `mobilecoin` repo commit to newer that includes a previous `mbedtls` big-num multiplication fix. * Patch `cc-rs` with new compiler args so mac-catalyst will build correctly * Patch `cmake-rs` with changes so mac-catalyst will build correctly * Patch `rust-mbedtls` with above changes so it can build mac-catalyst * Patch `libmobilecoin` with above patches * Add `patch-cmake.sh` script on the local machine to workaround a restriction of `cmake` where the CMAKE_SYSTEM_NAME cannot be iOS with a CMAKE_OSX_SYSROOT pointing to a MacOSX sdk. The patched `cmake` files in this context comes from brew as a build dependency. An un-patch script is included as well. ' * re-add back in old implementations of functions for `...add_output` and `...add_change_output` for the Transaction Builder that have the old sig and pull the tokenId from the TransactionBuilder. The new versions which support "mixed" transactions for "SCI" get the "_mixed" suffix. * Change deployment target to 11.0 * Fix dependency hell w/ cocoapods & Xcode 14, etc... ### Future Work Find a fix that doesn't require patching `cmake` locally. Merge the patches upstream into master-repo's main branches. Fix SwiftNIO catomic issue in Swift repo
116 lines
3.1 KiB
Makefile
116 lines
3.1 KiB
Makefile
MOBILECOIN_DIR = Vendor/mobilecoin
|
|
LIBMOBILECOIN_LIB_DIR = libmobilecoin
|
|
LIBMOBILECOIN_ARTIFACTS_DIR = $(LIBMOBILECOIN_LIB_DIR)/out/ios
|
|
LIBMOBILECOIN_ARTIFACTS_HEADERS = $(LIBMOBILECOIN_LIB_DIR)/out/ios/include
|
|
ARTIFACTS_DIR = Artifacts
|
|
IOS_TARGETS = aarch64-apple-ios aarch64-apple-ios-sim aarch64-apple-ios-macabi x86_64-apple-ios x86_64-apple-ios-macabi
|
|
LIBMOBILECOIN_PROFILE = mobile-release
|
|
|
|
define BINARY_copy
|
|
$(foreach arch,$(IOS_TARGETS),cp $(LIBMOBILECOIN_ARTIFACTS_DIR)/$(1)/$(arch)/$(LIBMOBILECOIN_PROFILE)/libmobilecoin.a $(ARTIFACTS_DIR)/target/$(arch)/release/libmobilecoin.a;)
|
|
endef
|
|
|
|
.PHONY: default
|
|
default: setup build clean-artifacts copy generate
|
|
|
|
.PHONY: setup
|
|
setup:
|
|
cd "$(LIBMOBILECOIN_LIB_DIR)"
|
|
bundle install
|
|
|
|
# Unexport conditional environment variables so the build is more predictable
|
|
unexport SGX_MODE
|
|
unexport IAS_MODE
|
|
unexport CARGO_BUILD_FLAGS
|
|
unexport CARGO_TARGET_DIR
|
|
unexport CARGO_PROFILE
|
|
|
|
.PHONY: build
|
|
build:
|
|
cd "$(LIBMOBILECOIN_LIB_DIR)" && $(MAKE)
|
|
|
|
.PHONY: clean-artifacts
|
|
clean-artifacts:
|
|
rm -r "$(ARTIFACTS_DIR)" 2>/dev/null || true
|
|
mkdir -p "$(ARTIFACTS_DIR)"
|
|
|
|
# Create arch specific folders for each lib
|
|
$(foreach arch,$(IOS_TARGETS),mkdir -p $(ARTIFACTS_DIR)/target/$(arch)/release;)
|
|
|
|
.PHONY: copy
|
|
copy:
|
|
$(call BINARY_copy,target)
|
|
cp -R "$(LIBMOBILECOIN_ARTIFACTS_HEADERS)" "$(ARTIFACTS_DIR)"
|
|
|
|
.PHONY: generate
|
|
generate:
|
|
rm -r Sources/Generated/Proto 2>/dev/null || true
|
|
DOCKER_BUILDKIT=1 docker build . \
|
|
--build-arg grpc_swift_version=1.0.0 \
|
|
--output .
|
|
|
|
.PHONY: lint
|
|
lint: lint-podspec
|
|
|
|
.PHONY: lint-locally
|
|
lint-locally: lint-locally-podspec
|
|
|
|
.PHONY: publish
|
|
publish: tag-release publish-podspec
|
|
|
|
.PHONY: publish-hotfix
|
|
publish-hotfix: tag-hotfix publish-podspec
|
|
|
|
.PHONY: push-generated
|
|
push-generated:
|
|
git add Artifacts/*
|
|
git add Sources/Generated/Proto/*
|
|
if ! git diff-index --quiet HEAD; then \
|
|
git commit -m '[skip ci] commit build Artifacts and generated protos from build machine'; \
|
|
git push origin HEAD; \
|
|
fi
|
|
|
|
# Release
|
|
|
|
.PHONY: tag-release
|
|
tag-release:
|
|
@[[ "$$(git rev-parse --abbrev-ref HEAD)" == "master" ]] || \
|
|
{ echo 'Error: Must be on branch "master" when tagging a release.'; exit 1; }
|
|
VERSION="$$(bundle exec pod ipc spec LibMobileCoin.podspec | jq -r '.version')" && \
|
|
git tag "v$$VERSION" && \
|
|
git push git@github.com:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/v$$VERSION"
|
|
|
|
.PHONY: tag-hotfix
|
|
tag-hotfix:
|
|
VERSION="$$(bundle exec pod ipc spec LibMobileCoin.podspec | jq -r '.version')" && \
|
|
git tag "v$$VERSION" && \
|
|
git push git@github.com:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/v$$VERSION"
|
|
|
|
# LibMobileCoin pod
|
|
|
|
.PHONY: lint-locally-podspec
|
|
lint-locally-podspec:
|
|
bundle exec pod lib lint LibMobileCoin.podspec --allow-warnings
|
|
|
|
.PHONY: lint-podspec
|
|
lint-podspec:
|
|
bundle exec pod spec lint LibMobileCoin.podspec --allow-warnings
|
|
|
|
.PHONY: publish-podspec
|
|
publish-podspec:
|
|
bundle exec pod trunk push LibMobileCoin.podspec --allow-warnings
|
|
|
|
.PHONY: patch-cmake
|
|
patch-cmake:
|
|
tools/patch-cmake.sh
|
|
|
|
.PHONY: unpatch-cmake
|
|
unpatch-cmake:
|
|
tools/unpatch-cmake.sh
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(MAKE) -C libmobilecoin clean
|
|
@rm -r $(MOBILECOIN_DIR)/target 2>/dev/null || true
|
|
|