From 67e49d6480126968a1d87a12ae6e967b861e8909 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 6 Oct 2013 17:52:34 -0700 Subject: Implement a qmake-based build for Subsurface This is working for me, but requires a bit more testing. To build, run: qmake [options] Where options might be: V=1 disable "silent" build LIBDCDEVEL=1 use side-by-side libdivecomputer INCLUDEPATH+=xxx add -Ixxx (e.g., INCLUDEPATH+=/usr/local/marble/include) LIBS+=xxx add xxx to the linker flags (e.g. LIBS+=-L/usr/local/marble/lib) or any other qmake option, including debug and release options If your distribution is already using qtchooser in place of qmake, you may need to pass an extra option to qmake to select the a cross-build. For example: qmake -qt=i686-w64-mingw32-qt4 If your distribution is not yet using qtchooser, then you need to file a bug report requesting it and you need to run the full path to qmake. Note: - there are some ### left in the buildsystem Signed-off-by: Thiago Macieira --- subsurface.pro | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 subsurface.pro (limited to 'subsurface.pro') diff --git a/subsurface.pro b/subsurface.pro new file mode 100644 index 000000000..8a4996385 --- /dev/null +++ b/subsurface.pro @@ -0,0 +1,129 @@ +include(subsurface-configure.pri) + +QT = core gui network webkit svg +INCLUDEPATH += qt-ui $$PWD + +VERSION = 3.1 + +HEADERS = \ + color.h \ + deco.h \ + device.h \ + display.h \ + dive.h \ + divelist.h \ + file.h \ + flag.h \ + gettextfromc.h \ + gettext.h \ + helpers.h \ + libdivecomputer.h \ + planner.h \ + pref.h \ + profile.h \ + qt-gui.h \ + qthelper.h \ + qt-ui/about.h \ + qt-ui/completionmodels.h \ + qt-ui/divecomputermanagementdialog.h \ + qt-ui/divelistview.h \ + qt-ui/diveplanner.h \ + qt-ui/downloadfromdivecomputer.h \ + qt-ui/globe.h \ + qt-ui/graphicsview-common.h \ + qt-ui/kmessagewidget.h \ + qt-ui/maintab.h \ + qt-ui/mainwindow.h \ + qt-ui/modeldelegates.h \ + qt-ui/models.h \ + qt-ui/plotareascene.h \ + qt-ui/preferences.h \ + qt-ui/printdialog.h \ + qt-ui/printlayout.h \ + qt-ui/printoptions.h \ + qt-ui/profilegraphics.h \ + qt-ui/simplewidgets.h \ + qt-ui/starwidget.h \ + qt-ui/subsurfacewebservices.h \ + qt-ui/tableview.h \ + satellite.h \ + sha1.h \ + statistics.h \ + subsurface-icon.h \ + subsurfacestartup.h \ + uemis.h \ + webservice.h + +SOURCES = \ + deco.c \ + device.c \ + dive.c \ + divelist.c \ + equipment.c \ + file.c \ + gettextfromc.cpp \ + libdivecomputer.c \ + main.cpp \ + parse-xml.c \ + planner.c \ + profile.c \ + qt-gui.cpp \ + qthelper.cpp \ + qt-ui/about.cpp \ + qt-ui/completionmodels.cpp \ + qt-ui/divecomputermanagementdialog.cpp \ + qt-ui/divelistview.cpp \ + qt-ui/diveplanner.cpp \ + qt-ui/downloadfromdivecomputer.cpp \ + qt-ui/globe.cpp \ + qt-ui/graphicsview-common.cpp \ + qt-ui/kmessagewidget.cpp \ + qt-ui/maintab.cpp \ + qt-ui/mainwindow.cpp \ + qt-ui/modeldelegates.cpp \ + qt-ui/models.cpp \ + qt-ui/plotareascene.cpp \ + qt-ui/preferences.cpp \ + qt-ui/printdialog.cpp \ + qt-ui/printlayout.cpp \ + qt-ui/printoptions.cpp \ + qt-ui/profilegraphics.cpp \ + qt-ui/simplewidgets.cpp \ + qt-ui/starwidget.cpp \ + qt-ui/subsurfacewebservices.cpp \ + qt-ui/tableview.cpp \ + save-xml.c \ + sha1.c \ + statistics.c \ + subsurfacestartup.c \ + time.c \ + uemis.c \ + uemis-downloader.c + +linux*: SOURCES += linux.c +mac: SOURCES += macos.c +win32: SOURCES += windows.c + +FORMS = \ + qt-ui/about.ui \ + qt-ui/divecomputermanagementdialog.ui \ + qt-ui/diveplanner.ui \ + qt-ui/downloadfromdivecomputer.ui \ + qt-ui/maintab.ui \ + qt-ui/mainwindow.ui \ + qt-ui/preferences.ui \ + qt-ui/printoptions.ui \ + qt-ui/renumber.ui \ + qt-ui/subsurfacewebservices.ui \ + qt-ui/tableview.ui + +RESOURCES = subsurface.qrc + +TRANSLATIONS = subsurface_de.ts + +doc.commands = $(CHK_DIR_EXISTS) Documentation || $(MKDIR) Documentation +doc.commands += $$escape_expand(\\n\\t)$(MAKE) -C $$PWD/Documentation OUT=$$OUT_PWD/Documentation doc +all.depends += doc +QMAKE_EXTRA_TARGETS += doc all + +include(subsurface-gen-version.pri) -- cgit v1.2.3-70-g09d2 From 9e069371c6ee3e2866296c43e15a2bfdd9064804 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 6 Oct 2013 18:41:37 -0700 Subject: Add qmake rules to install Subsurface This is probably the most complex part of the new buildsystem. This adds the following targets: - Linux: make install - installs to $(prefix) (default: /usr) The install path can be changed during make install time. - Windows: make install - installs Subsurface and its dependencies to packaging/windows. - Mac: make mac-deploy - populates Subsurface.app with the dependencies make install - mac-deploy + install Subsurface.app to /Application make mac-create-dmg - mac-deploy + creates Subsurface-$VERSION.dmg Signed-off-by: Thiago Macieira --- subsurface-install.pri | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ subsurface.pro | 10 +++++ 2 files changed, 112 insertions(+) create mode 100644 subsurface-install.pri (limited to 'subsurface.pro') diff --git a/subsurface-install.pri b/subsurface-install.pri new file mode 100644 index 000000000..585481f62 --- /dev/null +++ b/subsurface-install.pri @@ -0,0 +1,102 @@ +marbledir.files = $$MARBLEDIR +xslt.files = $$XSLT_FILES +doc.files = $$DOC_FILES + +nltab = $$escape_expand(\\n\\t) + +mac { + # OS X bundling rules + # "make mac-deploy" deploys the external libs (Qt, libdivecomputer, libusb, etc.) into the bundle + # "make install" installs the bundle to /Application + # "make mac-create-dmg" creates Subsurface.dmg + + mac_bundle.path = /Application + mac_bundle.files = Subsurface.app + mac_bundle.CONFIG += no_check_exist directory + INSTALLS += mac_bundle + install.depends += mac-deploy + + datadir = Contents/Resources/share/subsurface + marbledir.path = Contents/Resources/data + xslt.path = $$datadir + doc.path = Contents/Resources/share/doc/subsurface + doc.files = $$files($$doc.files) + QMAKE_BUNDLE_DATA += marbledir xslt doc + + mac_deploy.target = mac-deploy + mac_deploy.commands += $$[QT_INSTALL_BINS]/macdeployqt $${TARGET}.app + !isEmpty(V):mac_deploy.commands += -verbose=1 + + mac_dmg.target = mac-create-dmg + mac_dmg.commands = $$mac_deploy.commands -dmg + mac_dmg.commands += $${nltab}$(MOVE) $${TARGET}.dmg $${TARGET}-$${VERSION}.dmg + QMAKE_EXTRA_TARGETS += mac_deploy mac_dmg +} else: win32 { + # Windows bundling rules + # We don't have a helpful tool like macdeployqt for Windows, so we hardcode + # which libs we need. + # The only target is "make install", which copies everything into packaging/windows + WINDOWSSTAGING = packaging/windows + + deploy.path = $$WINDOWSSTAGING + for(qtlib, $$list(QtCore QtGui QtNetwork QtWebKit QtSvg QtXml QtDeclarative)) { + CONFIG(debug, debug|release): deploy.files += $$[QT_INSTALL_BINS]/$${qtlib}d4.dll + else: deploy.files += $$[QT_INSTALL_BINS]/$${qtlib}4.dll + } + + deploy.files += $$marbledir.files $$xslt.files $$doc.files + target.path = $$WINDOWSSTAGING + INSTALLS += deploy target + + qt_conf.commands = echo \'[Paths]\' > $@ + qt_conf.commands += $${nltab}echo \'Prefix=.\' >> $@ + qt_conf.commands += $${nltab}echo \'Plugins=plugins\' >> $@ + qt_conf.target = $$PWD/packaging/windows/qt.conf + install.depends += qt_conf +} else { + # Linux install rules + # On Linux, we can count on packagers doing the right thing + # We just need to drop a few files here and there + + # This is a fake rule just to create some rules in the target file + nl = $$escape_expand(\\n) + dummy.target = dummy-only-for-var-expansion + dummy.commands = $${nl}prefix = /usr$${nl}\ +BINDIR = $(prefix)/bin$${nl}\ +DATADIR = $(prefix)/share$${nl}\ +DOCDIR = $(DATADIR)/doc/subsurface$${nl}\ +DESKTOPDIR = $(DATADIR)/applications$${nl}\ +ICONPATH = $(DATADIR)/icons/hicolor$${nl}\ +ICONDIR = $(ICONPATH)/scalable/apps$${nl}\ +MANDIR = $(DATADIR)/man/man1$${nl}\ +XSLTDIR = $(DATADIR)/subsurface + QMAKE_EXTRA_TARGETS += dummy + + WINDOWSSTAGING = ./packaging/windows + + target.path = /$(BINDIR) + target.files = $$TARGET + + desktop.path = /$(DESKTOPDIR) + desktop.files = $$DESKTOP_FILE + manpage.path = /$(MANDIR) + manpage.files = $$MANPAGE + + icon.path = /$(ICONDIR) + icon.files = $$ICON + + xslt.path = /$(XSLTDIR) + marbledir.path = /$(DATADIR)/subsurface + doc.path = /$(DOCDIR) + + # FIXME: Linguist translations + #l10n_install.commands = for LOC in $$files(share/locale/*/LC_MESSAGES); do \ + # $(INSTALL_PROGRAM) -d $(INSTALL_ROOT)/$(prefix)/$$LOC; \ + # $(INSTALL_FILE) $$LOC/subsurface.mo $(INSTALL_ROOT)/$(prefix)/$$LOC/subsurface.mo; \ + # done + #install.depends += l10n_install + + INSTALLS += target desktop icon manpage xslt doc marbledir + install.target = install +} +QMAKE_EXTRA_TARGETS += install $$install.depends diff --git a/subsurface.pro b/subsurface.pro index 8a4996385..f3c0d12ca 100644 --- a/subsurface.pro +++ b/subsurface.pro @@ -126,4 +126,14 @@ doc.commands += $$escape_expand(\\n\\t)$(MAKE) -C $$PWD/Documentation OUT=$$OUT_ all.depends += doc QMAKE_EXTRA_TARGETS += doc all +DESKTOP_FILE = subsurface.desktop +ICON = subsurface-icon.svg +MANPAGE = subsurface.1 +XSLT_FILES = xslt/*.xslt xslt/*.xsl +DOC_FILES = $$OUT_PWD/Documentation/user-manual.html Documentation/images +MARBLEDIR = marbledata/maps + +OTHER_FILES += $$DESKTOPFILE $$ICON $$MANPAGE $$XSLT_FILES $$DOC_FILES $$MARBLEDIR + include(subsurface-gen-version.pri) +include(subsurface-install.pri) -- cgit v1.2.3-70-g09d2 From 57994fa7a19ece18ffbecfabd69216190f62e425 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 6 Oct 2013 23:12:59 -0700 Subject: And let qmake create the Mac bundle on its own It will even parse the Info.plist.in file for us and run sed on it. Signed-off-by: Thiago Macieira --- packaging/macosx/Info.plist.in | 2 +- subsurface.pro | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'subsurface.pro') diff --git a/packaging/macosx/Info.plist.in b/packaging/macosx/Info.plist.in index a623303a1..5e094401a 100644 --- a/packaging/macosx/Info.plist.in +++ b/packaging/macosx/Info.plist.in @@ -17,6 +17,6 @@ CFBundleInfoDictionaryVersion 1.0 CFBundleVersion - CFBUNDLEVERSION_TOKEN + @SHORT_VERSION@ diff --git a/subsurface.pro b/subsurface.pro index f3c0d12ca..a04281941 100644 --- a/subsurface.pro +++ b/subsurface.pro @@ -3,6 +3,9 @@ include(subsurface-configure.pri) QT = core gui network webkit svg INCLUDEPATH += qt-ui $$PWD +mac: TARGET = Subsurface +else: TARGET = subsurface + VERSION = 3.1 HEADERS = \ @@ -127,13 +130,30 @@ all.depends += doc QMAKE_EXTRA_TARGETS += doc all DESKTOP_FILE = subsurface.desktop -ICON = subsurface-icon.svg +mac: ICON = packaging/macosx/Subsurface.icns +else: ICON = subsurface-icon.svg MANPAGE = subsurface.1 -XSLT_FILES = xslt/*.xslt xslt/*.xsl +XSLT_FILES = xslt DOC_FILES = $$OUT_PWD/Documentation/user-manual.html Documentation/images MARBLEDIR = marbledata/maps -OTHER_FILES += $$DESKTOPFILE $$ICON $$MANPAGE $$XSLT_FILES $$DOC_FILES $$MARBLEDIR +# This information will go into the Windows .rc file and linked into the .exe +QMAKE_TARGET_COMPANY = subsurface team +QMAKE_TARGET_DESCRIPTION = subsurface dive log +QMAKE_TARGET_COPYRIGHT = Linus Torvalds, Dirk Hohndel and others + +# And this is the Mac Info.plist file +# qmake automatically generates sed rules to replace: +# token qmake expansion +# @ICON@ $$ICON +# @TYPEINFO@ first 4 chars of $$QMAKE_PKGINFO_TYPEINFO +# @EXECUTABLE@ $$QMAKE_ORIG_TARGET +# @LIBRARY@ $$QMAKE_ORIG_TARGET +# @SHORT_VERSION@ $$VER_MAJ.$$VER_MIN +QMAKE_INFO_PLIST = packaging/macosx/Info.plist.in + +OTHER_FILES += $$DESKTOPFILE $$ICON $$MANPAGE $$XSLT_FILES $$DOC_FILES $$MARBLEDIR \ + $$QMAKE_INFO_PLIST include(subsurface-gen-version.pri) include(subsurface-install.pri) -- cgit v1.2.3-70-g09d2 From 603d65c9616ee85e0e0de1535874b981261589d2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 8 Oct 2013 21:27:10 -0700 Subject: Deploy some Qt plugins alongside the binary Only implemented for Windows for now. On Mac, macdeployqt copies all imageformat plugins on its own. Signed-off-by: Thiago Macieira --- subsurface-install.pri | 8 +++++++- subsurface.pro | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'subsurface.pro') diff --git a/subsurface-install.pri b/subsurface-install.pri index c71ae0ada..0615bc325 100644 --- a/subsurface-install.pri +++ b/subsurface-install.pri @@ -45,7 +45,7 @@ mac { qt_conf.commands = echo \'[Paths]\' > $@ qt_conf.commands += $${nltab}echo \'Prefix=.\' >> $@ - qt_conf.commands += $${nltab}echo \'Plugins=plugins\' >> $@ + qt_conf.commands += $${nltab}echo \'Plugins=.\' >> $@ qt_conf.target = $$PWD/packaging/windows/qt.conf install.depends += qt_conf @@ -53,6 +53,12 @@ mac { #!equals($$QMAKE_HOST.os, "Windows"): dlls.commands += OBJDUMP=`$(CC) -dumpmachine`-objdump dlls.commands += PATH=\$\$PATH:`$(CC) -print-search-dirs | $(SED) -nE \'/^libraries: =/{s///;s,/lib/?(:|\\\$\$),/bin\\1,g;p;q;}\'` dlls.commands += perl $$PWD/scripts/win-ldd.pl $(DESTDIR_TARGET) + + for(plugin, $$list($$DEPLOYMENT_PLUGIN)) { + CONFIG(debug, debug|release): dlls.commands += $$[QT_INSTALL_PLUGINS]/$${plugin}d4.dll + else: dlls.commands += $$[QT_INSTALL_PLUGINS]/$${plugin}4.dll + } + dlls.commands += $$LIBS dlls.commands += | while read name; do $(INSTALL_FILE) \$\$name $$PWD/$$WINDOWSSTAGING; done dlls.depends = $(DESTDIR_TARGET) diff --git a/subsurface.pro b/subsurface.pro index a04281941..065897233 100644 --- a/subsurface.pro +++ b/subsurface.pro @@ -136,6 +136,7 @@ MANPAGE = subsurface.1 XSLT_FILES = xslt DOC_FILES = $$OUT_PWD/Documentation/user-manual.html Documentation/images MARBLEDIR = marbledata/maps +DEPLOYMENT_PLUGIN += imageformats/qjpeg # This information will go into the Windows .rc file and linked into the .exe QMAKE_TARGET_COMPANY = subsurface team -- cgit v1.2.3-70-g09d2