diff options
-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 +} |