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

Last change on this file since 2380 was 2289, checked in by nanardon, 5 years ago

DateTime::Format::Pg is now necessary

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