summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-05-10 09:57:59 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-05-10 10:18:23 -0700
commiteb1e6c0f0c5bc3f427888e52ddf4729f8914b8da (patch)
treec7b0aeebcd7141e92b7faf7f2bb1245dba0b7cfe
parent1634058b51da4885224ba7f63aab14c7d794652f (diff)
downloadqtlocation-mapboxgl-eb1e6c0f0c5bc3f427888e52ddf4729f8914b8da.tar.gz
[osx] Automate framework packaging
Added a package script and make rule that parallels the iOS SDK package script and make rule, but with far fewer intricacies.
-rw-r--r--Makefile3
-rwxr-xr-xplatform/osx/scripts/package.sh59
2 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 0bbaf01008..32abe297fb 100644
--- a/Makefile
+++ b/Makefile
@@ -66,6 +66,9 @@ test-osx: osx node_modules/express
-configuration $(BUILDTYPE) \
-workspace $(OSX_WORK_PATH) -scheme CI test $(XCPRETTY)
+xpackage: $(OSX_PROJ_PATH)
+ SYMBOLS=$(SYMBOLS) ./platform/osx/scripts/package.sh
+
xdocument:
OUTPUT=$(OUTPUT) ./platform/osx/scripts/document.sh
diff --git a/platform/osx/scripts/package.sh b/platform/osx/scripts/package.sh
new file mode 100755
index 0000000000..b04ba86d33
--- /dev/null
+++ b/platform/osx/scripts/package.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+set -u
+
+NAME=Mapbox
+OUTPUT=build/osx/pkg
+DERIVED_DATA=build/osx
+PRODUCTS=${DERIVED_DATA}/Build/Products
+
+BUILDTYPE=${BUILDTYPE:-Release}
+GCC_GENERATE_DEBUGGING_SYMBOLS=${SYMBOLS:-YES}
+
+function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
+function finish { >&2 echo -en "\033[0m"; }
+trap finish EXIT
+
+rm -rf ${OUTPUT}
+
+HASH=`git log | head -1 | awk '{ print $2 }' | cut -c 1-10` && true
+PROJ_VERSION=$(git rev-list --count HEAD)
+SEM_VERSION=$( git describe --tags --match=osx-v*.*.* --abbrev=0 | sed 's/^osx-v//' )
+SHORT_VERSION=${SEM_VERSION%-*}
+
+step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
+xcodebuild \
+ GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \
+ CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
+ CURRENT_SHORT_VERSION=${SHORT_VERSION} \
+ CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
+ CURRENT_COMMIT_HASH=${HASH} \
+ -derivedDataPath ${DERIVED_DATA} \
+ -workspace ./platform/osx/osx.xcworkspace \
+ -scheme dynamic \
+ -configuration ${BUILDTYPE} \
+ -jobs ${JOBS} | xcpretty
+
+step "Copying dynamic framework into place"
+mkdir -p ${OUTPUT}/${NAME}.framework
+cp -r \
+ ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework \
+ ${OUTPUT}/${NAME}.framework
+if [[ -e ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework.dSYM ]]; then
+ cp -r ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework.dSYM "${OUTPUT}"
+fi
+
+if [[ "${GCC_GENERATE_DEBUGGING_SYMBOLS}" == false ]]; then
+ step "Stripping binaries…"
+ strip -Sx "${OUTPUT}/${NAME}.framework/${NAME}"
+fi
+
+step "Copying library resources…"
+cp -pv LICENSE.md "${OUTPUT}"
+cp -pv platform/osx/docs/pod-README.md "${OUTPUT}/README.md"
+sed -n -e '/^## /,$p' platform/osx/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md"
+
+step "Generating API documentation…"
+make xdocument OUTPUT="${OUTPUT}/documentation"