diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:45:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:45:20 +0000 |
commit | 9a08cbfcc1ef900a04580f35afe2a4592d7d6030 (patch) | |
tree | 004cc7027bca2f2c0bcb5806527c8e0c48df2d6e /scripts/Build.PL.in | |
parent | Initial commit. (diff) | |
download | dpkg-upstream/1.19.8.tar.xz dpkg-upstream/1.19.8.zip |
Adding upstream version 1.19.8.upstream/1.19.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | scripts/Build.PL.in | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/scripts/Build.PL.in b/scripts/Build.PL.in new file mode 100644 index 0000000..b8f62d2 --- /dev/null +++ b/scripts/Build.PL.in @@ -0,0 +1,143 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +eval { + require Module::Build; +} or do { + die "error: Missing Module::Build module, cannot proceed.\n"; +}; + +if (-e 'Build.PL.in') { + die "error: This is an in-tree build, not a proper perl distribution.\n" . + "To create one please configure normally and then run 'make dist'.\n"; +} + +my $class = Module::Build->subclass( + class => 'Module::Build::Dpkg', + code => q{ + sub subst { + my ($self, $file) = @_; + my $path = $self->install_path(); + my $version = $self->dist_version(); + + unlink "blib/$file" + or die "error: cannot remove blib/$file: $!\n"; + open my $fhin, '<', $file + or die "error: cannot open $file: $!\n"; + open my $fhout, '>', "blib/$file" + or die "error: cannot create blib/$file: $!\n"; + while (<$fhin>) { + s{our \$PROGVERSION = .*;}{our \$PROGVERSION = '$version';}; + s{our \$CONFDIR = .*;}{our \$CONFDIR = '$path->{conf}';}; + s{our \$DATADIR = .*;}{our \$DATADIR = '$path->{data}';}; + s{our \$ADMINDIR = .*;}{our \$ADMINDIR = '$path->{admin}';}; + s{our \$LIBDIR = .*;}{our \$LIBDIR = '$path->{libexec}';}; + print { $fhout } $_; + } + close $fhout or die "error: cannot write blib/$file: $!\n"; + close $fhin; + } + + sub ACTION_build { + my $self = shift; + + $self->SUPER::ACTION_build; + $self->subst('lib/Dpkg.pm'); + } + sub ACTION_test { + my $self = shift; + + local $ENV{LANG} = 'C'; + local $ENV{LC_ALL} = 'C'; + local $ENV{DPKG_TEST_MODE} = 'cpan'; + local $ENV{DPKG_DATADIR} = 'data'; + local $ENV{DPKG_ORIGINS_DIR} = 't/origins'; + $self->SUPER::ACTION_test; + } + }, +); + +my $build = $class->new( + dist_name => '@PACKAGE_CPAN_NAME@', + dist_abstract => 'Debian Package Manager Perl modules', + dist_version => '@PACKAGE_VERSION@', + dist_author => '@PACKAGE_COPYRIGHT_HOLDER@ <@PACKAGE_BUGREPORT@>', + license => 'GPL_2', + + release_status => @PACKAGE_DIST_IS_RELEASE@ ? 'stable' : 'testing', + + # Set only to avoid warnings. + module_name => '@PACKAGE_CPAN_NAME@', + + meta_merge => { + 'meta-spec' => { + version => 2, + }, + prereqs => { + test => { + recommends => { + 'Test::Pod' => 0, + 'Test::Strict' => 0, + }, + }, + develop => { + recommends => { + 'Test::MinimumVersion' => 0, + 'Test::Perl::Critic' => 0, + 'Test::Pod::Coverage' => 0, + 'Test::Spelling' => 0, + 'Test::Synopsis' => 0, + }, + }, + }, + resources => { + homepage => '@PACKAGE_URL@', + repository => { + type => '@PACKAGE_VCS_TYPE@', + url => '@PACKAGE_VCS_URL@', + web => '@PACKAGE_VCS_WEB@', + }, + bugtracker => { + web => '@PACKAGE_BUG_WEB@', + }, + }, + keywords => [ qw(dpkg debian perl) ], + }, + + sign => @PACKAGE_DIST_IS_RELEASE@, + dynamic_config => 0, + + configure_requires => { + 'Module::Build' => '0.4004', + }, + test_requires => { + 'TAP::Harness' => 0, + 'Test::More' => 0, + }, + recommends => { + 'Algorithm::Merge' => 0, + 'File::FcntlLock' => 0, + 'Locale::gettext' => 0, + + }, + requires => { + 'perl' => '@PERL_MIN_VERSION@', + }, + + data_files => { + map { $_ => $_ } glob 'data/*' + }, + install_path => { + conf => '/etc/dpkg', + data => '/usr/share/dpkg', + admin => '/var/lib/dpkg', + libexec => '/usr/lib/dpkg', + }, +); + +$build->add_build_element('data'); +$build->create_build_script(); + +1; |