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

mason_build: fix creating universal binary #693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions mason.sh
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ function mason_build {

SIMULATOR_TARGETS="i386 x86_64"
DEVICE_TARGETS="armv7 arm64"
LIB_FOLDERS=
local LIB_FOLDERS=

for ARCH in ${SIMULATOR_TARGETS} ; do
mason_substep "Building for iOS Simulator ${ARCH}..."
Expand All @@ -453,7 +453,7 @@ function mason_build {
cd "${MASON_PREFIX}"
mv lib "lib-isim-${ARCH}"
for i in lib-isim-${ARCH}/*.a ; do lipo -info "$i" ; done
LIB_FOLDERS="${LIB_FOLDERS} lib-isim-${ARCH}"
LIB_FOLDERS+=" lib-isim-${ARCH}"
done

for ARCH in ${DEVICE_TARGETS} ; do
Expand All @@ -465,20 +465,20 @@ function mason_build {
cd "${MASON_PREFIX}"
mv lib lib-ios-${ARCH}
for i in lib-ios-${ARCH}/*.a ; do lipo -info $i ; done
LIB_FOLDERS="${LIB_FOLDERS} lib-ios-${ARCH}"
LIB_FOLDERS+=" lib-ios-${ARCH}"
done

# Create universal binary
mason_substep "Creating Universal Binary..."
cd "${MASON_PREFIX}"
mkdir -p lib
for LIB in $(find ${LIB_FOLDERS} -name "*.a" | xargs basename | sort | uniq) ; do
lipo -create $(find ${LIB_FOLDERS} -name "${LIB}") -output lib/${LIB}
for LIB in $(find ${LIB_FOLDERS} -name "*.a" | sed 's:.*/::' | sort -u); do
lipo -create $(find ${LIB_FOLDERS} -name ${LIB}) -output lib/${LIB}
lipo -info "lib/${LIB}"
done

cd "${MASON_PREFIX}"
rm -rf "${LIB_FOLDERS}"
rm -rf -- ${LIB_FOLDERS}
elif [ ${MASON_PLATFORM} = 'android' ]; then
cd "${MASON_BUILD_PATH}"
mason_compile
Expand Down