apkbuild-cpan: remove prepare function from APKBUILD

the generation of Makefile is comparable with running configure, which
we normally do in the build() function, not in prepare.

also fix some whitespace damamge.
This commit is contained in:
Natanael Copa 2019-03-21 11:25:52 +01:00
parent ede4203749
commit 122bcd7cb2
1 changed files with 6 additions and 36 deletions

View File

@ -44,26 +44,15 @@ subpackages="$pkgname-doc"
source="[% source %]"
builddir="$srcdir/$_pkgreal-$pkgver"
prepare() {
default_prepare
cd "$builddir"
if [ -e Build.PL ]; then
perl Build.PL installdirs=vendor
else
PERL_MM_USE_DEFAULT=1 perl -I. Makefile.PL INSTALLDIRS=vendor
fi
}
build() {
:
}
package() {
check() {
:
}
check() {
package() {
:
}
@ -116,8 +105,8 @@ sub write_apkbuild {
my %repl = (
authors => ($authors or "# Contributor: $packager\n# Maintainer: $packager"),
pkgname => map_cpan_to_apk($moddata->{distribution}),
pkgreal => $moddata->{distribution},
pkgver => $moddata->{version},
pkgreal => $moddata->{distribution},
pkgver => $moddata->{version},
source => $moddata->{download_url},
);
$template =~ s/\[% (.*?) %\]/$repl{$1}/g;
@ -174,26 +163,17 @@ sub prepare_tree {
sub update_functions {
my $apkbuild = read_apkbuild;
my $metaprefix = "src/" . $apkbuild->{'_pkgreal'} . "-" . $apkbuild->{'pkgver'} . "/";
my $prepare_func;
my $build_func;
my $check_func;
my $package_func;
my $text = read_file "APKBUILD";
if (-e "$metaprefix/Build.PL" ) {
$prepare_func = <<'EOF';
prepare() {
default_prepare
cd "$builddir"
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
perl Build.PL installdirs=vendor
}
EOF
$build_func = <<'EOF';
build() {
cd "$builddir"
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
perl Build.PL installdirs=vendor
./Build
}
EOF
@ -211,19 +191,11 @@ check() {
}
EOF
} else {
$prepare_func = <<'EOF';
prepare() {
default_prepare
cd "$builddir"
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
PERL_MM_USE_DEFAULT=1 perl -I. Makefile.PL INSTALLDIRS=vendor
}
EOF
$build_func = <<'EOF';
build() {
cd "$builddir"
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
PERL_MM_USE_DEFAULT=1 perl -I. Makefile.PL INSTALLDIRS=vendor
make
}
EOF
@ -243,8 +215,6 @@ check() {
EOF
}
$text =~ s/^prepare\(\) \{.*?^\}\n/$prepare_func/smg or
die "Can't replace prepare function APKBUILD";
$text =~ s/^build\(\) \{.*?^\}\n/$build_func/smg or
die "Can't replace build function APKBUILD";
$text =~ s/^package\(\) \{.*?^\}\n/$package_func/smg or