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

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

Add to to recompute data

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