Ports: Add perl5

This commit is contained in:
Beckett Normington 2023-07-28 13:24:21 -04:00 committed by Andrew Kaster
parent c5b8903761
commit 8ee71a9920
8 changed files with 230 additions and 0 deletions

View file

@ -224,6 +224,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`patch`](patch/) | patch (GNU) | 2.7.6 | https://savannah.gnu.org/projects/patch/ |
| [`pcre`](pcre/) | Perl-compatible Regular Expressions (PCRE) | 8.45 | https://www.pcre.org/ |
| [`pcre2`](pcre2/) | Perl-compatible Regular Expressions (PCRE2) | 10.40 | https://www.pcre.org/ |
| [`perl5`](perl5/) | Perl | 5.38.0 | https://www.perl.org/ |
| [`pfetch`](pfetch/) | pfetch | a906ff8 | https://github.com/dylanaraps/pfetch/ |
| [`php`](php/) | PHP | 8.1.12 | https://www.php.net/ |
| [`pixman`](pixman/) | pixman | 0.40.0 | http://pixman.org |

37
Ports/perl5/package.sh Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env -S bash ../.port_include.sh
port='perl5'
version='5.38.0'
useconfigure='true'
files="https://www.cpan.org/src/5.0/perl-${version}.tar.xz perl5-${version}.tar.xz eca551caec3bc549a4e590c0015003790bdd1a604ffe19cc78ee631d51f7072e
https://github.com/arsv/perl-cross/releases/download/1.5/perl-cross-1.5.tar.gz perl-cross.1.5.tar.gz d744a390939e2ebb9a12f6725b4d9c19255a141d90031eff90ea183fdfcbf211"
configopts=(
'-Dosname=serenity'
"--target=${SERENITY_ARCH}-pc-serenity"
"--targetarch=${SERENITY_ARCH}"
"--build=$(cc -dumpmachine)"
"--buildarch=$(uname -m)"
'--prefix=/usr/local'
"--sysroot="${SERENITY_INSTALL_ROOT}""
)
workdir="perl-${version}"
if [ "$(uname -s)" = 'Darwin' ]; then
makeopts+=('--ignore-errors')
# Make sure you have binutils and gnu-sed installed via homebrew
PATH="$(brew --prefix binutils)/bin:${PATH}"
PATH="$(brew --prefix gnu-sed)/libexec/gnubin:${PATH}"
export PATH="${SERENITY_BUILD_DIR}/Ports/${port}/${workdir}:${PATH}"
fi
post_fetch() {
run chmod -R +rw "${PWD}/perl-${version}"*
run cp -r "${PWD}/perl-cross-1.5/"* "${PWD}/perl-${version}/"
if [ "$(uname -s)" = 'Darwin' ]; then
cat <<- 'EOH' > "${PWD}/perl-${version}/readelf"
#!/bin/bash
exec gobjdump "$@"
EOH
chmod +x "${PWD}/perl-${version}/readelf"
fi
}

View file

@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Beckett Normington <beckett@b0ba.dev>
Date: Tue, 25 Jul 2023 16:59:20 -0400
Subject: [PATCH] configure: Hardcode `random()` in place of `drand48()`
---
cnf/configure_func.sh | 2 +-
cnf/configure_func_sel.sh | 8 +-------
cnf/configure_misc.sh | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/cnf/configure_func.sh b/cnf/configure_func.sh
index 45e11341c0c3cc3563328e06aaafc0b7a50135b4..af7691a848e89b3d18a7dd531f9decf8915e485e 100644
--- a/cnf/configure_func.sh
+++ b/cnf/configure_func.sh
@@ -54,7 +54,7 @@ checkfunc d_dirfd 'dirfd' "NULL" 'dirent.h sys/types.h'
checkfunc d_dladdr 'dladdr' 'NULL, NULL' 'dlfcn.h'
checkfunc d_dlerror 'dlerror' "" 'dlfcn.h'
checkfunc d_dlopen 'dlopen' "NULL,0" "dlfcn.h"
-checkfunc d_drand48 'drand48' "" 'stdlib.h'
+# checkfunc d_drand48 'drand48' "" 'stdlib.h'
checkfunc d_dup2 'dup2' "0,0" 'unistd.h'
checkfunc d_dup3 'dup3' "0,0,0" 'fcntl.h unistd.h'
checkfunc d_duplocale 'duplocale' '0' 'locale.h'
diff --git a/cnf/configure_func_sel.sh b/cnf/configure_func_sel.sh
index 90d350d5451907ba219ad9c817d6ffb25a2178aa..37d433609dbd0289cd1591a60ba60c05ae275084 100644
--- a/cnf/configure_func_sel.sh
+++ b/cnf/configure_func_sel.sh
@@ -53,13 +53,7 @@ fi
mstart "Looking for a random number function"
log "d_drand=$d_drand48 d_random=$d_random d_rand=$d_rand"
-if [ "$d_drand48" = 'define' ]; then
- define randfunc 'drand48'
- define seedfunc 'srand48'
- define randbits 48
- define randseedtype 'long'
- result 'good, found drand48()'
-elif [ "$d_random" = 'define' ]; then
+if [ "$d_random" = 'define' ]; then
define randfunc 'random'
define seedfunc 'srandom'
define randbits 31
diff --git a/cnf/configure_misc.sh b/cnf/configure_misc.sh
index c5dca506ea72fa3693a2d825c0cceb287b26abd8..b2ba57282f7dcc6ea2e889704699ee399bf6a6d5 100644
--- a/cnf/configure_misc.sh
+++ b/cnf/configure_misc.sh
@@ -108,7 +108,7 @@ define spitshell 'cat'
define d_Gconvert 'sprintf((b),"%.*g",(n),(x))'
define d_modfl_pow32_bug 'undef'
define direntrytype 'struct dirent'
-define drand01 'drand48()'
+define drand01 'random()'
define fflushNULL 'define'
define fflushall 'undef'
define freetype 'void'

