[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: introducing brockenboring
From: Stephan Kulow <coolo () kde ! org>
Date: 2003-06-25 15:19:32
[Download RAW message or body]
Hi!
Currently our kdeinit support in the Makefiles lack
as the kdeinit modules are installed in parallel to
a binary linking against these modules. This has
some drawbacks:
1. glibc's ldconfig doesn't cache DSOs that don't
match the lib*.so* pattern, so starting konqueror
won't be able to use the cache to find konqueror.so
2. (more important) this doesn't work at all on non-ELF
systems (have you asked who the hell is using non-ELF
these days? Mac OS X does)
Benjamin Reed once tried to get am_edit to create a
shared library per KLM and then link both the KLM and
the binary to it. As he failed, he tried the same for unsermake.
Problem with unsermake is: automake users will fall behind
without kdeinit support at all.
So we made a short brain storm session today and came up
with the following idea: install a kdeinit module only and create
in bin a link to a binary that will be kdeinit without kdeinit:
"one binary to rule them all".
So here is the patch to do exactly that: introducing brockenboring
Greetings, Stephan
P.S. DSO == dynamic shared object,
KLM == kdeinit loaded module
["patch" (text/x-diff)]
Index: configure.in.in
===================================================================
RCS file: /home/kde/kdelibs/configure.in.in,v
retrieving revision 1.108
diff -u -3 -p -u -r1.108 configure.in.in
--- configure.in.in 7 May 2003 07:08:43 -0000 1.108
+++ configure.in.in 25 Jun 2003 15:01:39 -0000
@@ -49,6 +49,7 @@ DCOPIDL2CPP="compiled"
DCOPIDL="compiled"
MEINPROC="compiled"
KDECONFIG="compiled"
+BROCKENBORING='$(bindir)/brockenboring'
dnl Checks for libraries etc
AC_BASE_PATH_KDE([don't test]) dnl kdelibs is a special case
Index: admin/acinclude.m4.in
===================================================================
RCS file: /home/kde/kde-common/admin/acinclude.m4.in,v
retrieving revision 2.369
diff -u -3 -p -u -r2.369 acinclude.m4.in
--- admin/acinclude.m4.in 9 Jun 2003 12:55:12 -0000 2.369
+++ admin/acinclude.m4.in 25 Jun 2003 15:01:39 -0000
@@ -546,8 +546,9 @@ AC_DEFUN(KDE_SUBST_PROGRAMS,
KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
fi
KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs])
+ KDE_FIND_PATH(brockenboring, BROCKENBORING, [$kde_default_bindirs])
KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
-
+
if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then
kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
@@ -566,6 +567,7 @@ AC_DEFUN(KDE_SUBST_PROGRAMS,
AC_SUBST(MCOPIDL)
AC_SUBST(ARTSCCONFIG)
AC_SUBST(KDECONFIG)
+ AC_SUBST(BROCKENBORING)
AC_SUBST(MEINPROC)
AC_SUBST(KDE_XSL_STYLESHEET)
@@ -654,6 +656,7 @@ AC_SUBST(kde_templatesdir)
AC_SUBST(kde_servicesdir)
AC_SUBST(kde_servicetypesdir)
AC_SUBST(kde_moduledir)
+AC_SUBST(kdeinitdir, '$(kde_moduledir)')
AC_SUBST(kde_styledir)
AC_SUBST(kde_widgetdir)
if test "$kde_qtver" = 1; then
Index: admin/am_edit
===================================================================
RCS file: /home/kde/kde-common/admin/am_edit,v
retrieving revision 1.372
diff -u -3 -p -u -r1.372 am_edit
--- admin/am_edit 7 Jun 2003 15:38:44 -0000 1.372
+++ admin/am_edit 25 Jun 2003 15:01:39 -0000
@@ -66,6 +66,7 @@ sub tag_NO_UNDEFINED();
sub tag_NMCHECK();
sub tag_NMCHECK_GLOBAL();
sub tag_DIST();
+sub tag_KDEINIT();
# Some global globals...
$verbose = 0; # a debug flag
@@ -331,6 +332,7 @@ sub processMakefile ($)
make_meta_classes();
tag_COMPILE_FIRST();
tag_FINAL() if (!$kdeopts{"nofinal"});
+ tag_KDEINIT();
my $final_lines = "final:\n\t\$(MAKE) ";
my $final_install_lines = "final-install:\n\t\$(MAKE) ";
@@ -805,6 +807,26 @@ sub tag_FINAL()
$finalfile =~ s/\.[^.]*$/.P/;
$dep_finals .= " \$(DEPDIR)/$finalfile";
}
+ }
+}
+
+sub tag_KDEINIT()
+{
+ my $lookup = 'kdeinit_LTLIBRARIES\s*=\s*(.*)';
+ if ($MakefileData =~ m/\n$lookup\n/) {
+ my @kdeinits = split(/[\034\s]+/, $1);
+ my $lines = "";
+ foreach $kdeinit (@kdeinits) {
+ if ($kdeinit =~ m/\.la$/) {
+ $kdeinit =~ s/\.la$//;
+ $lines .= "\t-rm -f \$(DESTDIR)\$(bindir)/$kdeinit\n";
+ $lines .= "\t\$(LN_S) \$(BROCKENBORING) \$(DESTDIR)\$(bindir)/$kdeinit\n";
+ }
+ }
+ $target_adds{"install-exec-am"} .= "install-kdeinit-links ";
+ $lines = "install-kdeinit-links:\n" .
+ "\t\$(mkinstalldirs) \$(DESTDIR)\$(bindir)\n" . $lines;
+ appendLines($lines);
}
}
Index: dcop/Makefile.am
===================================================================
RCS file: /home/kde/kdelibs/dcop/Makefile.am,v
retrieving revision 1.57
diff -u -3 -p -u -r1.57 Makefile.am
--- dcop/Makefile.am 6 Mar 2003 18:02:05 -0000 1.57
+++ dcop/Makefile.am 25 Jun 2003 15:01:39 -0000
@@ -26,10 +26,10 @@ KDE_OPTIONS = qtonly
INCLUDES= $(all_includes)
-bin_PROGRAMS = dcopserver dcopserver_shutdown
+bin_PROGRAMS = dcopserver_shutdown
check_PROGRAMS = testdcop testdcopc
-lib_LTLIBRARIES = libDCOP.la dcopserver.la
+lib_LTLIBRARIES = libDCOP.la
libDCOP_la_LIBADD = KDE-ICE/libkICE.la $(LIB_QT)
libDCOP_la_LDFLAGS = $(KDE_RPATH) -version-info 6:0:2 -no-undefined $(all_libraries)
libDCOP_la_NMCHECK = $(srcdir)/libDCOP.nmcheck
@@ -47,13 +47,10 @@ testdcop_METASOURCES = testdcop.moc
# dcopstub needs to go first for --enable-final to work
libDCOP_la_SOURCES = dcopstub.cpp dcopref.cpp dcopobject.cpp dcopclient.cpp
+kdeinit_LTLIBRARIES = dcopserver.la
dcopserver_la_LDFLAGS = -module -avoid-version $(all_libraries)
dcopserver_la_SOURCES = dcopserver.cpp dcopsignals.cpp
-dcopserver_la_LIBADD = libDCOP.la
-
-dcopserver_LDFLAGS = $(KDE_RPATH) $(all_libraries)
-dcopserver_SOURCES = dummy.cpp
-dcopserver_LDADD = dcopserver.la
+dcopserver_la_LIBADD = libDCOP.la
dcopserver_shutdown_SOURCES = dcopserver_shutdown.c
@@ -66,9 +63,6 @@ testdcopc_SOURCES = testdcopc.c dcopc.c
testdcopc_LDADD = KDE-ICE/libkICE.la $(LIBSM)
EXTRA_DIST = HOWTO ICE
-
-dummy.cpp:
- echo > dummy.cpp
DOXYGEN_REFERENCES = kdecore
DOXYGEN_EXCLUDE = KDE-ICE/*
Index: dcop/dcopserver.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopserver.cpp,v
retrieving revision 1.157
diff -u -3 -p -u -r1.157 dcopserver.cpp
--- dcop/dcopserver.cpp 19 Mar 2003 18:50:17 -0000 1.157
+++ dcop/dcopserver.cpp 25 Jun 2003 15:01:39 -0000
@@ -1538,7 +1538,7 @@ const char* const ABOUT =
"Copyright (C) 1999-2001, The KDE Developers <http://www.kde.org>\n"
;
-int main( int argc, char* argv[] )
+extern "C" int kdemain( int argc, char* argv[] )
{
bool serverid = false;
bool nofork = false;
Index: kinit/Makefile.am
===================================================================
RCS file: /home/kde/kdelibs/kinit/Makefile.am,v
retrieving revision 1.30
diff -u -3 -p -u -r1.30 Makefile.am
--- kinit/Makefile.am 13 Sep 2002 11:52:30 -0000 1.30
+++ kinit/Makefile.am 25 Jun 2003 15:01:40 -0000
@@ -19,9 +19,8 @@ INCLUDES = -I$(srcdir)/../libltdl/ $(all
SUBDIRS = . tests
-bin_PROGRAMS = kdeinit kdeinit_wrapper kshell kdeinit_shutdown lnusertemp kwrapper klauncher kioslave
-lib_LTLIBRARIES = klauncher.la
-
+bin_PROGRAMS = kdeinit kdeinit_wrapper kshell kdeinit_shutdown lnusertemp kwrapper kioslave brockenboring
+kdeinit_LTLIBRARIES = klauncher.la
kdeinit_SOURCES = kinit.cpp setproctitle.cpp
# NOTE: We link against all common libraries even if we don't need them ourselves.
@@ -37,6 +36,9 @@ kioslave_LDADD = $(LIB_KIO)
kdeinit_wrapper_SOURCES = wrapper.c
kdeinit_wrapper_LDADD = $(LIBSOCKET)
+brockenboring_SOURCES = brockenboring.c
+brockenboring_LDADD = $(top_builddir)/libltdl/libltdlc.la
+
kshell_SOURCES = shell.c
kshell_LDADD = $(LIBSOCKET)
@@ -52,10 +54,6 @@ kwrapper_LDADD = $(LIBSOCKET)
klauncher_la_LDFLAGS = $(all_libraries) -module -avoid-version
klauncher_la_LIBADD = $(LIB_KIO)
klauncher_la_SOURCES = klauncher.cpp klauncher_main.cpp autostart.cpp
-
-klauncher_LDFLAGS = $(all_libraries) $(KDE_RPATH)
-klauncher_LDADD = klauncher.la
-klauncher_SOURCES = dummy.cpp
METASOURCES = AUTO
Index: kinit/brockenboring.c
===================================================================
RCS file: kinit/brockenboring.c
diff -N kinit/brockenboring.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ kinit/brockenboring.c 25 Jun 2003 15:01:40 -0000
@@ -0,0 +1,90 @@
+#include <config.h>
+#include <limits.h>
+#include "ltdl.h"
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ char path[PATH_MAX + 1];
+ char target[PATH_MAX + 1];
+ char *p;
+
+ if (argv[0][0] != '/')
+ {
+ if (getcwd(path, PATH_MAX))
+ {
+ strncat(path, "/", PATH_MAX);
+ strncat(path, argv[0], PATH_MAX);
+ } else {
+ perror("getpwd");
+ return 1;
+ }
+ }
+ else
+ {
+ strncpy(path, argv[0], PATH_MAX);
+ }
+
+ p = path + strlen(path);
+ while (p > path)
+ {
+ if (*p == '/') break;
+ p--;
+ }
+
+ if ( *p == '/')
+ *p = 0;
+
+ strncpy(target, p + 1, PATH_MAX);
+
+ strncat(path, "/../lib/kde3/", PATH_MAX);
+ strncat(path, target, PATH_MAX);
+ strncat(path, ".la", PATH_MAX);
+
+ if (!access(path, R_OK)) {
+
+ lt_dlhandle handle;
+ lt_ptr sym;
+ int (*func)(int, char *[]);
+ int ret;
+
+ if (lt_dlinit())
+ {
+ const char * errMsg = lt_dlerror();
+ fprintf(stderr, "can't initialize dynamic loading: %s\n",
+ errMsg ? errMsg : "(null)" );
+ }
+
+ handle = lt_dlopen(path);
+
+ if ( !handle )
+ {
+ const char* errMsg = lt_dlerror();
+ fprintf(stderr, "Can't open %s - error: %s\n",
+ path, errMsg ? errMsg : "(null)");
+ return 1;
+ }
+ sym = lt_dlsym( handle, "kdemain");
+ if (!sym )
+ {
+ const char * errMsg = lt_dlerror();
+ fprintf(stderr, "Can't find 'kdemain' in '%s'\n%s",
+ path, errMsg ? errMsg : "(null)");
+ return 1;
+ }
+ func = (int (*)(int, char *[])) sym;
+ ret = func(argc, argv);
+ lt_dlexit();
+ return ret;
+
+ } else {
+ fprintf(stderr, "Can't access %s\n", path);
+ return 1;
+ }
+
+ return 0;
+}
+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic