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

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

Really fix everything about installing locale

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