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

Last change on this file since 1639 was 1623, checked in by nanardon, 9 years ago

Fix start / end Employment computation

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