Thursday, June 29, 2023

lang/sbcl: update to 2.3.6 (latest) and take MAINTAINER

diff /home/semarie/repos/openbsd/ports
commit - 24a3e531fc9c9cadff194b5f9fdaf9c0a68c3156
path + /home/semarie/repos/openbsd/ports
blob - 9d85d7514131d6aef49aab9ea5719239bea069bc
file + lang/sbcl/Makefile
--- lang/sbcl/Makefile
+++ lang/sbcl/Makefile
@@ -1,98 +1,125 @@
-# not yet ported to other arches
-ONLY_FOR_ARCHS = amd64 i386 powerpc
-USE_WXNEEDED = Yes
+COMMENT = high performance Common Lisp compiler

-COMMENT= compiler and runtime system for ANSI Common Lisp
+V = 2.3.6
+DISTNAME = sbcl-${V}-source
+PKGNAME = sbcl-${V}

-V = 2.2.5
-REVISION = 0
-DISTNAME= sbcl-${V}-source
-PKGNAME= sbcl-${V}
-WRKDIST= ${WRKDIR}/sbcl-${V}
-EXTRACT_SUFX= .tar.bz2
+CATEGORIES = lang

-CATEGORIES= lang
-HOMEPAGE= http://www.sbcl.org/
-MAINTAINER
= Joshua Elsasser <josh@elsasser.org>
+HOMEPAGE = https://www.sbcl.org/

+MAINTAINER = Sebastien Marie <semarie@online.fr>
+
# Public domain and BSD
-PERMIT_PACKAGE= Yes
+PERMIT_PACKAGE = Yes

-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=sbcl/}
+WANTLIB += c m util zstd

-WANTLIB= c m util z
+USE_WXNEEDED = Yes
+USE_NOEXECONLY = Yes
+USE_NOBTCFI = Yes

-PSEUDO_FLAVORS= native_bootstrap
+MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=sbcl/}
+EXTRACT_SUFX = .tar.bz2
+WRKDIST = ${WRKDIR}/sbcl-${V}

-FLAVORS= threads
-FLAVOR?=
+PSEUDO_FLAVORS = native_bootstrap
+FLAVORS = threads
+FLAVOR ?=

-MAKE_PARAMS = --prefix=${PREFIX}
+# Supported bootstrap methods:
+# - "ecl" : default (for portability)
+# - "clisp" : build might be faster than with ecl
+# - "sbcl" : for native bootstrap
+#
+# For testing, it could be manually overrided by passing
+# BOOTSTRAP_METHOD=xxx on make command-line.

-.if ${FLAVOR:Mthreads}
-ONLY_FOR_ARCHS = amd64 powerpc
-MAKE_PARAMS += --with-sb-thread
-WANTLIB+= pthread
-.endif
-# enable features from --fancy other than :sb-thread
-MAKE_PARAMS += --with-sb-core-compression \
- --with-sb-xref-for-internals
+BOOTSTRAP_METHOD-amd64 = clisp
+BOOTSTRAP_METHOD-powerpc = clisp
+BOOTSTRAP_METHOD-${MACHINE_ARCH} ?= ecl

-# contrib/sb-capstone/test.lisp uses it at build-time if present
-BUILD_DEPENDS = devel/capstone/main
+BOOTSTRAP_METHOD ?= ${BOOTSTRAP_METHOD-${MACHINE_ARCH}}

