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
RevLine 
[1]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.
[1553]5
6my @po;
[2240]7foreach (glob('po/*.po')) {
[1553]8    my ($po) = $_ =~  m:([^/\.]+)\.po$:;
9    push (@po, $po);
10}
11
[1]12WriteMakefile(
13    NAME              => 'LATMOS::Accounts',
[989]14    VERSION_FROM      => 'lib/LATMOS/Accounts.pm',
[258]15    PREREQ_PM         => {
16        'Net::LDAP' => undef,
17        'Unicode::Map8' => undef,
18        'DBD::Pg' => undef,
[413]19        'Crypt::RSA' => undef,
20        'MIME::Base64' => undef,
21        'Term::ReadKey' => undef,
[432]22        'Config::IniFiles' => undef,
23        'Mail::Sendmail' => undef,
24        'Net::DNS' => undef,
25        'Template' => undef,
26        'Sys::Syslog' => undef,
[627]27        'Pod::Usage' => undef,
[432]28        'Unicode::String' => undef,
[584]29        'Crypt::Cracklib' => undef,
[2035]30        'Crypt::Blowfish' => undef,
[861]31        'Net::IP' => undef,
[867]32        'Net::IPv4Addr' => undef,
33        'Net::IPv6Addr' => undef,
[1368]34        'DateTime' => undef,
[1376]35        'SOAP::Lite' => undef,
36        'HTTP::Cookies' => undef,
37        'XML::XPath' => undef,
[1604]38        'Crypt::SmbHash' => undef,
[1623]39        'Date::Calc' => undef,
[1653]40        'Spreadsheet::WriteExcel' => undef,
[1989]41        'Text::CSV' => undef,
[2289]42        'DateTime::Format::Pg' => undef,
[2388]43        'Net::IDN::Encode' => undef,
[258]44    }, # e.g., Module::Name => 1.1
[1]45    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
46      (ABSTRACT_FROM  => 'lib/LATMOS/Accounts.pm', # retrieve abstract from module
[254]47       AUTHOR         => 'Thauvin Olivier <olivier.thauvin@latmos.ipsl.fr>') : ()),
[416]48    EXE_FILES => [ qw(
49        bin/la-acls
[640]50        bin/la-qacls
[617]51        bin/la-attributes
[845]52        bin/la-cli
[416]53        bin/la-config
54        bin/la-create
[1005]55        bin/la-sql-crypt-passwd
[531]56        bin/la-delete
[416]57        bin/la-edit
[1323]58        bin/la-sql-find-expired
[416]59        bin/la-group
60        bin/la-guser
61        bin/la-passwd
[1999]62        bin/la-gen-passwd
[416]63        bin/la-query
[715]64        bin/la-rename
[1322]65        bin/la-sql-rename-host
[1006]66        bin/la-sql-exchange-ip
[1322]67        bin/la-sql-exchange-hostname
[1277]68        bin/la-sql-switch-cname
[1007]69        bin/la-sql-rev
[613]70        bin/la-search
[416]71        bin/la-sync
[578]72        bin/la-sync-manager
[1201]73        bin/la-sync-ctl
[416]74        bin/la-warn-expire
[1197]75        bin/la-sql-freeip
[861]76        bin/la-expired-reminder
[881]77        bin/la-sql-upgrade
[1855]78        bin/la-sql-recompute
[959]79        bin/la-sql-edit-form
[1225]80        bin/la-sql-updsshfp
[990]81        bin/la-test-mail
[1280]82        bin/la-sql-log
[1445]83        bin/la-sql-runstat
[1865]84        bin/la-sql-properties
85        bin/la-sql-alias
[1429]86        bin/la-sql-stat2csv
[1653]87        bin/la2xls
[1753]88        bin/la-ban-passwd
[1773]89        bin/la-renewEmp
[1985]90        bin/la-load-csv
[2278]91        bin/la-dump
[2094]92        bin/la-sql-attrvalues
[416]93        ) ],
[861]94        macro => {
95            INSTALLMAN5DIR      => '$(PERLPREFIX)/share/man/man5',
[991]96            INSTALLMAN8DIR      => '$(PERLPREFIX)/share/man/man8',
[861]97            DESTINSTALLMAN5DIR  => '$(DESTDIR)$(INSTALLMAN5DIR)',
[991]98            DESTINSTALLMAN8DIR  => '$(DESTDIR)$(INSTALLMAN8DIR)',
[1546]99            LOCALEDIR           => '/usr/share/locale',
[861]100            INST_MAN5DIR        => 'blib/man5',
[991]101            INST_MAN8DIR        => 'blib/man8',
[881]102            DESTRPMDIR          => '$(shell pwd)',
103            DATADIR             => '/usr/share/latmos-accounts',
104            DESTDATADIR         => '$(DESTDIR)$(DATADIR)',
[1963]105            MAN1PODSBIN         => join(' ', <bin/*>),
[1961]106            MAN5PODS            => join(' ', <man/man5/*.pod>),
107            MAN8PODS            => join(' ', <man/man8/*.pod>),
[861]108        },
109        MAN1PODS        => {
110            map {
111                my $targ = $_;
[1013]112                $targ =~ s{^man/man(\d)}{};
113                my $section = $1 || 1;
[861]114                $targ =~ s{^bin/}{};
[1013]115                $targ =~ s/.pod$//;
[861]116                ( $_ =>
117                    "\$(INST_MAN${section}DIR)/$targ.$section" );
[1013]118            } <man/man?/*.pod>, (grep { ! /~$/ } <bin/*>)
[861]119        },
[1]120);
[416]121
122package MY;
123
124sub postamble {
[1546]125
[1549]126    my $makepo = '';
[1546]127
[1553]128    foreach my $po (@po) {
[1549]129        $makepo .=
130"
[2240]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
[1546]134
[2240]135po/$po/LC_MESSAGES/linkaccounts.mo: po/$po.po
136\tinstall -d po/$po/LC_MESSAGES
[1549]137\tmsgfmt -o \$@ \$<
138\n"
139    }
140
[2240]141    $makepo .= "\n\npo: " . join(' ', map { "po/$_.po" } @po) . "\n";
142    $makepo .= "\n\nmo: " . join(' ', map { "po/$_/LC_MESSAGES/linkaccounts.mo" } @po) . "\n";
[1549]143
[416]144    <<EOF;
[2240]145.PHONY: po/messages.pot
[416]146
[2240]147pot: po/messages.pot
[1546]148
[2240]149po/messages.pot:
150\tcat MANIFEST | egrep '^(lib|bin)' | xargs xgettext.pl -o po/messages.pot
[1546]151
152$makepo
153
[416]154svnmanifest:
155\tsvn ls -R| grep -v "/\$\$"  > MANIFEST
156
[432]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`" \\
[861]168\t --define "_srcrpmdir \$(DESTRPMDIR)" \\
169\t --define "_rpmdir \$(DESTRPMDIR)" \\
[432]170\t latmos-accounts.spec
171
[861]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
[1963]182podhtml: \$(MAN5PODS) \$(MAN8PODS) \$(MAN3PODS) \$(MAN1PODSBIN)
[1009]183\tmkdir html || :
[1961]184\trm -fr html/*
[1963]185\tperl scripts/pod2xhtml.pl man1 \$(MAN1PODSBIN)
[1961]186\tperl scripts/pod2xhtml.pl man3 \$(MAN3PODS)
187\tperl scripts/pod2xhtml.pl man5 \$(MAN5PODS)
188\tperl scripts/pod2xhtml.pl man8 \$(MAN8PODS)
[1009]189
[416]190EOF
191}
[548]192
[861]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
[991]198    $inherited .= $self->dir_target("\$(INST_$_)") for qw(MAN5DIR MAN8DIR);
[861]199    $inherited;
200}
201
202sub top_targets {
203    my $inherited = shift->SUPER::top_targets(@_);
[991]204    $inherited =~ s/^config ::/$& \$(INST_MAN5DIR)\$(DIRFILESEP).exists \$(INST_MAN8DIR)\$(DIRFILESEP).exists/m;
[861]205    $inherited;
206}
207
[548]208sub install {
209    my ($self) = @_;
210    my $section = $self->SUPER::install();
211
[2472]212    $section =~ s/(^install ::.*)/$1 install_config install_templates install_data install_mo pure_man_install/m;
[991]213    $section =~ s/\$\(INST_BIN\) \$\(DESTINSTALL(\w*)BIN\)/$& \$(INST_MAN5DIR) \$(DESTINSTALLMAN5DIR) \$(INST_MAN8DIR) \$(DESTINSTALLMAN8DIR)/g;
[548]214
[705]215    $section .= q[
[2472]216pure_man_install :: all
217        $(NOECHO) $(MOD_INSTALL) \
218                "$(INST_MAN5DIR)" "$(DESTINSTALLMAN5DIR)" \
219                "$(INST_MAN8DIR)" "$(DESTINSTALLMAN8DIR)" \
220
[548]221install_config ::
222        install -d $(DESTDIR)/etc
[861]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
[2437]228        install sample/la-acls.ini $(DESTDIR)/etc/latmos-accounts/la-acls.ini
[705]229
230install_templates ::
[881]231        install -d $(DESTDIR)$(DATADIR)/templates
[705]232        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ templates => @ARGV })' \\
[881]233                $(DESTDIR)$(DATADIR)/templates
234
235install_data ::
236        install -d $(DESTDIR)$(DATADIR)
237        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ sqldata => @ARGV })' \\
238            $(DESTDIR)$(DATADIR)
[1546]239
[1549]240install_mo: mo
241        install -d $(DESTDIR)$(LOCALEDIR)
[705]242];
[1553]243
244    foreach (@po) {
[1554]245        $section .= "\tinstall -d \$(DESTDIR)\$(LOCALEDIR)/$_/LC_MESSAGES\n";
[2240]246        $section .= "\tinstall po/$_/LC_MESSAGES/linkaccounts.mo \$(DESTDIR)\$(LOCALEDIR)/$_/LC_MESSAGES/linkaccounts.mo\n";
[1553]247    }
248    $section .= "\n";
[548]249 
250    return $section;
251}
[1027]252
253sub test {
254    my $inherited = shift->SUPER::test(@_);
255
[1030]256    $inherited =~ s:^(test_dynamic .*):$1 test_scripts:m;
257
[1027]258    $inherited .= <<EOF;
259
260TESTLIVE_FILES = live-test/*.t
[1030]261TESTSCRIPTS_FILE = t/scripts.pl
[1027]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
[1030]266test_scripts :: pure_all
267\tPERL_DL_NONLAZY=1 \$(FULLPERLRUN) "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" \$(TESTSCRIPTS_FILE) \$(EXE_FILES)
[1027]268EOF
269    return $inherited;
270}
Note: See TracBrowser for help on using the repository browser.