[arch-commits] Commit in gpsbabel/trunk (4 files)
Balló György
bgyorgy at archlinux.org
Mon Jul 13 23:08:40 UTC 2020
Date: Monday, July 13, 2020 @ 23:08:39
Author: bgyorgy
Revision: 663544
upgpkg: gpsbabel 1.7.0-2: Add patches sent to upstream to make a proper installation
Added:
gpsbabel/trunk/install.patch
gpsbabel/trunk/no-map.patch
Modified:
gpsbabel/trunk/PKGBUILD
Deleted:
gpsbabel/trunk/drop-map.patch
----------------+
PKGBUILD | 36 ++--
drop-map.patch | 131 ---------------
install.patch | 459 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
no-map.patch | 162 +++++++++++++++++++
4 files changed, 639 insertions(+), 149 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2020-07-13 21:52:38 UTC (rev 663543)
+++ PKGBUILD 2020-07-13 23:08:39 UTC (rev 663544)
@@ -5,19 +5,21 @@
pkgname=gpsbabel
pkgver=1.7.0
-pkgrel=1
+pkgrel=2
pkgdesc="Read, write and manipulate GPS waypoints in a variety of formats"
arch=(x86_64)
url="https://www.gpsbabel.org/"
license=(GPL)
-depends=(hicolor-icon-theme libusb qt5-base) # qt5-webengine
+depends=(hicolor-icon-theme libusb qt5-base)
makedepends=(libicns qt5-tools)
source=(https://github.com/gpsbabel/$pkgname/archive/${pkgname}_${pkgver//./_}.tar.gz
gpsbabel.appdata.xml
- drop-map.patch)
+ install.patch
+ no-map.patch)
sha256sums=('30b186631fb43db576b8177385ed5c31a5a15c02a6bc07bae1e0d7af9058a797'
'5eb52ab0c4bdde61c747856e849f9bce9ca660e942c15f730a4330a38fd6a39a'
- 'd18fd718973cc9efc6bee95ec7741b7d63a0fd46fd9e2d281f687fd465b7c19e')
+ 'a12a48f2bcad5c2184cf2157488ee18d90f3415cb406eb8b70513f35dfe26b16'
+ '378202355f7dd5a01df554af6298b8871e8ab8112aa2a7fa727d26434623da21')
prepare() {
icns2png -x $pkgname-${pkgname}_${pkgver//./_}/gui/images/appicon.icns
@@ -24,13 +26,14 @@
cd $pkgname-${pkgname}_${pkgver//./_}
+ # Support make install for GUI on Linux systems
+ # https://github.com/gpsbabel/gpsbabel/pull/391
+ patch -Np1 -i ../install.patch
+ sed -i '/INSTALLS +=/ s/ icon//' gui/app.pro
+
# Remove map due to heavy WebEngine dependency
- patch -Np1 -i ../drop-map.patch
-
- # Fix path
- sed -i 's|langPath_ = QApplication::applicationDirPath();|langPath_ = "/usr/share/gpsbabel";|' gui/mainwindow.cc
- sed -i 's|baseFile = QApplication::applicationDirPath() + "/gmapbase.html";|baseFile = "/usr/share/gpsbabel/gmapbase.html";|' gui/map.cc
-
+ # https://github.com/gpsbabel/gpsbabel/pull/606
+ patch -Np1 -i ../no-map.patch
}
build() {
@@ -40,7 +43,7 @@
# GUI
cd gui
- qmake
+ qmake PREFIX=/usr
lrelease *.ts
make
}
@@ -50,15 +53,12 @@
make DESTDIR="$pkgdir" install
# GUI
- install -Dm755 gui/objects/gpsbabelfe "$pkgdir"/usr/bin/gpsbabelfe
- install -Dm644 gui/gpsbabel.desktop "$pkgdir"/usr/share/applications/gpsbabel.desktop
- install -Dm644 ../$pkgname.appdata.xml "$pkgdir/usr/share/metainfo/$pkgname.appdata.xml"
- install -Dm644 gui/gmapbase.html "$pkgdir"/usr/share/gpsbabel/gmapbase.html
- install -dm755 "$pkgdir"/usr/share/gpsbabel/translations/
- install -Dm644 gui/*.qm "$pkgdir"/usr/share/gpsbabel/translations/
+ cd gui
+ make INSTALL_ROOT="$pkgdir" install
+ install -Dm644 ../../$pkgname.appdata.xml "$pkgdir/usr/share/metainfo/$pkgname.appdata.xml"
for res in 16 32 128 256 512; do
- install -Dm644 ../appicon_${res}x${res}x32.png \
+ install -Dm644 ../../appicon_${res}x${res}x32.png \
"$pkgdir/usr/share/icons/hicolor/${res}x${res}/apps/$pkgname.png"
done
}
Deleted: drop-map.patch
===================================================================
--- drop-map.patch 2020-07-13 21:52:38 UTC (rev 663543)
+++ drop-map.patch 2020-07-13 23:08:39 UTC (rev 663544)
@@ -1,131 +0,0 @@
-diff -Naur gpsbabel-gpsbabel_1_6_0.orig/gui/advdlg.cc gpsbabel-gpsbabel_1_6_0/gui/advdlg.cc
---- gpsbabel-gpsbabel_1_6_0.orig/gui/advdlg.cc 2019-05-02 10:26:47.000000000 +0200
-+++ gpsbabel-gpsbabel_1_6_0/gui/advdlg.cc 2019-06-19 13:08:12.030299296 +0200
-@@ -37,7 +37,6 @@
- {
- ui_.setupUi(this);
- ui_.synthShortNames->setChecked(synthShortNames);
-- ui_.previewGmap->setChecked(previewGmap);
- ui_.debugCombo->setCurrentIndex(debugLevel+1);
- #if defined (Q_OS_WIN)
- ui_.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
-@@ -50,7 +49,6 @@
- void AdvDlg::acceptClicked()
- {
- synthShortNames_ = ui_.synthShortNames->isChecked();
-- previewGmap_ = ui_.previewGmap->isChecked();
- debugLevel_ = ui_.debugCombo->currentIndex()-1;
- accept();
- }
-diff -Naur gpsbabel-gpsbabel_1_6_0.orig/gui/advui.ui gpsbabel-gpsbabel_1_6_0/gui/advui.ui
---- gpsbabel-gpsbabel_1_6_0.orig/gui/advui.ui 2019-05-02 10:26:47.000000000 +0200
-+++ gpsbabel-gpsbabel_1_6_0/gui/advui.ui 2019-06-19 13:08:12.030299296 +0200
-@@ -38,13 +38,6 @@
- </widget>
- </item>
- <item>
-- <widget class="QCheckBox" name="previewGmap">
-- <property name="text">
-- <string>Preview in Google Maps</string>
-- </property>
-- </widget>
-- </item>
-- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QComboBox" name="debugCombo">
-diff -Naur gpsbabel-gpsbabel_1_6_0.orig/gui/app.pro gpsbabel-gpsbabel_1_6_0/gui/app.pro
---- gpsbabel-gpsbabel_1_6_0.orig/gui/app.pro 2019-05-02 10:26:47.000000000 +0200
-+++ gpsbabel-gpsbabel_1_6_0/gui/app.pro 2019-06-19 13:10:54.800233673 +0200
-@@ -11,14 +11,7 @@
- gui \
- network \
- widgets \
- xml
--
--qtHaveModule(webenginewidgets) {
-- QT += webenginewidgets webchannel
-- DEFINES += HAVE_WEBENGINE
--} else {
-- QT += webkit webkitwidgets
--}
-
- unix:DESTDIR = objects
- unix:MOC_DIR = objects
-@@ -72,13 +66,11 @@
- SOURCES += filterwidgets.cc
- SOURCES += format.cc
- SOURCES += formatload.cc
--SOURCES += gmapdlg.cc
- SOURCES += gpx.cc
- SOURCES += help.cc
- SOURCES += latlng.cc
- SOURCES += main.cc
- SOURCES += mainwindow.cc
--SOURCES += map.cc
- SOURCES += optionsdlg.cc
- SOURCES += preferences.cc
- SOURCES += processwait.cc
-@@ -98,11 +90,9 @@
- HEADERS += filterwidgets.h
- HEADERS += format.h
- HEADERS += formatload.h
--HEADERS += gmapdlg.h
- HEADERS += gpx.h
- HEADERS += help.h
- HEADERS += mainwindow.h
--HEADERS += map.h
- HEADERS += optionsdlg.h
- HEADERS += preferences.h
- HEADERS += processwait.h
-diff -Naur gpsbabel-gpsbabel_1_6_0.orig/gui/mainwindow.cc gpsbabel-gpsbabel_1_6_0/gui/mainwindow.cc
---- gpsbabel-gpsbabel_1_6_0.orig/gui/mainwindow.cc 2019-05-02 10:26:47.000000000 +0200
-+++ gpsbabel-gpsbabel_1_6_0/gui/mainwindow.cc 2019-06-19 13:12:30.790606265 +0200
-@@ -62,7 +62,6 @@
- #include "donate.h" // for Donate
- #include "filterdlg.h" // for FilterDialog
- #include "formatload.h" // for FormatLoad
--#include "gmapdlg.h" // for GMapDialog
- #include "help.h" // for ShowHelp
- #include "optionsdlg.h" // for OptionsDlg
- #include "preferences.h" // for Preferences
-@@ -1027,24 +1026,6 @@
- formatList_[fidx].bumpWriteUseCount(1);
- }
-
-- // Now output for preview in google maps
-- QString tempName;
-- if (babelData_.previewGmap_) {
-- QTemporaryFile ftemp;
-- ftemp.open();
-- tempName = ftemp.fileName();
-- ftemp.close();
--
-- // Ideally, expost this in the UI. For now, just split the track
-- // if we've no recorded fixes for > 5 mins and we've moved > 300 meters.
-- //args << "-x";
-- //args << "track,pack,sdistance=0.3k,split=5m";
--
-- args << "-o";
-- args << "gpx";
-- args << "-F" << tempName;
-- }
--
- ui_.outputWindow->clear();
- ui_.outputWindow->appendPlainText("gpsbabel " + args.join(" "));
-
-@@ -1056,14 +1037,6 @@
- ui_.outputWindow->appendPlainText(outputString);
- if (x) {
- ui_.outputWindow->appendPlainText(tr("Translation successful"));
-- if (babelData_.previewGmap_) {
-- this->hide();
-- GMapDialog dlg(nullptr, tempName, babelData_.debugLevel_ >=1 ? ui_.outputWindow : nullptr);
-- dlg.show();
-- dlg.exec();
-- QFile(tempName).remove();
-- this->show();
-- }
- } else {
- ui_.outputWindow->appendPlainText(tr("Error running gpsbabel: %1\n").arg(errorString));
- }
Added: install.patch
===================================================================
--- install.patch (rev 0)
+++ install.patch 2020-07-13 23:08:39 UTC (rev 663544)
@@ -0,0 +1,459 @@
+From 814c4695e6789666d4416e5c06aed0858feb9791 Mon Sep 17 00:00:00 2001
+From: tsteven4 <13596209+tsteven4 at users.noreply.github.com>
+Date: Tue, 6 Aug 2019 08:59:32 -0600
+Subject: [PATCH 1/4] provide method to override file locations.
+
+linux installs typically install the translation files
+and gmapbase.html out of the tree. These operations are now
+supported, see. gui/app.pro and look for PKGDATADIR, QTTRANSLATIONDIR.
+---
+ gui/app.pro | 24 ++++++++++++++++++++++++
+ gui/mainwindow.cc | 7 +++++--
+ gui/map.cc | 7 +++++--
+ 3 files changed, 34 insertions(+), 4 deletions(-)
+
+diff --git a/gui/app.pro b/gui/app.pro
+index cb1992bc0..de283ce0c 100755
+--- a/gui/app.pro
++++ b/gui/app.pro
+@@ -33,6 +33,30 @@ unix {
+ DEFINES += HAVE_UDEV
+ PKGCONFIG += libudev
+ }
++
++ # To override the installed location of gmapbase.html set PKGDATADIR.
++ # e.g. qmake PKGDATADIR=/usr/share/gpsbabel
++ !isEmpty(PKGDATADIR):DEFINES += PKGDATADIR=\\\"$$PKGDATADIR\\\"
++
++ # To override the installed location of the translation files (*.qm)
++ # set QTTRANSLATIONDIR.
++ # Common use case 1:
++ # If the translations are installed local to the package then
++ # gpsbabel_*.qm, gpsbabelfe_*.qm and the concatenated qt_*.qm must all
++ # be in QTTRANSLATIONDIR.
++ # .e.g. qmake QTTRANSLATIONDIR=/usr/share/gpsbabel/translations
++ # Note that the package_app target will create the concatenated qt_*.qm files.
++ # The concatenated qt_*.qm files are DIFFERENT from the
++ # the Qt provided meta catalog file of the same name, the concatenated
++ # qt_*.qm files include all the necessary Qt provided module qm files.
++ # Common use case 2:
++ # If the translations are installed in the directory that contains all the
++ # original Qt provided translations, then only gpsbabel_*.qm and
++ # gpsbabelfe_*.qm need be installed alongside the original Qt provided
++ # translations (which include the meta catalogs as well as the module
++ # qm files.)
++ # .e.g. qmake QTTRANSLATIONDIR=/usr/share/qt5/translations
++ !isEmpty(QTTRANSLATIONDIR):DEFINES += QTTRANSLATIONDIR=\\\"$$QTTRANSLATIONDIR\\\"
+ }
+
+ UI_DIR = tmp
+diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc
+index 80a6bbc62..17202c0c9 100644
+--- a/gui/mainwindow.cc
++++ b/gui/mainwindow.cc
+@@ -219,8 +219,11 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
+
+ ui_.outputWindow->setReadOnly(true);
+
+- langPath_ = QApplication::applicationDirPath();
+- langPath_.append("/translations/");
++#ifdef QTTRANSLATIONDIR
++ langPath_ = QTTRANSLATIONDIR;
++#else
++ langPath_ = QApplication::applicationDirPath() + "/translations";
++#endif
+
+ // Start up in the current system language.
+ loadLanguage(QLocale::system().name());
+diff --git a/gui/map.cc b/gui/map.cc
+index 9efeb6e09..42045845a 100644
+--- a/gui/map.cc
++++ b/gui/map.cc
+@@ -90,13 +90,16 @@ Map::Map(QWidget* parent,
+ connect(mclicker, SIGNAL(logTime(QString)), this, SLOT(logTime(QString)));
+ #endif
+
++#ifdef PKGDATADIR
++ QString baseFile = PKGDATADIR + "/gmapbase.html";
++#else
+ QString baseFile = QApplication::applicationDirPath() + "/gmapbase.html";
++#endif
+ if (!QFile(baseFile).exists()) {
+ QMessageBox::critical(nullptr, appName,
+ tr("Missing \"gmapbase.html\" file. Check installation"));
+ } else {
+- QString urlStr = "file:///" + baseFile;
+- this->load(QUrl(urlStr));
++ this->load(QUrl::fromLocalFile(baseFile));
+ }
+
+ #ifdef DEBUG_JS_GENERATION
+
+From 217dc1e0085a0e83d65f565254476e276fc15f0d Mon Sep 17 00:00:00 2001
+From: tsteven4 <13596209+tsteven4 at users.noreply.github.com>
+Date: Tue, 6 Aug 2019 13:49:19 -0600
+Subject: [PATCH 2/4] fix error using PKGDATADIR concatenation.
+
+---
+ gui/map.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gui/map.cc b/gui/map.cc
+index 42045845a..661aa19a8 100644
+--- a/gui/map.cc
++++ b/gui/map.cc
+@@ -91,7 +91,7 @@ Map::Map(QWidget* parent,
+ #endif
+
+ #ifdef PKGDATADIR
+- QString baseFile = PKGDATADIR + "/gmapbase.html";
++ QString baseFile = PKGDATADIR "/gmapbase.html";
+ #else
+ QString baseFile = QApplication::applicationDirPath() + "/gmapbase.html";
+ #endif
+
+From c6a8e404d4cd750b0e615ea68d01e8d2cc8dd363 Mon Sep 17 00:00:00 2001
+From: tsteven4 <13596209+tsteven4 at users.noreply.github.com>
+Date: Thu, 8 Aug 2019 12:52:37 -0600
+Subject: [PATCH 3/4] use a search path for finding translation files.
+
+We search for translation files (*.qm) in this order:
+1a. Relative to the executable, specifically at
+ QApplication::applicationDirPath() + "/translations".
+ This works when we package the app on windows and macos.
+ It also works we create a bundled app on linux,
+ for example with the package target. However, linux packagers typically
+ install the translation files in another location.
+ OR
+1b. In PKGDATADIR/translations. This works for linux packages that
+ place the translations in PKGDATADIR/translations, e.g.
+ qmake PKGDATADIR=/usr/share/gpsbabel with the translations in
+ /usr/share/gpsbabel/translations.
+2. In the Qt TranslationsPath. If this is not overridden in qt.conf it
+ will point to the hard-coded paths that are compiled into the Qt library.
+ This hard-coded path can be found with "qmake -query QT_INSTALL_TRANSLATIONS".
+ This works for linux packages that have some or all translation files
+ installed in the original location they used when compiling Qt.
+
+Further details can be found in app.pro.
+---
+ gui/app.pro | 72 ++++++++++++++++++++++++++++++++---------------
+ gui/mainwindow.cc | 29 ++++++++++++-------
+ gui/mainwindow.h | 1 -
+ 3 files changed, 69 insertions(+), 33 deletions(-)
+
+diff --git a/gui/app.pro b/gui/app.pro
+index de283ce0c..9024e16eb 100755
+--- a/gui/app.pro
++++ b/gui/app.pro
+@@ -34,29 +34,57 @@ unix {
+ PKGCONFIG += libudev
+ }
+
+- # To override the installed location of gmapbase.html set PKGDATADIR.
+- # e.g. qmake PKGDATADIR=/usr/share/gpsbabel
+- !isEmpty(PKGDATADIR):DEFINES += PKGDATADIR=\\\"$$PKGDATADIR\\\"
++ # Setting PKGDATADIR will:
++ # 1. Look for gmapbase.html in PKGDATADIR instead
++ # of in QApplication::applicationDirPath().
++ # E.g. qmake PKGDATADIR=/usr/share/gpsbabel
++ # will use /usr/share/gpsbabel/gmapbase.html instead of
++ # QApplication::applicationDirPath() + "/gmapbase.html".
++ # 2. Substitude PKGDATADIR/translations in the search path for
++ # translation files instead of
++ # QApplication::applicationDirPath() + "/translations".
++ # E.g. qmake PKGDATADIR=/usr/share/gpsbabel
++ # will look in /usr/share/gpsbabel/translations instead of
++ # QApplication::applicationDirPath() + "/translations".
++
++ # We search for translation files (*.qm) in this order:
++ # 1a. Relative to the executable, specifically at
++ # QApplication::applicationDirPath() + "/translations".
++ # This works when we package the app on windows and macos.
++ # It also works we create a bundled app on linux,
++ # for example with the package target. However, linux packagers typically
++ # install the translation files in another location.
++ # OR
++ # 1b. In PKGDATADIR/translations. This works for linux packages that
++ # place the translations in PKGDATADIR/translations, e.g.
++ # qmake PKGDATADIR=/usr/share/gpsbabel with the translations in
++ # /usr/share/gpsbabel/translations.
++ # 2. In the Qt TranslationsPath. If this is not overridden in qt.conf it
++ # will point to the hard-coded paths that are compiled into the Qt library.
++ # This hard-coded path can be found with "qmake -query QT_INSTALL_TRANSLATIONS".
++ # This works for linux packages that have some or all translation files
++ # installed in the original location they used when compiling Qt.
++
++ # There are three sets of translation files that should be available
++ # when running gpsbabelfe:
++ # 1. gpsbabelfe_*.qm
++ # 2. gpsbabel_*.qm
++ # 3a. The Qt supplied meta catalogs (qt_*.qm) and the module files they
++ # refer to (qt*_*.qm).
++ # Note if you are counting on finding the Qt supplied translations,
++ # then the package that provides the Qt translations
++ # needs to be a prerequisite to the gpsbabel gui package.
++ # OR
++ # 3b. The concatentated translation files for the modules that gpsbabelfe
++ # uses. These files are created by building the package target.
++ # These are named identically to the Qt translation meta catalogs, i.e.
++ # qt_*.qm, but contain the necessary translation data for the modules
++ # gpsbabelfe uses.
++ # A description of the meta catalogs and concatentation process is
++ # available at
++ # https://doc.qt.io/qt-5/linguist-programmers.html#deploying-translations
+
+- # To override the installed location of the translation files (*.qm)
+- # set QTTRANSLATIONDIR.
+- # Common use case 1:
+- # If the translations are installed local to the package then
+- # gpsbabel_*.qm, gpsbabelfe_*.qm and the concatenated qt_*.qm must all
+- # be in QTTRANSLATIONDIR.
+- # .e.g. qmake QTTRANSLATIONDIR=/usr/share/gpsbabel/translations
+- # Note that the package_app target will create the concatenated qt_*.qm files.
+- # The concatenated qt_*.qm files are DIFFERENT from the
+- # the Qt provided meta catalog file of the same name, the concatenated
+- # qt_*.qm files include all the necessary Qt provided module qm files.
+- # Common use case 2:
+- # If the translations are installed in the directory that contains all the
+- # original Qt provided translations, then only gpsbabel_*.qm and
+- # gpsbabelfe_*.qm need be installed alongside the original Qt provided
+- # translations (which include the meta catalogs as well as the module
+- # qm files.)
+- # .e.g. qmake QTTRANSLATIONDIR=/usr/share/qt5/translations
+- !isEmpty(QTTRANSLATIONDIR):DEFINES += QTTRANSLATIONDIR=\\\"$$QTTRANSLATIONDIR\\\"
++ !isEmpty(PKGDATADIR):DEFINES += PKGDATADIR=\\\"$$PKGDATADIR\\\"
+ }
+
+ UI_DIR = tmp
+diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc
+index 17202c0c9..9708962ac 100644
+--- a/gui/mainwindow.cc
++++ b/gui/mainwindow.cc
+@@ -26,11 +26,14 @@
+ #include <QtCore/QEvent> // for QEvent (& QEvent::LanguageChange, QEvent::LocaleChange)
+ #include <QtCore/QFile> // for QFile
+ #include <QtCore/QFileInfo> // for QFileInfo
++#include <QtCore/QLibraryInfo> // for QLibraryInfo, QLibraryInfo::TranslationsPath
+ #include <QtCore/QLocale> // for QLocale
+ #include <QtCore/QMimeData> // for QMimeData
+ #include <QtCore/QProcess> // for QProcess, QProcess::NotRunning
+ #include <QtCore/QRegExp> // for QRegExp
+ #include <QtCore/QSettings> // for QSettings
++#include <QtCore/QString> // for QString
++#include <QtCore/QStringList> // for QStringList
+ #include <QtCore/QTemporaryFile> // for QTemporaryFile
+ #include <QtCore/QTime> // for QTime
+ #include <QtCore/QUrl> // for QUrl
+@@ -39,7 +42,6 @@
+ #include <QtCore/QtGlobal> // for foreach
+ #include <QtGui/QCursor> // for QCursor
+ #include <QtGui/QDesktopServices> // for QDesktopServices
+-#include <QtGui/QIcon> // for QIcon
+ #include <QtGui/QImage> // for QImage
+ #include <QtWidgets/QApplication> // for QApplication, qApp
+ #include <QtWidgets/QCheckBox> // for QCheckBox
+@@ -219,12 +221,6 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
+
+ ui_.outputWindow->setReadOnly(true);
+
+-#ifdef QTTRANSLATIONDIR
+- langPath_ = QTTRANSLATIONDIR;
+-#else
+- langPath_ = QApplication::applicationDirPath() + "/translations";
+-#endif
+-
+ // Start up in the current system language.
+ loadLanguage(QLocale::system().name());
+ loadFormats();
+@@ -314,9 +310,22 @@ void MainWindow::switchTranslator(QTranslator& translator, const QString& filena
+ // remove the old translator
+ qApp->removeTranslator(&translator);
+
+- // load the new translator
+- if (translator.load(filename, langPath_)) {
+- qApp->installTranslator(&translator);
++ // Set a list of directories to search for the translation file.
++ const QStringList directories = {
++#ifdef PKGDATADIR
++ PKGDATADIR "/translations",
++#else
++ QApplication::applicationDirPath() + "/translations",
++#endif
++ QLibraryInfo::location(QLibraryInfo::TranslationsPath)
++ };
++
++ // Load the new translator.
++ for (const auto& directory : directories) {
++ if (translator.load(filename, directory)) {
++ qApp->installTranslator(&translator);
++ break;
++ }
+ }
+ }
+
+diff --git a/gui/mainwindow.h b/gui/mainwindow.h
+index 3fd107fbf..b6de39944 100644
+--- a/gui/mainwindow.h
++++ b/gui/mainwindow.h
+@@ -70,7 +70,6 @@ class MainWindow: public QMainWindow
+ QTranslator translatorCore_; // translation for the core application.
+ QTranslator translatorQt_; // translations for Qt.
+ QString currLang_; // currently loaded language.
+- QString langPath_; // Absolute path of language files.
+
+ private:
+ void loadFormats();
+
+From 203f13c6b222ab4f283d5335fa7255e8c8692824 Mon Sep 17 00:00:00 2001
+From: Chris Mayo <aklhfex at gmail.com>
+Date: Sun, 11 Aug 2019 19:35:00 +0100
+Subject: [PATCH 4/4] Support make install for GUI on Linux systems
+
+---
+ gui/app.pro | 128 +++++++++++++++++++++++++++++++---------------------
+ 1 file changed, 76 insertions(+), 52 deletions(-)
+
+diff --git a/gui/app.pro b/gui/app.pro
+index 9024e16eb..5305124a0 100755
+--- a/gui/app.pro
++++ b/gui/app.pro
+@@ -33,58 +33,6 @@ unix {
+ DEFINES += HAVE_UDEV
+ PKGCONFIG += libudev
+ }
+-
+- # Setting PKGDATADIR will:
+- # 1. Look for gmapbase.html in PKGDATADIR instead
+- # of in QApplication::applicationDirPath().
+- # E.g. qmake PKGDATADIR=/usr/share/gpsbabel
+- # will use /usr/share/gpsbabel/gmapbase.html instead of
+- # QApplication::applicationDirPath() + "/gmapbase.html".
+- # 2. Substitude PKGDATADIR/translations in the search path for
+- # translation files instead of
+- # QApplication::applicationDirPath() + "/translations".
+- # E.g. qmake PKGDATADIR=/usr/share/gpsbabel
+- # will look in /usr/share/gpsbabel/translations instead of
+- # QApplication::applicationDirPath() + "/translations".
+-
+- # We search for translation files (*.qm) in this order:
+- # 1a. Relative to the executable, specifically at
+- # QApplication::applicationDirPath() + "/translations".
+- # This works when we package the app on windows and macos.
+- # It also works we create a bundled app on linux,
+- # for example with the package target. However, linux packagers typically
+- # install the translation files in another location.
+- # OR
+- # 1b. In PKGDATADIR/translations. This works for linux packages that
+- # place the translations in PKGDATADIR/translations, e.g.
+- # qmake PKGDATADIR=/usr/share/gpsbabel with the translations in
+- # /usr/share/gpsbabel/translations.
+- # 2. In the Qt TranslationsPath. If this is not overridden in qt.conf it
+- # will point to the hard-coded paths that are compiled into the Qt library.
+- # This hard-coded path can be found with "qmake -query QT_INSTALL_TRANSLATIONS".
+- # This works for linux packages that have some or all translation files
+- # installed in the original location they used when compiling Qt.
+-
+- # There are three sets of translation files that should be available
+- # when running gpsbabelfe:
+- # 1. gpsbabelfe_*.qm
+- # 2. gpsbabel_*.qm
+- # 3a. The Qt supplied meta catalogs (qt_*.qm) and the module files they
+- # refer to (qt*_*.qm).
+- # Note if you are counting on finding the Qt supplied translations,
+- # then the package that provides the Qt translations
+- # needs to be a prerequisite to the gpsbabel gui package.
+- # OR
+- # 3b. The concatentated translation files for the modules that gpsbabelfe
+- # uses. These files are created by building the package target.
+- # These are named identically to the Qt translation meta catalogs, i.e.
+- # qt_*.qm, but contain the necessary translation data for the modules
+- # gpsbabelfe uses.
+- # A description of the meta catalogs and concatentation process is
+- # available at
+- # https://doc.qt.io/qt-5/linguist-programmers.html#deploying-translations
+-
+- !isEmpty(PKGDATADIR):DEFINES += PKGDATADIR=\\\"$$PKGDATADIR\\\"
+ }
+
+ UI_DIR = tmp
+@@ -189,3 +137,79 @@ macx|linux{
+ QMAKE_DISTCLEAN += compile_commands.json
+ }
+
++linux:!isEmpty(PREFIX) {
++ DATADIR = $$PREFIX/share
++ ICONSDIR = $$DATADIR/pixmaps
++ PKGDATADIR = $$DATADIR/gpsbabel
++
++ target.path = $$PREFIX/bin
++
++ desktop.path = $$DATADIR/applications
++ desktop.files = gpsbabel.desktop
++
++ icon.path = $$ICONSDIR
++ icon.extra = $(INSTALL_FILE) images/appicon.png $(INSTALL_ROOT)$$ICONSDIR/gpsbabel.png
++
++ gmapbase.files = gmapbase.html
++ gmapbase.path = $$PKGDATADIR
++
++ translations.files = gpsbabelfe_*.qm
++ translations.files += coretool/gpsbabel_*.qm
++ translations.path = $$PKGDATADIR/translations
++
++ INSTALLS += target desktop icon gmapbase translations
++}
++
++unix {
++ # Setting PKGDATADIR will:
++ # 1. Look for gmapbase.html in PKGDATADIR instead
++ # of in QApplication::applicationDirPath().
++ # E.g. qmake PKGDATADIR=/usr/share/gpsbabel
++ # will use /usr/share/gpsbabel/gmapbase.html instead of
++ # QApplication::applicationDirPath() + "/gmapbase.html".
++ # 2. Substitude PKGDATADIR/translations in the search path for
++ # translation files instead of
++ # QApplication::applicationDirPath() + "/translations".
++ # E.g. qmake PKGDATADIR=/usr/share/gpsbabel
++ # will look in /usr/share/gpsbabel/translations instead of
++ # QApplication::applicationDirPath() + "/translations".
++
++ # We search for translation files (*.qm) in this order:
++ # 1a. Relative to the executable, specifically at
++ # QApplication::applicationDirPath() + "/translations".
++ # This works when we package the app on windows and macos.
++ # It also works we create a bundled app on linux,
++ # for example with the package target. However, linux packagers typically
++ # install the translation files in another location.
++ # OR
++ # 1b. In PKGDATADIR/translations. This works for linux packages that
++ # place the translations in PKGDATADIR/translations, e.g.
++ # qmake PKGDATADIR=/usr/share/gpsbabel with the translations in
++ # /usr/share/gpsbabel/translations.
++ # 2. In the Qt TranslationsPath. If this is not overridden in qt.conf it
++ # will point to the hard-coded paths that are compiled into the Qt library.
++ # This hard-coded path can be found with "qmake -query QT_INSTALL_TRANSLATIONS".
++ # This works for linux packages that have some or all translation files
++ # installed in the original location they used when compiling Qt.
++
++ # There are three sets of translation files that should be available
++ # when running gpsbabelfe:
++ # 1. gpsbabelfe_*.qm
++ # 2. gpsbabel_*.qm
++ # 3a. The Qt supplied meta catalogs (qt_*.qm) and the module files they
++ # refer to (qt*_*.qm).
++ # Note if you are counting on finding the Qt supplied translations,
++ # then the package that provides the Qt translations
++ # needs to be a prerequisite to the gpsbabel gui package.
++ # OR
++ # 3b. The concatentated translation files for the modules that gpsbabelfe
++ # uses. These files are created by building the package target.
++ # These are named identically to the Qt translation meta catalogs, i.e.
++ # qt_*.qm, but contain the necessary translation data for the modules
++ # gpsbabelfe uses.
++ # A description of the meta catalogs and concatentation process is
++ # available at
++ # https://doc.qt.io/qt-5/linguist-programmers.html#deploying-translations
++
++ !isEmpty(PKGDATADIR):DEFINES += PKGDATADIR=\\\"$$PKGDATADIR\\\"
++}
Added: no-map.patch
===================================================================
--- no-map.patch (rev 0)
+++ no-map.patch 2020-07-13 23:08:39 UTC (rev 663544)
@@ -0,0 +1,162 @@
+From 58b44bb24ceedf8de9a728ed13ac1a3f51f933a5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor at gmail.com>
+Date: Tue, 14 Jul 2020 00:02:13 +0200
+Subject: [PATCH] Make the map optional
+
+This makes the webengine/webkit dependency optional.
+---
+ gui/advdlg.cc | 4 ++++
+ gui/app.pro | 5 ++++-
+ gui/gmapdlg.cc | 2 ++
+ gui/gmapdlg.h | 2 ++
+ gui/mainwindow.cc | 6 ++++++
+ gui/map.cc | 2 ++
+ gui/map.h | 2 ++
+ 7 files changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/gui/advdlg.cc b/gui/advdlg.cc
+index 469aa4694..17779d544 100644
+--- a/gui/advdlg.cc
++++ b/gui/advdlg.cc
+@@ -37,7 +37,11 @@ AdvDlg::AdvDlg(QWidget* parent,
+ {
+ ui_.setupUi(this);
+ ui_.synthShortNames->setChecked(synthShortNames);
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ ui_.previewGmap->setChecked(previewGmap);
++#else // HAVE_WEBENGINE || HAVE_WEBKIT
++ ui_.previewGmap->hide();
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+ ui_.debugCombo->setCurrentIndex(debugLevel+1);
+ #if defined (Q_OS_WIN)
+ ui_.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":/images/ok.png"));
+diff --git a/gui/app.pro b/gui/app.pro
+index 4daefde48..d3523862e 100755
+--- a/gui/app.pro
++++ b/gui/app.pro
+@@ -18,7 +18,10 @@ qtHaveModule(webenginewidgets) {
+ QT += webenginewidgets webchannel
+ DEFINES += HAVE_WEBENGINE
+ } else {
+- QT += webkit webkitwidgets
++ qtHaveModule(webkitwidgets) {
++ QT += webkit webkitwidgets
++ DEFINES += HAVE_WEBKIT
++ }
+ }
+
+ unix:DESTDIR = objects
+diff --git a/gui/gmapdlg.cc b/gui/gmapdlg.cc
+index 8b761441b..3dedf8be4 100644
+--- a/gui/gmapdlg.cc
++++ b/gui/gmapdlg.cc
+@@ -21,6 +21,7 @@
+ //
+ //------------------------------------------------------------------------
+
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ #include <QStandardItemModel>
+ #include <QMenu>
+ #include <QHeaderView>
+@@ -580,3 +581,4 @@ void GMapDialog::copyButtonClickedX()
+ {
+
+ }
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+diff --git a/gui/gmapdlg.h b/gui/gmapdlg.h
+index 461c89cab..5c3b414a7 100644
+--- a/gui/gmapdlg.h
++++ b/gui/gmapdlg.h
+@@ -20,6 +20,7 @@
+ // USA.
+ //
+ //------------------------------------------------------------------------
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ #ifndef GMAPDLG_H
+ #define GMAPDLG_H
+
+@@ -92,3 +93,4 @@ private slots:
+ };
+
+ #endif
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc
+index 22b2b449c..4c496b18c 100644
+--- a/gui/mainwindow.cc
++++ b/gui/mainwindow.cc
+@@ -62,7 +62,9 @@
+ #include "donate.h" // for Donate
+ #include "filterdlg.h" // for FilterDialog
+ #include "formatload.h" // for FormatLoad
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ #include "gmapdlg.h" // for GMapDialog
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+ #include "help.h" // for ShowHelp
+ #include "optionsdlg.h" // for OptionsDlg
+ #include "preferences.h" // for Preferences
+@@ -1023,6 +1025,7 @@ void MainWindow::applyActionX()
+ }
+
+ // Now output for preview in google maps
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ QString tempName;
+ if (babelData_.previewGmap_) {
+ QTemporaryFile ftemp;
+@@ -1039,6 +1042,7 @@ void MainWindow::applyActionX()
+ args << "gpx";
+ args << "-F" << tempName;
+ }
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+
+ ui_.outputWindow->clear();
+ ui_.outputWindow->appendPlainText("gpsbabel " + args.join(" "));
+@@ -1052,6 +1056,7 @@ void MainWindow::applyActionX()
+ ui_.outputWindow->appendPlainText(outputString);
+ if (x) {
+ ui_.outputWindow->appendPlainText(tr("Translation successful"));
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ if (babelData_.previewGmap_) {
+ this->hide();
+ GMapDialog dlg(nullptr, tempName, babelData_.debugLevel_ >=1 ? ui_.outputWindow : nullptr);
+@@ -1060,6 +1065,7 @@ void MainWindow::applyActionX()
+ QFile(tempName).remove();
+ this->show();
+ }
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+ } else {
+ ui_.outputWindow->appendPlainText(tr("Error running gpsbabel: %1\n").arg(errorString));
+ }
+diff --git a/gui/map.cc b/gui/map.cc
+index a55c752e3..0acbfba79 100644
+--- a/gui/map.cc
++++ b/gui/map.cc
+@@ -20,6 +20,7 @@
+ // USA.
+ //
+ //------------------------------------------------------------------------
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ #include "map.h"
+
+ #include <QNetworkRequest>
+@@ -471,3 +472,4 @@ void Map::evaluateJS(const QStringList& s, bool upd)
+ {
+ evaluateJS(s.join('\n'), upd);
+ }
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
+diff --git a/gui/map.h b/gui/map.h
+index 460e1c9b7..b03ad976a 100644
+--- a/gui/map.h
++++ b/gui/map.h
+@@ -20,6 +20,7 @@
+ // USA.
+ //
+ //------------------------------------------------------------------------
++#if HAVE_WEBENGINE || HAVE_WEBKIT
+ #ifndef MAP_H
+ #define MAP_H
+ #if HAVE_WEBENGINE
+@@ -127,3 +128,4 @@ public slots:
+
+
+ #endif // HEADER_H
++#endif // HAVE_WEBENGINE || HAVE_WEBKIT
More information about the arch-commits
mailing list