.if ${FLAVOR:Mnative_bootstrap}
-BUILD_DEPENDS+= lang/sbcl
-BOOTSTRAP_CMD= ${LOCALBASE}/bin/sbcl \
- --disable-debugger --no-sysinit --no-userinit
-.elif ${MACHINE_ARCH:Mi386}
-# ecl is slower but lang/clisp fails to build sbcl on i386
-BUILD_DEPENDS += lang/ecl
-BOOTSTRAP_CMD = ${LOCALBASE}/bin/ecl -q --norc
-.else
+BOOTSTRAP_METHOD = sbcl
+.endif
+
+.if ${BOOTSTRAP_METHOD:Msbcl}
+BUILD_DEPENDS += lang/sbcl
+XCHOST_CMD = ${LOCALBASE}/bin/sbcl \
+ --disable-debugger --no-sysinit --no-userinit
+
+.elif ${BOOTSTRAP_METHOD:Mclisp}
BUILD_DEPENDS += lang/clisp
-BOOTSTRAP_CMD = ${LOCALBASE}/bin/clisp -q -norc
+XCHOST_CMD = ${LOCALBASE}/bin/clisp -q -norc
+
+.elif ${BOOTSTRAP_METHOD:Mecl}
+BUILD_DEPENDS += lang/ecl
+XCHOST_CMD = ${LOCALBASE}/bin/ecl -q --norc
+
+.else
+ERRORS += "Fatal: unknown BOOTSTRAP_METHOD"
.endif
-MAKE_PARAMS += --xc-host="${BOOTSTRAP_CMD}" ${EXTRA_PARAMS}
-TEST_DEPENDS = devel/gmp

-# base makeinfo chokes on sbcl texinfo files
+# sb-thread is available only on some architectures and required on others
+.if ${FLAVOR:Mthreads}
+ONLY_FOR_ARCHS += riscv64 powerpc powerpc64 i386 amd64 aarch64
+EXTRA_PARAMS += --with-sb-thread
+WANTLIB += pthread
+.else
+NOT_FOR_ARCHS += aarch64 powerpc64
+EXTRA_PARAMS += --without-sb-thread
+.endif
+
+# sb-simd is available on amd64 only
+COMMENT_SB_SIMD-${MACHINE_ARCH} ?= "@comment "
+COMMENT_SB_SIMD-amd64 =
+COMMENT_SB_SIMD ?= ${COMMENT_SB_SIMD-${MACHINE_ARCH}}
+
+SUBST_VARS += COMMENT_SB_SIMD
+UPDATE_PLIST_ARGS += -c COMMENT_SB_SIMD
+
BUILD_DEPENDS += print/texinfo
+LIB_DEPENDS += archivers/zstd
+TEST_DEPENDS += devel/capstone/main \
+ devel/gmp

-USE_GMAKE= Yes
-PORTHOME= ${TMPDIR}
-MAKE_ENV= GNUMAKE=${GMAKE} INSTALL_ROOT=${PREFIX} \
- MAN_DIR=${PREFIX}/man INFO_DIR=${PREFIX}/info \
- MAKEINFO=${PREFIX}/bin/gmakeinfo
+MAKE_ENV += CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib" \
+ LINKFLAGS="-L${LOCALBASE}/lib" \
+ MAKEINFO=${PREFIX}/bin/gmakeinfo \
+ MAN_DIR="${PREFIX}/man/" \
+ INFO_DIR="${PREFIX}/info/"

-# Upstream asks that packagers append something like this to the
-# version to distinguish official tarballs from third-party packages.
-.if defined(REVISION) && !empty(REVISION)
-LOCAL_VERSION = openbsd.${REVISION}
-.else
-LOCAL_VERSION = openbsd
-.endif
-VERSION_FILE = ${WRKSRC}/version.lisp-expr
+USE_GMAKE = Yes

-pre-configure:
- sed -i 's/^"\([0-9.]*\)"$$/"\1.${LOCAL_VERSION}"/' ${VERSION_FILE}
+DEBUG_PACKAGES = ${BUILD_PACKAGES}

+do-configure:
+ printf '"%s.%s.%s"\n' "${V}" "openbsd" "${FULLPKGNAME}" \
+ >${WRKSRC}/version.lisp-expr
+
do-build:
- cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} SBCL_CONTRIB_TARGET=all \
- /bin/sh make.sh ${MAKE_PARAMS}
- cd ${WRKSRC}/doc/manual && touch sbcl.texinfo && \
- ${SETENV} ${MAKE_ENV} ${GMAKE} asdf.info sbcl.info
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ /bin/sh ./make.sh \
+ --prefix="${PREFIX}" \
+ --xc-host="${XCHOST_CMD}" \
+ --with-sb-core-compression \
+ --with-sb-xref-for-internals \
+ ${EXTRA_PARAMS}
+ cd ${WRKSRC}/doc/manual/ && ${SETENV} ${MAKE_ENV} \
+ ${GMAKE} info

