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

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

Fix I18N

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