lwp_mediatypes: new perl module recipe

This commit is contained in:
Joachim Mairböck
2025-01-25 16:13:45 +01:00
parent 7743d664e9
commit 8091ed4b90
2 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
SUMMARY="Guess media type for a file or a URL"
DESCRIPTION="This module provides functions for handling media (also known as MIME) types and \
encodings. The mapping from file extensions to media types is defined by the media.types file. If \
the ~/config/settings/media.types file exists it is used instead. For backwards compatibility we \
will also look for ~/config/settings/mime.types."
HOMEPAGE="https://metacpan.org/pod/LWP::MediaTypes"
COPYRIGHT="1995-1999 Gisle Aas"
LICENSE="Artistic"
REVISION="1"
SOURCE_URI="https://cpan.metacpan.org/authors/id/O/OA/OALDERS/LWP-MediaTypes-$portVersion.tar.gz"
CHECKSUM_SHA256="8f1bca12dab16a1c2a7c03a49c5e58cce41a6fec9519f0aadfba8dad997919d9"
SOURCE_DIR="LWP-MediaTypes-$portVersion"
PATCHES="lwp_mediatypes-$portVersion.patchset"
ARCHITECTURES="any"
PROVIDES="
lwp_mediatypes = $portVersion
"
REQUIRES="
haiku
vendor_perl
"
BUILD_REQUIRES="
haiku_devel
"
BUILD_PREREQUIRES="
cmd:make
cmd:perl
"
TEST_REQUIRES="
test_fatal
"
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)
}
TEST()
{
make test
}

View File

@@ -0,0 +1,22 @@
From e36031deb79133525f4d487f64f20010fdcfe482 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Sat, 25 Jan 2025 16:00:56 +0100
Subject: use config/settings directory for user files
diff --git a/lib/LWP/MediaTypes.pm b/lib/LWP/MediaTypes.pm
index 22d00e3..fd178da 100644
--- a/lib/LWP/MediaTypes.pm
+++ b/lib/LWP/MediaTypes.pm
@@ -170,7 +170,7 @@ sub read_media_types
local($/, $_) = ("\n", undef); # ensure correct $INPUT_RECORD_SEPARATOR
my @priv_files = ();
- push(@priv_files, "$ENV{HOME}/.media.types", "$ENV{HOME}/.mime.types")
+ push(@priv_files, "$ENV{HOME}/config/settings/media.types", "$ENV{HOME}/config/settings/mime.types")
if defined $ENV{HOME}; # Some doesn't have a home (for instance Win32)
# Try to locate "media.types" file, and initialize %suffixType from it
--
2.45.2