-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
[wip] Cleanup build script, use XCFramework #61
Changes from all commits
7d6ef31
a3976b0
5dfde8f
6d1bcab
cd21774
4588994
4050ff7
de7ecc9
16cbc4f
248a124
dde977c
b7e97ef
188794c
60ed50a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
Pod::Spec.new do |spec| | ||
|
||
spec.name = "LibWally" | ||
spec.version = "0.0.1" | ||
spec.version = "0.0.7" | ||
spec.summary = "Swift wrapper for LibWally." | ||
spec.description = "Swift wrapper for LibWally, a collection of useful primitives for cryptocurrency wallets." | ||
spec.homepage = "https://github.com/Sjors/libwally-swift" | ||
|
@@ -17,21 +17,12 @@ Pod::Spec.new do |spec| | |
spec.platform = :ios, "10" | ||
spec.swift_version = '5.0' | ||
|
||
spec.source = { :git => "https://github.com/Sjors/libwally-swift.git", :tag => "v#{spec.version}", :submodules => true } | ||
spec.source = { :git => "https://github.com/jurvis/libwally-swift.git", :tag => "v#{spec.version}", :submodules => true } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 60ed50a: don't forget to drop this. Also, I wonder if you really need that in order to test a fork. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did this to test |
||
|
||
spec.source_files = "LibWally" | ||
|
||
spec.vendored_libraries = "CLibWally/libwally-core/src/.libs/libwallycore.a" | ||
|
||
spec.pod_target_xcconfig = { | ||
'SWIFT_WHOLE_MODULE_OPTIMIZATION' => 'YES', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. de7ecc9 Why the removal? Is it deprecated? Useless? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, ignore all the diffs in |
||
'SWIFT_INCLUDE_PATHS' => '$(PODS_TARGET_SRCROOT)/CLibWally', | ||
'LIBRARY_SEARCH_PATHS' => '$(PODS_TARGET_SRCROOT)/CLibWally/libwally-core/src/.libs' | ||
} | ||
spec.preserve_paths = 'LibWally/LibWally.modulemap', 'CLibWally' | ||
|
||
spec.module_map = 'LibWally/LibWally.modulemap' | ||
spec.vendored_frameworks = "build/LibwallySwift.xcframework" | ||
|
||
spec.preserve_paths = "build/LibwallySwift.xcframework" | ||
spec.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' } | ||
spec.prepare_command = './build-libwally.sh -sdc' | ||
|
||
spec.cocoapods_version = '>= 1.10.0' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ set -e # abort if any command fails | |
device=0 | ||
simulator=0 | ||
clean=0 | ||
PROJ_DIRECTORY=`pwd` | ||
BIN_OUTPUT_DIRECTORY="`pwd`/build" | ||
|
||
while getopts "h?dsc" opt; do | ||
case "$opt" in | ||
|
@@ -33,6 +35,8 @@ if [ $device == 1 ] && [ $simulator == 1 ]; then | |
echo "Build libwally-core for device and simulator and combine into a single library..." | ||
fi | ||
|
||
rm -rf build | ||
|
||
cd CLibWally/libwally-core | ||
|
||
if [ $clean == 1 ]; then | ||
|
@@ -50,56 +54,64 @@ if [ $simulator == 1 ]; then | |
if [ ! -d "build" ]; then | ||
echo "Configure and compile for the simulator..." | ||
set -v | ||
export CFLAGS="-O3 -arch x86_64 -arch i386 -fembed-bitcode-marker -mios-simulator-version-min=10.0 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path`" | ||
export CXXFLAGS="-O3 -arch x86_64 -arch i386 -fembed-bitcode-marker -mios-simulator-version-min=10.0 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path`" | ||
export CFLAGS="-O3 -arch arm64 -arch x86_64 -fembed-bitcode-marker -mios-simulator-version-min=11.0 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path`" | ||
export CXXFLAGS="-O3 -arch arm64 -arch x86_64 -fembed-bitcode-marker -mios-simulator-version-min=11.0 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path`" | ||
mkdir -p build | ||
|
||
architecture=$(uname -m) | ||
arch_target="x86_64-apple-darwin" | ||
|
||
if [ "$architecture" = "arm64" ]; then | ||
arch_target="aarch64-apple-darwin" | ||
fi | ||
|
||
./configure --disable-shared --host=$arch_target --enable-static --disable-elements | ||
./configure --disable-shared --host=aarch64-apple-darwin --enable-static --disable-elements | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 7d6ef31: why would this work on an intel mac? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch, it probably won't. I just hard-coded it for now and can fix it later 😄 |
||
|
||
if [ $clean == 1 ]; then | ||
set -v # display commands | ||
make clean | ||
fi | ||
fi | ||
make | ||
if [ $device == 1 ]; then | ||
cp src/.libs/libwallycore.a build/libwallycore-simulator.a | ||
cd $PROJ_DIRECTORY | ||
xcodebuild archive -scheme LibWally -destination "generic/platform=iOS Simulator" -archivePath ${BIN_OUTPUT_DIRECTORY}/LibwallySwift-Sim ONLY_ACTIVE_ARCH=NO SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dde977c: please squash when you find the right ones :-) |
||
if [ $device != 1 ]; then | ||
xcodebuild -create-xcframework \ | ||
-framework ${BIN_OUTPUT_DIRECTORY}/LibwallySwift-Sim.xcarchive/Products/Library/Frameworks/LibWally.framework \ | ||
-output ${BIN_OUTPUT_DIRECTORY}/LibwallySwift.xcframework | ||
fi | ||
fi | ||
|
||
if [ $device == 1 ]; then | ||
cd CLibWally/libwally-core | ||
set +v | ||
if [ ! -d "build" ] || [ $clean == 1 ]; then | ||
echo "Configure and cross-compile for the device..." | ||
set -v | ||
export CFLAGS="-O3 -arch arm64 -arch arm64e -arch armv7 -arch armv7s -fembed-bitcode -mios-version-min=10.0 -isysroot `xcrun -sdk iphoneos --show-sdk-path`" | ||
export CXXFLAGS="-O3 -arch arm64 -arch arm64e -arch armv7 -arch armv7s -isysroot -fembed-bitcode -mios-version-min=10.0 -isysroot `xcrun -sdk iphoneos --show-sdk-path`" | ||
export CFLAGS="-O3 -arch arm64 -fembed-bitcode -mios-version-min=11.0 -isysroot `xcrun -sdk iphoneos --show-sdk-path`" | ||
export CXXFLAGS="-O3 -arch arm64 -fembed-bitcode -mios-version-min=11.0 -isysroot `xcrun -sdk iphoneos --show-sdk-path`" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a3976b0: If you bump the minimum version, don't forget to update the Podspec. For my own app (nthKey) I'm also fine with a bump to 15.0 if there's any benefit. But I don't know if anyone else is using LibWally-Swift and needs support for older versions of iOs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I bumped to 11.0 because 10.3 was the last supported iOS for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. think it will be nice to keep it at a generous minimum version, since developers may want to support them |
||
mkdir -p build | ||
./configure --disable-shared --host=aarch64-apple-darwin14 --enable-static --disable-elements | ||
./configure --disable-shared --host=aarch64-apple-darwin --enable-static --disable-elements | ||
if [ $clean == 1 ]; then | ||
make clean | ||
fi | ||
fi | ||
make | ||
set +v | ||
if [ $simulator == 1 ]; then | ||
cd $PROJ_DIRECTORY | ||
xcodebuild archive -scheme LibWally -destination "generic/platform=iOS" -archivePath ${BIN_OUTPUT_DIRECTORY}/LibwallySwift-iOS SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES | ||
if [ $simulator != 1 ]; then | ||
set -v | ||
cp src/.libs/libwallycore.a build/libwallycore-device.a | ||
xcodebuild -create-xcframework \ | ||
-framework ${BIN_OUTPUT_DIRECTORY}/LibwallySwift-iOS.xcarchive/Products/Library/Frameworks/LibWally.framework \ | ||
-output ${BIN_OUTPUT_DIRECTORY}/LibwallySwift.xcframework | ||
fi | ||
fi | ||
|
||
set +v | ||
if [ $device == 1 ] && [ $simulator == 1 ]; then | ||
echo "Combine simulator and device libraries..." | ||
set -v | ||
lipo -create build/libwallycore-device.a build/libwallycore-simulator.a -o src/.libs/libwallycore.a | ||
|
||
rm -rf ${BIN_OUTPUT_DIRECTORY}/LibwallySwift.xcframework | ||
|
||
xcodebuild -create-xcframework \ | ||
-framework ${BIN_OUTPUT_DIRECTORY}/LibwallySwift-iOS.xcarchive/Products/Library/Frameworks/LibWally.framework \ | ||
-framework ${BIN_OUTPUT_DIRECTORY}/LibwallySwift-Sim.xcarchive/Products/Library/Frameworks/LibWally.framework \ | ||
-output ${BIN_OUTPUT_DIRECTORY}/LibwallySwift.xcframework | ||
fi | ||
|
||
set +v | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
188794c: no need to bump the version when you're trying this. You can point to a branch, see e.g. Sjors/nthkey-ios@ecf2513
I'll try to remember to bump this version next time I tag a release though.