[X2Go-Commits] [x2goclient] 01/01: {macbuild.sh, src/{x2goutils.h, {pulsemanager, onmainwindow}.cpp}, x2goclient.pro}: make MacPorts prefix selectable at compile time.

git-admin at x2go.org git-admin at x2go.org
Sat Feb 25 09:06:31 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 6ff714b0ee5372576ce209daa033ae6fd31f1927
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Feb 25 07:59:11 2017 +0100

    {macbuild.sh,src/{x2goutils.h,{pulsemanager,onmainwindow}.cpp},x2goclient.pro}: make MacPorts prefix selectable at compile time.
    
    Much cleaner for downstream package maintainers (like, for instance,
    MacPorts itself.)
---
 debian/changelog     |    4 ++++
 macbuild.sh          |    3 ++-
 src/onmainwindow.cpp |    4 ++--
 src/pulsemanager.cpp |    4 ++--
 src/x2goutils.h      |    4 ++++
 x2goclient.pro       |    4 ++++
 6 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d0bb1ff..fb32acc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -120,6 +120,10 @@ x2goclient (4.1.0.1-0x2go1) UNRELEASED; urgency=medium
     - res/i18n/x2goclient_*.ts: regenerate translation files and fix up some
       SSH and PulseManager messages manually, where possible.
     - src/x2ogutils.h: guard UNUSED macro definition.
+    - {macbuild.sh,src/{x2goutils.h,{pulsemanager,onmainwindow}.cpp},
+       x2goclient.pro}: make MacPorts prefix selectable at compile time. Much
+      cleaner for downstream package maintainers (like, for instance, MacPorts
+      itself.)
 
   [ Oleksandr Shneyder ]
   * New upstream version (4.1.0.1):
diff --git a/macbuild.sh b/macbuild.sh
index 2cb3a8f..3a4966a 100755
--- a/macbuild.sh
+++ b/macbuild.sh
@@ -319,7 +319,8 @@ qmake -config "${BUILD_MODE}" -spec macx-g++ "${PROJECT}" \
       QMAKE_MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
       OSX_STDLIB="${STDLIB}" \
       MACPORTS_INCLUDE_PATH="${MACPORTS_PREFIX}/include" \
-      MACPORTS_LIBRARY_PATH="${MACPORTS_PREFIX}/lib"
+      MACPORTS_LIBRARY_PATH="${MACPORTS_PREFIX}/lib" \
+      MACPORTS_PREFIX="${MACPORTS_PREFIX}"
 
 phase "Running make"
 make -j2
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index dd6fa87..9585ec5 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -5761,14 +5761,14 @@ void ONMainWindow::slotSetModMap()
         /* Let's set a reasonable default value if none is provided. */
         if (path_val.isEmpty ()) {
             /* Prefer the default MacPorts prefix. */
-            path_val = "/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/opt/X11/bin";
+            path_val = MACPORTS_PREFIX "/bin:" MACPORTS_PREFIX "/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/opt/X11/bin";
             tmp_env.insert ("PATH", path_val);
         }
         else {
             /* Search for and add specific directories to the PATH value, if necessary. */
             QStringList to_back, to_front;
             to_back << "/opt/X11/bin";
-            to_front << "/opt/local/bin" << "/usr/local/bin";
+            to_front << MACPORTS_PREFIX "/bin" << "/usr/local/bin";
 
             path_val = add_to_path (path_val, to_back);
             path_val = add_to_path (path_val, to_front, false);
diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp
index 0a3e193..98ab6ee 100644
--- a/src/pulsemanager.cpp
+++ b/src/pulsemanager.cpp
@@ -71,7 +71,7 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
   QString path_val = tmp_env.value ("PATH");
 
   QStringList to_front, to_back;
-  to_front << "/opt/local/bin"; /* MacPorts default prefix, FIXME: might need to make that configurable. */
+  to_front << MACPORTS_PREFIX "/bin"; /* MacPorts prefix. */
   to_back << "/usr/local/bin"; /* Homebrew or random stuff. Probably even both intermingled... */
 
   path_val = add_to_path (path_val, to_back);
@@ -94,7 +94,7 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
 
   if (server_binary_.isEmpty ()) {
     search_paths = QStringList ();
-    search_paths << "/opt/local/bin"; /* MacPorts default prefix, FIXME: might need to make that configurable. */
+    search_paths << MACPORTS_PREFIX "/bin"; /* MacPorts prefix. */
 
     server_binary_ = QStandardPaths::findExecutable ("pulseaudio", search_paths);
 
diff --git a/src/x2goutils.h b/src/x2goutils.h
index 68684f0..8a406c7 100644
--- a/src/x2goutils.h
+++ b/src/x2goutils.h
@@ -27,6 +27,10 @@
 #define UNUSED(x) do { (void) x; } while (0)
 #endif
 
+#ifndef MACPORTS_PREFIX
+#define MACPORTS_PREFIX "/opt/local"
+#endif
+
 QString expandHome (QString path);
 
 QString fixup_resource_URIs (const QString &res_path);
diff --git a/x2goclient.pro b/x2goclient.pro
index a5e421f..6cc8fd5 100644
--- a/x2goclient.pro
+++ b/x2goclient.pro
@@ -221,6 +221,10 @@ macx {
     LIBS = -L$${MACPORTS_LIBRARY_PATH} $${LIBS}
   }
 
+  !isEmpty(MACPORTS_PREFIX) {
+    DEFINES += MACPORTS_PREFIX=\"\\\"$${MACPORTS_PREFIX}\\\"\"
+  }
+
   # Strictly speaking, this is a bug in qmake and we should neither need $${PWD}
   # nor QMAKE_INFO_PLIST_OUT nor PRE_TARGETDEPS nor QMAKE_POST_LINK.
   # Not defining the latter two will however lead to it being empty and no

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list