source: trunk/LATMOS-Accounts/Makefile.PL @ 1201

Last change on this file since 1201 was 1201, checked in by nanardon, 12 years ago

add tools to reset (bug #3)

File size: 6.0 KB
Line 
1use 5.010000;
2use ExtUtils::MakeMaker;
3# See lib/ExtUtils/MakeMaker.pm for details of how to influence
4# the contents of the Makefile that is written.
5WriteMakefile(
6    NAME              => 'LATMOS::Accounts',
7    VERSION_FROM      => 'lib/LATMOS/Accounts.pm',
8    PREREQ_PM         => {
9        'Net::LDAP' => undef,
10        'Unicode::Map8' => undef,
11        'DBD::Pg' => undef,
12        'Crypt::RSA' => undef,
13        'MIME::Base64' => undef,
14        'Term::ReadKey' => undef,
15        'Config::IniFiles' => undef,
16        'Mail::Sendmail' => undef,
17        'Net::DNS' => undef,
18        'Template' => undef,
19        'Sys::Syslog' => undef,
20        'Pod::Usage' => undef,
21        'Unicode::String' => undef,
22        'Crypt::Cracklib' => undef,
23        'Net::IP' => undef,
24        'Net::IPv4Addr' => undef,
25        'Net::IPv6Addr' => undef,
26    }, # e.g., Module::Name => 1.1
27    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
28      (ABSTRACT_FROM  => 'lib/LATMOS/Accounts.pm', # retrieve abstract from module
29       AUTHOR         => 'Thauvin Olivier <olivier.thauvin@latmos.ipsl.fr>') : ()),
30    EXE_FILES => [ qw(
31        bin/la-acls
32        bin/la-qacls
33        bin/la-attributes
34        bin/la-cli
35        bin/la-config
36        bin/la-create
37        bin/la-sql-crypt-passwd
38        bin/la-delete
39        bin/la-edit
40        bin/la-find-expired
41        bin/la-group
42        bin/la-guser
43        bin/la-passwd
44        bin/la-query
45        bin/la-rename
46        bin/la-rename-host
47        bin/la-sql-exchange-ip
48        bin/la-sql-rev
49        bin/la-search
50        bin/la-sync
51        bin/la-sync-manager
52        bin/la-sync-ctl
53        bin/la-warn-expire
54        bin/la-sql-freeip
55        bin/la-expired-reminder
56        bin/la-sql-regatt
57        bin/la-sql-loadatt
58        bin/la-sql-upgrade
59        bin/la-sql-edit-form
60        bin/la-test-mail
61        ) ],
62        macro => {
63            INSTALLMAN5DIR      => '$(PERLPREFIX)/share/man/man5',
64            INSTALLMAN8DIR      => '$(PERLPREFIX)/share/man/man8',
65            DESTINSTALLMAN5DIR  => '$(DESTDIR)$(INSTALLMAN5DIR)',
66            DESTINSTALLMAN8DIR  => '$(DESTDIR)$(INSTALLMAN8DIR)',
67            INST_MAN5DIR        => 'blib/man5',
68            INST_MAN8DIR        => 'blib/man8',
69            DESTRPMDIR          => '$(shell pwd)',
70            DATADIR             => '/usr/share/latmos-accounts',
71            DESTDATADIR         => '$(DESTDIR)$(DATADIR)',
72        },
73        MAN1PODS        => {
74            map {
75                my $targ = $_;
76                $targ =~ s{^man/man(\d)}{};
77                my $section = $1 || 1;
78                $targ =~ s{^bin/}{};
79                $targ =~ s/.pod$//;
80                ( $_ =>
81                    "\$(INST_MAN${section}DIR)/$targ.$section" );
82            } <man/man?/*.pod>, (grep { ! /~$/ } <bin/*>)
83        },
84
85);
86
87package MY;
88
89sub postamble {
90    <<EOF;
91#.PHONY .= svnmanifest
92
93bin/la-sql-upgrade: bin/la-sql-upgrade.in
94\tcat \$< \| sed 's:\@DATADIR\@:\$(DATADIR):' > \$@
95\tchmod +x \$@
96
97svnmanifest:
98\tsvn ls -R| grep -v "/\$\$"  > MANIFEST
99
100ChangeLog:
101\tsvn log > ChangeLog
102
103latmos-accounts.spec: latmos-accounts.spec.in Makefile
104\tsed -e 's/\@VERSION@/\$(VERSION)/' < \$< > \$@
105
106rpm: \$(DISTVNAME).tar.gz latmos-accounts.spec
107\tmkdir ./noarch || :
108\trpmbuild -ba --clean\\
109\t --define "_sourcedir `pwd`" \\
110\t --define "_specdir `pwd`" \\
111\t --define "_srcrpmdir \$(DESTRPMDIR)" \\
112\t --define "_rpmdir \$(DESTRPMDIR)" \\
113\t latmos-accounts.spec
114
115svnrpm: \$(DISTVNAME).tar.gz latmos-accounts.spec
116\tmkdir \$(DESTRPMDIR)/noarch || :
117\trpmbuild -ba --clean\\
118\t --define "_sourcedir `pwd`" \\
119\t --define "_specdir `pwd`" \\
120\t --define "_srcrpmdir \$(DESTRPMDIR)" \\
121\t --define "_rpmdir \$(DESTRPMDIR)" \\
122\t --define "svnrelease `LC_ALL=C svn info | grep '^Revision:' | sed 's/Revision: //'`" \\
123\t latmos-accounts.spec
124
125podhtml: \$(MAN1PODS) \$(MAN3PODS)
126\tmkdir html || :
127\trm -f html/*
128\tperl scripts/pod2xhtml.pl \$(MAN1PODS) \$(MAN3PODS)
129
130EOF
131}
132
133sub installbin {
134    my $self = shift;
135    my $inherited = $self->SUPER::installbin(@_);
136    my $s = join '|', map quotemeta, @sbin_scripts;
137    # how to create needed directories under blib
138    $inherited .= $self->dir_target("\$(INST_$_)") for qw(MAN5DIR MAN8DIR);
139    $inherited;
140}
141
142sub top_targets {
143    my $inherited = shift->SUPER::top_targets(@_);
144    $inherited =~ s/^config ::/$& \$(INST_MAN5DIR)\$(DIRFILESEP).exists \$(INST_MAN8DIR)\$(DIRFILESEP).exists/m;
145    $inherited;
146}
147
148sub install {
149    my ($self) = @_;
150    my $section = $self->SUPER::install();
151
152    $section =~ s/(^install ::.*)/$1 install_config install_templates install_data/m;
153    $section =~ s/\$\(INST_BIN\) \$\(DESTINSTALL(\w*)BIN\)/$& \$(INST_MAN5DIR) \$(DESTINSTALLMAN5DIR) \$(INST_MAN8DIR) \$(DESTINSTALLMAN8DIR)/g;
154
155    $section .= q[
156install_config ::
157        install -d $(DESTDIR)/etc
158        install -d $(DESTDIR)/etc/latmos-accounts
159        install sample/latmos-accounts.ini $(DESTDIR)/etc/latmos-accounts/latmos-accounts.ini
160        install sample/la-sync-list.ini $(DESTDIR)/etc/latmos-accounts/la-sync-list.ini
161        install sample/la-allowed-values.ini $(DESTDIR)/etc/latmos-accounts/la-allowed-values.ini
162        install sample/la-sync-manager.ini $(DESTDIR)/etc/latmos-accounts/la-sync-manager.ini
163
164install_templates ::
165        install -d $(DESTDIR)$(DATADIR)/templates
166        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ templates => @ARGV })' \\
167                $(DESTDIR)$(DATADIR)/templates
168
169install_data ::
170        install -d $(DESTDIR)$(DATADIR)
171        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ sqldata => @ARGV })' \\
172            $(DESTDIR)$(DATADIR)
173];
174 
175    return $section;
176}
177
178sub test {
179    my $inherited = shift->SUPER::test(@_);
180
181    $inherited =~ s:^(test_dynamic .*):$1 test_scripts:m;
182
183    $inherited .= <<EOF;
184
185TESTLIVE_FILES = live-test/*.t
186TESTSCRIPTS_FILE = t/scripts.pl
187
188test_live :: pure_all
189\tPERL_DL_NONLAZY=1 \$(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" \$(TESTLIVE_FILES)
190
191test_scripts :: pure_all
192\tPERL_DL_NONLAZY=1 \$(FULLPERLRUN) "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" \$(TESTSCRIPTS_FILE) \$(EXE_FILES)
193EOF
194    return $inherited;
195}
Note: See TracBrowser for help on using the repository browser.