diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-10-08 23:51:02 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-10-08 23:51:02 -0700 |
commit | 83eb64a9ef5281a28378af8cb252ec5329b0d142 (patch) | |
tree | 43de2f48b5c0c05c1c206f84251eabccffe5a5b2 | |
parent | 8e8a631cbc354e47c94913f4e82295cea13b3892 (diff) | |
parent | dddcd1016218a1b9b9662be078665e24d46efbac (diff) | |
download | subsurface-83eb64a9ef5281a28378af8cb252ec5329b0d142.tar.gz |
Merge http://github.com/thiagomacieira/subsurface
-rw-r--r-- | .gitignore | 19 | ||||
-rw-r--r-- | Configure.mk | 183 | ||||
-rw-r--r-- | Documentation/Makefile | 10 | ||||
-rw-r--r-- | INSTALL | 155 | ||||
-rw-r--r-- | Makefile | 165 | ||||
-rw-r--r-- | README | 172 | ||||
-rw-r--r-- | Rules.mk | 289 | ||||
-rw-r--r-- | packaging/macosx/Info.plist.in | 2 | ||||
-rw-r--r-- | packaging/windows/subsurface.rc | 25 | ||||
-rw-r--r-- | scripts/win-ldd.pl | 69 | ||||
-rw-r--r-- | subsurface-configure.pri | 102 | ||||
-rw-r--r-- | subsurface-gen-version.pri | 16 | ||||
-rw-r--r-- | subsurface-install.pri | 114 | ||||
-rw-r--r-- | subsurface.pro | 160 |
14 files changed, 628 insertions, 853 deletions
diff --git a/.gitignore b/.gitignore index 520248b58..085323a37 100644 --- a/.gitignore +++ b/.gitignore @@ -3,19 +3,14 @@ *.rej *.exe *.dmg -*.moc -*.moc.cpp *.patch -*.ui.h *.xml version.h !dives/*.xml *~ po/*.mo -qt-ui/ui_*.h /subsurface /*.tar.gz -.dep/ share/ Documentation/docbook-xsl.css Documentation/user-manual.html @@ -23,13 +18,11 @@ Documentation/user-manual.pdf Documentation/user-manual.text packaging/windows/subsurface.nsi packaging/macos/Info.plist -config.cache -*.qrc.cpp -ui_* -/subsurface.config -/subsurface.creator -/subsurface.creator.user -/subsurface.files -/subsurface.includes *.kdev4 callgrind.out.* +.rcc +.moc +.uic +.obj +Makefile +subsurface.pro.user* diff --git a/Configure.mk b/Configure.mk deleted file mode 100644 index 9e9a2ba0e..000000000 --- a/Configure.mk +++ /dev/null @@ -1,183 +0,0 @@ -# -*- Makefile -*- -# This file contains the detection rules -all: - -PKGCONFIG=pkg-config -XML2CONFIG=xml2-config -XSLCONFIG=xslt-config -QMAKE=qmake -MOC=moc -UIC=uic -TAR=tar - -CONFIGFILE = config.cache -ifeq ($(CONFIGURING),1) - -# Detect the target system -# Ask the compiler what OS it's producing files for -UNAME := $(shell $(CC) -dumpmachine 2>&1 | grep -E -o "linux|darwin|win|gnu|kfreebsd") - -# find libdivecomputer -# First deal with the cross compile environment and with Mac. -# For the native case, Linus doesn't want to trust pkg-config given -# how young libdivecomputer still is - so we check the typical -# subdirectories of /usr/local and /usr and then we give up. You can -# override by simply setting it here -# -ifeq ($(CC), i686-w64-mingw32-gcc) -# ok, we are cross building for Windows - LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer) - LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer) - RESFILE = packaging/windows/subsurface.res - LDFLAGS += -Wl,-subsystem,windows - LIBWINSOCK = -lwsock32 -else ifeq ($(UNAME), darwin) - LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer) - LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer) -else ifneq ($(LIBDCDEVEL),) - LIBDIVECOMPUTERDIR = ../libdivecomputer - LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include - LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/src/.libs/libdivecomputer.a -else ifeq ($(shell $(PKGCONFIG) --exists libdivecomputer; echo $$?),0) - LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer) - LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer) -else -libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a) -libdc-local64 := $(wildcard /usr/local/lib64/libdivecomputer.a) -libdc-usr := $(wildcard /usr/lib/libdivecomputer.a) -libdc-usr64 := $(wildcard /usr/lib64/libdivecomputer.a) - -ifneq ($(strip $(libdc-local)),) - LIBDIVECOMPUTERDIR = /usr/local - LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include - LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a -else ifneq ($(strip $(libdc-local64)),) - LIBDIVECOMPUTERDIR = /usr/local - LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include - LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a -else ifneq ($(strip $(libdc-usr)),) - LIBDIVECOMPUTERDIR = /usr - LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include - LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a -else ifneq ($(strip $(libdc-usr64)),) - LIBDIVECOMPUTERDIR = /usr - LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include - LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a -else -$(error Cannot find libdivecomputer - please edit Makefile) -endif -endif - -# Libusb-1.0 is only required if libdivecomputer was built with it. -# And libdivecomputer is only built with it if libusb-1.0 is -# installed. So get libusb if it exists, but don't complain -# about it if it doesn't. -LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null) - -# Find qmake. Rules are: -# - use qmake if it is in $PATH -# [qmake -query QT_VERSION will fail if it's Qt 3's qmake] -# - if that fails, try qmake-qt4 -# - if that fails, print an error -# We specifically do not search for qmake-qt5 since that is not supposed -# to exist. -QMAKE = $(shell { qmake -query QT_VERSION >/dev/null 2>&1 && echo qmake; } || \ - { qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; }) -ifeq ($(strip $(QMAKE)),) -$(error Could not find qmake or qmake-qt4 in $$PATH or they failed) -endif - -# Use qmake to find out which Qt version we are building for. -QT_VERSION_MAJOR = $(shell $(QMAKE) -query QT_VERSION | cut -d. -f1) -ifeq ($(QT_VERSION_MAJOR), 5) -# QT_MODULES = Qt5Widgets Qt5Svg -# QT_CORE = Qt5Core -# QTBINDIR = $(shell $(QMAKE) -query QT_HOST_BINS) -# # Tool paths are not stored in .pc files in Qt 5.0 -# MOC = $(QTBINDIR)/moc -# UIC = $(QTBINDIR)/uic -# RCC = $(QTBINDIR)/rcc -# if qmake is qt5, try to get the qt4 one. - QMAKE = { qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; } -#else -endif - -ifeq ($(strip $(QMAKE)),) -$(error Could not find qmake or qmake-qt4 in $$PATH for the Qt4 version they failed) -endif - - QT_MODULES = QtGui QtSvg QtNetwork QtWebKit - QT_CORE = QtCore - MOC = $(shell $(PKGCONFIG) --variable=moc_location QtCore) - UIC = $(shell $(PKGCONFIG) --variable=uic_location QtGui) - RCC = $(shell $(PKGCONFIG) --variable=rcc_location QtGui) -#endif - -QTCXXFLAGS = $(shell $(PKGCONFIG) --cflags $(QT_MODULES)) -LIBQT = $(shell $(PKGCONFIG) --libs $(QT_MODULES)) -ifneq ($(filter reduce_relocations, $(shell $(PKGCONFIG) --variable qt_config $(QT_CORE))), ) - QTCXXFLAGS += -fPIE -endif - -ifeq ($(UNAME), darwin) - LDFLAGS += -framework CoreFoundation -framework CoreServices -endif - -LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES) -LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB) - -LIBXML2 = $(shell $(XML2CONFIG) --libs) -LIBXSLT = $(shell $(XSLCONFIG) --libs) -XML2CFLAGS = $(shell $(XML2CONFIG) --cflags) -XSLCFLAGS = $(shell $(XSLCONFIG) --cflags) - -LIBZIP = $(shell $(PKGCONFIG) --libs libzip 2> /dev/null) -ZIPFLAGS = $(strip $(shell $(PKGCONFIG) --cflags libzip 2> /dev/null)) - -LIBSQLITE3 = $(shell $(PKGCONFIG) --libs sqlite3 2> /dev/null) -SQLITE3FLAGS = $(strip $(shell $(PKGCONFIG) --cflags sqlite3)) - -# Before Marble 4.9, the GeoDataTreeModel.h header wasn't installed -# Check if it's present by trying to compile -MARBLEFLAGS = $(shell $(CXX) $(QTCXXFLAGS) -E -include marble/GeoDataTreeModel.h -xc++ /dev/null > /dev/null 2>&1 || echo " -DINCOMPLETE_MARBLE") -MARBLELIBS = -lmarblewidget - -# Write the configure file -all: configure -configure $(CONFIGURE): Configure.mk - @echo "\ - CONFIGURED = 1\\\ - UNAME = $(UNAME)\\\ - LIBDIVECOMPUTERDIR = $(LIBDIVECOMPUTERDIR)\\\ - LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERCFLAGS)\\\ - LIBDIVECOMPUTER = $(LIBDIVECOMPUTER)\\\ - LIBWINSOCK = $(LIBWINSOCK)\\\ - LDFLAGS = $(LDFLAGS)\\\ - RESFILE = $(RESFILE)\\\ - LIBQT = $(LIBQT)\\\ - QTCXXFLAGS = $(QTCXXFLAGS)\\\ - MOC = $(MOC)\\\ - UIC = $(UIC)\\\ - RCC = $(RCC)\\\ - LIBXML2 = $(LIBXML2)\\\ - LIBXSLT = $(LIBXSLT)\\\ - XML2CFLAGS = $(XML2CFLAGS)\\\ - XSLCFLAGS = $(XSLCFLAGS)\\\ - LIBZIP = $(LIBZIP)\\\ - ZIPFLAGS = $(ZIPFLAGS)\\\ - LIBSQLITE3 = $(LIBSQLITE3)\\\ - SQLITE3FLAGS = $(SQLITE3FLAGS)\\\ - MARBLEFLAGS = $(MARBLEFLAGS)\\\ - MARBLELIBS = $(MARBLELIBS)\\\ - " | tr '\\' '\n' > $(CONFIGFILE) - -else -configure $(CONFIGFILE): Configure.mk - @test -e $(CONFIGFILE) && echo Reconfiguring.. || echo Configuring... - @$(MAKE) CONFIGURING=1 configure - @echo Done - --include $(CONFIGFILE) -endif - -.PHONY: configure all diff --git a/Documentation/Makefile b/Documentation/Makefile index c56b3efcb..67d2a0c73 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -7,20 +7,20 @@ BROWSER = firefox all: doc $(addprefix $(DOCNAME).,pdf text) -doc: $(HTMLDOC) +doc: $(OUT)$(HTMLDOC) -$(DOCNAME).text: $(DOCSOURCE) +$(OUT)$(DOCNAME).text: $(DOCSOURCE) $(A2X) -f text $< -$(DOCNAME).pdf: $(DOCSOURCE) +$(OUT)$(DOCNAME).pdf: $(DOCSOURCE) $(A2X) -f pdf $< -$(HTMLDOC): $(DOCSOURCE) +$(OUT)$(HTMLDOC): $(DOCSOURCE) @echo "if asciidoc isn't found no HTML documentation is produced but Subsurface is still functional" $(ASCIIDOC) $< || true # Alternatively:: -$(DOCNAME).xhtml: $(DOCSOURCE) +$(OUT)$(DOCNAME).xhtml: $(DOCSOURCE) $(A2X) --icons -f xhtml $< show: $(HTMLDOC) diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..fe0f7967d --- /dev/null +++ b/INSTALL @@ -0,0 +1,155 @@ +Building the Qt version under Linux +----------------------------------- + +On Debian you need libqt4-dev, libmarble-dev, libzip-dev. +Unfortunately the marble version in Debian stable (and possibly +Ubuntu) appears broken and missing essential header files used in the +current git version of Subsurface. We hack around this right now by +including this header file but this needs to be revisited before an +actual release. + +On Fedora you need qt-devel, marble-devel, libzip-devel, +libxml2-devel, libxslt-devel, libsqlite3x-devel. If you are going to +compile libdivecomputer, you need to libusb-devel too. + +On Debian the package names are different; try libxml2-dev, +libsqlite3-dev, libxslt1-dev, libzip-dev (and libusb-1.0-0-dev if +you're going to compile libdivecomputer). + +To compile libdivecomputer: +$ git clone git://git.libdivecomputer.org/libdivecomputer +$ cd libdivecomputer +$ git checkout release-0.4 +$ autoreconf --install +$ ./configure +$ make +$ sudo make install + +To compile Subsurface: +$ git clone git://subsurface.hohndel.org/subsurface.git +$ cd subsurface +$ qmake +$ make +$ sudo make install [optionally, add: prefix=/usr/local] + +Building the Qt version under MacOSX +------------------------------------ + +1) Install Homebrew + +$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" + +2) Install needed dependencies + +$ brew install asciidoc libzip qt sqlite cmake libusb pkg-config + +3) Make the brew version of sqlite the default + +$ brew link --force sqlite + +4) Install Marble + +$ mkdir -p ~/src/marble/build +$ git clone -b KDE/4.11 git://anongit.kde.org/marble ~/src/marble/sources +$ cd ~/src/marble/build +$ cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local ~/src/marble/sources +$ make +$ sudo make install +$ cd src/lib +$ mkdir -p /usr/local/include/marble +$ cp $(find . -name '*.h') /usr/local/include/marble/ +$ cp *dylib /usr/local/lib/ + +5) Install Libdivecomputer + +$ brew install automake libtool +$ cd ~/src +$ git clone git://libdivecomputer.git.sourceforge.net/gitroot/libdivecomputer/libdivecomputer +$ cd libdivecomputer +$ git checkout release-0.4 +$ autoreconf --install +$ ./configure +$ make +$ sudo make install + +6) Compile Subsurface + +$ cd ~/src +$ git clone git://subsurface.hohndel.org/subsurface.git +$ cd subsurface +$ qmake +$ make +$ sudo make install + +After the above is done, Subsurface will be installed to +/Applications. + +Another option is to create a .dmg for distribution: + +$ qmake +$ make +$ make mac-create-dmg + +Cross-building Subsurface on Linux for Windows +---------------------------------------------- + +Subsurface builds nicely with MinGW - the official builds are done as +cross builds under Linux (currently on Fedora 17). A shell script to do +that (plus the .nsi file to create the installer with makensis) are +included in the packaging/Windows directory. + +The best way to get libdivecomputer to build appears to be + +$ git clone git://libdivecomputer.git.sourceforge.net/gitroot/libdivecomputer/libdivecomputer +$ cd libdivecomputer +$ git checkout release-0.4 +$ mingw32-configure +$ mingw32-make +$ sudo mingw32-make install + +To compile Subsurface, use: + +$ git clone git://subsurface.hohndel.org/subsurface.git +$ cd subsurface +$ i686-w64-mingw32-qmake-qt4 +$ make +$ make install +$ make create-windows-installer + +Building Subsurface on Windows +------------------------------ + +This is still work in progress. + +To build subsurface, use: + +$ git clone git://subsurface.hohndel.org/subsurface.git +$ cd subsurface +$ qmake +$ make +$ make install +$ make create-windows-installer + +Build options +------------- + +The following options are recognised when passed to qmake: + + -config debug Create a debug build + -config release Create a release build + The default depends on how Qt was built. + V=1 Disable the "silent" build mode + LIBDCDEVEL=1 Search for libdivecomputer in ../libdivecomputer + INCLUDEPATH+=xxx Add xxx to the include paths to the compiler + (pass the actual path, without -I) + LIBS+=xxx Add xxx to the linker flags. -l and -L options are + recognised. + +The INCLUDEPATH and LIBS options are useful to tell the buildsystem +about non-standard installation paths for the dependencies (such as +Marble). They can be repeated as often as needed, or multiple +arguments can be passed on the same switch, separated by a space. For +example: + + qmake LIBS+="-L$HOME/marble/lib -L$HOME/libdivecomputer/lib" \ + INCLUDEPATH+="$HOME/marble/include $HOME/libdivecomputer/include" diff --git a/Makefile b/Makefile deleted file mode 100644 index 657309918..000000000 --- a/Makefile +++ /dev/null @@ -1,165 +0,0 @@ -NAME = subsurface -CAPITALIZED_NAME = Subsurface -TARGET = $(NAME) - -include Configure.mk -VERSION=3.1 - -CC=gcc -CFLAGS=-Wall -Wno-pointer-sign -g $(CLCFLAGS) -DGSEAL_ENABLE -CXX=g++ -CXXFLAGS=-Wall -g $(CLCXXFLAGS) $(MARBLEFLAGS) -INSTALL=install - -# these locations seem to work for SuSE and Fedora -# prefix = $(HOME) -prefix = $(DESTDIR)/usr -BINDIR = $(prefix)/bin -DATADIR = $(prefix)/share -DOCDIR = $(DATADIR)/doc/$(NAME) -DESKTOPDIR = $(DATADIR)/applications -ICONPATH = $(DATADIR)/icons/hicolor -ICONDIR = $(ICONPATH)/scalable/apps -MANDIR = $(DATADIR)/man/man1 -XSLTDIR = $(DATADIR)/$(NAME)/xslt -MARBLEDIR = marbledata/maps/earth/googlesat - -ICONFILE = $(NAME)-icon.svg -DESKTOPFILE = $(NAME).desktop -MANFILES = $(NAME).1 -XSLTFILES = xslt/*.xslt xslt/*.xsl - -EXTRA_FLAGS = $(QTCXXFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) \ - $(LIBDIVECOMPUTERCFLAGS) \ - $(LIBSOUPCFLAGS) -I. -DQT_NO_STL - -HEADERS = \ - qt-ui/divelistview.h \ - qt-ui/maintab.h \ - qt-ui/mainwindow.h \ - qt-ui/models.h \ - qt-ui/plotareascene.h \ - qt-ui/starwidget.h \ - qt-ui/modeldelegates.h \ - qt-ui/profilegraphics.h \ - qt-ui/globe.h \ - qt-ui/kmessagewidget.h \ - qt-ui/downloadfromdivecomputer.h \ - qt-ui/preferences.h \ - qt-ui/simplewidgets.h \ - qt-ui/subsurfacewebservices.h \ - qt-ui/divecomputermanagementdialog.h \ - qt-ui/diveplanner.h \ - qt-ui/about.h \ - qt-ui/graphicsview-common.h \ - qt-ui/printdialog.h \ - qt-ui/printoptions.h \ - qt-ui/printlayout.h \ - qt-ui/completionmodels.h \ - qt-ui/tableview.h - - -SOURCES = \ - deco.c \ - device.c \ - dive.c \ - divelist.c \ - equipment.c \ - file.c \ - parse-xml.c \ - planner.c \ - subsurfacestartup.c \ - profile.c \ - save-xml.c \ - sha1.c \ - statistics.c \ - time.c \ - uemis.c \ - uemis-downloader.c \ - libdivecomputer.c \ - gettextfromc.cpp \ - qthelper.cpp \ - qt-ui/simplewidgets.cpp \ - qt-ui/tableview.cpp \ - qt-ui/mainwindow.cpp \ - qt-ui/models.cpp \ - qt-ui/plotareascene.cpp \ - qt-ui/starwidget.cpp \ - qt-ui/modeldelegates.cpp \ - qt-ui/profilegraphics.cpp \ - qt-ui/globe.cpp \ - qt-ui/kmessagewidget.cpp \ - qt-ui/downloadfromdivecomputer.cpp \ - qt-ui/preferences.cpp \ - qt-ui/subsurfacewebservices.cpp \ - qt-ui/divecomputermanagementdialog.cpp \ - qt-ui/diveplanner.cpp \ - qt-ui/divelistview.cpp \ - qt-ui/about.cpp \ - qt-ui/graphicsview-common.cpp \ - qt-ui/printdialog.cpp \ - qt-ui/printoptions.cpp \ - qt-ui/printlayout.cpp \ - qt-ui/completionmodels.cpp \ - qt-ui/maintab.cpp \ - qt-gui.cpp \ - main.cpp \ - $(RESFILE) - -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 = $(NAME).qrc - -ifneq ($(SQLITE3FLAGS),) - EXTRA_FLAGS += -DSQLITE3 $(SQLITE3FLAGS) -endif -ifneq ($(ZIPFLAGS),) - EXTRA_FLAGS += -DLIBZIP $(ZIPFLAGS) -endif -ifneq ($(strip $(LIBXSLT)),) - EXTRA_FLAGS += -DXSLT='"$(XSLTDIR)"' $(XSLCFLAGS) -endif - -ifneq (,$(filter $(UNAME),linux kfreebsd gnu)) - SOURCES += linux.c -else ifeq ($(UNAME), darwin) - SOURCES += macos.c - MACOSXINSTALL = /Applications/$(CAPITALIZED_NAME).app - MACOSXFILES = packaging/macosx - MACOSXSTAGING = $(MACOSXFILES)/$(CAPITALIZED_NAME).app - INFOPLIST = $(MACOSXFILES)/Info.plist - INFOPLISTINPUT = $(INFOPLIST).in - LDFLAGS += -headerpad_max_install_names -else - SOURCES += windows.c - WINDOWSSTAGING = ./packaging/windows - WINMSGDIRS=$(addprefix share/locale/,$(shell ls po/*.po | sed -e 's/po\/\(..\)_.*/\1\/LC_MESSAGES/')) - NSIINPUTFILE = $(WINDOWSSTAGING)/$(NAME).nsi.in - NSIFILE = $(WINDOWSSTAGING)/$(NAME).nsi - MAKENSIS = makensis - XSLTDIR = .\\xslt - TARGET = $(NAME).exe -endif - -LIBS = $(LIBQT) $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBDIVECOMPUTER) \ - $(EXTRALIBS) $(LIBZIP) -lpthread -lm $(LIBSOUP) $(LIBWINSOCK) $(MARBLELIBS) - -MSGLANGS=$(notdir $(wildcard po/*.po)) - -# Add files to the following variables if the auto-detection based on the -# filename fails -OBJS_NEEDING_MOC = -HEADERS_NEEDING_MOC = - -include Rules.mk @@ -11,89 +11,6 @@ will get you the latest version of the fully functional Subsurface. git checkout Gtk -If you are indeed planning to work on the Qt version, here are some -pointers to get you started: - -Building the Qt version under Linux ------------------------------------ - -On Debian you need libqt4-dev, libmarble-dev, libzip-dev. -Unfortunately the marble version in Debian stable (and possibly -Ubuntu) appears broken and missing essential header files used in the -current git version of Subsurface. We hack around this right now by -including this header file but this needs to be revisited before an -actual release. - -On Fedora you need qt-devel, marble-devel, libzip-devel. - -Building the Qt version under MacOSX ------------------------------------- - -You might have built MacPorts packages with +quartz dependencies to -build the previous Subsurface/Gtk version. Switch to the +x11 -dependencies and prepare your system for Subsurface/Qt by doing: - -sudo port uninstall gtk-osx-application subsurface libdivecomputer -sudo port install cairo +x11 pango +x11 py27-pygtk +x11 gtk2 +x11 -sudo port install qt4-mac marble libzip libtool libusb - -Then build libdivecomputer and Subsurface as described below. - -With the current version (and dependencies of marble), to run subsurface you have to once - -sudo port install dbus -sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist -launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist -sudo chown -R ${USER} ~/Library/Preferences/KDE - -Buildling the Qt version under MacOSX, using dependencies from Homebrew ------------------------------------------------------------------------ - -1) Install Homebrew - -$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" - -2) Install needed dependencies - -$ brew install asciidoc libzip qt sqlite cmake libusb pkg-config - -3) Make the brew version of sqlite the default - -$ brew link --force sqlite - -4) Install Marble - -$ mkdir -p ~/src/marble/build -$ git clone -b KDE/4.11 git://anongit.kde.org/marble ~/src/marble/sources -$ cd ~/src/marble/build -$ cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local ~/src/marble/sources -$ make -$ sudo make install -$ cd src/lib -$ mkdir -p /usr/local/include/marble -$ cp $(find . -name '*.h') /usr/local/include/marble/ -$ cp *dylib /usr/local/lib/ - -5) Install Libdivecomputer - -$ brew install automake libtool -$ cd ~/src -$ git clone git://libdivecomputer.git.sourceforge.net/gitroot/libdivecomputer/libdivecomputer -$ cd libdivecomputer -$ git checkout release-0.4 -$ autoreconf --install -$ ./configure -$ make -$ sudo make install - -6) Compile Subsurface - -$ cd ~/src -$ git clone git://subsurface.hohndel.org/subsurface.git -$ cd subsurface -$ make - - Subsurface - an Open Source Divelog =================================== @@ -154,95 +71,6 @@ can get a tar ball from http://subsurface.hohndel.org/downloads/Subsurface-3.1.tgz - -Building subsurface under Linux -------------------------------- -You need libxml2-devel, libxslt-devel, gtk2-devel, glib2-devel, -gconf2-devel, libsoup-devel, osm-gps-map-devel, libsqlite3x-devel, and -libzip-devel to build this (and libusb-1.0 if you have libdivecomputer -built with it, but then you obviously already have it installed). -Check with your Linux distribution how to install these packages. - -On Debian the package names are different; try libxml2-dev, -libgtk2.0-dev, libglib2.0-dev, libgconf2-dev, libsoup2.4-dev, -libosmgpsmap-dev, libsqlite3-dev, libxslt1-dev, libzip-dev, -zlib1g-dev (and libusb-1.0-0-dev if libdivecomputer is built with it). - -Note that contrary to earlier versions of Subsurface, starting in v3.1 -XSLT, LIBZIP and OSMGPSMAP are no longer optional but instead are -required to build. - -You also need to have libdivecomputer installed. The current git -versions of Subsurface assume that you use libdivecomputer version -0.4, which goes something like this: - -git clone git://git.libdivecomputer.org/libdivecomputer -cd libdivecomputer -git checkout release-0.4 -autoreconf --install -./configure -make -sudo make install - -NOTE! Sometimes you may need to tell the main Subsurface Makefile where -you installed libdivecomputer; pkg-config for libdivecomputer doesn't -always work unless the project has been installed by the distro. - -Just edit the makefile directly. - - -Building Subsurface under Windows ---------------------------------- -Subsurface builds nicely with MinGW - the official builds are done as -cross builds under Linux (currently on Fedora 17). A shell script to do -that (plus the .nsi file to create the installer with makensis) are -included in the packaging/Windows directory. - -Strangely the developers have failed to make 'https' support work in -the cross-built Windows binaries. As a workaround at this point the -cross built Windows binaries use http instead https connections (right -now this only applies to divelogs.de uploads). - -The best way to get libdivecomputer to build appears to be - -mingw32-configure -mingw32-make -sudo mingw32-make install - -Once you have built and installed libdivecomputer you can use - -sh packaging/Windows/mingw-make.sh - -to then build subsurface. In order to create an installer simply use - -sh packaging/Windows/mingw-make.sh create-windows-installer - - -Building subsurface on a Mac ----------------------------- -Install MacPorts and install the dependencies from MacPorts: - -sudo port install libusb libtool libzip qt4-mac marble - -Install libdivecomputer: -git clone git://git.libdivecomputer.org/libdivecomputer -cd libdivecomputer -git checkout release-0.4 -autoreconf --install -LIBUSB_CFLAGS=-I/opt/local/include ./configure -make -sudo make install - -Install subsurface: -git clone git://subsurface.hohndel.org/subsurface.git -cd subsurface -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" make -sudo make install-macosx - -More instructions on how to create a Subsurface DMG can be found in -packaging/macosx/README - - Usage: ====== diff --git a/Rules.mk b/Rules.mk deleted file mode 100644 index d6ab2584c..000000000 --- a/Rules.mk +++ /dev/null @@ -1,289 +0,0 @@ -# -*- Makefile -*- -# Rules for building and creating the version file - -VERSION_FILE = version.h -# There's only one line in $(VERSION_FILE); use the shell builtin `read' -STORED_VERSION_STRING = \ - $(subst ",,$(shell [ ! -r $(VERSION_FILE) ] || \ - read ignore ignore v <$(VERSION_FILE) && echo $$v)) -#" workaround editor syntax highlighting quirk - -GET_VERSION = ./scripts/get-version -VERSION_STRING := $(shell $(GET_VERSION) linux || echo "v$(VERSION)") -# Mac Info.plist style with three numbers 1.2.3 -CFBUNDLEVERSION_STRING := $(shell $(GET_VERSION) darwin $(VERSION_STRING) || \ - echo "$(VERSION).0") -# Windows .nsi style with four numbers 1.2.3.4 -PRODVERSION_STRING := $(shell $(GET_VERSION) win $(VERSION_STRING) || \ - echo "$(VERSION).0.0") - -MSGOBJS=$(addprefix share/locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/$(NAME).mo)) - -ifeq ($(V),1) - PRETTYECHO=true - COMPILE_PREFIX= -else - PRETTYECHO=echo - COMPILE_PREFIX=@ -endif - -C_SOURCES = $(filter %.c, $(SOURCES)) -CXX_SOURCES = $(filter %.cpp, $(SOURCES)) $(RESOURCES:.qrc=.qrc.cpp) -OTHER_SOURCES = $(filter-out %.c %.cpp, $(SOURCES)) -OBJS = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(OTHER_SOURCES) - -# Add the objects for the header files which define QObject subclasses -HEADERS_NEEDING_MOC += $(shell grep -l -s 'Q_OBJECT' $(HEADERS)) -MOC_OBJS = $(HEADERS_NEEDING_MOC:.h=.moc.o) - -ALL_OBJS = $(OBJS) $(MOC_OBJS) - -# handling of uic -UIC_HEADERS = $(patsubst qt-ui/%.ui, .uic/ui_%.h, $(FORMS)) -# Needs to exist before we add path -$(shell mkdir -p .uic) -vpath ui_%.h .uic - -# Files for using Qt Creator -CREATOR_FILES = $(NAME).config $(NAME).creator $(NAME).files $(NAME).includes - -all: $(TARGET) doc - -$(TARGET): gen_version_file $(UIC_HEADERS) $(ALL_OBJS) $(INFOPLIST) - @$(PRETTYECHO) ' LINK' $(TARGET) - $(COMPILE_PREFIX)$(CXX) $(LDFLAGS) -o $(TARGET) $(ALL_OBJS) $(LIBS) - -gen_version_file $(VERSION_FILE): -ifneq ($(STORED_VERSION_STRING),$(VERSION_STRING)) - $(info updating $(VERSION_FILE) to $(VERSION_STRING)) - @echo \#define VERSION_STRING \"$(VERSION_STRING)\" >$(VERSION_FILE) -endif - -install: all - $(INSTALL) -d -m 755 $(BINDIR) - $(INSTALL) $(NAME) $(BINDIR) - $(INSTALL) -d -m 755 $(DESKTOPDIR) - $(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR) - $(INSTALL) -d -m 755 $(ICONDIR) - $(INSTALL) -m 644 $(ICONFILE) $(ICONDIR) - @-if test -z "$(DESTDIR)"; then \ - $(gtk_update_icon_cache); \ - fi - $(INSTALL) -d -m 755 $(MANDIR) - $(INSTALL) -m 644 $(MANFILES) $(MANDIR) - @-if test ! -z "$(XSLT)"; then \ - $(INSTALL) -d -m 755 $(DATADIR)/$(NAME); \ - $(INSTALL) -d -m 755 $(XSLTDIR); \ - $(INSTALL) -m 644 $(XSLTFILES) $(XSLTDIR); \ - fi - @-if test ! -z "$(MARBLEDIR)"; then \ - $(INSTALL) -d -m 755 $(DATADIR)/$(NAME)/$(MARBLEDIR); \ - $(TAR) cf - $(MARBLEDIR) | ( cd $(DATADIR)/$(NAME); $(TAR) xf - ); \ - fi - for LOC in $(wildcard share/locale/*/LC_MESSAGES); do \ - $(INSTALL) -d $(prefix)/$$LOC; \ - $(INSTALL) -m 644 $$LOC/$(NAME).mo $(prefix)/$$LOC/$(NAME).mo; \ - done - $(INSTALL) -d -m 755 $(DOCDIR) - $(INSTALL) -m 644 Documentation/user-manual.html $(DOCDIR) - for IMG in $(wildcard Documentation/images/*); do \ - $(INSTALL) -m 644 $$IMG $(DOCDIR)/images; \ - done - - -install-macosx: all - $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/Resources - $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/MacOS - $(INSTALL) $(NAME) $(MACOSXINSTALL)/Contents/MacOS/$(NAME)-bin - $(INSTALL) $(MACOSXFILES)/$(NAME).sh $(MACOSXINSTALL)/Contents/MacOS/$(NAME) - $(INSTALL) $(MACOSXFILES)/PkgInfo $(MACOSXINSTALL)/Contents/ - $(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXINSTALL)/Contents/ - $(INSTALL) $(ICONFILE) $(MACOSXINSTALL)/Contents/Resources/ - $(INSTALL) $(MACOSXFILES)/$(CAPITALIZED_NAME).icns $(MACOSXINSTALL)/Contents/Resources/ - @-if test ! -z "$(MARBLEDIR)"; then \ - $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/Resources/share/$(MARBLEDIR); \ - $(TAR) cf - $(MARBLEDIR) | ( cd $(MACOSXINSTALL)/Contents/Resources/share; $(TAR) xf - ); \ - fi - for LOC in $(wildcard share/locale/*/LC_MESSAGES); do \ - $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/Resources/$$LOC; \ - $(INSTALL) $$LOC/$(NAME).mo $(MACOSXINSTALL)/Contents/Resources/$$LOC/$(NAME).mo; \ - done - @-if test ! -z "$(XSLT)"; then \ - $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/Resources/share/xslt; \ - $(INSTALL) -m 644 $(XSLTFILES) $(MACOSXINSTALL)/Contents/Resources/share/xslt/; \ - fi - $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/resources/share/doc/$(NAME) - $(INSTALL) -m 644 Documentation/user-manual.html $(MACOSXINSTALL)/Contents/Resources/share/doc/$(NAME) - for IMG in $(wildcard Documentation/images/*); do \ - $(INSTALL) -m 644 $$IMG $(MACOSXINSTALL)/Contents/Resources/share/doc/$(NAME)/images; \ - done - - -create-macosx-bundle: all - $(INSTALL) -d -m 755 $(MACOSXSTAGING)/Contents/Resources - $(INSTALL) -d -m 755 $(MACOSXSTAGING)/Contents/MacOS - $(INSTALL) $(NAME) $(MACOSXSTAGING)/Contents/MacOS/ - $(INSTALL) $(MACOSXFILES)/PkgInfo $(MACOSXSTAGING)/Contents/ - $(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXSTAGING)/Contents/ - $(INSTALL) $(ICONFILE) $(MACOSXSTAGING)/Contents/Resources/ - $(INSTALL) $(MACOSXFILES)/$(CAPITALIZED_NAME).icns $(MACOSXSTAGING)/Contents/Resources/ - for LOC in $(wildcard share/locale/*/LC_MESSAGES); do \ - $(INSTALL) -d -m 755 $(MACOSXSTAGING)/Contents/Resources/$$LOC; \ - $(INSTALL) $$LOC/$(NAME).mo $(MACOSXSTAGING)/Contents/Resources/$$LOC/$(NAME).mo; \ - done - @-if test ! -z "$(XSLT)"; then \ - $(INSTALL) -d -m 755 $(MACOSXSTAGING)/Contents/Resources/xslt; \ - $(INSTALL) -m 644 $(XSLTFILES) $(MACOSXSTAGING)/Contents/Resources/xslt/; \ - fi - $(INSTALL) -d -m 755 $(MACOSXSTAGING)/Contents/resources/share/doc/$(NAME) - $(INSTALL) -m 644 Documentation/user-manual.html $(MACOSXSTAGING)/Contents/Resources/share/doc/$(NAME) - for IMG in $(wildcard Documentation/images/*); do \ - $(INSTALL) -m 644 $$IMG $(MACOSXSTAGING)/Contents/Resources/share/doc/$(NAME)/images; \ - done - $(GTK_MAC_BUNDLER) packaging/macosx/$(NAME).bundle - -sign-macosx-bundle: all - codesign -s "3A8CE62A483083EDEA5581A61E770EC1FA8BECE8" /Applications/$(CAPITALIZED_NAME).app/Contents/MacOS/$(NAME)-bin - -$(RESFILE): packaging/windows/subsurface.rc - @$(PRETTYECHO) ' WINDRES' $< - @i686-w64-mingw32-windres -O coff -i $< -o $@ - -install-cross-windows: all - $(INSTALL) -d -m 755 $(WINDOWSSTAGING)/share/locale - for MSG in $(WINMSGDIRS); do\ - $(INSTALL) -d -m 755 $(WINDOWSSTAGING)/$$MSG;\ - $(INSTALL) $(CROSS_PATH)/$$MSG/* $(WINDOWSSTAGING)/$$MSG;\ - done - for LOC in $(wildcard share/locale/*/LC_MESSAGES); do \ - $(INSTALL) -d -m 755 $(WINDOWSSTAGING)/$$LOC; \ - $(INSTALL) $$LOC/$(NAME).mo $(WINDOWSSTAGING)/$$LOC/$(NAME).mo; \ - done - $(INSTALL) -d -m 755 $(WINDOWSSTAGING)/share/doc/$(NAME) - $(INSTALL) -m 644 Documentation/user-manual.html $(WINDOWSSTAGING)/share/doc/$(NAME) - for IMG in $(wildcard Documentation/images/*); do \ - $(INSTALL) -m 644 $$IMG $(WINDOWSSTAGING)/share/doc/$(NAME)/images; \ - done - - -create-windows-installer: all $(NSIFILE) install-cross-windows - $(MAKENSIS) $(NSIFILE) - -$(NSIFILE): $(NSIINPUTFILE) - $(shell cat $(NSIINPUTFILE) | sed -e 's/VERSIONTOKEN/$(VERSION_STRING)/;s/PRODVTOKEN/$(PRODVERSION_STRING)/' > $(NSIFILE)) - -$(INFOPLIST): $(INFOPLISTINPUT) - $(shell cat $(INFOPLISTINPUT) | sed -e 's/CFBUNDLEVERSION_TOKEN/$(CFBUNDLEVERSION_STRING)/' > $(INFOPLIST)) - -# Transifex merge the translations -update-po-files: - xgettext -o po/$(NAME)-new.pot -s -k_ -kN_ -ktr --keyword=C_:1c,2 --add-comments="++GETTEXT" *.c qt-ui/*.cpp - tx push -s - tx pull -af - -MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $(EXTRA_FLAGS)) - -%.o: %.c - @$(PRETTYECHO) ' CC' $< - @mkdir -p .dep/$(@D) - $(COMPILE_PREFIX)$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $< - -%.o: %.cpp - @$(PRETTYECHO) ' CXX' $< - @mkdir -p .dep/$(@D) - $(COMPILE_PREFIX)$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -I.uic -Iqt-ui -MD -MF .dep/$@.dep -c -o $@ $< - -# This rule is for running the moc on QObject subclasses defined in the .h -# files. -%.moc.cpp: %.h - @$(PRETTYECHO) ' MOC' $< - $(COMPILE_PREFIX)$(MOC) $(MOCFLAGS) $< -o $@ - -# This rule is for running the moc on QObject subclasses defined in the .cpp -# files; remember to #include "<file>.moc" at the end of the .cpp file, or -# you'll get linker errors ("undefined vtable for...") -%.moc: %.cpp - @$(PRETTYECHO) ' MOC' $< - $(COMPILE_PREFIX)$(MOC) -i $(MOCFLAGS) $< -o $@ - -# This creates the Qt resource sources. -%.qrc.cpp: %.qrc - @$(PRETTYECHO) ' RCC' $< - $(COMPILE_PREFIX)$(RCC) $< -o $@ -%.qrc: - -# Create the .ui headers in .uic searched by vpath -# Added to include path in cpp rule -.uic/ui_%.h: qt-ui/%.ui - @$(PRETTYECHO) ' UIC' $< - $(COMPILE_PREFIX)$(UIC) $< -o $@ - -share/locale/%.UTF-8/LC_MESSAGES/$(NAME).mo: po/%.po po/%.aliases - @$(PRETTYECHO) ' MSGFMT' $*.po - @mkdir -p $(dir $@) - $(COMPILE_PREFIX)msgfmt -c -o $@ po/$*.po - @-if test -s po/$*.aliases; then \ - for ALIAS in `cat po/$*.aliases`; do \ - mkdir -p share/locale/$$ALIAS/LC_MESSAGES; \ - cp $@ share/locale/$$ALIAS/LC_MESSAGES; \ - done; \ - fi - -satellite.png: satellite.svg - convert -transparent white -resize 11x16 -depth 8 $< $@ - -# This should work, but it doesn't get the colors quite right - so I manually converted with Gimp -# convert -colorspace RGB -transparent white -resize 256x256 subsurface-icon.svg subsurface-icon.png -# -# The following creates the pixbuf data in .h files with the basename followed by '_pixmap' -# as name of the data structure -%.h: %.png - @echo ' gdk-pixbuf-csource' $< - @gdk-pixbuf-csource --struct --name `echo $* | sed 's/-/_/g'`_pixbuf $< > $@ - -doc: - $(MAKE) -C Documentation doc - -clean: - rm -f $(ALL_OBJS) *~ $(NAME) $(VERSION_FILE) \ - $(NAME).exe po/*~ po/$(NAME)-new.pot \ - *.moc qt-ui/*.moc \ - .uic/*.h \ - $(RESOURCES:.qrc=.qrc.cpp) - rm -rf share - -confclean: clean - rm -f $(CONFIGFILE) - rm -rf .dep .uic - -distclean: confclean - $(MAKE) -C Documentation clean - rm -f $(CREATOR_FILES) - -release: - @scripts/check-version -cr $(VERSION_STRING) - git archive --prefix $(CAPITALIZED_NAME)-$(VERSION_STRING)/ \ - --output $(CAPITALIZED_NAME)-$(VERSION_STRING).tgz \ - v$(VERSION_STRING) - -.PHONY: creator-files -creator-files: $(CREATOR_FILES) -$(NAME).files: Makefile $(CONFIGFILE) - echo $(wildcard *.h qt-ui/*.h qt-ui/*.ui) $(HEADERS) $(SOURCES) | tr ' ' '\n' | sort | uniq > $(NAME).files - { echo Makefile; echo Rules.mk; echo Configure.mk; } >> $(NAME).files -$(NAME).config: Makefile $(CONFIGFILE) - echo $(patsubst -D%,%,$(filter -D%, $(CXXFLAGS) $(CFLAGS) $(EXTRA_FLAGS))) | tr ' ' '\n' | sort | uniq > $(NAME).config -$(NAME).includes: Makefile $(CONFIGFILE) - echo $$PWD > $(NAME).includes - echo $(patsubst -I%,%,$(filter -I%, $(CXXFLAGS) $(CFLAGS) $(EXTRA_FLAGS))) | tr ' ' '\n' | sort | uniq >> $(NAME).includes -$(NAME).creator: - echo '[General]' > $(NAME).creator - -ifneq ($(CONFIGURED)$(CONFIGURING),) -.dep/%.o.dep: %.cpp - @mkdir -p $(@D) - @$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -MM -MG -MF $@ -MT $(<:.cpp=.o) -c $< -endif - -DEPS = $(addprefix .dep/,$(C_SOURCES:.c=.o.dep) $(CXX_SOURCES:.cpp=.o.dep)) --include $(DEPS) 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 @@ <key>CFBundleInfoDictionaryVersion</key> <string>1.0</string> <key>CFBundleVersion</key> - <string>CFBUNDLEVERSION_TOKEN</string> + <string>@SHORT_VERSION@</string> </dict> </plist> diff --git a/packaging/windows/subsurface.rc b/packaging/windows/subsurface.rc deleted file mode 100644 index af79f6de9..000000000 --- a/packaging/windows/subsurface.rc +++ /dev/null @@ -1,25 +0,0 @@ -1 VERSIONINFO -FILEVERSION 1,1,0,0 -PRODUCTVERSION 1,1,0,0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904E4" - BEGIN - VALUE "CompanyName", "subsurface team" - VALUE "FileDescription", "subsurface dive log" - VALUE "FileVersion", "1.1" - VALUE "InternalName", "subsurface" - VALUE "LegalCopyright", "Linus Torvalds, Dirk Hohndel and others" - VALUE "OriginalFilename", "subsurface.exe" - VALUE "ProductName", "subsurface" - VALUE "ProductVersion", "1.1" - END - END - - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1252 - END -END -ID ICON "subsurface.ico"
\ No newline at end of file diff --git a/scripts/win-ldd.pl b/scripts/win-ldd.pl new file mode 100644 index 000000000..6ca97b74a --- /dev/null +++ b/scripts/win-ldd.pl @@ -0,0 +1,69 @@ +#!perl +use strict; +my %deploy; +my $objdump = $ENV{objdump} ? $ENV{objdump} : "i686-w64-mingw32-objdump"; +my @searchdirs = split(/:/, $ENV{PATH}); + +sub addDependenciesFor($) { + open OBJDUMP, "-|", $objdump, "-p", $_[0] or die; + while (<OBJDUMP>) { + last if /^The Import Tables/; + } + while (<OBJDUMP>) { + next unless /DLL Name: (.*)/; + $deploy{$1} = 0 unless defined($deploy{$1}); + last if /^\w/; + } + close OBJDUMP; +} + +sub findMissingDependencies { + for my $name (keys %deploy) { + next if $deploy{$name}; + my $path; + for my $dir (@searchdirs) { + my $fpath = "$dir/$name"; + my $lcfpath = "$dir/" . lc($name); + if (-e $fpath) { + $path = $fpath; + } elsif (-e $lcfpath) { + $path = $lcfpath; + } else { + next; + } + addDependenciesFor($path); + last; + } + + $path = "/missing/file" unless $path; + $deploy{$name} = $path; + } +} + +for (@ARGV) { + s/^-L//; + next if /^-/; + if (-d $_) { + push @searchdirs, $_; + } elsif (-f $_) { + $deploy{$_} = $_; + addDependenciesFor($_); + } +} + +while (1) { + findMissingDependencies(); + + my $i = 0; + while (my ($name, $path) = each(%deploy)) { + next if $path; + ++$i; + last; + } + last if $i == 0; +} + +for (sort values %deploy) { + next if $_ eq "/missing/file"; + print "$_\n"; +} diff --git a/subsurface-configure.pri b/subsurface-configure.pri new file mode 100644 index 000000000..7836594dc --- /dev/null +++ b/subsurface-configure.pri @@ -0,0 +1,102 @@ +# +# Global settings +# +# Set some C constructs to be diagnosed as errors: +# - calling implicit functions +# - casting from integers to pointers or vice-versa without an explicit cast +# Also turn on C99 mode with GNU extensions +*-g++*: QMAKE_CFLAGS += -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=implicit-int +!win32-msvc*: QMAKE_CFLAGS += -std=gnu99 + +# Don't turn warnings on (but don't suppress them either) +CONFIG -= warn_on warn_off + +# Turn exceptions off +!win32-msvc*: QMAKE_CXXFLAGS += -fno-exceptions +CONFIG += exceptions_off + +# Check if we have pkg-config +equals($$QMAKE_HOST.os, "Windows"):NUL=NUL +else:NUL=/dev/null +system(pkg-config --version 2>$$NUL >$$NUL) { + CONFIG += link_pkgconfig +} else { + message("pkg-config not found, no detection performed. See README for details") +} + +# +# Find libdivecomputer +# +!isEmpty(LIBDCDEVEL) { + # find it next to our sources + INCLUDEPATH += ../libdivecomputer/include + LIBS += -L../libdivecomputer/src/.libs -ldivecomputer +} else:exists(/usr/local/lib/libdivecomputer.a) { + LIBS += -L/usr/local/lib -ldivecomputer +} else:exists(/usr/local/lib64/libdivecomputer.a) { + LIBS += -L/usr/local/lib64 -ldivecomputer +} else:link_pkgconfig { + # find it via pkg-config + PKGCONFIG += libdivecomputer +} + +# Libusb-1.0 is only required if libdivecomputer was built with it. +# And libdivecomputer is only built with it if libusb-1.0 is +# installed. So get libusb if it exists, but don't complain +# about it if it doesn't. +#link_pkgconfig: packagesExist(libusb-1.0): PKGCONFIG += libusb-1.0 + +# +# Find libxml2 and libxslt +# +# They come with shell scripts that contain the information we need, so we just +# run them. They also come with pkg-config files, but those are missing on +# Mac (where they are part of the XCode-supplied tools). +# +XML2_CFLAGS = $$system(xml2-config --cflags 2>$$NUL) +XSLT_CFLAGS = $$system(xslt-config --cflags 2>$$NUL) +XML2_LIBS = $$system(xml2-config --libs 2>$$NUL) +XSLT_LIBS = $$system(xslt-config --libs 2>$$NUL) +link_pkgconfig { + isEmpty(XML2_CFLAGS)|isEmpty(XML2_LIBS): \ + error("Could not find libxml2. Did you forget to install it?") + isEmpty(XSLT_CFLAGS)|isEmpty(XSLT_LIBS): \ + error("Could not find libxslt. Did you forget to install it?") +} + +QMAKE_CFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS +QMAKE_CXXFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS +LIBS *= $$XML2_LIBS $$XSLT_LIBS + +# +# Find other pkg-config-based projects +# We're searching for: +# libzip +# sqlite3 +link_pkgconfig: PKGCONFIG += libzip sqlite3 + +# +# Find libmarble +# +# Before Marble 4.9, the GeoDataTreeModel.h header wasn't installed +# Check if it's present by trying to compile +# ### FIXME: implement that +win32: CONFIG(debug, debug|release): LIBS += -lmarblewidgetd +else: LIBS += -lmarblewidget + +# +# Platform-specific changes +# +win32 { + LIBS += -lwsock32 + DEFINES -= UNICODE +} + +# +# misc +# +!equals(V, 1): CONFIG += silent +MOC_DIR = .moc +UI_DIR = .uic +RCC_DIR = .rcc +OBJECTS_DIR = .obj diff --git a/subsurface-gen-version.pri b/subsurface-gen-version.pri new file mode 100644 index 000000000..a94a65adb --- /dev/null +++ b/subsurface-gen-version.pri @@ -0,0 +1,16 @@ +# Generate the version.h file +VERSION_FILE = version.h +exists(.git/HEAD): { + GIT_HEAD = .git/HEAD + VERSION_SCRIPT = $$PWD/scripts/get-version + version_h.depends = $$VERSION_SCRIPT + version_h.commands = echo \\$${LITERAL_HASH}define VERSION_STRING \\\"`$$VERSION_SCRIPT linux`\\\" > ${QMAKE_FILE_OUT} + version_h.input = GIT_HEAD + version_h.output = $$VERSION_FILE + version_h.variable_out = GENERATED_FILES + version_h.CONFIG = ignore_no_exist + QMAKE_EXTRA_COMPILERS += version_h +} else { + # This is probably a package + system(echo \\$${LITERAL_HASH}define VERSION_STRING \\\"$$VERSION\\\" > $$VERSION_FILE) +} diff --git a/subsurface-install.pri b/subsurface-install.pri new file mode 100644 index 000000000..3a625973a --- /dev/null +++ b/subsurface-install.pri @@ -0,0 +1,114 @@ +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 + deploy.files += $$xslt.files $$doc.files + target.path = $$WINDOWSSTAGING + marbledir.path = $$WINDOWSSTAGING/data + INSTALLS += deploy marbledir target + + qt_conf.commands = echo \'[Paths]\' > $@ + qt_conf.commands += $${nltab}echo \'Prefix=.\' >> $@ + qt_conf.commands += $${nltab}echo \'Plugins=.\' >> $@ + qt_conf.target = $$PWD/packaging/windows/qt.conf + install.depends += qt_conf + + !win32-msvc* { + #!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) + install.depends += dlls + } +} 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 new file mode 100644 index 000000000..065897233 --- /dev/null +++ b/subsurface.pro @@ -0,0 +1,160 @@ +include(subsurface-configure.pri) + +QT = core gui network webkit svg +INCLUDEPATH += qt-ui $$PWD + +mac: TARGET = Subsurface +else: TARGET = subsurface + +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 + +DESKTOP_FILE = subsurface.desktop +mac: ICON = packaging/macosx/Subsurface.icns +else: ICON = subsurface-icon.svg +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 +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) |