/[soft]/rpm/urpmi/branches/1/Makefile.PL
ViewVC logotype

Contents of /rpm/urpmi/branches/1/Makefile.PL

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3132 - (show annotations) (download)
Wed Feb 29 23:59:36 2012 UTC (8 years, 4 months ago) by tv
File MIME type: text/plain
File size: 5288 byte(s)
branch

1 #!perl
2 # Makefile.PL for urpmi
3 # $Id: Makefile.PL 271298 2010-11-21 15:39:18Z peroyvind $
4
5 use strict;
6 use ExtUtils::MakeMaker;
7
8 # Command-line parsing.
9 # --without-rpm : don't use rpm to find some paths, and generate make targets
10 # to produce an rpm of this
11 # --install-po : compile .po files and install locale files
12 # also, install localized man pages
13 # --install-gui : install gurpmi
14 my $with_rpm = 1; $with_rpm = 0 if grep $_ eq '--without-rpm', @ARGV;
15 my $with_po = 0; $with_po = 1 if grep $_ eq '--install-po', @ARGV;
16 my $with_gui = 0; $with_gui = 1 if grep $_ eq '--install-gui', @ARGV;
17
18 # All scripts, some of them go in /usr/sbin (see DESTINSTALLSBIN below)
19 our @bin_scripts = qw(urpmq urpmf rpm-find-leaves urpmi.recover);
20 our @sbin_scripts = qw(urpmi urpme urpmi.addmedia urpmi.update urpmi.removemedia rurpmi rurpme);
21 if ($with_gui) {
22 push @bin_scripts, qw(gurpmi);
23 push @sbin_scripts, qw(gurpmi2);
24 }
25
26 # And now, add some functionality to MakeMaker.
27 package MY;
28
29 # Don't install gurpmi.pm if we don't install gui
30 sub libscan {
31 my ($self, $path) = @_;
32 if (!$with_gui && $path =~ /gurpmi/) { return '' }
33 return $path;
34 }
35
36 # Make proper sbin/man5/man8 dirs in blib
37 sub top_targets {
38 my $inherited = shift->SUPER::top_targets(@_);
39 $inherited =~ s/^config ::/$& \$(INST_MAN5DIR)\$(DIRFILESEP).exists \$(INST_MAN8DIR)\$(DIRFILESEP).exists \$(INST_SBIN)\$(DIRFILESEP).exists/m;
40 $inherited;
41 }
42
43 # Install sbin_scripts in sbin under blib
44 sub installbin {
45 my $self = shift;
46 my $inherited = $self->SUPER::installbin(@_);
47 my $s = join '|', map quotemeta, @sbin_scripts;
48 $inherited =~ s{\$\(INST_SCRIPT\)/($s)}{\$(INST_SBIN)/$1}g;
49 # how to create needed directories under blib
50 $inherited .= $self->dir_target("\$(INST_$_)") for qw(SBIN MAN5DIR MAN8DIR);
51 $inherited;
52 }
53
54 sub install {
55 my $inherited = shift->SUPER::install(@_);
56 # Take into account scripts in sbin under blib
57 # and new manpage sections
58 $inherited =~ s/\$\(INST_BIN\) \$\(DESTINSTALL(\w*)BIN\)/$& \$(INST_SBIN) \$(DESTINSTALL$1SBIN) \$(INST_MAN5DIR) \$(DESTINSTALLMAN5DIR) \$(INST_MAN8DIR) \$(DESTINSTALLMAN8DIR)/g;
59 # install files under /etc and /var
60 my $po = $with_po ? ' installpo' : '';
61 my $gui = $with_gui ? ' installgurpmi2' : '';
62 $inherited =~ s/^install ::/$& installconfigfiles installstatedir$po$gui/gm;
63 $inherited;
64 }
65
66 # Due to some hateful layout (that I can't change because the whole stuff is
67 # hosted in CVS (double hate)) I need to add pm_to_blib in the phonic targets.
68 sub special_targets {
69 my $inherited = shift->SUPER::special_targets(@_);
70 $inherited =~ s/PHONY:/$& pm_to_blib/;
71 $inherited;
72 }
73
74 sub manifypods {
75 my $inherited = shift->SUPER::manifypods(@_);
76 #- TODO repartition of man pages in sections by pod2man is incorrect
77 #- TODO as more languages are added adapt the following quick hack
78 $inherited;
79 }
80
81 # to generate the ChangeLog depending on the checkout layout
82 my $commonusername = "../common/";
83 -d $commonusername or do {
84 $commonusername = "../../common/";
85 -d $commonusername or do {
86 $commonusername = "../../../common/";
87 -d $commonusername or $commonusername = "";
88 };
89 };
90
91 # Additional targets
92 sub postamble {
93 <<"**MM**";
94 .PHONY: installconfigfiles installstatedir ChangeLog TAGS
95
96 installpo:
97 \$(MAKE) -C po install
98
99 installconfigfiles:
100 install -d \$(SYSCONFDIR)/urpmi
101 install -m 644 inst.list skip.list \$(SYSCONFDIR)/urpmi
102
103 installstatedir:
104 install -d \$(LOCALSTATEDIR)/urpmi
105 install -d \$(DESTDIR)/var/cache/urpmi/partial
106 install -d \$(DESTDIR)/var/cache/urpmi/headers
107 install -d \$(DESTDIR)/var/cache/urpmi/rpms
108
109 installgurpmi2: pure_install gurpmi.desktop
110 ln -s -f consolehelper \$(DESTINSTALLSCRIPT)/gurpmi2
111
112 ChangeLog:
113 svn2cl --accum --authors ${commonusername}username.xml
114 rm -f *.bak
115
116 TAGS:
117 etags *.pm */*.pm
118
119 testall:
120 make test
121 sudo make test TEST_FILES='t/superuser--*.t'
122
123 %.desktop: %.desktop.in
124 intltool-merge --utf8 po \$< \$@ -d -u -c intltool-merge-cache
125
126
127 **MM**
128 }
129
130 # Back to our schedule
131 package main;
132
133 WriteMakefile(
134 NAME => 'urpmi',
135 PREREQ_PM => {
136 'Locale::gettext' => '1.01',
137 'MDV::Packdrakeng' => '1.01',
138 'URPM' => '1.48',
139 },
140 VERSION_FROM => 'urpm.pm',
141 macro => {
142 DESTINSTALLSBIN => '$(DESTINSTALLBIN)/../sbin',
143 DESTINSTALLSITESBIN => '$(DESTINSTALLSITEBIN)/../sbin',
144 DESTINSTALLVENDORSBIN => '$(DESTINSTALLVENDORBIN)/../sbin',
145 INSTALLMAN5DIR => '$(PERLPREFIX)/share/man/man5',
146 DESTINSTALLMAN5DIR => '$(DESTDIR)$(INSTALLMAN5DIR)',
147 INSTALLMAN8DIR => '$(PERLPREFIX)/share/man/man8',
148 DESTINSTALLMAN8DIR => '$(DESTDIR)$(INSTALLMAN8DIR)',
149 INST_SBIN => 'blib/sbin',
150 INST_MAN5DIR => 'blib/man5',
151 INST_MAN8DIR => 'blib/man8',
152 # We could read those values from rpm macros.
153 SYSCONFDIR => '$(DESTDIR)/etc',
154 LOCALSTATEDIR => '$(DESTDIR)/var/lib',
155 },
156 EXE_FILES => [ @bin_scripts, @sbin_scripts ],
157 PMLIBDIRS => [ qw(urpm) ],
158 $with_po ? (DIR => [ 'po' ]) : (),
159 MAN1PODS => {
160 map {
161 my $targ = $_;
162 $targ =~ s{^pod/}{};
163 $targ =~ s/\.(\d)\.pod$//;
164 my $section = $1 || 1;
165 ( $_ => "\$(INST_MAN${section}DIR)/$targ.$section" );
166 } <pod/*.pod>, $with_po ? <pod/*/*.pod> : ()
167 },
168 dist => { COMPRESS => "xz -f", SUFFIX => ".xz" },
169 );

  ViewVC Help
Powered by ViewVC 1.1.28