aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
blob: f8629a41dff7b829eda9fbb01da9af1887bc40f2 (plain)
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
# $Id: Makefile.PL 1723 2006-10-17 13:53:27Z warly $
use ExtUtils::MakeMaker;
use Config;

WriteMakefile(
    NAME       => 'youri-submit',
    VERSION    => '0.9.4',
    AUTHOR     => 'Mageia Sysadmin Team <mageia-sysadm@mageia.org>',
    EXE_FILES  => [
        'bin/youri-submit',
        'bin/youri-submit-restricted',
        'bin/youri-submit-proxy',
	'bin/mga-signpackage'
        ],
    PREREQ_PM  => {
        'Youri::Config'          => 0,
        'Youri::Utils'           => 0,
        'Pod::Simple::HTMLBatch' => 0
    },
    PREFIX               => '/usr/local',
    INSTALLPRIVLIB       => $Config{installprivlib},
    INSTALLSITELIB       => $Config{installsitelib},
    INSTALLVENDORLIB     => $Config{installvendorlib},
    INSTALLMAN3DIR       => $Config{installman3dir},
    INSTALLSITEMAN3DIR   => $Config{installsiteman3dir},
    INSTALLVENDORMAN3DIR => $Config{installvendorman3dir},
    INSTALLSCRIPT        => '$(PREFIX)/bin',
    INSTALLSITESCRIPT    => '$(PREFIX)/bin',
    INSTALLVENDORSCRIPT  => '$(PREFIX)/bin',
    INSTALLMAN1DIR       => '$(PREFIX)/share/man/man1',
    INSTALLSITEMAN1DIR   => '$(PREFIX)/share/man/man1',
    INSTALLVENDORMAN1DIR => '$(PREFIX)/share/man/man1',
);

package MY;

sub post_constants {
    my ($self) = @_;
    my $sysconfdir = $self->{ARGS}->{SYSCONFDIR} || '$(PREFIX)/etc';
    return <<EOF;
SYSCONFDIR = $sysconfdir
EOF
}

sub top_targets {
    my ($self) = @_;
    my $top_targets = $self->SUPER::top_targets(@_);
    $top_targets =~ s/all :: pure_all manifypods/all :: pure_all manifypods htmlifypods/;
    $top_targets .= <<'EOF';
htmlifypods : $(TO_INST_PM)
	if [ ! -d blib/html ]; then mkdir blib/html; fi
	perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go lib blib/html
	pod2html < bin/youri-submit > blib/html/youri-submit.html
	pod2html < bin/youri-submit-restricted > blib/html/youri-submit-restricted.html
	pod2html < bin/youri-submit-proxy > blib/html/youri-submit-proxy.html
EOF
     return $top_targets;
}

sub install {
    my ($self) = @_;
    my $install = $self->SUPER::install(@_);
    $install =~ s/install :: all pure_install doc_install/install :: all pure_install doc_install config_install completion_install/;
    $install .= <<'EOF';
config_install :
	install -d -m 755 $(DESTDIR)$(SYSCONFDIR)/youri
	install -m 644 etc/submit.conf $(DESTDIR)$(SYSCONFDIR)/youri

completion_install :
	install -d -m 755 $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
	install -m 644 etc/bash_completion.d/youri-submit $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
EOF
    return $install;
}

sub installbin {
    my ($self) = @_;
    my $installbin = $self->SUPER::installbin(@_);
    $installbin .= <<'EOF';
bin/youri-submit : bin/youri-submit.in Makefile
	perl -p \
	    -e 's|\@sysconfdir\@|$(SYSCONFDIR)|;' \
	    < $< > $@

bin/youri-submit-restricted : bin/youri-submit-restricted.in Makefile
	perl -p \
	    -e 's|\@sysconfdir\@|$(SYSCONFDIR)|;' \
	    -e 's|\@bindir\@|$(PREFIX)/bin|;' \
	    < $< > $@

bin/youri-submit-proxy : bin/youri-submit-proxy.in Makefile
	perl -p \
	    -e 's|\@sysconfdir\@|$(SYSCONFDIR)|;' \
	    -e 's|\@bindir\@|$(PREFIX)/bin|;' \
	    < $< > $@
EOF
    return $installbin;
}