Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] Fix issues with static lib signing and app store submission
Browse files Browse the repository at this point in the history
Add a flavor of static build that:

- Puts resources in a Mapbox.bundle file
- Puts Mapbox.bundle and Settings.bundle at the same level as
Mapbox.framework in the /static output folder
- Removes CFBundleExecutable and CFBundlePackageType from the Info.plist
in Mapbox.bundle that cause errors when uploading to iTunes Connect

This also updates the `binary` instructions in INSTALL.md to reflect
these changes.
  • Loading branch information
boundsj committed Mar 24, 2016
1 parent 38e6d51 commit d310897
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ ibench: export XCODEBUILD_ARGS += -sdk iphoneos ARCHS="arm64"
ibench: ; $(RUN) HOST=ios Xcode/ios-bench

.PHONY: ipackage ipackage-strip ipackage-sim itest
ipackage: Xcode/ios ; @JOBS=$(JOBS) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) ./platform/ios/scripts/package.sh
ipackage-strip: Xcode/ios ; @JOBS=$(JOBS) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO ./platform/ios/scripts/package.sh
ipackage: Xcode/ios ; @JOBS=$(JOBS) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES ./platform/ios/scripts/package.sh
ipackage-strip: Xcode/ios ; @JOBS=$(JOBS) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES ./platform/ios/scripts/package.sh
ipackage-sim: Xcode/ios ; @JOBS=$(JOBS) BUILDTYPE=Debug BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=false SYMBOLS=$(SYMBOLS) ./platform/ios/scripts/package.sh
iframework: Xcode/ios ; @JOBS=$(JOBS) BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) ./platform/ios/scripts/package.sh
ifabric: Xcode/ios ; @JOBS=$(JOBS) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO BUNDLE_RESOURCES=YES ./platform/ios/scripts/package.sh
Expand Down
9 changes: 7 additions & 2 deletions platform/ios/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ If your application targets iOS 7.x, you’ll need to install the static framewo
1. Build from source manually per above.
1. Open the project editor and select your application target. Drag `build/ios/pkg/static/Mapbox.framework` into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish.
1. Copy the contents of `build/ios/pkg/static` into your project. It should happen automatically, but ensure that:
- `Mapbox.framework` is listed in your `Link Binary With Libraries` build phase.
- The path to the project's local copy of `Mapbox.framework` is in your *Framework Search Paths* (`FRAMEWORK_SEARCH_PATHS`) build setting.
- `Mapbox.bundle` is in your target's *Copy Bundle Resources* build phase.
- `Settings.bundle` is in your target's *Copy Bundle Resources* build phase.

1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Librariessection:

- `GLKit.framework`
Expand Down
28 changes: 22 additions & 6 deletions platform/ios/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,28 @@ if [[ ${BUNDLE_RESOURCES} ]]; then
BUNDLE_PATH="/${NAME}.bundle"
fi

PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK:-}
STATIC_BUNDLE_PATH=
if [[ ${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK} ]]; then
STATIC_BUNDLE_PATH="${OUTPUT}/static${BUNDLE_PATH}"
else
STATIC_BUNDLE_PATH="${OUTPUT}/static/${NAME}.framework${BUNDLE_PATH}"
fi

STATIC_SETTINGS_DIRECTORY=
if [[ ${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK} ]]; then
STATIC_SETTINGS_DIRECTORY="${OUTPUT}/static"
else
STATIC_SETTINGS_DIRECTORY="${OUTPUT}/static/${NAME}.framework"
fi

SDK=iphonesimulator
if [[ ${BUILD_FOR_DEVICE} == true ]]; then
SDK=iphoneos
fi
IOS_SDK_VERSION=`xcrun --sdk ${SDK} --show-sdk-version`

echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${GCC_GENERATE_DEBUGGING_SYMBOLS}; Bitcode: ${ENABLE_BITCODE}; Mapbox.bundle: ${BUNDLE_RESOURCES}"
echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${GCC_GENERATE_DEBUGGING_SYMBOLS}; Bitcode: ${ENABLE_BITCODE}; Mapbox.bundle: ${BUNDLE_RESOURCES} bundle.outside: ${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK}"

function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
function finish { >&2 echo -en "\033[0m"; }
Expand Down Expand Up @@ -207,25 +222,26 @@ SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v
SHORT_VERSION=${SEM_VERSION%-*}
if [[ ${BUNDLE_RESOURCES} ]]; then
cp -pv LICENSE.md "${OUTPUT}/static/${NAME}.framework"
cp -rv platform/ios/app/Settings.bundle "${OUTPUT}/static/${NAME}.framework"
cp -rv platform/ios/app/Settings.bundle ${STATIC_SETTINGS_DIRECTORY}
else
cp -pv LICENSE.md "${OUTPUT}"
cp -rv platform/ios/app/Settings.bundle "${OUTPUT}"
fi
if [[ ${BUILD_STATIC} == true ]]; then
mkdir -p "${OUTPUT}/static/${NAME}.framework${BUNDLE_PATH}"
cp -pv platform/{default,ios}/resources/* "${OUTPUT}/static/${NAME}.framework${BUNDLE_PATH}"
mkdir -p ${STATIC_BUNDLE_PATH}
cp -pv platform/{default,ios}/resources/* ${STATIC_BUNDLE_PATH}
INFO_PLIST_PATH="${OUTPUT}/static/${NAME}.framework/Info.plist"
cp -pv platform/ios/framework/Info.plist "${INFO_PLIST_PATH}"
plutil -replace CFBundleExecutable -string ${NAME} "${INFO_PLIST_PATH}"
plutil -remove CFBundleExecutable "${INFO_PLIST_PATH}"
plutil -remove CFBundlePackageType "${INFO_PLIST_PATH}"
plutil -replace CFBundleIdentifier -string com.mapbox.sdk.ios "${INFO_PLIST_PATH}"
plutil -replace CFBundleName -string ${NAME} "${INFO_PLIST_PATH}"
plutil -replace CFBundleShortVersionString -string "${SHORT_VERSION}" "${INFO_PLIST_PATH}"
plutil -replace CFBundleVersion -string ${PROJ_VERSION} "${INFO_PLIST_PATH}"
plutil -replace MGLSemanticVersionString -string "${SEM_VERSION}" "${INFO_PLIST_PATH}"
plutil -replace MGLCommitHash -string "${HASH}" "${INFO_PLIST_PATH}"
if [[ ${BUNDLE_RESOURCES} ]]; then
cp -pv "${INFO_PLIST_PATH}" "${OUTPUT}/static/${NAME}.framework${BUNDLE_PATH}/Info.plist"
cp -pv "${INFO_PLIST_PATH}" "${STATIC_BUNDLE_PATH}/Info.plist"
fi
mkdir "${OUTPUT}/static/${NAME}.framework/Modules"
cp -pv platform/ios/framework/modulemap "${OUTPUT}/static/${NAME}.framework/Modules/module.modulemap"
Expand Down

0 comments on commit d310897

Please sign in to comment.