gnucash-on-windows master: Rewrite libtool link files (libfoo.la) for certain cached-build directories.

John Ralls jralls at code.gnucash.org
Fri Nov 7 18:47:35 EST 2014


Updated	 via  https://github.com/Gnucash/gnucash-on-windows/commit/78737c61 (commit)
	from  https://github.com/Gnucash/gnucash-on-windows/commit/d3c86ed8 (commit)



commit 78737c6181429ffa13173ef6d604dbcb91d9d2dd
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Nov 7 15:23:11 2014 -0800

    Rewrite libtool link files (libfoo.la) for certain cached-build directories.
    
    To always point to the current installation directory.
    
    * Ensures that build targets linking those files always have a valid and
    correct path.
    * Reduces the number of "appears to have moved" warnings.

diff --git a/functions.sh b/functions.sh
index 859b92f..4502268 100644
--- a/functions.sh
+++ b/functions.sh
@@ -312,6 +312,26 @@ function get_major_minor () {
   major_minor=$(perl  -e '($maj,$min,$rest) = <>  =~ /([0-9]*)[.]([0-9]*)(.*)/; print $maj*100+$min;' <<< $version)
 }
 
+function fix_lt_file () {
+    filename="$2";
+    orig_dir=`grep ^libdir= $filename | cut -d "'" -f 2`
+    orig_dir=`dirname $orig_dir`
+    target_dir="$1"/`echo $(dirname "$filename") | sed -e"s;$1/;;"`
+
+    sed -i'.bak' -E -e"s;-L$orig_dir;-L$target_dir;g" -e"s;([/a-z0-9A-Z:_-]+)/lib([a-zA-Z0-9._-]+)\.la;-L\1 -l\2;g" -e"s;^libdir=.*$;libdir='$target_dir';" $filename
+}
+
+function fix_libtool_files () {
+if test -n "$1" -a -d "$1"; then
+    for i in `find "$1" -name *.la`; do
+        fix_lt_file $1 $i
+    done
+else
+    echo "Can't find directory $1"
+    exit 1
+fi
+}
+
 ### Local Variables: ***
 ### mode: shell-script ***
 ### sh-basic-offset: 4 ***
diff --git a/install-impl.sh b/install-impl.sh
index 07ab6c6..d71338b 100644
--- a/install-impl.sh
+++ b/install-impl.sh
@@ -412,9 +412,6 @@ function inst_gnome() {
                 sed '1s,!.*perl,!'"perl"',;s,/opt/gnu/bin/iconv,iconv,' $file > tmp
                 mv tmp $file
             done
-
-            # remove *.la files. They are hindering the build
-            rm -f lib/*.la
         qpopd
 
         if quiet ${PKG_CONFIG} --exact-version=${LIBXML2_VERSION} libxml-2.0 ; then
@@ -439,6 +436,7 @@ function inst_gnome() {
             perl -pi.bak -e"s!^prefix=.*\$!prefix=$_GNOME_UDIR!" *.pc
             #perl -pi.bak -e's!^Libs: !Libs: -L\${prefix}/bin !' *.pc
         qpopd
+        fix_libtool_files ${_GNOME_UDIR}
 
         quiet ${PKG_CONFIG} --atleast-version=${GTK_VERSION} gtk+-2.0 || die "gnome not installed correctly: no gtk+-2.0 with atleast-version=${GTK_VERSION}"
         quiet ${PKG_CONFIG} --atleast-version=${CAIRO_VERSION} cairo || die "gnome not installed correctly: no cairo with atleast-version=${CAIRO_VERSION}"
@@ -500,6 +498,7 @@ function inst_gnutls() {
             mkdir -p $_GNUTLS_UDIR
             wget_unpacked $GNUTLS_URL $DOWNLOAD_DIR $GNUTLS_DIR
             wget_unpacked $GNUTLS_DEV_URL $DOWNLOAD_DIR $GNUTLS_DIR
+            fix_libtool_files ${_GNUTLS_UDIR}
         fi
         quiet ${PKG_CONFIG} --exists gnutls || die "GNUTLS not installed correctly"
     fi
@@ -651,6 +650,7 @@ function inst_gwenhywfar() {
             rm -rf ${_GWENHYWFAR_UDIR}
             make install
         qpopd
+#        fix_libtool_files ${_GWENHYWFAR_UDIR}
         ${PKG_CONFIG} --exists gwenhywfar || die "Gwenhywfar not installed correctly"
         rm -rf ${TMP_UDIR}/gwenhywfar-*
     fi
@@ -912,10 +912,11 @@ function inst_libsoup() {
                 make
                 make install
             qpopd
-        else
+       else
             mkdir -p $_LIBSOUP_UDIR
             wget_unpacked $LIBSOUP_URL $DOWNLOAD_DIR $LIBSOUP_DIR
             wget_unpacked $LIBSOUP_DEV_URL $DOWNLOAD_DIR $LIBSOUP_DIR
+            fix_libtool_files ${_LIBSOUP_UDIR}
         fi
         quiet ${PKG_CONFIG} --exists libsoup-2.4 || die "libsoup not installed correctly"
         rm -rf ${TMP_UDIR}/libsoup-*



Summary of changes:
 functions.sh    | 20 ++++++++++++++++++++
 install-impl.sh |  9 +++++----
 2 files changed, 25 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list