-
-
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
Don't rebuild C static libs if the desired architecture/platform already exists #82
Changes from 2 commits
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ build() { | |
CC="$(xcrun --sdk $SDK_NAME -f clang) -isysroot $(xcrun --sdk $SDK_NAME --show-sdk-path)" | ||
CC_FOR_BUILD="$(xcrun --sdk macosx -f clang) -isysroot $(xcrun --sdk macosx --show-sdk-path)" | ||
|
||
sh ./tools/autogen.sh | ||
./configure --disable-shared --host=$HOST --enable-static --disable-elements --enable-standard-secp \ | ||
CC="$CC $EXTRA_CFLAGS" \ | ||
CPP="$CC $EXTRA_CFLAGS -E" \ | ||
|
@@ -42,8 +43,6 @@ build() { | |
} | ||
|
||
if [[ ${ACTION:-build} = "build" || $ACTION = "install" ]]; then | ||
sh ./tools/autogen.sh | ||
|
||
if [[ $PLATFORM_NAME = "macosx" ]]; then | ||
TARGET_OS="macos" | ||
elif [[ $PLATFORM_NAME = "iphonesimulator" ]]; then | ||
|
@@ -61,20 +60,38 @@ if [[ ${ACTION:-build} = "build" || $ACTION = "install" ]]; then | |
ARCHES=() | ||
LIBWALLYCORE_EXECUTABLES=() | ||
LIBSECP256K1_EXECUTABLES=() | ||
NEEDS_LIPO=false | ||
|
||
for ARCH in $ARCHS | ||
do | ||
TARGET_ARCH=$ARCH | ||
if [[ $TARGET_ARCH = "arm64" ]]; then | ||
TARGET_ARCH="aarch64" | ||
fi | ||
|
||
build ${PLATFORM_NAME} ${TARGET_ARCH}-apple-darwin "-arch ${ARCH} -m${TARGET_OS}-version-min=7.0 -fembed-bitcode" | ||
LIBWALLYCORE_EXECUTABLES+=("${BUILD_DIR}/${PLATFORM_NAME}/libwallycore-${TARGET_ARCH}-apple-darwin.a") | ||
LIBSECP256K1_EXECUTABLES+=("${BUILD_DIR}/${PLATFORM_NAME}/libsecp256k1-${TARGET_ARCH}-apple-darwin.a") | ||
LIBWALLY_DIR="${BUILD_DIR}/${PLATFORM_NAME}/libwallycore-${TARGET_ARCH}-apple-darwin.a" | ||
SECP_DIR="${BUILD_DIR}/${PLATFORM_NAME}/libsecp256k1-${TARGET_ARCH}-apple-darwin.a" | ||
|
||
# If we haven't built our static library, let's go ahead and build it. Else, we can probably just not try and build at all. | ||
if [ ! -f $LIBWALLY_DIR ] || [ ! -f $SECP_DIR ] | ||
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 guess this means that if you change something in libwally-core you should clean the build folder? 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. correct, unfortunately Xcode changed its build system a couple of releases ago which does not allow for custom build targets to define their own clean behaviors when you clean from Xcode. these lines here were meant to handle that case, but doesn't work: https://github.com/Sjors/libwally-swift/pull/82/files#diff-cf8443a1af8a2de0df5857abe08d2469008f13a0a65f4f984d3d60acdbc68679R95-R97 |
||
then | ||
echo "DEBUG:: File not found, let's build!" | ||
build ${PLATFORM_NAME} ${TARGET_ARCH}-apple-darwin "-arch ${ARCH} -m${TARGET_OS}-version-min=7.0 -fembed-bitcode" | ||
|
||
# Tracks our list of executables so we know the static libraries we need to lipo later | ||
LIBWALLYCORE_EXECUTABLES+=($LIBWALLY_DIR) | ||
LIBSECP256K1_EXECUTABLES+=($SECP_DIR) | ||
|
||
# Something changed, we should lipo later. | ||
NEEDS_LIPO=true | ||
fi | ||
done | ||
|
||
xcrun --sdk $PLATFORM_NAME lipo -create "${LIBWALLYCORE_EXECUTABLES[@]}" -output "${BUILD_DIR}/LibWallyCore" | ||
xcrun --sdk $PLATFORM_NAME lipo -create "${LIBSECP256K1_EXECUTABLES[@]}" -output "${BUILD_DIR}/libsecp256k1" | ||
# If nothing changed, we can just not try lipo at all and skip. | ||
if [ "$NEEDS_LIPO" = true ] ; then | ||
xcrun --sdk $PLATFORM_NAME lipo -create "${LIBWALLYCORE_EXECUTABLES[@]}" -output "${BUILD_DIR}/LibWallyCore" | ||
xcrun --sdk $PLATFORM_NAME lipo -create "${LIBSECP256K1_EXECUTABLES[@]}" -output "${BUILD_DIR}/libsecp256k1" | ||
fi | ||
elif [[ $ACTION = "clean" ]]; then | ||
make clean | ||
fi |
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.
Did you mean to touch all these?
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.
hm, I don't see a reason why it should change -- let me take a second look here
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.
I thought maybe a checksum of some sort.
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.
yeah, you're right. it's the checksum of the scheme action we define here https://github.com/Sjors/libwally-swift/pull/82/files#diff-a0467817f744b83783e73e607681e81427686debb56a8ba92f697ba854994937R13
since our change works, I will go ahead and delete the pre-build script
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.
sorry, I misspoke, it was a checksum of our script,
build-libwally.sh
. Either way, I just committed 2f7f66f to remove the unneeded pre-build script.