source: trunk/LATMOS-Accounts/Makefile.PL

Last change on this file was 2602, checked in by nanardon, 2 months ago

Return something when object got deleted

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