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 # 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 gcs: uavobjects
$(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@
ground_package: | gcs ground_package: | package
package: release_ground release_flight .PHONY: gcs ground_package package
$(ROOT_DIR)/release/osx/package
release: | package
.PHONY: gcs ground_package

View File

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

View File

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