diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index d3ff5f7edbb..984e6a51b81 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -74,6 +74,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`grep`](grep/) | GNU Grep | 3.7 | https://www.gnu.org/software/grep/ | | [`griffon`](griffon/) | The Griffon Legend | 1.0 | https://www.scummvm.org/games/#games-griffon | | [`gsl`](gsl/) | GNU Scientific Library | 2.7.1 | https://www.gnu.org/software/gsl/ | +| [`guile`](guile/) | The GNU guile programming language | 3.0.8 | https://www.gnu.org/software/guile/ | | [`halflife`](halflife/) | Half-Life | 2022.05.01 | https://github.com/FWGS/xash3d-fwgs | | [`harfbuzz`](harfbuzz/) | HarfBuzz | 2.8.1 | https://github.com/harfbuzz/harfbuzz | | [`hatari`](hatari/) | Atari ST/STE/TT/Falcon emulator | 2.4.0-devel | https://hatari.tuxfamily.org/ | diff --git a/Ports/guile/package.sh b/Ports/guile/package.sh new file mode 100755 index 00000000000..2b57e3145c9 --- /dev/null +++ b/Ports/guile/package.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port=guile +version=3.0.8 +files="https://ftpmirror.gnu.org/gnu/guile/guile-${version}.tar.gz guile-${version}.tar.gz f25ae0c26e911af1b5005292d4f56621879f74d6958b30741cf67d8b6feb2016" +depends=("gmp" "libunistring" "libffi" "bdwgc" "libiconv") +auth_type=sha256 + +useconfigure=true +use_fresh_config_sub=true +config_sub_path="build-aux/config.sub" +configopts=("--disable-lto" "--disable-jit") +pre_configure() { + run autoreconf +} diff --git a/Ports/guile/patches/0001-build-When-cross-compiling-get-type-sizes-of-the-tar.patch b/Ports/guile/patches/0001-build-When-cross-compiling-get-type-sizes-of-the-tar.patch new file mode 100644 index 00000000000..ab140cc9386 --- /dev/null +++ b/Ports/guile/patches/0001-build-When-cross-compiling-get-type-sizes-of-the-tar.patch @@ -0,0 +1,85 @@ +From 2029ec1800c3e9a1d8a50f158c1550523c022cec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= +Date: Mon, 28 Feb 2022 22:57:52 +0100 +Subject: [PATCH 1/2] build: When cross-compiling, get type sizes of the target + system. + +Fixes . + +As noted in the comment at the top, 'SIZEOF_TYPE' must be used instead +of 'sizeof (TYPE)' to support cross-compilation. + +The regression was introduced in +5e5afde06fd9dd0992294d6c7dc9f9966c0caa37 but only became apparent with +717e787da6ae75bbaa53139c0ef3791cd758a9d8. + +* libguile/gen-scmconfig.c (main): Replace uses of 'sizeof' by +references to the SIZEOF_* macros. +* configure.ac: Add 'AC_CHECK_SIZEOF' call for 'intmax_t'. +--- + configure.ac | 1 + + libguile/gen-scmconfig.c | 32 ++++++++++++++++---------------- + 2 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 827e1c0..ad7ff12 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -357,6 +357,7 @@ AC_CHECK_SIZEOF(uintptr_t) + AC_CHECK_SIZEOF(ptrdiff_t) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(off_t) ++AC_CHECK_SIZEOF(intmax_t) + + if test "$ac_cv_sizeof_long" -gt "$ac_cv_sizeof_void_p"; then + AC_MSG_ERROR(long does not fit into a void*) +diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c +index 01b14f1..691ebd0 100644 +--- a/libguile/gen-scmconfig.c ++++ b/libguile/gen-scmconfig.c +@@ -1,4 +1,4 @@ +-/* Copyright 2003-2013,2018,2020,2021 ++/* Copyright 2003-2013, 2018, 2020-2022 + Free Software Foundation, Inc. + + This file is part of Guile. +@@ -238,21 +238,21 @@ main (int argc, char *argv[]) + pf ("\n"); + pf ("/* Standard types. */\n"); + +- pf ("#define SCM_SIZEOF_CHAR %zu\n", sizeof (char)); +- pf ("#define SCM_SIZEOF_UNSIGNED_CHAR %zu\n", sizeof (unsigned char)); +- pf ("#define SCM_SIZEOF_SHORT %zu\n", sizeof (short)); +- pf ("#define SCM_SIZEOF_UNSIGNED_SHORT %zu\n", sizeof (unsigned short)); +- pf ("#define SCM_SIZEOF_LONG %zu\n", sizeof (long)); +- pf ("#define SCM_SIZEOF_UNSIGNED_LONG %zu\n", sizeof (unsigned long)); +- pf ("#define SCM_SIZEOF_INT %zu\n", sizeof (int)); +- pf ("#define SCM_SIZEOF_UNSIGNED_INT %zu\n", sizeof (unsigned int)); +- pf ("#define SCM_SIZEOF_SIZE_T %zu\n", sizeof (size_t)); +- pf ("#define SCM_SIZEOF_LONG_LONG %zu\n", sizeof (long long)); +- pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %zu\n", sizeof (unsigned long long)); +- pf ("#define SCM_SIZEOF_INTMAX %zu\n", sizeof (intmax_t)); +- pf ("#define SCM_SIZEOF_SCM_T_PTRDIFF %zu\n", sizeof (ptrdiff_t)); +- pf ("#define SCM_SIZEOF_INTPTR_T %zu\n", sizeof (intptr_t)); +- pf ("#define SCM_SIZEOF_UINTPTR_T %zu\n", sizeof (uintptr_t)); ++ pf ("#define SCM_SIZEOF_CHAR %d\n", SIZEOF_CHAR); ++ pf ("#define SCM_SIZEOF_UNSIGNED_CHAR %d\n", SIZEOF_UNSIGNED_CHAR); ++ pf ("#define SCM_SIZEOF_SHORT %d\n", SIZEOF_SHORT); ++ pf ("#define SCM_SIZEOF_UNSIGNED_SHORT %d\n", SIZEOF_UNSIGNED_SHORT); ++ pf ("#define SCM_SIZEOF_LONG %d\n", SIZEOF_LONG); ++ pf ("#define SCM_SIZEOF_UNSIGNED_LONG %d\n", SIZEOF_UNSIGNED_LONG); ++ pf ("#define SCM_SIZEOF_INT %d\n", SIZEOF_INT); ++ pf ("#define SCM_SIZEOF_UNSIGNED_INT %d\n", SIZEOF_UNSIGNED_INT); ++ pf ("#define SCM_SIZEOF_SIZE_T %d\n", SIZEOF_SIZE_T); ++ pf ("#define SCM_SIZEOF_LONG_LONG %d\n", SIZEOF_LONG_LONG); ++ pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %d\n", SIZEOF_UNSIGNED_LONG_LONG); ++ pf ("#define SCM_SIZEOF_INTMAX %d\n", SIZEOF_INTMAX_T); ++ pf ("#define SCM_SIZEOF_SCM_T_PTRDIFF %d\n", SIZEOF_PTRDIFF_T); ++ pf ("#define SCM_SIZEOF_INTPTR_T %d\n", SIZEOF_INTPTR_T); ++ pf ("#define SCM_SIZEOF_UINTPTR_T %d\n", SIZEOF_UINTPTR_T); + + pf ("\n"); + pf ("/* same as POSIX \"struct timespec\" -- always defined */\n"); +-- +2.36.1 + diff --git a/Ports/guile/patches/0002-Remove-contents-of-return_unused_stack_to_os.patch b/Ports/guile/patches/0002-Remove-contents-of-return_unused_stack_to_os.patch new file mode 100644 index 00000000000..49e4ee89043 --- /dev/null +++ b/Ports/guile/patches/0002-Remove-contents-of-return_unused_stack_to_os.patch @@ -0,0 +1,49 @@ +From fcd26f263a018d69cf62135f798a04d4c354d5f1 Mon Sep 17 00:00:00 2001 +From: Peter Elliott +Date: Wed, 18 May 2022 01:43:41 -0600 +Subject: [PATCH 2/2] Remove contents of return_unused_stack_to_os + +guile attempts to madvise(2) away parts of the stack, but serenity only +supports madvise(2) on entire mmaped regions. +--- + libguile/vm.c | 24 ------------------------ + 1 file changed, 24 deletions(-) + +diff --git a/libguile/vm.c b/libguile/vm.c +index 6fd5c55..2eab110 100644 +--- a/libguile/vm.c ++++ b/libguile/vm.c +@@ -626,30 +626,6 @@ scm_i_vm_prepare_stack (struct scm_vm *vp) + static void + return_unused_stack_to_os (struct scm_vm *vp) + { +-#if HAVE_SYS_MMAN_H +- uintptr_t lo = (uintptr_t) vp->stack_bottom; +- uintptr_t hi = (uintptr_t) vp->sp; +- +- lo &= ~(page_size - 1U); /* round down */ +- hi &= ~(page_size - 1U); /* round down */ +- +- /* Return these pages to the OS. The next time they are paged in, +- they will be zeroed. */ +- if (lo < hi) +- { +- int ret = 0; +- +- do +- ret = madvise ((void *) lo, hi - lo, MADV_DONTNEED); +- while (ret && errno == EAGAIN); +- +- /* If the OS doesn't implement 'madvise' (as is currently the case +- for GNU/Hurd), don't warn the user since there's nothing they +- can do about it. */ +- if (ret && errno != ENOSYS) +- perror ("madvise failed"); +- } +-#endif + } + + #define SLOT_MAP_CACHE_SIZE 32U +-- +2.36.1 + diff --git a/Ports/guile/patches/ReadMe.md b/Ports/guile/patches/ReadMe.md new file mode 100644 index 00000000000..8a47d8960f7 --- /dev/null +++ b/Ports/guile/patches/ReadMe.md @@ -0,0 +1,26 @@ +# Patches for guile on SerenityOS + +## `0001-build-When-cross-compiling-get-type-sizes-of-the-tar.patch` + +build: When cross-compiling, get type sizes of the target system. + +Fixes . + +As noted in the comment at the top, 'SIZEOF_TYPE' must be used instead +of 'sizeof (TYPE)' to support cross-compilation. + +The regression was introduced in +5e5afde06fd9dd0992294d6c7dc9f9966c0caa37 but only became apparent with +717e787da6ae75bbaa53139c0ef3791cd758a9d8. + +* libguile/gen-scmconfig.c (main): Replace uses of 'sizeof' by +references to the SIZEOF_* macros. +* configure.ac: Add 'AC_CHECK_SIZEOF' call for 'intmax_t'. + +## `0002-Remove-contents-of-return_unused_stack_to_os.patch` + +Remove contents of return_unused_stack_to_os + +guile attempts to madvise(2) away parts of the stack, but serenity only +supports madvise(2) on entire mmaped regions. +