diff options
Diffstat (limited to 'platform/ios/scripts')
-rwxr-xr-x | platform/ios/scripts/framework.sh | 40 | ||||
-rwxr-xr-x | platform/ios/scripts/package.sh | 112 | ||||
-rwxr-xr-x | platform/ios/scripts/publish.sh | 2 | ||||
-rwxr-xr-x | platform/ios/scripts/run.sh | 7 |
4 files changed, 80 insertions, 81 deletions
diff --git a/platform/ios/scripts/framework.sh b/platform/ios/scripts/framework.sh deleted file mode 100755 index e2842a4707..0000000000 --- a/platform/ios/scripts/framework.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -cd build/ios/pkg -rm -rf framework -mkdir framework -cd framework - -mkdir Mapbox.framework - -# headers -cp -rv ../static/Headers Mapbox.framework/Headers -cat ../../../../ios/framework/umbrella >> Mapbox.framework/Headers/Mapbox.h - -# resources -cp -rv ../static/Mapbox.bundle Mapbox.framework/Mapbox.bundle - -# license -cp -v ../../../../LICENSE.md Mapbox.framework - -# settings bundle -cp -rv ../../../../ios/framework/Settings.bundle Mapbox.framework/Settings.bundle - -# binary -cp -v ../static/libMapbox.a Mapbox.framework/Mapbox -strip -Sx Mapbox.framework/Mapbox - -# module map -mkdir Mapbox.framework/Modules -cp -v ../../../../ios/framework/modulemap Mapbox.framework/Modules/module.modulemap - -# Info.plist -VERSION=$( git tag | grep ^ios | sed 's/^ios-//' | sort -r | grep -v '\-rc.' | grep -v '\-pre.' | sed -n '1p' | sed 's/^v//' ) -echo "Using $VERSION for Info.plist. Note that you will need to manually update the product for pre-releases or release candidates." -cp -v ../../../../ios/framework/Info.plist Mapbox.framework -perl -pi -e "s/#####/$VERSION/" Mapbox.framework/Info.plist -perl -pi -e "s/%%%%%/$VERSION/" Mapbox.framework/Info.plist diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 8faebb60e8..0d5808aea3 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -7,17 +7,11 @@ set -u NAME=Mapbox OUTPUT=build/ios/pkg LIBUV_VERSION=1.7.5 -ENABLE_BITCODE=YES if [[ ${#} -eq 0 ]]; then # e.g. "make ipackage" BUILDTYPE="Release" BUILD_FOR_DEVICE=true GCC_GENERATE_DEBUGGING_SYMBOLS="YES" -elif [[ ${1} == "no-bitcode" ]]; then # e.g. "make ipackage-no-bitcode" - BUILDTYPE="Release" - BUILD_FOR_DEVICE=true - GCC_GENERATE_DEBUGGING_SYMBOLS="YES" - ENABLE_BITCODE=NO elif [[ ${1} == "sim" ]]; then # e.g. "make ipackage-sim" BUILDTYPE="Debug" BUILD_FOR_DEVICE=false @@ -41,10 +35,11 @@ trap finish EXIT rm -rf ${OUTPUT} mkdir -p "${OUTPUT}"/static +mkdir -p "${OUTPUT}"/dynamic -step "Recording library version..." -VERSION="${OUTPUT}"/static/version.txt +step "Recording library version…" +VERSION="${OUTPUT}"/version.txt echo -n "https://github.com/mapbox/mapbox-gl-native/commit/" > ${VERSION} HASH=`git log | head -1 | awk '{ print $2 }' | cut -c 1-10` && true echo -n "mapbox-gl-native " @@ -52,27 +47,44 @@ echo ${HASH} echo ${HASH} >> ${VERSION} -step "Creating build files..." +step "Creating build files…" export MASON_PLATFORM=ios export BUILDTYPE=${BUILDTYPE:-Release} export HOST=ios make Xcode/ios +PROJ_VERSION=${TRAVIS_JOB_NUMBER:-${BITRISE_BUILD_NUMBER:-0}} + if [[ "${BUILD_FOR_DEVICE}" == true ]]; then - step "Building iOS device targets..." + step "Building intermediate static libraries for iOS devices (build ${PROJ_VERSION})…" xcodebuild -sdk iphoneos${IOS_SDK_VERSION} \ ARCHS="arm64 armv7 armv7s" \ ONLY_ACTIVE_ARCH=NO \ GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - ENABLE_BITCODE=${ENABLE_BITCODE} \ + ENABLE_BITCODE=NO \ DEPLOYMENT_POSTPROCESSING=YES \ -project ./build/ios-all/gyp/mbgl.xcodeproj \ -configuration ${BUILDTYPE} \ -target everything \ -jobs ${JOBS} + + step "Building dynamic framework for iOS devices (build ${PROJ_VERSION})…" + xcodebuild -sdk iphoneos${IOS_SDK_VERSION} \ + ARCHS="arm64 armv7 armv7s" \ + ONLY_ACTIVE_ARCH=NO \ + GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ + ENABLE_BITCODE=YES \ + DEPLOYMENT_POSTPROCESSING=YES \ + CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGN_IDENTITY= \ + -project ./build/ios-all/gyp/ios.xcodeproj \ + -configuration ${BUILDTYPE} \ + -target iossdk \ + -jobs ${JOBS} fi -step "Building iOS Simulator targets..." +step "Building intermediate static libraries for iOS Simulator (build ${PROJ_VERSION})…" xcodebuild -sdk iphonesimulator${IOS_SDK_VERSION} \ ARCHS="x86_64 i386" \ ONLY_ACTIVE_ARCH=NO \ @@ -82,54 +94,88 @@ xcodebuild -sdk iphonesimulator${IOS_SDK_VERSION} \ -target everything \ -jobs ${JOBS} +step "Building dynamic framework for iOS Simulator (build ${PROJ_VERSION})…" +xcodebuild -sdk iphonesimulator${IOS_SDK_VERSION} \ + ARCHS="x86_64 i386" \ + ONLY_ACTIVE_ARCH=NO \ + GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ + ENABLE_BITCODE=YES \ + CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ + -project ./build/ios-all/gyp/ios.xcodeproj \ + -configuration ${BUILDTYPE} \ + -target iossdk \ + -jobs ${JOBS} -step "Building static library..." LIBS=(core.a platform-ios.a asset-fs.a http-nsurl.a) + +# https://medium.com/@syshen/create-an-ios-universal-framework-148eb130a46c if [[ "${BUILD_FOR_DEVICE}" == true ]]; then + step "Assembling static framework for iOS Simulator and devices…" + mkdir -p ${OUTPUT}/static/${NAME}.framework libtool -static -no_warning_for_no_symbols \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libuv.a` \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \ - -o ${OUTPUT}/static/lib${NAME}.a \ + -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphoneos/libmbgl-} \ ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphonesimulator/libmbgl-} + + step "Copying dynamic framework into place for iOS devices" + cp -r \ + gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework \ + ${OUTPUT}/dynamic/ + + step "Merging simulator dynamic library into device dynamic library…" + lipo \ + gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework/${NAME} \ + gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ + -create -output ${OUTPUT}/dynamic/${NAME}.framework/${NAME} | echo else + step "Assembling static library for iOS Simulator…" + mkdir -p ${OUTPUT}/static/${NAME}.framework libtool -static -no_warning_for_no_symbols \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libuv.a` \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \ -o ${OUTPUT}/static/lib${NAME}.a \ ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphonesimulator/libmbgl-} + + step "Copying dynamic framework into place for iOS Simulator…" + cp -r \ + gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ + ${OUTPUT}/dynamic/${NAME}.framework fi -echo "Created ${OUTPUT}/static/lib${NAME}.a" +if [[ "${GCC_GENERATE_DEBUGGING_SYMBOLS}" == false ]]; then + step "Stripping binaries…" + strip -Sx "${OUTPUT}/static/${NAME}.framework/${NAME}" + strip -Sx "${OUTPUT}/dynamic/${NAME}.framework/${NAME}" +fi -step "Copying Headers..." -mkdir -p "${OUTPUT}/static/Headers" -for i in `ls -R include/mbgl/darwin | grep -vi private`; do - cp -pv include/mbgl/darwin/$i "${OUTPUT}/static/Headers" -done -for i in `ls -R include/mbgl/ios | grep -vi private`; do - cp -pv include/mbgl/ios/$i "${OUTPUT}/static/Headers" -done +stat "${OUTPUT}/static/${NAME}.framework" +stat "${OUTPUT}/dynamic/${NAME}.framework" +step "Copying static library headers…" +mkdir -p "${OUTPUT}/static/${NAME}.framework/Headers" +cp -pv include/mbgl/{darwin,ios}/*.h "${OUTPUT}/static/${NAME}.framework/Headers" -# Manually create resource bundle. We don't use a GYP target here because of -# complications between faked GYP bundles-as-executables, device build -# dependencies, and code signing. -step "Copying Resources..." -cp -pv LICENSE.md "${OUTPUT}/static" -mkdir -p "${OUTPUT}/static/${NAME}.bundle" -cp -pv platform/ios/resources/* "${OUTPUT}/static/${NAME}.bundle" +step "Copying library resources…" +cp -pv LICENSE.md "${OUTPUT}" +cp -rv ios/app/Settings.bundle "${OUTPUT}" +cp -pv platform/ios/resources/* "${OUTPUT}/static/${NAME}.framework" +cp -pv ios/framework/Info.plist "${OUTPUT}/static/${NAME}.framework/Info.plist" +perl -pi -e "s/(?<=<string>)0(?=<\/string>)/${PROJ_VERSION}/g" "${OUTPUT}/static/${NAME}.framework/Info.plist" +mkdir "${OUTPUT}/static/${NAME}.framework/Modules" +cp -pv ios/framework/modulemap "${OUTPUT}/static/${NAME}.framework/Modules/module.modulemap" -step "Creating API Docs..." +step "Generating API documentation…" if [ -z `which jazzy` ]; then - step "Installing jazzy..." + step "Installing jazzy…" gem install jazzy if [ -z `which jazzy` ]; then echo "Unable to install jazzy. See https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/INSTALL.md" exit 1 fi fi -DOCS_OUTPUT="${OUTPUT}/static/Docs" +DOCS_OUTPUT="${OUTPUT}/documentation" DOCS_VERSION=$( git tag | grep ^ios | sed 's/^ios-//' | sort -r | grep -v '\-rc.' | grep -v '\-pre.' | sed -n '1p' | sed 's/^v//' ) rm -rf /tmp/mbgl mkdir -p /tmp/mbgl/ diff --git a/platform/ios/scripts/publish.sh b/platform/ios/scripts/publish.sh index c914fcaccd..bdfbc94314 100755 --- a/platform/ios/scripts/publish.sh +++ b/platform/ios/scripts/publish.sh @@ -19,7 +19,7 @@ fi # # zip # -cd build/ios/pkg/static +cd build/ios/pkg ZIP=mapbox-ios-sdk-${PUBLISH_VERSION}${PUBLISH_STYLE}.zip rm -f ../${ZIP} zip -r ../${ZIP} * diff --git a/platform/ios/scripts/run.sh b/platform/ios/scripts/run.sh index bfca74d318..02699f29b6 100755 --- a/platform/ios/scripts/run.sh +++ b/platform/ios/scripts/run.sh @@ -31,13 +31,6 @@ if [[ ${PUBLISH_PLATFORM} = 'ios' ]]; then mapbox_time "deploy_ios_stripped" ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" - - # debug symbols but no Bitcode - mapbox_time "package_ios_no_bitcode" \ - make ipackage-no-bitcode - - mapbox_time "deploy_ios_no_bitcode" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" no-bitcode else # build & test iOS mapbox_time "run_ios_tests" \ |