From: wolfgang Date: Tue, 22 Mar 2005 06:37:59 +0000 (+0000) Subject: [project @ 2005-03-22 06:37:57 by wolfgang] X-Git-Tag: Initial_conversion_from_CVS_complete~877 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=2b811329caa54eee7c1b159384e1e1aa3a5e9feb [project @ 2005-03-22 06:37:57 by wolfgang] Mac OS X: Make bindist work with dynamic libraries MERGE TO STABLE --- diff --git a/Makefile b/Makefile index 4f900d5..f9e10be 100644 --- a/Makefile +++ b/Makefile @@ -211,6 +211,10 @@ BIN_DIST_TOP= distrib/Makefile-bin.in \ config.sub \ aclocal.m4 +ifeq "$(darwin_TARGET_OS)" "1" +BIN_DIST_TOP+=mk/fix_install_names.sh +endif + # # binary-dist creates a binary bundle, set BIN_DIST_NAME # to package name and do `make binary-dist Project=' diff --git a/distrib/Makefile-bin.in b/distrib/Makefile-bin.in index f4497da..197a2e1 100644 --- a/distrib/Makefile-bin.in +++ b/distrib/Makefile-bin.in @@ -173,6 +173,13 @@ config-pkgs :: $(SED) -e "s|\$$libdir|$(libdir)|g;s|\$$datadir|$(datadir)|g" lib/$(platform)/$$i; \ fi; \ done + @if test "$(platform)" == "powerpc-apple-darwin"; then \ + echo "Configuring install names..."; \ + for i in lib/$(platform)/*; do \ + sh fix_install_names.sh "$(libdir)" "$$i"; \ + done; \ + echo "Done."; \ + fi in-place :: $(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share diff --git a/mk/fix_install_names.sh b/mk/fix_install_names.sh index 7e51f23..f6278ce 100644 --- a/mk/fix_install_names.sh +++ b/mk/fix_install_names.sh @@ -7,6 +7,13 @@ prefix=$1 file=$2 +type=`file "$file"` + +if `test "${type/Mach-O}" == "$type"` +then + exit +fi + if `test x${prefix%/} != x"" ` then prefix=${prefix%/}/ @@ -16,6 +23,10 @@ for i in `otool -L $file \ | grep 'libHS.*_dyn.dylib' \ | sed 's/.\(.*libHS.*_dyn.dylib\).*/\1/'` do - install_name_tool -change $i $prefix`basename $i` $file + install_name_tool -change $i "$prefix`basename $i`" $file done +if `test "${file%.dylib}" != "${file}"` +then + install_name_tool -id "$prefix`basename $file`" $file +fi