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

Last change on this file since 2250 was 2240, checked in by nanardon, 5 years ago

Revert back po files

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