View file

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Beckett Normington <beckett@b0ba.dev>
Date: Tue, 25 Jul 2023 17:00:13 -0400
Subject: [PATCH] pp_sys: Avoid redefining `h_errno`
---
pp_sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pp_sys.c b/pp_sys.c
index b18911b3f4b047fa9b8422f66530cbee094af824..0bef81722379e4f28e18f622f9e1c977a9debd63 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -69,7 +69,7 @@
compiling multithreaded and singlethreaded ($ccflags et al).
HOST_NOT_FOUND is typically defined in <netdb.h>.
*/
-#if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__)
+#if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__) && !defined(__serenity__)
extern int h_errno;
#endif

View file

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Beckett Normington <beckett@b0ba.dev>
Date: Tue, 25 Jul 2023 17:13:12 -0400
Subject: [PATCH] Makefile: Don't run `lib/unicore/mktables` with -maketest
This argument causes the interpreter to hang and consume huge amounts
of RAM.
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 4b80079f22738918822df9c30d6be15f5b5b6078..0a319af97e896d5d2784906fd21367e90c293991 100644
--- a/Makefile
+++ b/Makefile
@@ -302,7 +302,7 @@ dist/Unicode-Normalize/Makefile: lib/unicore/CombiningClass.pl
pod/perluniprops.pod: lib/unicore/CombiningClass.pl
lib/unicore/CombiningClass.pl: $(CONFIGPM)
- ./miniperl_top lib/unicore/mktables -w -C lib/unicore -P pod -maketest -makelist -p
+ ./miniperl_top lib/unicore/mktables -w -C lib/unicore -P pod -makelist -p
# The following rules ensure that modules listed in mkppport.lst get
# their ppport.h installed. There's a bunch of comments in that file,

View file

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: EWouters <6179932+EWouters@users.noreply.github.com>
Date: Thu, 27 Jul 2023 16:49:13 +0200
Subject: [PATCH] Disable nanosleep
---
config_h.SH | 1 -
1 file changed, 1 deletion(-)
diff --git a/config_h.SH b/config_h.SH
index 5880dc532de82a795f0ab3c9d65d84b3679c24b5..f63bf2aa1a848677c71e98017fe4e48f0e5cc8e6 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -3116,7 +3116,6 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
* This symbol, if defined, indicates that the nanosleep
* system call is available to sleep with 1E-9 sec accuracy.
*/
-#$d_nanosleep HAS_NANOSLEEP /**/
/* HAS_NEARBYINT:
* This symbol, if defined, indicates that the nearbyint routine is

View file

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Beckett Normington <beckett@b0ba.dev>
Date: Thu, 27 Jul 2023 13:58:01 -0400
Subject: [PATCH] configure: Add hint for `serenity`
---
cnf/hints/serenity | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 cnf/hints/serenity
diff --git a/cnf/hints/serenity b/cnf/hints/serenity
new file mode 100644
index 0000000000000000000000000000000000000000..3e038d0ac1660d7ee485bc32ddaec5a1c953cabd
--- /dev/null
+++ b/cnf/hints/serenity
@@ -0,0 +1,24 @@
+libs='-ldl -lm -lcrypt -lcore'
+
+# Use OS's malloc() by default.
+case "$usemymalloc" in
+'') usemymalloc='n' ;;
+esac
+
+# uses gcc.
+cc='gcc'
+ld='gcc'
+
+# as of the latest some symbols are confusing the nm lookup
+case "$usenm" in
+'') usenm='undef' ;;
+esac
+
+# disable nanosleep
+d_nanosleep='undef'
+
+# don't try to test min/max of gmtime/localtime
+sGMTIME_max=2147483647
+sGMTIME_min=-2147481748
+sLOCALTIME_max=2147483647
+sLOCALTIME_min=-2147481748

29
Ports/perl5/patches/ReadMe.md Executable file
View file

@ -0,0 +1,29 @@
# Patches for perl5 on SerenityOS
## `0001-configure-Hardcode-random-in-place-of-drand48.patch`
configure: Hardcode `random()` in place of `drand48()`
## `0002-pp_sys-Avoid-redefining-h_errno.patch`
pp_sys: Avoid redefining `h_errno`
## `0003-Makefile-Don-t-run-lib-unicore-mktables-with-maketes.patch`
Makefile: Don't run `lib/unicore/mktables` with -maketest
This argument causes the interpreter to hang and consume huge amounts
of RAM.
## `0004-Disable-nanosleep.patch`
Disable nanosleep
## `0005-configure-Add-hint-for-serenity.patch`
configure: Add hint for `serenity`