[59387] trunk/dports/kde/kdelibs4

sharky at macports.org sharky at macports.org
Wed Oct 14 06:31:57 PDT 2009


Revision: 59387
          http://trac.macports.org/changeset/59387
Author:   sharky at macports.org
Date:     2009-10-14 06:31:55 -0700 (Wed, 14 Oct 2009)
Log Message:
-----------
kdelibs4 : make kdeinit4 work on Snow Leopard

* Work around kdeinit4 crashing (Closes: #21973)
* Remove DBus hacks, not needed with launchd-based DBus

Modified Paths:
--------------
    trunk/dports/kde/kdelibs4/Portfile

Added Paths:
-----------
    trunk/dports/kde/kdelibs4/files/remove-dbus-hacks.patch
    trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch

Modified: trunk/dports/kde/kdelibs4/Portfile
===================================================================
--- trunk/dports/kde/kdelibs4/Portfile	2009-10-14 13:31:43 UTC (rev 59386)
+++ trunk/dports/kde/kdelibs4/Portfile	2009-10-14 13:31:55 UTC (rev 59387)
@@ -6,7 +6,7 @@
 
 name                kdelibs4
 version             4.3.2
-revision            1
+revision            2
 categories          kde kde4
 maintainers         snc sharky
 description         KDE4 core libraries
@@ -41,7 +41,9 @@
                     dont-use-fdatasync.patch \
                     dont-use-carbon-keyboard.patch \
                     fix-bundle-icons.patch \
-                    nameser-compat.patch
+                    nameser-compat.patch \
+                    remove-dbus-hacks.patch \
+                    workaround-kdeinit4-crash.patch
 patch.dir           ${workpath}/${distname}
 patch.pre_args      -p1
 

Added: trunk/dports/kde/kdelibs4/files/remove-dbus-hacks.patch
===================================================================
--- trunk/dports/kde/kdelibs4/files/remove-dbus-hacks.patch	                        (rev 0)
+++ trunk/dports/kde/kdelibs4/files/remove-dbus-hacks.patch	2009-10-14 13:31:55 UTC (rev 59387)
@@ -0,0 +1,141 @@
+Index: kdelibs-4.3.2/kdecore/kernel/kkernel_mac.cpp
+===================================================================
+--- kdelibs-4.3.2.orig/kdecore/kernel/kkernel_mac.cpp	2009-01-06 18:27:48.000000000 +0100
++++ kdelibs-4.3.2/kdecore/kernel/kkernel_mac.cpp	2009-10-14 14:40:01.000000000 +0200
+@@ -43,10 +43,6 @@
+ #include <kconfig.h>
+ #include <kdebug.h>
+ 
+-int timeout = 3000; // msec
+-
+-bool dbus_initialized = false;
+-
+ /**
+   qAppFileName() is not public in qt4/mac, so we need to redo it here
+ */
+@@ -112,79 +108,6 @@
+ 	}
+ }
+ 
+-/**
+- Set the D-Bus environment based on session bus socket
+-*/
+-
+-bool mac_set_dbus_address(QString value)
+-{
+-	if (!value.isEmpty() && QFile::exists(value) && (QFile::permissions(value) & QFile::WriteUser)) {
+-		value = "unix:path=" + value;
+-		::setenv("DBUS_SESSION_BUS_ADDRESS", value.toLocal8Bit(), 1);
+-		kDebug() << "set session bus address to" << value;
+-		return true;
+-	}
+-	return false;
+-}
+-
+-/**
+- Make sure D-Bus is initialized, by any means necessary.
+-*/
+-
+-void mac_initialize_dbus()
+-{
+-	if (dbus_initialized)
+-		return;
+-
+-	QString dbusVar = qgetenv("DBUS_SESSION_BUS_ADDRESS");
+-	if (!dbusVar.isEmpty()) {
+-		dbus_initialized = true;
+-		return;
+-	}
+-
+-	dbusVar = QFile::decodeName(qgetenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET"));
+-	if (mac_set_dbus_address(dbusVar)) {
+-		dbus_initialized = true;
+-		return;
+-	}
+-
+-	QString externalProc;
+-	QStringList path = QFile::decodeName(qgetenv("KDEDIRS")).split(':').replaceInStrings(QRegExp("$"), "/bin");
+-	path << QFile::decodeName(qgetenv("PATH")).split(':') << "/usr/local/bin";
+-
+-	for (int i = 0; i < path.size(); ++i) {
+-		QString testLaunchctl = QString(path.at(i)).append("/launchctl");
+-		if (QFile(testLaunchctl).exists()) {
+-			externalProc = testLaunchctl;
+-			break;
+-		}
+-	}
+-
+-	if (!externalProc.isEmpty()) {
+-                QProcess qp;
+-                qp.setTextModeEnabled(true);
+-
+-		qp.start(externalProc, QStringList() << "getenv" << "DBUS_LAUNCHD_SESSION_BUS_SOCKET");
+-                if (!qp.waitForFinished(timeout)) {
+-                    kDebug() << "error running" << externalProc << qp.errorString();
+-                    return;
+-                }
+-                if (qp.exitCode() != 0) {
+-                    kDebug() << externalProc << "unsuccessful:" << qp.readAllStandardError();
+-                    return;
+-                }
+-
+-                QString line = qp.readLine().trimmed(); // read the first line
+-                if (mac_set_dbus_address(line))
+-                    dbus_initialized = true; // hooray
+-	}
+-
+-	if (dbus_initialized == false) {
+-		kDebug() << "warning: unable to initialize D-Bus environment!";
+-	}
+-
+-}
+-
+ QString mac_app_filename() {
+ 	static QString appFileName;
+ 	if (appFileName.isEmpty()) {
+Index: kdelibs-4.3.2/kdecore/kernel/kkernel_mac.h
+===================================================================
+--- kdelibs-4.3.2.orig/kdecore/kernel/kkernel_mac.h	2009-01-01 17:28:04.000000000 +0100
++++ kdelibs-4.3.2/kdecore/kernel/kkernel_mac.h	2009-10-14 14:40:22.000000000 +0200
+@@ -41,11 +41,6 @@
+ KDECORE_EXPORT void mac_fork_and_reexec_self();
+ 
+ /**
+-  * Initialize D-Bus Mac-specific stuff if necessary.
+-  */
+-KDECORE_EXPORT void mac_initialize_dbus();
+-
+-/**
+   * Get the application name.
+   */
+ KDECORE_EXPORT QString mac_app_filename();
+Index: kdelibs-4.3.2/kdeui/kernel/kapplication.cpp
+===================================================================
+--- kdelibs-4.3.2.orig/kdeui/kernel/kapplication.cpp	2009-07-21 17:16:13.000000000 +0200
++++ kdelibs-4.3.2/kdeui/kernel/kapplication.cpp	2009-10-14 14:40:58.000000000 +0200
+@@ -451,10 +451,6 @@
+      ::exit(127);
+   }
+ 
+-#ifdef Q_WS_MAC
+-  mac_initialize_dbus();
+-#endif
+-
+   KApplication::KApp = q;
+ 
+   parseCommandLine();
+Index: kdelibs-4.3.2/kdeui/kernel/kuniqueapplication.cpp
+===================================================================
+--- kdelibs-4.3.2.orig/kdeui/kernel/kuniqueapplication.cpp	2009-07-21 17:16:13.000000000 +0200
++++ kdelibs-4.3.2/kdeui/kernel/kuniqueapplication.cpp	2009-10-14 14:41:12.000000000 +0200
+@@ -141,10 +141,6 @@
+         appName.prepend(s);
+      }
+ 
+-#ifdef Q_WS_MAC
+-  mac_initialize_dbus();
+-#endif
+-
+   bool forceNewProcess = Private::s_multipleInstances || flags & NonUniqueInstance;
+ 
+   if (Private::s_nofork)

Added: trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch
===================================================================
--- trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch	                        (rev 0)
+++ trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch	2009-10-14 13:31:55 UTC (rev 59387)
@@ -0,0 +1,42 @@
+Index: kdelibs-4.3.2/kinit/kinit.cpp
+===================================================================
+--- kdelibs-4.3.2.orig/kinit/kinit.cpp	2009-10-13 07:31:16.000000000 +0200
++++ kdelibs-4.3.2/kinit/kinit.cpp	2009-10-13 07:31:52.000000000 +0200
+@@ -489,6 +489,13 @@
+       init_startup_info( startup_id, name, envc, envs );
+ #endif
+ 
++  // Don't run this inside the child process, it crashes on OS/X 10.6
++  const QByteArray docPath = QFile::encodeName(KGlobalSettings::documentPath());
++#ifdef Q_WS_MAC
++  QString bundlepath = s_instance->dirs()->findExe(QFile::decodeName(execpath));
++  QString argvexe = s_instance->dirs()->findExe(QString::fromLatin1(_name));
++#endif
++
+   d.errorMsg = 0;
+   d.fork = fork();
+   switch(d.fork) {
+@@ -513,7 +520,6 @@
+      if (cwd && *cwd) {
+          (void)chdir(cwd);
+      } else {
+-         const QByteArray docPath = QFile::encodeName(KGlobalSettings::documentPath());
+          (void)chdir(docPath.constData());
+      }
+ 
+@@ -552,7 +558,6 @@
+        d.argv = (char **) malloc(sizeof(char *) * (argc+1));
+        d.argv[0] = (char *) _name;
+ #ifdef Q_WS_MAC
+-       QString argvexe = s_instance->dirs()->findExe(QString::fromLatin1(d.argv[0]));
+        if (!argvexe.isEmpty()) {
+           QByteArray cstr = argvexe.toLocal8Bit();
+           kDebug(7016) << "kdeinit4: launch() setting argv: " << cstr.data();
+@@ -628,7 +633,6 @@
+ 
+         QByteArray executable = execpath;
+ #ifdef Q_WS_MAC
+-        QString bundlepath = s_instance->dirs()->findExe(QFile::decodeName(executable));
+         if (!bundlepath.isEmpty())
+            executable = QFile::encodeName(bundlepath);
+ #endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091014/98d0ae19/attachment-0001.html>


More information about the macports-changes mailing list