Binary relocatability part 1

Mike Hearn mike at navi.cx
Sat Aug 28 06:47:29 CDT 2004


First step towards binary relocability.

Mike Hearn <mike at navi.cx>
Add a linker rpath so libwine can be found without modifying
ld.so.conf or LD_LIBRARY_PATH


-------------- next part --------------


--- configure.ac.~1.302.~	2004-08-22 13:57:16.000000000 +0100
+++ configure.ac	2004-08-22 19:32:15.345613936 +0100
@@ -36,6 +36,12 @@
     AC_DEFINE(NO_TRACE_MSGS,1,[Define to disable trace messages.])
 fi
 
+dnl This is used for binary relocatability
+if echo $libdir | grep '^\${exec_prefix}' >/dev/null; then
+   RPATH="-Wl,-rpath,'\$\${ORIGIN}/..'`echo $libdir | sed 's/\${exec_prefix}//'`"
+fi
+AC_SUBST(RPATH)
+
 dnl **** Check for some programs ****
 
 AC_CANONICAL_HOST
--- Make.rules.in.orig	2004-08-22 14:01:58.000000000 +0100
+++ Make.rules.in	2004-08-22 19:05:10.132683856 +0100
@@ -81,7 +81,7 @@
 LIBPORT      = -L$(TOPOBJDIR)/libs/port -lwine_port
 LIBUNICODE   = -L$(TOPOBJDIR)/libs/unicode -lwine_unicode
 LIBWINE      = -L$(TOPOBJDIR)/libs/wine -lwine
-
+RPATH        = @RPATH@
 @SET_MAKE@
 
 # Installation infos
--- server/Makefile.in.~1.51.~	2004-06-23 21:44:58.000000000 +0100
+++ server/Makefile.in	2004-08-02 22:59:26.095458520 +0100
@@ -52,7 +52,7 @@
 @MAKE_RULES@
 
 wineserver: $(OBJS)
-	$(CC) -o $(PROGRAMS) $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LIBPORT) $(LDFLAGS) $(LIBS)
+	$(CC) -o $(PROGRAMS) $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LIBPORT) $(LDFLAGS) $(LIBS) $(RPATH)
 
 install:: $(PROGRAMS)
 	$(MKINSTALLDIRS) $(bindir)
--- loader/Makefile.in.~1.16~	2004-08-02 23:07:56.630845344 +0100
+++ loader/Makefile.in	2004-08-02 23:08:02.140007824 +0100
@@ -25,16 +25,16 @@
 LDEXECFLAGS = @LDEXECFLAGS@
 
 wine-glibc: glibc.o Makefile.in
-	$(CC) -o $@ glibc.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS)
+	$(CC) -o $@ glibc.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(RPATH)
 
 wine-preloader: preloader.o Makefile.in
 	$(CC) -o $@ -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x78000000 preloader.o $(LIBPORT) $(LDFLAGS)
 
 wine-kthread: $(KTHREAD_OBJS) Makefile.in
-	$(CC) -o $@ $(LDEXECFLAGS) $(KTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(EXTRALIBS) $(LDFLAGS)
+	$(CC) -o $@ $(LDEXECFLAGS) $(KTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(RPATH)
 
 wine-pthread: $(PTHREAD_OBJS) Makefile.in
-	$(CC) -o $@ $(LDEXECFLAGS) $(PTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS)
+	$(CC) -o $@ $(LDEXECFLAGS) $(PTHREAD_OBJS) $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(RPATH)
 
 $(MODULE): $(MAIN_BINARY)
 	$(RM) $(MODULE) && $(LN_S) $(MAIN_BINARY) $(MODULE)


More information about the wine-patches mailing list