do-install:
- cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} /bin/sh install.sh
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ /bin/sh ./install.sh \
+ --prefix="${PREFIX}"

post-install:
- chown -R 0:0 ${PREFIX}/lib/sbcl
- rmdir ${PREFIX}/share/doc/sbcl/html
+ rmdir ${PREFIX}/share/doc/sbcl/html/

do-test:
- cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} DONT_CLEAN_SBCL_CONTRIB=1 \
- /bin/sh make-target-contrib.sh
- cd ${WRKSRC}/tests && ${SETENV} ${MAKE_ENV} /bin/sh run-tests.sh
+ cd ${WRKSRC}/tests/ && ${SETENV} ${MAKE_ENV} /bin/sh ./run-tests.sh

.include <bsd.port.mk>
blob - 279535707a1d85eb0a42ea1a70e79a49c50c2178
file + lang/sbcl/distinfo
--- lang/sbcl/distinfo
+++ lang/sbcl/distinfo
@@ -1,2 +1,2 @@
-SHA256 (sbcl-2.2.5-source.tar.bz2) = hYS1QTcP1q1uWNP5eYIHffyrJA8w1OmxjxXakcLxPtE=
-SIZE (sbcl-2.2.5-source.tar.bz2) = 7029912
+SHA256 (sbcl-2.3.6-source.tar.bz2) = tEFMpNmnR06NiE19YyN+LynvRZ39WoSEJKnD+lUdGbk=
+SIZE (sbcl-2.3.6-source.tar.bz2) = 7483612
blob - 772a5ee017abbceb81f2db0b215c044e8744d0e1
file + /dev/null
--- lang/sbcl/patches/patch-contrib_build-contrib
+++ /dev/null
@@ -1,14 +0,0 @@
-don't run the tests for contrib while building
-
-Index: contrib/build-contrib
---- contrib/build-contrib.orig
-+++ contrib/build-contrib
-@@ -2,7 +2,7 @@
-
- mkdir -p ../obj/asdf-cache/$@/
-
--if $GNUMAKE -j1 -C $@ test < /dev/null 2>&1 && touch ../obj/asdf-cache/$@/test-passed.test-report ; then
-+if $GNUMAKE -j1 -C $@ < /dev/null 2>&1 && touch ../obj/asdf-cache/$@/test-passed.test-report ; then
- :
- else
- exit $?
blob - 04ac67540cae466ed11f7b7aebe8a92c84634fea
file + /dev/null
--- lang/sbcl/patches/patch-src_runtime_Config_generic-openbsd
+++ /dev/null
@@ -1,17 +0,0 @@
-Don't try to guess (wrong) with clang. Just assume we have pie
-
-Index: src/runtime/Config.generic-openbsd
---- src/runtime/Config.generic-openbsd.orig
-+++ src/runtime/Config.generic-openbsd
-@@ -17,11 +17,7 @@ CFLAGS += -pthread
- OS_LIBS += -pthread
- endif
-
--ifeq ($(DISABLE_PIE),yes)
--ifneq ($(shell $(CC) -dM -E - < /dev/null 2>/dev/null | grep -e '__clang__'),)
- CFLAGS += -fno-pie
- LINKFLAGS += -nopie
- LDFLAGS += -nopie
- __LDFLAGS__ += -nopie
--endif
--endif
blob - 65c4b1e9fe17f4b907bbf24734997e62aee8a58e
file + lang/sbcl/patches/patch-src_runtime_GNUmakefile
--- lang/sbcl/patches/patch-src_runtime_GNUmakefile
+++ lang/sbcl/patches/patch-src_runtime_GNUmakefile
@@ -1,3 +1,6 @@
+- don't hardcode optimization
+- pass -I${LOCALBASE}/include
+
Index: src/runtime/GNUmakefile
--- src/runtime/GNUmakefile.orig
+++ src/runtime/GNUmakefile
@@ -6,7 +9,7 @@ Index: src/runtime/GNUmakefile
include ../../output/prefix.def

-CFLAGS += -g -Wall -Wundef -Wsign-compare -Wpointer-arith -O3
-+CFLAGS += -Wall -Wundef -Wsign-compare -Wpointer-arith
++CFLAGS += -g -Wall -Wundef -Wsign-compare -Wpointer-arith -I/usr/local/include
ASFLAGS += $(CFLAGS)
CPPFLAGS += -I.

