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

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

add la2xls: generate xls file

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