Makefile.PL: handle PREFIX consistently
authorPhilipp A. Hartmann <philipp.hartmann@offis.de>
Mon, 27 Aug 2012 11:23:04 +0000 (13:23 +0200)
committerPhilipp A. Hartmann <philipp.hartmann@offis.de>
Mon, 27 Aug 2012 13:22:51 +0000 (15:22 +0200)
This patch fixes the handling of the PREFIX variable in the generated
Makefile.  The following issues are addressed:

 * drop explicit PREFIX in WriteMakefile call

   By default, the local $Config{prefix} setting should be fine.
   This allows to specify either PREFIX or INSTALL_BASE as Makefile.PL
   parameter, depending on the user needs.

 * use PREFIX in extra_install target

   Previously, pristine-tar, pristine-gz, pristine-bz2, pristine-xz, and
   zgz were always installed to /usr/bin (if $DESTDIR was not set). Also,
   the man pages were always installed to /usr/share/man/man1.

 * call $(MAKE) and pass PREFIX to the build of suse-bzip2

   Although PREFIX is not really used during the build of suse-bzip2,
   it should be passed to the build to enable e.g. the inclusion
   of the "correct" location during the linking process.

Reported-by: Torsten Maehne <torsten.maehne@gmx.de>
Signed-off-by: Philipp A. Hartmann <philipp.hartmann@offis.de>
Makefile.PL

index d11e39638147c49b46da579629ef696ccf729c2f..c1ffad44558377ee0c889ea9b665368e74d0986e 100755 (executable)
@@ -19,7 +19,7 @@ extra_build: zgz/zgz pristine-tar.spec
        pod2man -c pristine-bz2 pristine-bz2 > pristine-bz2.1
        pod2man -c pristine-xz pristine-xz > pristine-xz.1
        pod2man -c zgz zgz/zgz.pod > zgz.1
-       make -C pit/suse-bzip2
+       $(MAKE) -C pit/suse-bzip2 PREFIX=$(PREFIX)
 
 ZGZ_SOURCES = zgz/zgz.c zgz/gzip/*.c zgz/old-bzip2/*.c
 zgz/zgz: $(ZGZ_SOURCES)
@@ -30,17 +30,17 @@ pit/suse-bzip2/suse-bzip2: $(SUSE_BZIP2_SOURCES)
        gcc -Wall -O2 -o $@ $(SUSE_BZIP2_SOURCES)
 
 extra_install:
-       install -d $(DESTDIR)/usr/bin
-       install -d $(DESTDIR)/usr/share/man/man1
-       install pristine-tar pristine-gz pristine-bz2 pristine-xz zgz/zgz $(DESTDIR)/usr/bin
-       install -m 0644 *.1 $(DESTDIR)/usr/share/man/man1
+       install -d $(DESTDIR)$(PREFIX)/bin
+       install -d $(DESTDIR)$(PREFIX)/share/man/man1
+       install pristine-tar pristine-gz pristine-bz2 pristine-xz zgz/zgz $(DESTDIR)$(PREFIX)/bin
+       install -m 0644 *.1 $(DESTDIR)$(PREFIX)/share/man/man1
        install -d $(DESTDIR)$(ZGZ_LIB)/suse-bzip2
        install pit/suse-bzip2/bzip2 $(DESTDIR)$(ZGZ_LIB)/suse-bzip2
        install pit/suse-bzip2/libbz2* $(DESTDIR)$(ZGZ_LIB)/suse-bzip2
 
-extra_clean: pristine-tar.spec
+extra_clean:
        rm -f *.1 zgz/zgz
-       make clean -C pit/suse-bzip2
+       $(MAKE) clean -C pit/suse-bzip2 PREFIX=$(PREFIX)
 
 pristine-tar.spec:
        sed -i "s/Version:.*/Version: $$(perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)/" pristine-tar.spec
@@ -51,7 +51,6 @@ pristine-tar.spec:
 
 WriteMakefile(
        NAME            => 'Pristine',
-       PREFIX          => "/usr/local",
        MAN1PODS        => {},
        MAN3PODS        => {},
        PMLIBDIRS       => ["Pristine"],