1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merge remote-tracking branch 'origin/amorale/OP-1155_osx_package' into next

This commit is contained in:
Alessio Morale 2014-01-18 13:54:57 +01:00
commit f5bd8a556d
10 changed files with 215 additions and 31 deletions

View File

@ -5,6 +5,124 @@ TEMPLATE = subdirs
# Copy Qt runtime libraries into the build directory (to run or package)
equals(copydata, 1) {
GCS_LIBRARY_PATH
linux-* {
QT_LIBS = libQt5Core.so.5 \
libQt5Gui.so.5 \
libQt5Widgets.so.5 \
libQt5Network.so.5 \
libQt5OpenGL.so.5 \
libQt5Sql.so.5 \
libQt5Svg.so.5 \
libQt5Test.so.5 \
libQt5Xml.so.5 \
libQt5Declarative.so.5 \
libQt5XmlPatterns.so.5 \
libQt5Script.so.5 \
libQt5Concurrent.so.5 \
libQt5PrintSupport.so.5 \
libQt5SerialPort.so.5 \
libQt5Multimedia.so.5 \
libQt5MultimediaWidgets.so.5 \
libQt5Quick.so.5 \
libQt5Qml.so.5 \
libQt5V8.so.5 \
libQt5DBus.so.5 \
libQt5QuickParticles.so.5 \
libicui18n.so.51 \
libicuuc.so.51 \
libicudata.so.51
data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_LIBRARY_PATH\") $$addNewline()
for(lib, QT_LIBS) {
data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_LIBS]/$$lib\") $$targetPath(\"$$GCS_QT_LIBRARY_PATH/$$lib\") $$addNewline()
}
# create Qt plugin directories
QT_PLUGIN_DIRS = iconengines \
imageformats \
platforms \
mediaservice \
sqldrivers
for(dir, QT_PLUGIN_DIRS) {
data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_PLUGINS_PATH/$$dir\") $$addNewline()
}
QT_PLUGIN_LIBS = iconengines/libqsvgicon.so \
imageformats/libqgif.so \
imageformats/libqico.so \
imageformats/libqjpeg.so \
imageformats/libqmng.so \
imageformats/libqsvg.so \
imageformats/libqtiff.so \
platforms/libqxcb.so \
sqldrivers/libqsqlite.so
for(lib, QT_PLUGIN_LIBS) {
data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_PLUGINS]/$$lib\") $$targetPath(\"$$GCS_QT_PLUGINS_PATH/$$lib\") $$addNewline()
}
# create QtQuick2 plugin directories
QT_QUICK2_DIRS = QtQuick \
QtQuick.2 \
QtQuick/Layouts \
QtQuick/LocalStorage \
QtQuick/Particles.2 \
QtQuick/PrivateWidgets \
QtQuick/Window.2 \
QtQuick/XmlListModel
for(dir, QT_QUICK2_DIRS) {
data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline()
}
# Copy QtQuick2 complete directories
# These directories have a lot of files
# Easier to copy everything
QTQ_WHOLE_DIRS = QtQuick/Controls \
QtQuick/Dialogs
for(dir, QTQ_WHOLE_DIRS) {
data_copy.commands += $(COPY_DIR) $$targetPath(\"$$[QT_INSTALL_QML]/$$dir\") $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline()
}
# Remove the few unwanted libs after whole dir copy
QT_QUICK2_DELS = QtQuick/Controls/libqtquickcontrolsplugin.so \
QtQuick/Controls/Private/libqtquickcontrolsprivateplugin.so \
QtQuick/Dialogs/libdialogplugin.so
for(delfile, QT_QUICK2_DELS) {
data_copy.commands += $(DEL_FILE) $$targetPath(\"$$GCS_QT_QML_PATH/$${delfile}\") $$addNewline()
}
# Remaining QtQuick plugin libs
QT_QUICK2_DLLS = QtQuick.2/libqtquick2plugin.so \
QtQuick.2/plugins.qmltypes \
QtQuick.2/qmldir \
QtQuick/Layouts/libqquicklayoutsplugin.so \
QtQuick/Layouts/plugins.qmltypes \
QtQuick/Layouts/qmldir \
QtQuick/LocalStorage/libqmllocalstorageplugin.so \
QtQuick/LocalStorage/plugins.qmltypes \
QtQuick/LocalStorage/qmldir \
QtQuick/Particles.2/libparticlesplugin.so \
QtQuick/Particles.2/plugins.qmltypes \
QtQuick/Particles.2/qmldir \
QtQuick/PrivateWidgets/libwidgetsplugin.so \
QtQuick/PrivateWidgets/plugins.qmltypes \
QtQuick/PrivateWidgets/qmldir \
QtQuick/Window.2/libwindowplugin.so \
QtQuick/Window.2/plugins.qmltypes \
QtQuick/Window.2/qmldir \
QtQuick/XmlListModel/libqmlxmllistmodelplugin.so \
QtQuick/XmlListModel/plugins.qmltypes \
QtQuick/XmlListModel/qmldir
for(lib, QT_QUICK2_DLLS) {
data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$lib\") $$targetPath(\"$$GCS_QT_QML_PATH/$$lib\") $$addNewline()
}
data_copy.target = FORCE
QMAKE_EXTRA_TARGETS += data_copy
}
# Windows release only, no debug target DLLs ending with 'd'
# It is assumed that SDL.dll can be found in the same directory as mingw32-make.exe
win32 {
@ -153,4 +271,30 @@ equals(copydata, 1) {
QMAKE_EXTRA_TARGETS += data_copy
}
macx{
#NOTE: debug dylib can be copied as they will be cleaned out with packaging scripts
#standard plugins directory (will copy just dylib, plugins.qmltypes and qmldir
QT_QUICK2_PLUGINS = QtQuick.2 QtQuick/Layouts QtQuick/LocalStorage QtQuick/Particles.2 QtQuick/PrivateWidgets QtQuick/Window.2 QtQuick/XmlListModel
#those directories will be fully copied to dest
QT_QUICK2_FULL_DIRS = QtQuick/Controls QtQuick/Dialogs
#create QtQuick dir (that will host all subdirs)
data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_QML_PATH/QtQuick\") $$addNewline()
for(dir, QT_QUICK2_FULL_DIRS) {
#data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline()
data_copy.commands += $(COPY_DIR) $$targetPath(\"$$[QT_INSTALL_QML]/$$dir\") $$targetPath(\"$$GCS_QT_QML_PATH/$$dir\") $$addNewline()
}
for(lib, QT_QUICK2_PLUGINS) {
data_copy.commands += $(MKDIR) $$targetPath(\"$$GCS_QT_QML_PATH/$$lib\") $$addNewline()
data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$lib/\"*.dylib) $$targetPath(\"$$GCS_QT_QML_PATH/$$lib/\") $$addNewline()
data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$lib/plugins.qmltypes\") $$targetPath(\"$$GCS_QT_QML_PATH/$$lib/plugins.qmltypes\") $$addNewline()
data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$lib/qmldir\") $$targetPath(\"$$GCS_QT_QML_PATH/$$lib/qmldir\") $$addNewline()
}
data_copy.target = FORCE
QMAKE_EXTRA_TARGETS += data_copy
}
}

View File

@ -77,6 +77,7 @@ macx {
GCS_APP_TARGET = "OpenPilot GCS"
GCS_LIBRARY_PATH = $$GCS_APP_PATH/$${GCS_APP_TARGET}.app/Contents/Plugins
GCS_PLUGIN_PATH = $$GCS_LIBRARY_PATH
GCS_QT_QML_PATH = $$GCS_APP_PATH/$${GCS_APP_TARGET}.app/Contents/Imports
GCS_LIBEXEC_PATH = $$GCS_APP_PATH/$${GCS_APP_TARGET}.app/Contents/Resources
GCS_DATA_PATH = $$GCS_APP_PATH/$${GCS_APP_TARGET}.app/Contents/Resources
GCS_DATA_BASENAME = Resources
@ -89,6 +90,9 @@ macx {
} else {
GCS_APP_WRAPPER = openpilotgcs
GCS_APP_TARGET = openpilotgcs.bin
GCS_QT_LIBRARY_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5
GCS_QT_PLUGINS_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5/plugins
GCS_QT_QML_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5/qml
}
GCS_LIBRARY_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/openpilotgcs
GCS_PLUGIN_PATH = $$GCS_LIBRARY_PATH/plugins

View File

@ -21,6 +21,7 @@ macx {
QMAKE_CC = /usr/bin/gcc
QMAKE_CXX = /usr/bin/g++
QMAKE_LINK = /usr/bin/g++
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
}
include(openpilotgcs.pri)

View File

@ -31,7 +31,7 @@ macx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Plugins/$${PROVIDER}/
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
QMAKE_RPATHDIR += \$\$ORIGIN
QMAKE_RPATHDIR = \$\$ORIGIN
QMAKE_RPATHDIR += \$\$ORIGIN/..
QMAKE_RPATHDIR += \$\$ORIGIN/../..
GCS_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":")
@ -45,7 +45,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hGCS_symbols
CONFIG += plugin plugin_with_soname
!macx {
target.path = /$$GCS_LIBRARY_BASENAME/opnepilotgcs/plugins/$$PROVIDER
target.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs/plugins/$$PROVIDER
pluginspec.files += $${TARGET}.pluginspec
pluginspec.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs/plugins/$$PROVIDER
INSTALLS += target pluginspec

View File

@ -3,7 +3,8 @@ macx {
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
# this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var
QMAKE_RPATHDIR += \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/openpilotgcs
QMAKE_RPATHDIR = \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/openpilotgcs
QMAKE_RPATHDIR += \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/qt5
GCS_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":")
QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${GCS_PLUGIN_RPATH}\'

View File

@ -1,2 +1,2 @@
shlibs:Depends=libc6 (>= 2.3.6-6~), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libglu1-mesa | libglu1, libphonon4 (>= 4:4.3.0), libqt4-network (>= 4:4.6.1), libqt4-opengl (>= 4:4.6.1), libqt4-script (>= 4:4.5.3), libqt4-sql (>= 4:4.5.3), libqt4-svg (>= 4:4.5.3), libqt4-test (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.6.2), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.1), libudev0 (>= 147), libusb-0.1-4 (>= 2:0.1.12), phonon
shlibs:Depends=libc6 (>= 2.3.6-6~), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, libglu1-mesa | libglu1, libphonon4 (>= 4:4.3.0), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.1), libudev0 | libudev1, libusb-0.1-4 (>= 2:0.1.12), phonon
misc:Depends=

View File

@ -25,7 +25,7 @@ clean:
dh_testdir
dh_testroot
dh_clean
install:
dh_testdir
dh_testroot
@ -37,6 +37,7 @@ install:
cp -arp build/openpilotgcs_release/lib debian/openpilot/usr/local/OpenPilot
cp -arp build/openpilotgcs_release/share debian/openpilot/usr/local/OpenPilot
cp -arp build/openpilotgcs_release/.obj debian/openpilot/usr/local/OpenPilot
cp -arp package/linux/qt.conf debian/openpilot/usr/local/OpenPilot/bin
cp -arp package/linux/openpilot.desktop debian/openpilot/usr/share/applications
cp -arp package/linux/openpilot.png debian/openpilot/usr/share/pixmaps
cp -arp package/linux/openpilot_menu.png debian/openpilot/usr/share/pixmaps
@ -54,7 +55,8 @@ endif
rm -rf debian/openpilot/usr/local/OpenPilot/share/openpilotgcs/mapicons/mapicons
rm -rf debian/openpilot/usr/local/OpenPilot/share/openpilotgcs/dials/dials
rm -rf debian/openpilot/usr/local/OpenPilot/share/openpilotgcs/diagrams/diagrams
# Removing leaked files from the dist
find debian/openpilot -name Makefile -exec rm -f {} \;
# Build architecture-independent files here.
binary-indep: install
@ -73,10 +75,10 @@ binary-arch: install
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps -l/usr/local/OpenPilot/lib/openpilotgcs --dpkg-shlibdeps-params="--ignore-missing-info -v"
dh_shlibdeps -l/usr/local/OpenPilot/lib/openpilotgcs -l/usr/local/OpenPilot/lib/qt5 --dpkg-shlibdeps-params="--ignore-missing-info -v"
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb -- -Zbzip2
binary: binary-indep binary-arch

6
package/linux/qt.conf Normal file
View File

@ -0,0 +1,6 @@
[Paths]
Prefix = ..
Plugins = lib/qt5/plugins
Imports = lib/qt5/qml
Qml2Imports = lib/qt5/qml
Libraries = lib/qt5

View File

@ -3,7 +3,7 @@
APP="${1?}"
PLUGINS="${APP}/Contents/Plugins"
OP_PLUGINS="${APP}/Contents/Plugins/OpenPilot"
QT_LIBS="QtDeclarative QtXmlPatterns QtGui QtTest QtCore QtSvg QtSql QtOpenGL QtNetwork QtXml QtScript"
QT_LIBS="QtCore QtGui QtMultimedia QtMultimediaWidgets QtNetwork QtOpenGL QtPrintSupport QtQml QtQuick QtScript QtSerialPort QtSql QtSvg QtWidgets QtV8 QtXml"
QT_DIR=$(otool -L "${APP}/Contents/MacOS/OpenPilot GCS" | sed -n -e 's/\/QtCore\.framework.*//p' | sed -n -E 's:^.::p')
QT_EXTRA="accessible/libqtaccessiblewidgets.dylib bearer/libqgenericbearer.dylib imageformats/libqgif.dylib imageformats/libqico.dylib imageformats/libqjpeg.dylib imageformats/libqmng.dylib imageformats/libqtiff.dylib imageformats/libqsvg.dylib qmltooling/libqmldbg_tcp.dylib sqldrivers/libqsqlodbc.dylib sqldrivers/libqsqlpsql.dylib sqldrivers/libqsqlite.dylib imageformats/libqtga.dylib iconengines/libqsvgicon.dylib"
@ -23,25 +23,36 @@ fi
echo "Qt library directory is \"${QT_DIR}\""
echo "Running macdeployqt"
macdeployqt "${APP}" -no-strip
echo "Running macdeployqt from ${QT_DIR}../bin/macdeployqt"
echo "Processing Qt libraries in ${APP}"
for f in "${PLUGINS}/"*.dylib "${OP_PLUGINS}/"*.dylib
"${QT_DIR}../bin/macdeployqt" "${APP}" -no-strip -verbose=2
#Append Qml2Imports config to qt.conf
echo "Qml2Imports = Imports" >> "${APP}/"Contents/Resources/qt.conf
echo "Processing Qt libraries paths in ${APP}"
for f in "${PLUGINS}/"*.dylib "${OP_PLUGINS}/"*.dylib "${APP}/"Contents/Imports/QtQuick.2/*.dylib "${APP}/"Contents/Imports/QtQuick/*/*.dylib
do
# Only process plain files
[ ! -L "${f}" ] && for g in $QT_LIBS
do
install_name_tool -change \
"${QT_DIR}${g}.framework/Versions/5/${g}" \
@executable_path/../Frameworks/${g}.framework/Versions/5/${g} \
"${f}"
done
if [ -f "${f}" ] && [ ! -L "${f}" ]
then
# Only process plain files
chmod +w "${f}"
echo "* ${f}"
for g in $QT_LIBS
do
install_name_tool -change \
"${QT_DIR}${g}.framework/Versions/5/${g}" \
@executable_path/../Frameworks/${g}.framework/Versions/5/${g} \
"${f}"
done
chmod -w "${f}"
fi
done
echo "Copying SDL"
cp -a "/Library/Frameworks/SDL.framework" "${APP}/Contents/Frameworks/"
chmod +w "${APP}/Contents/Plugins/libsdlgamepad.1.dylib"
chmod +w "${APP}/Contents/Frameworks/SDL.framework/SDL"
echo "Changing package identification of SDL"
install_name_tool -id \
@executable_path/../Frameworks/SDL.framework/SDL \
@ -50,6 +61,8 @@ install_name_tool -change \
@rpath/SDL.framework/Versions/A/SDL \
"@executable_path/../Frameworks/SDL.framework/SDL" \
"${APP}/Contents/Plugins/libsdlgamepad.1.dylib"
chmod -w "${APP}/Contents/Plugins/libsdlgamepad.1.dylib"
chmod -w "${APP}/Contents/Frameworks/SDL.framework/SDL"
# deleting unnecessary files
echo "Deleting unnecessary files"

View File

@ -14,8 +14,9 @@ rm -f "${TEMP_FILE}"
rm -f "${OUT_FILE}"
# if an OpenPilot volume is already mounted, unmount it
if [ ! -f "/Volumes/${VOL_NAME}" ]
if [ -f "/Volumes/${VOL_NAME}" ]
then
echo "Unmount existing /Volumes/${VOL_NAME}"
hdiutil unmount "/Volumes/${VOL_NAME}"
fi
@ -24,18 +25,30 @@ hdiutil convert "${ROOT_DIR}/package/osx/OpenPilot.dmg" \
device=$(hdiutil attach "${TEMP_FILE}" | \
egrep '^/dev/' | sed 1q | awk '{print $1}')
#Just in case something is still mounted as ${VOL_NAME}, check the correct mount point
mountvolume=$(hdiutil info | egrep "^${device}"| egrep "${VOL_NAME}" | sed 's/.*Volumes\///;s/*//' | sed 1q)
echo "Image mounted as /Volumes/${mountvolume}"
if [ ! -d "/Volumes/${mountvolume}/OpenPilot GCS.app" ]
then
echo "Cannot find a valid image at /Volumes/${mountvolume}"
exit 1
fi
# packaging goes here
cp -a "${APP_PATH}" "/Volumes/${VOL_NAME}"
cp -a "${APP_PATH}" "/Volumes/${mountvolume}"
#ls "${FW_DIR}" | xargs -n 1 -I {} cp "${FW_DIR}/{}" "/Volumes/${VOL_NAME}/Firmware"
cp "${BUILD_DIR}/uavobject-synthetics/matlab/OPLogConvert.m" "/Volumes/${VOL_NAME}/Utilities"
cp "${ROOT_DIR}/WHATSNEW.txt" "/Volumes/${VOL_NAME}"
cp "${ROOT_DIR}/README.txt" "/Volumes/${VOL_NAME}/Docs"
cp "${ROOT_DIR}/MILESTONES.txt" "/Volumes/${VOL_NAME}/Docs"
cp "${ROOT_DIR}/LICENSE.txt" "/Volumes/${VOL_NAME}/Docs"
cp "${ROOT_DIR}/GPLv3.txt" "/Volumes/${VOL_NAME}/Docs"
cp "${BUILD_DIR}/uavobject-synthetics/matlab/OPLogConvert.m" "/Volumes/${mountvolume}/Utilities"
cp "${ROOT_DIR}/WHATSNEW.txt" "/Volumes/${mountvolume}"
cp "${ROOT_DIR}/README.txt" "/Volumes/${mountvolume}/Docs"
cp "${ROOT_DIR}/MILESTONES.txt" "/Volumes/${mountvolume}/Docs"
cp "${ROOT_DIR}/LICENSE.txt" "/Volumes/${mountvolume}/Docs"
cp "${ROOT_DIR}/GPLv3.txt" "/Volumes/${mountvolume}/Docs"
"${ROOT_DIR}/package/osx/libraries" \
"/Volumes/${VOL_NAME}/OpenPilot GCS.app" || exit 1
"/Volumes/${mountvolume}/OpenPilot GCS.app" || exit 1
hdiutil detach ${device}