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

Last change on this file since 1966 was 1963, checked in by nanardon, 7 years ago

Don't mix man1 and 5 in html doc

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