source: tags/5.1.27/LATMOS-Accounts/Makefile.PL @ 2361

Last change on this file since 2361 was 1773, checked in by nanardon, 8 years ago

Add tools to automate employement renewal

File size: 7.5 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.
5
6my @po;
7foreach (glob('po/*.po')) {
8    my ($po) = $_ =~  m:([^/\.]+)\.po$:;
9    push (@po, $po);
10}
11
12WriteMakefile(
13    NAME              => 'LATMOS::Accounts',
14    VERSION_FROM      => 'lib/LATMOS/Accounts.pm',
15    PREREQ_PM         => {
16        'Net::LDAP' => undef,
17        'Unicode::Map8' => undef,
18        'DBD::Pg' => undef,
19        'Crypt::RSA' => undef,
20        'MIME::Base64' => undef,
21        'Term::ReadKey' => undef,
22        'Config::IniFiles' => undef,
23        'Mail::Sendmail' => undef,
24        'Net::DNS' => undef,
25        'Template' => undef,
26        'Sys::Syslog' => undef,
27        'Pod::Usage' => undef,
28        'Unicode::String' => undef,
29        'Crypt::Cracklib' => undef,
30        'Net::IP' => undef,
31        'Net::IPv4Addr' => undef,
32        'Net::IPv6Addr' => undef,
33        'DateTime' => undef,
34        'SOAP::Lite' => undef,
35        'HTTP::Cookies' => undef,
36        'XML::XPath' => undef,
37        'Crypt::SmbHash' => undef,
38        'Date::Calc' => undef,
39        'Spreadsheet::WriteExcel' => undef,
40    }, # e.g., Module::Name => 1.1
41    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
42      (ABSTRACT_FROM  => 'lib/LATMOS/Accounts.pm', # retrieve abstract from module
43       AUTHOR         => 'Thauvin Olivier <olivier.thauvin@latmos.ipsl.fr>') : ()),
44    EXE_FILES => [ qw(
45        bin/la-acls
46        bin/la-qacls
47        bin/la-attributes
48        bin/la-cli
49        bin/la-config
50        bin/la-create
51        bin/la-sql-crypt-passwd
52        bin/la-delete
53        bin/la-edit
54        bin/la-sql-find-expired
55        bin/la-group
56        bin/la-guser
57        bin/la-passwd
58        bin/la-query
59        bin/la-rename
60        bin/la-sql-rename-host
61        bin/la-sql-exchange-ip
62        bin/la-sql-exchange-hostname
63        bin/la-sql-switch-cname
64        bin/la-sql-rev
65        bin/la-search
66        bin/la-sync
67        bin/la-sync-manager
68        bin/la-sync-ctl
69        bin/la-warn-expire
70        bin/la-sql-freeip
71        bin/la-expired-reminder
72        bin/la-sql-upgrade
73        bin/la-sql-edit-form
74        bin/la-sql-updsshfp
75        bin/la-test-mail
76        bin/la-sql-log
77        bin/la-sql-runstat
78        bin/la-sql-stat2csv
79        bin/la2xls
80        bin/la-ban-passwd
81        bin/la-renewEmp
82        ) ],
83        macro => {
84            INSTALLMAN5DIR      => '$(PERLPREFIX)/share/man/man5',
85            INSTALLMAN8DIR      => '$(PERLPREFIX)/share/man/man8',
86            DESTINSTALLMAN5DIR  => '$(DESTDIR)$(INSTALLMAN5DIR)',
87            DESTINSTALLMAN8DIR  => '$(DESTDIR)$(INSTALLMAN8DIR)',
88            LOCALEDIR           => '/usr/share/locale',
89            INST_MAN5DIR        => 'blib/man5',
90            INST_MAN8DIR        => 'blib/man8',
91            DESTRPMDIR          => '$(shell pwd)',
92            DATADIR             => '/usr/share/latmos-accounts',
93            DESTDATADIR         => '$(DESTDIR)$(DATADIR)',
94        },
95        MAN1PODS        => {
96            map {
97                my $targ = $_;
98                $targ =~ s{^man/man(\d)}{};
99                my $section = $1 || 1;
100                $targ =~ s{^bin/}{};
101                $targ =~ s/.pod$//;
102                ( $_ =>
103                    "\$(INST_MAN${section}DIR)/$targ.$section" );
104            } <man/man?/*.pod>, (grep { ! /~$/ } <bin/*>)
105        },
106
107);
108
109package MY;
110
111sub postamble {
112
113    my $makepo = '';
114
115    foreach my $po (@po) {
116        $makepo .=
117"
118po/$po.po: po/messages.pot
119\t[ -f po/$po.po ] || msginit --no-translator --input=po/messages.pot --output= --locale=$_
120\tmsgmerge -U po/$po.po po/messages.pot
121
122po/$po/LC_MESSAGES/linkaccounts.mo: po/$po.po
123\tinstall -d po/$po/LC_MESSAGES
124\tmsgfmt -o \$@ \$<
125\n"
126    }
127
128    $makepo .= "\n\npo: " . join(' ', map { "po/$_.po" } @po) . "\n";
129    $makepo .= "\n\nmo: " . join(' ', map { "po/$_/LC_MESSAGES/linkaccounts.mo" } @po) . "\n";
130
131    <<EOF;
132.PHONY: po/messages.pot
133
134pot: po/messages.pot
135
136po/messages.pot:
137\tcat MANIFEST | egrep '^(lib|bin)' | xargs xgettext.pl -o po/messages.pot
138
139$makepo
140
141bin/la-sql-upgrade: bin/la-sql-upgrade.in
142\tcat \$< \| sed 's:\@DATADIR\@:\$(DATADIR):' > \$@
143\tchmod +x \$@
144
145svnmanifest:
146\tsvn ls -R| grep -v "/\$\$"  > MANIFEST
147
148ChangeLog:
149\tsvn log > ChangeLog
150
151latmos-accounts.spec: latmos-accounts.spec.in Makefile
152\tsed -e 's/\@VERSION@/\$(VERSION)/' < \$< > \$@
153
154rpm: \$(DISTVNAME).tar.gz latmos-accounts.spec
155\tmkdir ./noarch || :
156\trpmbuild -ba --clean\\
157\t --define "_sourcedir `pwd`" \\
158\t --define "_specdir `pwd`" \\
159\t --define "_srcrpmdir \$(DESTRPMDIR)" \\
160\t --define "_rpmdir \$(DESTRPMDIR)" \\
161\t latmos-accounts.spec
162
163svnrpm: \$(DISTVNAME).tar.gz latmos-accounts.spec
164\tmkdir \$(DESTRPMDIR)/noarch || :
165\trpmbuild -ba --clean\\
166\t --define "_sourcedir `pwd`" \\
167\t --define "_specdir `pwd`" \\
168\t --define "_srcrpmdir \$(DESTRPMDIR)" \\
169\t --define "_rpmdir \$(DESTRPMDIR)" \\
170\t --define "svnrelease `LC_ALL=C svn info | grep '^Revision:' | sed 's/Revision: //'`" \\
171\t latmos-accounts.spec
172
173podhtml: \$(MAN1PODS) \$(MAN3PODS)
174\tmkdir html || :
175\trm -f html/*
176\tperl scripts/pod2xhtml.pl \$(MAN1PODS) \$(MAN3PODS)
177
178EOF
179}
180
181sub installbin {
182    my $self = shift;
183    my $inherited = $self->SUPER::installbin(@_);
184    my $s = join '|', map quotemeta, @sbin_scripts;
185    # how to create needed directories under blib
186    $inherited .= $self->dir_target("\$(INST_$_)") for qw(MAN5DIR MAN8DIR);
187    $inherited;
188}
189
190sub top_targets {
191    my $inherited = shift->SUPER::top_targets(@_);
192    $inherited =~ s/^config ::/$& \$(INST_MAN5DIR)\$(DIRFILESEP).exists \$(INST_MAN8DIR)\$(DIRFILESEP).exists/m;
193    $inherited;
194}
195
196sub install {
197    my ($self) = @_;
198    my $section = $self->SUPER::install();
199
200    $section =~ s/(^install ::.*)/$1 install_config install_templates install_data install_mo/m;
201    $section =~ s/\$\(INST_BIN\) \$\(DESTINSTALL(\w*)BIN\)/$& \$(INST_MAN5DIR) \$(DESTINSTALLMAN5DIR) \$(INST_MAN8DIR) \$(DESTINSTALLMAN8DIR)/g;
202
203    $section .= q[
204install_config ::
205        install -d $(DESTDIR)/etc
206        install -d $(DESTDIR)/etc/latmos-accounts
207        install sample/latmos-accounts.ini $(DESTDIR)/etc/latmos-accounts/latmos-accounts.ini
208        install sample/la-sync-list.ini $(DESTDIR)/etc/latmos-accounts/la-sync-list.ini
209        install sample/la-allowed-values.ini $(DESTDIR)/etc/latmos-accounts/la-allowed-values.ini
210        install sample/la-sync-manager.ini $(DESTDIR)/etc/latmos-accounts/la-sync-manager.ini
211
212install_templates ::
213        install -d $(DESTDIR)$(DATADIR)/templates
214        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ templates => @ARGV })' \\
215                $(DESTDIR)$(DATADIR)/templates
216
217install_data ::
218        install -d $(DESTDIR)$(DATADIR)
219        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ sqldata => @ARGV })' \\
220            $(DESTDIR)$(DATADIR)
221
222install_mo: mo
223        install -d $(DESTDIR)$(LOCALEDIR)
224];
225
226    foreach (@po) {
227        $section .= "\tinstall -d \$(DESTDIR)\$(LOCALEDIR)/$_/LC_MESSAGES\n";
228        $section .= "\tinstall po/$_/LC_MESSAGES/linkaccounts.mo \$(DESTDIR)\$(LOCALEDIR)/$_/LC_MESSAGES/linkaccounts.mo\n";
229    }
230    $section .= "\n";
231 
232    return $section;
233}
234
235sub test {
236    my $inherited = shift->SUPER::test(@_);
237
238    $inherited =~ s:^(test_dynamic .*):$1 test_scripts:m;
239
240    $inherited .= <<EOF;
241
242TESTLIVE_FILES = live-test/*.t
243TESTSCRIPTS_FILE = t/scripts.pl
244
245test_live :: pure_all
246\tPERL_DL_NONLAZY=1 \$(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" \$(TESTLIVE_FILES)
247
248test_scripts :: pure_all
249\tPERL_DL_NONLAZY=1 \$(FULLPERLRUN) "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" \$(TESTSCRIPTS_FILE) \$(EXE_FILES)
250EOF
251    return $inherited;
252}
Note: See TracBrowser for help on using the repository browser.