diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-10-26 14:04:48 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-10-26 14:04:48 +0000 |
commit | 2df3d891926b785d1abd590eb8bc233913fed992 (patch) | |
tree | 5d5afee28c3b990efb762747c1894fb36d1a32fe | |
parent | 731ca15ed0c02730197deb3fd16321544eebee47 (diff) | |
download | bzip2-baserock/richardmaw/bzip2-symlink-fix.tar.gz |
Fix up makefile to allow DESTDIRbaserock/richardmaw/bzip2-symlink-fix
PREFIX is mostly substitutable, except in the case of symlinks.
-rw-r--r-- | bzip2.morph | 4 | ||||
-rw-r--r-- | bzip2.morph-makefix.sed | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/bzip2.morph b/bzip2.morph index bb321f1..7dd89e6 100644 --- a/bzip2.morph +++ b/bzip2.morph @@ -2,14 +2,14 @@ "name": "bzip2", "kind": "chunk", "configure-commands": [ - "sed -i -e 's|$(PREFIX)/man|$(PREFIX)/share/man|g' Makefile" + "sed -i -rf bzip2.morph-makefix.sed Makefile" ], "build-commands": [ "make -f Makefile-libbz2_so", "make" ], "install-commands": [ - "make PREFIX=\"$DESTDIR$PREFIX\" install", + "make DESTDIR=\"$DESTDIR\" PREFIX=\"$PREFIX\" install", "install libbz2.so* \"$DESTDIR$PREFIX/lib\"" ] } diff --git a/bzip2.morph-makefix.sed b/bzip2.morph-makefix.sed new file mode 100644 index 0000000..9589790 --- /dev/null +++ b/bzip2.morph-makefix.sed @@ -0,0 +1,10 @@ +#!/usr/bin/sed +# Match the install section of the makefile +/^install:/,/^$/{ + # link commands only substitute the final PREFIX + /^\s*ln.*$/s/\$\(PREFIX\)(\S+)$/$(DESTDIR)$(PREFIX)\1/; + # non-inks substitute $(PREFIX) for $(DESTDIR)$(PREFIX) + /^\s*ln.*$/!s/\$\(PREFIX\)/$(DESTDIR)$(PREFIX)/g; + # fix manpage paths + s|\$\(PREFIX\)/man|$(PREFIX)/share/man|g +} |