mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
xml_sax: new perl module recipe
This includes a patch to install the ParserDetails.ini configuration file into site_perl (i.e. the non-packaged hierarchy) instead of vendor_perl because it should be editable by other perl module packages that provide an XML SAX parser (whether installed as HPKG or manually). The config file is created and modified using post-install and pre-uninstall scripts.
This commit is contained in:
5
dev-perl/xml_sax/additional-files/install_xml_sax_pureperl.pl
Executable file
5
dev-perl/xml_sax/additional-files/install_xml_sax_pureperl.pl
Executable file
@@ -0,0 +1,5 @@
|
||||
#!perl
|
||||
|
||||
use XML::SAX;
|
||||
|
||||
XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers();
|
||||
5
dev-perl/xml_sax/additional-files/uninstall_xml_sax_pureperl.pl
Executable file
5
dev-perl/xml_sax/additional-files/uninstall_xml_sax_pureperl.pl
Executable file
@@ -0,0 +1,5 @@
|
||||
#!perl
|
||||
|
||||
use XML::SAX;
|
||||
|
||||
XML::SAX->remove_parser(q(XML::SAX::PurePerl))->save_parsers();
|
||||
49
dev-perl/xml_sax/patches/xml_sax-1.02.patchset
Normal file
49
dev-perl/xml_sax/patches/xml_sax-1.02.patchset
Normal file
@@ -0,0 +1,49 @@
|
||||
From bb777002f24040802543de8e9ae6716365c04898 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
|
||||
Date: Sun, 8 Dec 2024 21:52:07 +0100
|
||||
Subject: put ParserDetails.ini into site_perl in non-packaged
|
||||
|
||||
|
||||
diff --git a/lib/XML/SAX.pm b/lib/XML/SAX.pm
|
||||
index 7cd93d2..b04b3e8 100644
|
||||
--- a/lib/XML/SAX.pm
|
||||
+++ b/lib/XML/SAX.pm
|
||||
@@ -12,7 +12,9 @@ use Exporter ();
|
||||
|
||||
@EXPORT_OK = qw(Namespaces Validation);
|
||||
|
||||
+use Config;
|
||||
use File::Basename qw(dirname);
|
||||
+use File::Path qw(make_path);
|
||||
use File::Spec ();
|
||||
use Symbol qw(gensym);
|
||||
use XML::SAX::ParserFactory (); # loaded for simplicity
|
||||
@@ -53,8 +55,8 @@ sub load_parsers {
|
||||
|
||||
# get directory from wherever XML::SAX is installed
|
||||
if (!$dir) {
|
||||
- $dir = $INC{'XML/SAX.pm'};
|
||||
- $dir = dirname($dir);
|
||||
+ $dir = $Config{'sitelib'};
|
||||
+ $dir = File::Spec->catdir($dir, "XML");
|
||||
}
|
||||
|
||||
my $fh = gensym();
|
||||
@@ -180,10 +182,11 @@ sub save_parsers {
|
||||
my $class = shift;
|
||||
|
||||
# get directory from wherever XML::SAX is installed
|
||||
- my $dir = $INC{'XML/SAX.pm'};
|
||||
- $dir = dirname($dir);
|
||||
+ my $dir = $Config{'sitelib'};
|
||||
+ $dir = File::Spec->catdir($dir, "XML", "SAX");
|
||||
+ make_path($dir);
|
||||
|
||||
- my $file = File::Spec->catfile($dir, "SAX", PARSER_DETAILS);
|
||||
+ my $file = File::Spec->catfile($dir, PARSER_DETAILS);
|
||||
chmod 0644, $file;
|
||||
unlink($file);
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
||||
73
dev-perl/xml_sax/xml_sax-1.02.recipe
Normal file
73
dev-perl/xml_sax/xml_sax-1.02.recipe
Normal file
@@ -0,0 +1,73 @@
|
||||
SUMMARY="Simple API for XML"
|
||||
DESCRIPTION="XML::SAX is a SAX parser access API for Perl. It includes classes and APIs required \
|
||||
for implementing SAX drivers, along with a factory class for returning any SAX parser installed \
|
||||
on the user's system."
|
||||
HOMEPAGE="https://metacpan.org/pod/XML::SAX::Base"
|
||||
COPYRIGHT="Grant McLean"
|
||||
LICENSE="Artistic"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://cpan.metacpan.org/authors/id/G/GR/GRANTM/XML-SAX-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="4506c387043aa6a77b455f00f57409f3720aa7e553495ab2535263b4ed1ea12a"
|
||||
SOURCE_DIR="XML-SAX-$portVersion"
|
||||
PATCHES="xml_sax-$portVersion.patchset"
|
||||
ADDITIONAL_FILES="
|
||||
install_xml_sax_pureperl.pl
|
||||
uninstall_xml_sax_pureperl.pl
|
||||
"
|
||||
|
||||
ARCHITECTURES="any"
|
||||
|
||||
POST_INSTALL_SCRIPTS="$relativePostInstallDir/install_xml_sax_pureperl.pl"
|
||||
PRE_UNINSTALL_SCRIPTS="$relativePreUninstallDir/uninstall_xml_sax_pureperl.pl"
|
||||
|
||||
PROVIDES="
|
||||
xml_sax = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
vendor_perl
|
||||
xml_namespacesupport
|
||||
xml_sax_base
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:make
|
||||
cmd:perl
|
||||
"
|
||||
|
||||
TEST_REQUIRES="
|
||||
xml_namespacesupport
|
||||
xml_sax_base
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
perl Makefile.PL PREFIX=$prefix
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make pure_install
|
||||
|
||||
# remove architecture-specific files
|
||||
cd $prefix
|
||||
rm -r $(perl -V:vendorarch | cut -d\' -f2 | cut -d/ -f5-)
|
||||
# cut extracts the quoted string and strips the prefix (which is perl's and not ours)
|
||||
|
||||
mkdir -p $postInstallDir $preUninstallDir
|
||||
cp $portDir/additional-files/install_xml_sax_pureperl.pl $postInstallDir
|
||||
cp $portDir/additional-files/uninstall_xml_sax_pureperl.pl $preUninstallDir
|
||||
}
|
||||
|
||||
TEST()
|
||||
{
|
||||
# The patch to install the configuration into site_perl in non-packaged causes two tests to
|
||||
# fail because it can't create the configuration directory and save a configuration there.
|
||||
# The path uses perl Config and therefore perl's prefix which is read-only and non-packaged
|
||||
# doesn't exist inside the haikuporter chroot.
|
||||
make test
|
||||
}
|
||||
Reference in New Issue
Block a user