9 die "error: Missing Module::Build module, cannot proceed.\n";
12 if (-e
'Build.PL.in') {
13 die "error: This is an in-tree build, not a proper perl distribution.\n" .
14 "To create one please configure normally and then run 'make dist'.\n";
17 my $class = Module
::Build
->subclass(
18 class => 'Module::Build::Dpkg',
26 foreach my $cmd (@alts) {
27 my $pathname = IPC::Cmd::can_run($cmd);
28 return $pathname if defined $pathname;
30 die "error: cannot find any of @alts\n";
34 my ($self, $file) = @_;
35 my $path = $self->install_path();
36 my $version = $self->dist_version();
38 my $progmake = find_command(qw(gmake make));
39 my $progpatch = find_command
(qw(gpatch patch));
40 my $progtar = find_command
(qw(gtar tar));
43 or die "error: cannot remove blib/$file: $!\n";
44 open my $fhin, '<', $file
45 or die "error: cannot open $file: $!\n";
46 open my $fhout, '>', "blib/$file"
47 or die "error: cannot create blib/$file: $!\n";
49 s{our \$PROGVERSION = .*;}{our \$PROGVERSION = '$version';};
50 s{our \$PROGMAKE = .*;}{our \$PROGMAKE = '$progmake';};
51 s{our \$PROGPATCH = .*;}{our \$PROGPATCH = '$progpatch';};
52 s{our \$PROGTAR = .*;}{our \$PROGTAR = '$progtar';};
53 s{our \$CONFDIR = .*;}{our \$CONFDIR = '$path->{conf}';};
54 s{our \$DATADIR = .*;}{our \$DATADIR = '$path->{data}';};
55 s{our \$ADMINDIR = .*;}{our \$ADMINDIR = '$path->{admin}';};
56 s{our \$LIBDIR = .*;}{our \$LIBDIR = '$path->{libexec}';};
59 close $fhout or die "error: cannot write blib/$file: $!\n";
66 $self->SUPER::ACTION_build
;
67 $self->subst('lib/Dpkg.pm');
72 local $ENV{LC_ALL
} = 'C';
73 local $ENV{PERL
} = $Config::Config
{perlpath
} || $^X
|| 'perl';
74 local $ENV{DPKG_TEST_MODE
} = 'cpan';
75 local $ENV{DPKG_DATADIR
} = 'data';
76 local $ENV{DPKG_ORIGINS_DIR
} = 't/origins';
77 # To avoid requiring dpkg(1).
78 local $ENV{DEB_BUILD_ARCH
} = 'amd64';
79 $self->SUPER::ACTION_test
;
84 my $build = $class->new(
85 dist_name
=> '@PACKAGE_CPAN_NAME@',
86 dist_abstract
=> 'Debian Package Manager Perl modules',
87 dist_version
=> '@PACKAGE_VERSION@',
88 dist_author
=> '@PACKAGE_COPYRIGHT_HOLDER@ <@PACKAGE_BUGREPORT@>',
91 release_status
=> @PACKAGE_DIST_IS_RELEASE@ ?
'stable' : 'testing',
93 # Set only to avoid warnings.
94 module_name
=> '@PACKAGE_CPAN_NAME@',
103 'Module::Signature' => 0,
114 'Test::MinimumVersion' => 0,
115 'Test::Perl::Critic' => 0,
116 'Test::Pod::Coverage' => 0,
117 'Test::Spelling' => 0,
118 'Test::Synopsis' => 0,
123 homepage
=> '@PACKAGE_URL@',
125 type
=> '@PACKAGE_VCS_TYPE@',
126 url
=> '@PACKAGE_VCS_URL@',
127 web
=> '@PACKAGE_VCS_WEB@',
130 web
=> '@PACKAGE_BUG_WEB@',
133 keywords
=> [ qw(dpkg debian perl) ],
136 sign
=> @PACKAGE_DIST_IS_RELEASE@
,
139 configure_requires
=> {
140 'Module::Build' => '0.4004',
147 'Algorithm::Merge' => 0,
148 'File::FcntlLock' => 0,
149 'Locale::gettext' => 0,
153 'perl' => '@PERL_MIN_VERSION@',
157 map { $_ => $_ } glob 'data/*'
161 data
=> '/usr/share/dpkg',
162 admin
=> '/var/lib/dpkg',
163 libexec
=> '/usr/lib/dpkg',
167 $build->add_build_element('data');
168 $build->create_build_script();