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

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