forked from pah/pristine-tar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.PL
executable file
·104 lines (89 loc) · 2.93 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env perl
use warnings;
use strict;
use ExtUtils::MakeMaker;
# read custom parameters
my %args = map { split /\s*=\s*/ } @ARGV;
my $PERL_SHEBANG = $args{PERL_SHEBANG} || "" ;
my $TAR_PROGRAM = $args{TAR_PROGRAM} || "" ;
my $XDELTA_PROGRAM = $args{XDELTA_PROGRAM} || "" ;
if ($PERL_SHEBANG || $TAR_PROGRAM || $XDELTA_PROGRAM) {
print <<EOF;
Info: MakeMaker may warn about the custom parameters 'PERL_SHEBANG',
'TAR_PROGRAM', and 'XDELTA_PROGRAM', which are anyway correctly
handled for generating the Makefile.
EOF
}
package MY;
sub macro {
my $inherited = shift->SUPER::macro(@_);
my $subst = '';
$subst .= q[-e "s|^\#!.*|\#!$(PERL_SHEBANG)|g" ]
unless ! ${PERL_SHEBANG};
$subst .= q[-e "s|tar_program = \".*\";|tar_program = \"$(TAR_PROGRAM)\";|g" ]
unless ! ${TAR_PROGRAM};
$subst .= q[-e "s|xdelta_program = \".*\";|xdelta_program = \"$(XDELTA_PROGRAM)\";|g" ]
unless ! ${XDELTA_PROGRAM};
$inherited .= "\nPARAM_SUBST = ${subst}";
$inherited;
}
# Add a few more targets.
sub postamble {
q{
all:: extra_build
clean:: extra_clean
install:: extra_install
pure_install:: extra_install
ifneq (,$(PARAM_SUBST))
$(EXE_FILES): %:
sed $(PARAM_SUBST) $@ > [email protected]
$(MV) [email protected] $@
$(CHMOD) $(PERM_RWX) $@
PHONY+=$(EXE_FILES)
endif
LIBDIR ?= $(PREFIX)/lib
PKGLIBDIR ?= $(LIBDIR)/pristine-tar
extra_build: zgz/zgz pristine-tar.spec
pod2man -c pristine-tar pristine-tar > pristine-tar.1
pod2man -c pristine-gz pristine-gz > pristine-gz.1
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 PREFIX=$(PREFIX)
ZGZ_SOURCES = zgz/zgz.c zgz/gzip/*.c zgz/old-bzip2/*.c
zgz/zgz: $(ZGZ_SOURCES)
gcc -Wall -O2 -o $@ $(ZGZ_SOURCES) -lz -DPKGLIBDIR=\"$(PKGLIBDIR)\"
extra_install:
install -d $(DESTDIR)$(PREFIX)/bin
install zgz/zgz $(DESTDIR)$(PREFIX)/bin
install -d $(DESTDIR)$(PREFIX)/share/man/man1
install -m 0644 *.1 $(DESTDIR)$(PREFIX)/share/man/man1
install -d $(DESTDIR)$(PKGLIBDIR)/suse-bzip2
install pit/suse-bzip2/bzip2 pit/suse-bzip2/libbz2* $(DESTDIR)$(PKGLIBDIR)/suse-bzip2
extra_clean:
$(MAKE) clean -C pit/suse-bzip2 PREFIX=$(PREFIX)
rm *.1
pristine-tar.spec: debian/changelog
sed "s/Version:.*/Version: $$($(PERLRUN) -e '$$_=<>;print m/\((.*?)\)/'<$<)/" \
$@ > [email protected] && $(MV) [email protected] $@
PHONY+=pristine-tar.spec
.PHONY: $(PHONY)
}
}
ExtUtils::MakeMaker::WriteMakefile(
NAME => 'Pristine',
AUTHOR => 'Joey Hess <[email protected]>',
ABSTRACT =>
'regenerate a pristine upstream tarball using only a small '.
'binary delta file and a revision control checkout',
MAN1PODS => {},
MAN3PODS => {},
PMLIBDIRS => ["Pristine"],
EXE_FILES => ["pristine-tar","pristine-bz2","pristine-gz","pristine-xz"],
macro => {
PERL_SHEBANG => "${PERL_SHEBANG}",
TAR_PROGRAM => "${TAR_PROGRAM}",
XDELTA_PROGRAM => "${XDELTA_PROGRAM}"
},
clean => { FILES => 'zgz/zgz' },
);