module_build: add support for HAIKU_USE_VENDOR_DIRECTORIES

So that recipes using Module::Build don't need to specify that in their
recipes. Ironically, Module::Build itself doesn't profit from that, because its
build script overrides the default, so we have to set it on the command line
still (or alternatively patch the build file).

Also, unset the variable for tests, otherwise a test would have to be patched
too.
This commit is contained in:
Joachim Mairböck
2025-02-09 15:39:17 +01:00
parent 2e7fa6c7bc
commit 133a0bbf5f
2 changed files with 31 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ very cross-platform way."
HOMEPAGE="https://metacpan.org/pod/distribution/Module-Build/lib/Module/Build.pm"
COPYRIGHT="2001-2006 Ken Williams"
LICENSE="Artistic"
REVISION="3"
REVISION="4"
SOURCE_URI="https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-$portVersion.tar.gz"
CHECKSUM_SHA256="66aeac6127418be5e471ead3744648c766bd01482825c5b66652675f2bc86a8f"
SOURCE_DIR="Module-Build-$portVersion"
@@ -34,6 +34,8 @@ BUILD_PREREQUIRES="
BUILD()
{
# We do patch Module::Build to install into vendor directories by default in HaikuPorter, but
# this Build.PL script overrides it for historical reasons, so specify it manually still.
perl Build.PL --installdirs vendor --prefix $prefix
./Build
}
@@ -50,5 +52,8 @@ INSTALL()
TEST()
{
unset HAIKU_USE_VENDOR_DIRECTORIES
# tests assume installation in site directories by default
./Build test
}

View File

@@ -1,4 +1,4 @@
From b397d50d5f0b67cf25d555a9407963ee04173322 Mon Sep 17 00:00:00 2001
From 18db2ea3c12b6fa184a6f21a2cd41fff85ff07cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Sun, 4 Aug 2024 21:07:10 +0200
Subject: hack to support naked 'perl' as the perl interpreter path
@@ -34,7 +34,7 @@ index 10b653f..0ee2515 100644
2.45.2
From 0b4e07616333ae4643d1a93606c2b201687a0845 Mon Sep 17 00:00:00 2001
From a5bd63049b78b8f596b4a35825b5a92846c0c583 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Sun, 5 Jan 2025 14:45:19 +0100
Subject: fix tests
@@ -57,3 +57,26 @@ index 2aeda20..3620523 100644
--
2.45.2
From 8cc76665e751cdc799b6be2d67f264e3fda9b391 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Sun, 9 Feb 2025 15:35:30 +0100
Subject: Add support for HAIKU_USE_VENDOR_DIRECTORIES
diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm
index 0ee2515..170137d 100644
--- a/lib/Module/Build/Base.pm
+++ b/lib/Module/Build/Base.pm
@@ -917,7 +917,7 @@ __PACKAGE__->add_property(pureperl_only => 0);
__PACKAGE__->add_property(allow_pureperl => 0);
__PACKAGE__->add_property(
'installdirs',
- default => 'site',
+ default => $ENV{'HAIKU_USE_VENDOR_DIRECTORIES'} ? 'vendor' : 'site',
check => sub {
return 1 if /^(core|site|vendor)$/;
return shift->property_error(
--
2.45.2