# HG changeset patch # User Jan Nieuwenhuizen # Date 1296570080 -3600 # Node ID 0ea4f16c7d7acf42fe688af2c1b60e57ba05de99 # Parent a4af49dd321ea3a4e631ba4255c3eabe7f5b4666 guile: somewhat better relocation patch. diff -r a4af49dd321e -r 0ea4f16c7d7a gub/specs/guile.py --- a/gub/specs/guile.py Tue Feb 01 15:20:42 2011 +0100 +++ b/gub/specs/guile.py Tue Feb 01 15:21:20 2011 +0100 @@ -131,8 +131,13 @@ self.update_libtool () target.AutoBuild.install (self) majmin_version = '.'.join (self.expand ('%(version)s').split ('.')[0:2]) + majmin_version = '2.0' - self.dump ("prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/%(majmin_version)s\n", + self.dump (''' +prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/%(majmin_version)s +prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/site +prependdir GUILE_LOAD_COMPILED_PATH=$INSTALLER_PREFIX/lib/guile/%(majmin_version)s/ccache +''', '%(install_prefix)s/etc/relocate/guile.reloc', env=locals ()) version = self.expand ('%(version)s') @@ -169,8 +174,10 @@ + ' --without-threads') configure_variables = (Guile.configure_variables .replace ("':'", "';'") +###we're debugging here +###CFLAGS='-O2 -DHAVE_CONFIG_H=1 -I%(builddir)s' + misc.join_lines (''' -CFLAGS='-O2 -DHAVE_CONFIG_H=1 -I%(builddir)s' +CFLAGS='-g -DHAVE_CONFIG_H=1 -I%(builddir)s' LIBS='-lgc -lmingw-extras' ''')) config_cache_overrides = Guile.config_cache_overrides + ''' diff -r a4af49dd321e -r 0ea4f16c7d7a patches/guile-1.9.14-reloc.patch --- a/patches/guile-1.9.14-reloc.patch Tue Feb 01 15:20:42 2011 +0100 +++ b/patches/guile-1.9.14-reloc.patch Tue Feb 01 15:21:20 2011 +0100 @@ -1,43 +1,46 @@ -From 73b081531e9191876105c1e16d62868eb1c43b8a Mon Sep 17 00:00:00 2001 -From: Han-Wen Nienhuys -Date: Sat, 22 Mar 2008 17:43:04 -0300 -Subject: [PATCH] Relocate patch +From d93b5bd21e99cda017e1b2d7b459e453113fbfa6 Mon Sep 17 00:00:00 2001 +From: Jan Nieuwenhuizen +Date: Mon, 31 Jan 2011 21:05:48 +0100 +Subject: [PATCH] Add dynamic relocation support, default off. +Set PATH, GUILE_LOAD_PATH, GUILE_LOAD_COMPILED_PATH according to +location of the guile executable. Using this together with +-rpath $ORIGIN/../lib and not changing the general installed +directory layout, this enables relocatable binary packages, +for use in $HOME or for Windows. - 2005-06-08 Jan Nieuwenhuizen - * configure.in: Add --enable-relocation option. Default off. + * configure.in: Add --enable-relocation option. Default off. libguile/ ChangeLog 2005-06-09 Jan Nieuwenhuizen - Experimental relocation patch. + Experimental relocation patch. - * load.c (scm_init_argv0_relocation)[ARGV0_RELOCATION]: New - function. - - (scm_init_load_path)[ARGV0_RELOCATION]: Use it. + * load.c (scm_init_argv0_relocation)[ARGV0_RELOCATION]: New + function. + + (scm_init_load_path)[ARGV0_RELOCATION]: Use it. + + * load.c (scm_c_argv0_relocation)[ARGV0_RELOCATION]: - * load.c (scm_c_argv0_relocation)[ARGV0_RELOCATION]: - - * guile.c (main)[ARGV0_RELOCATION]: Use it to append from - executable location derived scm library directory. - [__MINGW32__|__CYGWIN__]: Append directory of executable to PATH. - + * guile.c (main)[ARGV0_RELOCATION]: Use it to append from + executable location derived scm library directory. + [__MINGW32__|__CYGWIN__]: Append directory of executable to PATH. --- - configure.in | 12 +++++++++++ - libguile/guile.c | 5 ++++ - libguile/load.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - libguile/load.h | 4 +++ - 4 files changed, 79 insertions(+), 0 deletions(-) + configure.ac | 12 +++++++++++ + libguile/guile.c | 3 ++ + libguile/load.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + libguile/load.h | 5 ++++ + 4 files changed, 75 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac -index dd0628f..41c5c96 100644 +index 5c70aa8..5fa6cf4 100644 --- a/configure.ac +++ b/configure.ac -@@ -1196,6 +1196,18 @@ AC_MSG_RESULT($works) +@@ -1452,6 +1452,18 @@ GUILE_THREAD_LOCAL_STORAGE fi # with_threads=pthreads @@ -57,10 +60,10 @@ if test "$cross_compiling" = "yes"; then AC_MSG_CHECKING(cc for build) diff --git a/libguile/guile.c b/libguile/guile.c -index c8341c2..116aa2f 100644 +index 6da547b..896adc4 100644 --- a/libguile/guile.c +++ b/libguile/guile.c -@@ -66,6 +66,9 @@ inner_main (void *closure SCM_UNUSED, int argc, char **argv) +@@ -67,6 +67,9 @@ inner_main (void *closure SCM_UNUSED, int argc, char **argv) int main (int argc, char **argv) { @@ -71,10 +74,10 @@ return 0; /* never reached */ } diff --git a/libguile/load.c b/libguile/load.c -index 3e702c4..2341daf 100644 +index cbf9dc0..9ad1008 100644 --- a/libguile/load.c +++ b/libguile/load.c -@@ -195,6 +195,72 @@ SCM_DEFINE (scm_parse_path, "parse-path", 1, 1, 0, +@@ -234,6 +234,53 @@ SCM_DEFINE (scm_parse_path, "parse-path", 1, 1, 0, } #undef FUNC_NAME @@ -99,35 +102,16 @@ + SCM prefix = scm_dirname (bindir); + SCM datadir = scm_string_append (scm_list_2 (prefix, + scm_from_locale_string ("/share/guile/" GUILE_EFFECTIVE_VERSION))); -+ SCM libdir = scm_string_append (scm_list_2 (prefix, -+ scm_from_locale_string ("/lib"))); ++ SCM path; ++ char *env = getenv ("PATH"); ++ if (env) ++ path = scm_string_append (scm_list_3 (bindir, ++ scm_from_locale_string (PATH_SEPARATOR), ++ scm_from_locale_string (env))); ++ else ++ path = bindir; ++ scm_putenv (scm_string_append (scm_list_2 (scm_from_locale_string ("PATH="), path))); + -+#if 0 /* def SYSV */ -+ { -+ SCM path; -+ char *env = getenv ("LD_LIBRARY_PATH"); -+ if (env) -+ path = scm_string_append (scm_list_3 (scm_from_locale_string (env), -+ scm_from_locale_string (PATH_SEPARATOR), -+ datadir)); -+ else -+ path = libdir; -+ scm_putenv (scm_string_append (scm_list_2 (scm_from_locale_string ("LD_LIBRARY_PATH="), path))); -+ } -+#elif defined (__CYGWIN__) || defined (__MINGW32__) -+ { -+ SCM path; -+ char *env = getenv ("PATH"); -+ if (env) -+ path = scm_string_append (scm_list_3 (scm_from_locale_string (env), -+ scm_from_locale_string (PATH_SEPARATOR), -+ bindir)); -+ else -+ path = bindir; -+ scm_putenv (scm_string_append (scm_list_2 (scm_from_locale_string ("PATH="), path))); -+ } -+#endif /* __CYGWIN__ || __MINGW32__ */ -+ + return scm_list_1 (datadir); +} + @@ -147,23 +131,25 @@ /* Initialize the global variable %load-path, given the value of the SCM_SITE_DIR and SCM_LIBRARY_DIR preprocessor symbols and the -@@ -215,6 +268,14 @@ scm_init_load_path () +@@ -304,6 +351,14 @@ scm_init_load_path () if (env) - path = scm_parse_path (scm_from_locale_string (env), path); + cpath = scm_parse_path (scm_from_locale_string (env), cpath); +#if ARGV0_RELOCATION + if (global_argv0) + { -+ path = scm_append (scm_list_2 (path, scm_init_argv0_relocation (global_argv0))); -+ cpath = scm_append (scm_list_2 (cpath, scm_init_argv0_compiled_relocation (global_argv0))); ++ path = scm_append (scm_list_2 (scm_init_argv0_relocation (global_argv0), path)); ++ cpath = scm_append (scm_list_2 (scm_init_argv0_compiled_relocation (global_argv0), cpath)); + } +#endif /* __CYGWIN__ || __MINGW32__ */ + *scm_loc_load_path = path; + *scm_loc_load_compiled_path = cpath; } - ---- a/libguile/load.h~ 2010-12-14 19:15:17.000000000 +0100 -+++ a/libguile/load.h 2011-01-26 17:33:13.797510681 +0100 +diff --git a/libguile/load.h b/libguile/load.h +index d1afefb..ea29d3a 100644 +--- a/libguile/load.h ++++ b/libguile/load.h @@ -27,6 +27,11 @@ @@ -176,3 +162,6 @@ SCM_API SCM scm_primitive_load (SCM filename); SCM_API SCM scm_c_primitive_load (const char *filename); SCM_API SCM scm_sys_package_data_dir (void); +-- +1.7.1 +