blob - 428931b7e4d94e55f04faa3d13e83324628a3b5e
file + /dev/null
--- lang/sbcl/patches/patch-src_runtime_bsd-os_c
+++ /dev/null
@@ -1,13 +0,0 @@
-stack should be RW (without X)
-
-Index: src/runtime/bsd-os.c
---- src/runtime/bsd-os.c.orig
-+++ src/runtime/bsd-os.c
-@@ -182,6 +182,7 @@ os_validate(int attributes, os_vm_address_t addr, os_v
- /* OpenBSD requires MAP_STACK for pages used as stack.
- * Note that FreeBSD has a MAP_STACK with different behavior. */
- flags = MAP_STACK;
-+ protection = OS_VM_PROT_READ | OS_VM_PROT_WRITE;
- #endif
- }
- #endif
blob - 8a79069ee00e95f37413c3ed8cdfafb161168a00
file + /dev/null
--- lang/sbcl/patches/patch-src_runtime_gc-common_c
+++ /dev/null
@@ -1,15 +0,0 @@
-ffsl is non-standard, but both gcc and clang have it as builtin...
-clang only has it as builtin
-
-Index: src/runtime/gc-common.c
---- src/runtime/gc-common.c.orig
-+++ src/runtime/gc-common.c
-@@ -58,6 +58,8 @@
- #define LONG_FLOAT_SIZE 3
- #endif
-
-+#define ffsl __builtin_ffsl
-+
- os_vm_size_t dynamic_space_size = DEFAULT_DYNAMIC_SPACE_SIZE;
- os_vm_size_t thread_control_stack_size = DEFAULT_CONTROL_STACK_SIZE;
-
blob - c04a0424dafeb4f4cd6af9a7ca0a1cea170f5561
file + lang/sbcl/pkg/PLIST
--- lang/sbcl/pkg/PLIST
+++ lang/sbcl/pkg/PLIST
@@ -20,8 +20,6 @@ lib/sbcl/contrib/sb-graph.asd
lib/sbcl/contrib/sb-executable.fasl
lib/sbcl/contrib/sb-gmp.asd
lib/sbcl/contrib/sb-gmp.fasl
-lib/sbcl/contrib/sb-graph.asd
-lib/sbcl/contrib/sb-graph.fasl
lib/sbcl/contrib/sb-grovel.asd
lib/sbcl/contrib/sb-grovel.fasl
lib/sbcl/contrib/sb-introspect.asd
@@ -38,6 +36,8 @@ lib/sbcl/contrib/sb-simple-streams.asd
lib/sbcl/contrib/sb-rotate-byte.fasl
lib/sbcl/contrib/sb-rt.asd
lib/sbcl/contrib/sb-rt.fasl
+${COMMENT_SB_SIMD}lib/sbcl/contrib/sb-simd.asd
+${COMMENT_SB_SIMD}lib/sbcl/contrib/sb-simd.fasl
lib/sbcl/contrib/sb-simple-streams.asd
lib/sbcl/contrib/sb-simple-streams.fasl
lib/sbcl/contrib/sb-sprof.asd
Hi,

With latest changes on ecl, we are able to update sbcl to latest version (2.3.6).

As maintainer systematically timeout since several years now, I am taking over
the maintainership (and no reply on private mail asking about continuing or not
to maintain lang/sbcl).

I have mostly rewritten the port to ease testing building it with several
bootstraps (ecl, clisp, sbcl) on one architecture, and drop some historical
parts.

Regarding the way to build sbcl, it defaults to using lang/ecl (which is
portable as written in C), and use clisp for some archs only (amd64 and powerpc,
as currently) as it is more fast.


The mail includes:
- a proper tarball (as for a new port)
- a diff (for braves diff readers)

I tested:
- on amd64, building with clisp (default), ecl and sbcl (2.2.5p0 and 2.3.6)
- on aarch64, building with ecl, and sbcl (2.3.6)
- all dependencies are still building on amd64

The port is buildable on wider architectures range.

Comments or OK ?
--
Sebastien Marie

No comments:

Post a Comment