Revision: 72785 http://trac.macports.org/changeset/72785 Author: snc@macports.org Date: 2010-10-26 13:30:37 -0700 (Tue, 26 Oct 2010) Log Message: ----------- reinstate patchfiles mistaken axed in r72769 Revision Links: -------------- http://trac.macports.org/changeset/72769 Added Paths: ----------- trunk/dports/kde/kdelibs4/files/ trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch Removed Paths: ------------- trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch Deleted: trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch =================================================================== --- trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch 2010-10-26 01:39:54 UTC (rev 72768) +++ trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -1,27 +0,0 @@ -Index: kdelibs-4.3.2/kdecore/CMakeLists.txt -=================================================================== ---- kdelibs-4.3.2.orig/kdecore/CMakeLists.txt 2009-08-27 10:19:05.000000000 +0200 -+++ kdelibs-4.3.2/kdecore/CMakeLists.txt 2009-10-15 14:17:22.000000000 +0200 -@@ -59,6 +59,7 @@ - endif (HAVE_RESOLV_LIBRARY) - - if (APPLE) -+ add_definitions(-DBUNDLE_INSTALL_DIR="\\"${BUNDLE_INSTALL_DIR}\\"") - set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS} - kernel/kkernel_mac.cpp - ) -Index: kdelibs-4.3.2/kdecore/kernel/kstandarddirs.cpp -=================================================================== ---- kdelibs-4.3.2.orig/kdecore/kernel/kstandarddirs.cpp 2009-05-06 12:14:38.000000000 +0200 -+++ kdelibs-4.3.2/kdecore/kernel/kstandarddirs.cpp 2009-10-15 14:21:57.000000000 +0200 -@@ -1204,6 +1204,10 @@ - exePaths << KShell::tildeExpand( tokens[ i ] ); - } - -+#ifdef Q_WS_MAC -+ exePaths << QString::fromLatin1(BUNDLE_INSTALL_DIR); -+#endif -+ - return exePaths; - } - Copied: trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch (from rev 72768, trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch) =================================================================== --- trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch (rev 0) +++ trunk/dports/kde/kdelibs4/files/add-bundles-to-path.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -0,0 +1,27 @@ +Index: kdelibs-4.3.2/kdecore/CMakeLists.txt +=================================================================== +--- kdelibs-4.3.2.orig/kdecore/CMakeLists.txt 2009-08-27 10:19:05.000000000 +0200 ++++ kdelibs-4.3.2/kdecore/CMakeLists.txt 2009-10-15 14:17:22.000000000 +0200 +@@ -59,6 +59,7 @@ + endif (HAVE_RESOLV_LIBRARY) + + if (APPLE) ++ add_definitions(-DBUNDLE_INSTALL_DIR="\\"${BUNDLE_INSTALL_DIR}\\"") + set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS} + kernel/kkernel_mac.cpp + ) +Index: kdelibs-4.3.2/kdecore/kernel/kstandarddirs.cpp +=================================================================== +--- kdelibs-4.3.2.orig/kdecore/kernel/kstandarddirs.cpp 2009-05-06 12:14:38.000000000 +0200 ++++ kdelibs-4.3.2/kdecore/kernel/kstandarddirs.cpp 2009-10-15 14:21:57.000000000 +0200 +@@ -1204,6 +1204,10 @@ + exePaths << KShell::tildeExpand( tokens[ i ] ); + } + ++#ifdef Q_WS_MAC ++ exePaths << QString::fromLatin1(BUNDLE_INSTALL_DIR); ++#endif ++ + return exePaths; + } + Deleted: trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch =================================================================== --- trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch 2010-10-26 01:39:54 UTC (rev 72768) +++ trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -1,35 +0,0 @@ -Patch borrowed from Debian's kde4libs package. ---- a/kded/CMakeLists.txt -+++ b/kded/CMakeLists.txt -@@ -69,7 +69,7 @@ - if (WIN32) - install( FILES applications.menu DESTINATION ${SHARE_INSTALL_PREFIX}/xdg/menus ) - else (WIN32) --install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus ) -+install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus RENAME kde4-applications.menu ) - endif (WIN32) - install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) - install( FILES kded.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update ) ---- a/kded/vfolder_menu.cpp -+++ b/kded/vfolder_menu.cpp -@@ -770,8 +770,10 @@ - QString result; - - QString xdgMenuPrefix = QString::fromLocal8Bit(qgetenv("XDG_MENU_PREFIX")); -- if (!xdgMenuPrefix.isEmpty()) -- { -+ // enforce kde4 prefix unless XDG_MENU_PREFIX is set (LP: #297195) -+ if (xdgMenuPrefix.isEmpty()) -+ xdgMenuPrefix = QString("kde4-"); -+ - QFileInfo fileInfo(fileName); - - QString fileNameOnly = fileInfo.fileName(); -@@ -781,7 +783,6 @@ - QString baseName = QDir::cleanPath(m_docInfo.baseDir + - fileInfo.path() + '/' + fileNameOnly); - result = KStandardDirs::locate("xdgconf-menu", baseName); -- } - - if (result.isEmpty()) - { Copied: trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch (from rev 72768, trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch) =================================================================== --- trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch (rev 0) +++ trunk/dports/kde/kdelibs4/files/default-kde4-xdg-menu-prefix.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -0,0 +1,35 @@ +Patch borrowed from Debian's kde4libs package. +--- a/kded/CMakeLists.txt ++++ b/kded/CMakeLists.txt +@@ -69,7 +69,7 @@ + if (WIN32) + install( FILES applications.menu DESTINATION ${SHARE_INSTALL_PREFIX}/xdg/menus ) + else (WIN32) +-install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus ) ++install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus RENAME kde4-applications.menu ) + endif (WIN32) + install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) + install( FILES kded.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update ) +--- a/kded/vfolder_menu.cpp ++++ b/kded/vfolder_menu.cpp +@@ -770,8 +770,10 @@ + QString result; + + QString xdgMenuPrefix = QString::fromLocal8Bit(qgetenv("XDG_MENU_PREFIX")); +- if (!xdgMenuPrefix.isEmpty()) +- { ++ // enforce kde4 prefix unless XDG_MENU_PREFIX is set (LP: #297195) ++ if (xdgMenuPrefix.isEmpty()) ++ xdgMenuPrefix = QString("kde4-"); ++ + QFileInfo fileInfo(fileName); + + QString fileNameOnly = fileInfo.fileName(); +@@ -781,7 +783,6 @@ + QString baseName = QDir::cleanPath(m_docInfo.baseDir + + fileInfo.path() + '/' + fileNameOnly); + result = KStandardDirs::locate("xdgconf-menu", baseName); +- } + + if (result.isEmpty()) + { Deleted: trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch =================================================================== --- trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch 2010-10-26 01:39:54 UTC (rev 72768) +++ trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -1,17 +0,0 @@ -Index: kdelibs-4.3.2/cmake/modules/KDE4Macros.cmake -=================================================================== ---- kdelibs-4.3.2.orig/cmake/modules/KDE4Macros.cmake 2009-07-21 17:16:04.000000000 +0200 -+++ kdelibs-4.3.2/cmake/modules/KDE4Macros.cmake 2009-10-14 10:38:21.000000000 +0200 -@@ -1155,11 +1155,7 @@ - # main target - list(APPEND ${appsources} ${_outfilename}.icns) - -- # this doesn't seem to work for me - Use manual "install" instead -- # TODO: test again with cmake 2.6 ? -- # SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${target}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) -- -- install(FILES ${_outfilename}.icns DESTINATION ${BIN_INSTALL_DIR}/${target}.app/Contents/Resources/) -+ set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - - else(_icon) - # TODO - try to scale a non-128 icon...? Try to convert an SVG on the fly? Copied: trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch (from rev 72768, trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch) =================================================================== --- trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch (rev 0) +++ trunk/dports/kde/kdelibs4/files/fix-bundle-icons.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -0,0 +1,17 @@ +Index: kdelibs-4.3.2/cmake/modules/KDE4Macros.cmake +=================================================================== +--- kdelibs-4.3.2.orig/cmake/modules/KDE4Macros.cmake 2009-07-21 17:16:04.000000000 +0200 ++++ kdelibs-4.3.2/cmake/modules/KDE4Macros.cmake 2009-10-14 10:38:21.000000000 +0200 +@@ -1155,11 +1155,7 @@ + # main target + list(APPEND ${appsources} ${_outfilename}.icns) + +- # this doesn't seem to work for me - Use manual "install" instead +- # TODO: test again with cmake 2.6 ? +- # SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${target}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) +- +- install(FILES ${_outfilename}.icns DESTINATION ${BIN_INSTALL_DIR}/${target}.app/Contents/Resources/) ++ set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + + else(_icon) + # TODO - try to scale a non-128 icon...? Try to convert an SVG on the fly? Deleted: trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff =================================================================== --- trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff 2010-10-26 01:39:54 UTC (rev 72768) +++ trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff 2010-10-26 20:30:37 UTC (rev 72785) @@ -1,11 +0,0 @@ ---- kdelibs-4.4.2/cmake/modules/FindKDE4Internal.cmake.orig 2010-04-04 21:28:24.000000000 -0400 -+++ kdelibs-4.4.2/cmake/modules/FindKDE4Internal.cmake 2010-04-04 21:28:38.000000000 -0400 -@@ -1016,7 +1016,7 @@ - endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) - - if (UNIX) -- set ( _KDE4_PLATFORM_DEFINITIONS "${_KDE4_PLATFORM_DEFINITIONS} -D_LARGEFILE64_SOURCE") -+ set ( _KDE4_PLATFORM_DEFINITIONS "${_KDE4_PLATFORM_DEFINITIONS} ") - - check_cxx_source_compiles(" - #include <sys/types.h> Copied: trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff (from rev 72768, trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff) =================================================================== --- trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff (rev 0) +++ trunk/dports/kde/kdelibs4/files/patch-cmake-modules-FindKDE4-Internal.cmake.diff 2010-10-26 20:30:37 UTC (rev 72785) @@ -0,0 +1,11 @@ +--- kdelibs-4.4.2/cmake/modules/FindKDE4Internal.cmake.orig 2010-04-04 21:28:24.000000000 -0400 ++++ kdelibs-4.4.2/cmake/modules/FindKDE4Internal.cmake 2010-04-04 21:28:38.000000000 -0400 +@@ -1016,7 +1016,7 @@ + endif (CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) + + if (UNIX) +- set ( _KDE4_PLATFORM_DEFINITIONS "${_KDE4_PLATFORM_DEFINITIONS} -D_LARGEFILE64_SOURCE") ++ set ( _KDE4_PLATFORM_DEFINITIONS "${_KDE4_PLATFORM_DEFINITIONS} ") + + check_cxx_source_compiles(" + #include <sys/types.h> Deleted: trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch =================================================================== --- trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch 2010-10-26 01:39:54 UTC (rev 72768) +++ trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch 2010-10-26 20:30:37 UTC (rev 72785) @@ -1,166 +0,0 @@ -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! */ -+} -+ Copied: trunk/dports/kde/kdelibs4/files/workaround-kdeinit4-crash.patch (from rev 72768, 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 2010-10-26 20:30:37 UTC (rev 72785) @@ -0,0 +1,166 @@ +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! */ ++} ++
participants (1)
-
snc@macports.org