1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Use Makefile variables for the OSX packaging

This commit is contained in:
Oleg Semyonov 2011-05-22 01:43:13 +03:00
parent 1c9cfe7740
commit 958807e4c3
3 changed files with 56 additions and 47 deletions

View File

@ -2,14 +2,19 @@
# MacOSX-specific packaging
#
package: gcs release_flight
( \
ROOT_DIR="$(ROOT_DIR)" \
BUILD_DIR="$(BUILD_DIR)" \
RELEASE_LBL="$(RELEASE_LBL)" \
RELEASE_DIR="$(RELEASE_DIR)" \
FW_DIR="$(FW_DIR)" \
"$(ROOT_DIR)/release/osx/package" \
)
gcs: uavobjects
$(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@
ground_package: | gcs
ground_package: | package
package: release_ground release_flight
$(ROOT_DIR)/release/osx/package
release: | package
.PHONY: gcs ground_package
.PHONY: gcs ground_package package

View File

@ -1,38 +1,43 @@
#!/bin/bash
APP=$1
PLUGINS=${APP}/Contents/PlugIns
OP_PLUGINS=${APP}/Contents/PlugIns/OpenPilot
APP="${1?}"
PLUGINS="${APP}/Contents/PlugIns"
OP_PLUGINS="${APP}/Contents/PlugIns/OpenPilot"
QT_LIBS="QtGui QtCore QtSvg QtSql QtOpenGL QtNetwork QtXml QtDBus QtScript phonon"
echo $1
echo "Processing Qt libraries in $1"
macdeployqt "${APP}"
for f in "${PLUGINS}/"*.dylib "${OP_PLUGINS}/"*.dylib
do
for g in $QT_LIBS
do
install_name_tool -change ${g}.framework/Versions/4/${g} @executable_path/../Frameworks/${g}.framework/Versions/4/${g} "${f}"
done
for g in $QT_LIBS
do
install_name_tool -change \
${g}.framework/Versions/4/${g} \
@executable_path/../Frameworks/${g}.framework/Versions/4/${g} \
"${f}"
done
done
# should be redundant but some libs missed by main app and macdeployqt
for f in ${QT_LIBS} SDL
do
echo "Copying ${f}"
cp -r /Library/Frameworks/${f}.framework "${APP}/Contents/Frameworks/"
echo "Copying ${f}"
cp -r /Library/Frameworks/${f}.framework "${APP}/Contents/Frameworks/"
echo "Changing package identification of ${f}"
install_name_tool -id @executable_path/../Frameworks/${f}.framework/Versions/4/QtCore "${APP}/Contents/Frameworks/${f}.framework/Versions/4/${f}"
echo "Changing package linkages"
for g in $QT_LIBS
do
install_name_tool -change ${g}.framework/Versions/4/${g} @executable_path/../Frameworks/${g}.framework/Versions/4/${g} "${APP}/Contents/Frameworks/${f}.framework/Versions/4/${f}"
done
echo "Changing package identification of ${f}"
install_name_tool -id \
@executable_path/../Frameworks/${f}.framework/Versions/4/QtCore \
"${APP}/Contents/Frameworks/${f}.framework/Versions/4/${f}"
echo "Changing package linkages"
for g in $QT_LIBS
do
install_name_tool -change \
${g}.framework/Versions/4/${g} \
@executable_path/../Frameworks/${g}.framework/Versions/4/${g} \
"${APP}/Contents/Frameworks/${f}.framework/Versions/4/${f}"
done
done
# deleting unnecessary files
@ -40,5 +45,3 @@ echo "Deleting unnecessary files"
find "${APP}/Contents/Frameworks" -iname "current" -exec rm -rf \{\} \;
find "${APP}/Contents/Frameworks" -iname "4.0" -exec rm -rf \{\} \;
find "${APP}/Contents/Frameworks" -iname "*_debug*" -exec rm -rf \{\} \;

View File

@ -1,31 +1,32 @@
#!/bin/bash
OP_BASE=~/Documents/Programming/OpenPilot
RELEASE_NAME=20110519-460cc1ad
# the following environment variables must be set
: ${ROOT_DIR?} ${BUILD_DIR?} ${RELEASE_LBL?} ${RELEASE_DIR?} ${FW_DIR?}
REL_DIR=${OP_BASE}/build/release-${RELEASE_NAME}
TEMP_FILE=${REL_DIR}/OpenPilot-temp.dmg
OUT_FILE=${REL_DIR}/OpenPilot-${RELEASE_NAME}.dmg
VOL_NAME=OpenPilot
# more variables
APP_PATH="${BUILD_DIR}/ground/openpilotgcs/bin/OpenPilot GCS.app"
TEMP_FILE="${RELEASE_DIR}/OpenPilot-temp.dmg"
OUT_FILE="${RELEASE_DIR}/OpenPilot-${RELEASE_LBL}.dmg"
VOL_NAME="OpenPilot"
APP_PATH=${OP_BASE}/build/ground/openpilotgcs/bin/OpenPilot\ GCS.app
FW_PATH="${OP_BASE}/build/release-${RELEASE_NAME}/firmware-${RELEASE_NAME}"
# prepare the stage
rm -f "${TEMP_FILE}"
rm -f "${OUT_FILE}"
rm ${TEMP_FILE}
rm ${OUT_FILE}
hdiutil convert "${OP_BASE}/release/osx/OpenPilot.dmg" -format UDRW -o "${TEMP_FILE}"
device=$(hdiutil attach ${TEMP_FILE} | \
hdiutil convert "${ROOT_DIR}/release/osx/OpenPilot.dmg" \
-format UDRW -o "${TEMP_FILE}"
device=$(hdiutil attach "${TEMP_FILE}" | \
egrep '^/dev/' | sed 1q | awk '{print $1}')
# packaging goes here
cp -r "${APP_PATH}" "/Volumes/${VOL_NAME}"
cp -r "${FW_PATH}" "/Volumes/${VOL_NAME}/firmware"
cp -r "${FW_DIR}" "/Volumes/${VOL_NAME}/firmware"
${OP_BASE}/release/osx/libraries "/Volumes/${VOL_NAME}/OpenPilot GCS.app"
"${ROOT_DIR}/release/osx/libraries" \
"/Volumes/${VOL_NAME}/OpenPilot GCS.app" || exit 1
hdiutil detach ${device}
hdiutil convert ${TEMP_FILE} -format UDZO -o ${OUT_FILE}
rm ${TEMP_FILE}
hdiutil convert "${TEMP_FILE}" -format UDZO -o "${OUT_FILE}"
# cleanup
rm "${TEMP_FILE}"