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

Last change on this file since 2472 was 2472, checked in by nanardon, 3 years ago

Install man{5,8} documentations

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