diff options
| author | Mike Arthur | 2010-04-17 20:03:23 +0200 |
|---|---|---|
| committer | Mike Arthur | 2010-04-17 20:03:23 +0200 |
| commit | 9644b50c590c4da3c6b270a5d168472c7b3aa96f (patch) | |
| tree | 368ea6f94164cc74d3d79d99de2380bbe368165e | |
| parent | a27864d054d84f0d198f53d4d69c5e55c96d6a74 (diff) | |
| download | homebrew-9644b50c590c4da3c6b270a5d168472c7b3aa96f.tar.bz2 | |
KDELibs update to 4.4.2 and begrudgingly add a Macports patch.
| -rw-r--r-- | Library/Formula/kdelibs.rb | 184 |
1 files changed, 172 insertions, 12 deletions
diff --git a/Library/Formula/kdelibs.rb b/Library/Formula/kdelibs.rb index c4e229624..77ae2f1f0 100644 --- a/Library/Formula/kdelibs.rb +++ b/Library/Formula/kdelibs.rb @@ -20,6 +20,10 @@ class Kdelibs <Formula depends_on 'libpng' unless File.exist? "/usr/X11R6/lib" + def patches + DATA + end + def install gettext = Formula.factory 'gettext' FileUtils.mkdir('build') @@ -27,17 +31,173 @@ class Kdelibs <Formula system "cmake .. #{std_cmake_parameters} -DCMAKE_PREFIX_PATH=#{gettext.prefix} -DBUNDLE_INSTALL_DIR=#{bin}" system "make install" end +end - def caveats - <<-END_CAVEATS - WARNING: this doesn't actually work for running KDE applications yet! - - Please don't just add the Macports patches and expect them to be pulled. - I'm avoiding adding patches that haven't been committed to KDE upstream - (which I have commit access to). Instead of requesting I add these, - consider writing and testing an upstream-suitable patch. +__END__ - Thanks for your patience! - END_CAVEATS - end -end +Index: kdelibs-4.3.2/kinit/kinit.cpp +=================================================================== +--- kdelibs-4.3.2.orig/kinit/kinit.cpp 2009-10-14 18:47:04.000000000 +0200 ++++ kdelibs-4.3.2/kinit/kinit.cpp 2009-10-14 19:10:14.000000000 +0200 +@@ -489,6 +489,14 @@ + 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()); ++ const QString helperpath = s_instance->dirs()->findExe(QString::fromLatin1("kdeinit4_helper")); ++#ifdef Q_WS_MAC ++ const QString bundlepath = s_instance->dirs()->findExe(QFile::decodeName(execpath)); ++ const QString argvexe = s_instance->dirs()->findExe(QString::fromLatin1(_name)); ++#endif ++ + d.errorMsg = 0; + d.fork = fork(); + switch(d.fork) { +@@ -513,7 +521,6 @@ + if (cwd && *cwd) { + (void)chdir(cwd); + } else { +- const QByteArray docPath = QFile::encodeName(KGlobalSettings::documentPath()); + (void)chdir(docPath.constData()); + } + +@@ -549,10 +556,9 @@ + { + int r; + QByteArray procTitle; +- d.argv = (char **) malloc(sizeof(char *) * (argc+1)); ++ d.argv = (char **) malloc(sizeof(char *) * (argc+2)); + 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 +634,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 +@@ -642,25 +647,13 @@ + exit(255); + } + +- void * sym = l.resolve( "kdeinitmain"); +- if (!sym ) +- { +- sym = l.resolve( "kdemain" ); +- if ( !sym ) +- { +- QString ltdlError = l.errorString(); +- fprintf(stderr, "Could not find kdemain: %s\n", qPrintable(ltdlError) ); +- QString errorMsg = i18n("Could not find 'kdemain' in '%1'.\n%2", +- libpath, ltdlError); +- exitWithErrorMsg(errorMsg); +- } +- } +- +- d.result = 0; // Success ++ d.result = 2; // Try execing + write(d.fd[1], &d.result, 1); +- close(d.fd[1]); + +- d.func = (int (*)(int, char *[])) sym; ++ // We set the close on exec flag. ++ // Closing of d.fd[1] indicates that the execvp succeeded! ++ fcntl(d.fd[1], F_SETFD, FD_CLOEXEC); ++ + if (d.debug_wait) + { + fprintf(stderr, "kdeinit4: Suspending process\n" +@@ -674,8 +667,18 @@ + setup_tty( tty ); + } + +- exit( d.func(argc, d.argv)); /* Launch! */ ++ QByteArray helperexe = QFile::encodeName(helperpath); ++ QByteArray libpathbytes = QFile::encodeName(libpath); ++ d.argv[argc] = libpathbytes.data(); ++ d.argv[argc+1] = 0; ++ ++ if (!helperexe.isEmpty()) ++ execvp(helperexe, d.argv); + ++ d.result = 1; // Error ++ write(d.fd[1], &d.result, 1); ++ close(d.fd[1]); ++ exit(255); + break; + } + default: +Index: kdelibs-4.3.2/kinit/CMakeLists.txt +=================================================================== +--- kdelibs-4.3.2.orig/kinit/CMakeLists.txt 2009-10-14 18:47:04.000000000 +0200 ++++ kdelibs-4.3.2/kinit/CMakeLists.txt 2009-10-14 19:10:14.000000000 +0200 +@@ -53,6 +53,16 @@ + + install(TARGETS kdeinit4 ${INSTALL_TARGETS_DEFAULT_ARGS} ) + ++########### kdeinit4_helper ############### ++ ++set(kdeinit4_helper_SRCS helper.cpp) ++ ++kde4_add_executable(kdeinit4_helper NOGUI ${kdeinit4_helper_SRCS}) ++ ++target_link_libraries(kdeinit4_helper ${QT_QTCORE_LIBRARY}) ++ ++install(TARGETS kdeinit4_helper DESTINATION ${LIBEXEC_INSTALL_DIR} ) ++ + ########### kwrapper4 ############### + if (WIN32) + set(kwrapper_SRCS kwrapper_win.cpp ) +Index: kdelibs-4.3.2/kinit/helper.cpp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kdelibs-4.3.2/kinit/helper.cpp 2009-10-14 19:11:06.000000000 +0200 +@@ -0,0 +1,42 @@ ++#include <stdio.h> ++#include <stdlib.h> ++ ++#include <QFile> ++#include <QLibrary> ++ ++typedef int (*handler) (int, char *[]); ++ ++int main(int argc, char *argv[]) ++{ ++ if (argc < 2) ++ { ++ fprintf(stderr, "Too few arguments\n"); ++ exit(1); ++ } ++ ++ QString libpath = QFile::decodeName(argv[argc-1]); ++ QLibrary l(libpath); ++ ++ if (!libpath.isEmpty() && (!l.load() || !l.isLoaded())) ++ { ++ QString ltdlError = l.errorString(); ++ fprintf(stderr, "Could not open library %s: %s\n", qPrintable(libpath), qPrintable(ltdlError) ); ++ exit(1); ++ } ++ ++ void * sym = l.resolve( "kdeinitmain"); ++ if (!sym) ++ { ++ sym = l.resolve( "kdemain" ); ++ if ( !sym ) ++ { ++ QString ltdlError = l.errorString(); ++ fprintf(stderr, "Could not find kdemain: %s\n", qPrintable(ltdlError) ); ++ exit(1); ++ } ++ } ++ ++ handler func = (int (*)(int, char *[])) sym; ++ exit( func(argc - 1, argv)); /* Launch! */ ++} ++ |
