Index | Thread | Search

From:
Dima Pasechnik <dima@sagemath.org>
Subject:
Re: update lang/sbcl to 2.4.4 (and add libsbcl.so)
To:
ports@openbsd.org, Sebastien Marie <semarie@kapouay.eu.org>
Date:
Sat, 04 May 2024 12:19:27 +0100

Download raw body.

Thread
On 1 May 2024 16:50:59 BST, Dima Pasechnik <dima@sagemath.org> wrote:
>Hi,
>On Wed, May 01, 2024 at 03:59:29PM +0200, Sebastien Marie wrote:
>> 
>> The following diff updates sbcl to 2.4.4.
>> 
>> It also adds libsbcl.a and libsbcl.so to the port.
>> 
>> Regarding libsbcl.so, the library isn't available on all platforms (some
>> .S files aren't PIC compatible - at least on i386), so I only added it
>> to tested platforms (aarch64 and amd64 at time).
>> 
>> Comments or OK ?
>
>All good for me (on amd64), including using libsbcl.so.
>(with sbcl-librarian -  I was confised about wxneeded flag at some
>point, but it's OK. Executables linking this library might need this
>flag.)
>
>Is there a reason for not installing libsbcl.a to /usr/local/lib/ ?
>On my system it ends up in /usr/local/lib/sbcl/.
>
>Best
>Dima
>
>
>> -- 
>> Sebastien Marie
>> 
>> Index: Makefile
>> ===================================================================
>> RCS file: /cvs/ports/lang/sbcl/Makefile,v
>> diff -u -p -r1.67 Makefile
>> --- Makefile	8 Apr 2024 15:32:45 -0000	1.67
>> +++ Makefile	1 May 2024 13:41:32 -0000
>> @@ -4,10 +4,12 @@ ONLY_FOR_ARCHS +=	aarch64 amd64 arm i386
>>  
>>  COMMENT =	high performance Common Lisp compiler
>>  
>> -V =		2.4.3
>> +V =		2.4.4
>>  DISTNAME =	sbcl-${V}-source
>>  PKGNAME =	sbcl-${V}
>>  
>> +SHARED_LIBS +=	sbcl	0.0
>> +
>>  CATEGORIES =	lang
>>  
>>  HOMEPAGE =	https://www.sbcl.org/
>> @@ -79,17 +81,28 @@ WANTLIB +=		pthread
>>  EXTRA_PARAMS +=		--without-sb-thread
>>  .endif
>>  
>> +# libsbcl.so is not available everywhere
>> +LIBSBCL-${MACHINE_ARCH} ?=	No
>> +LIBSBCL-aarch64 =	Yes
>> +LIBSBCL-amd64 =		Yes
>> +
>> +SUBST_VARS +=		COMMENT_libsbcl
>> +
>> +.if ${LIBSBCL-${MACHINE_ARCH}:MYes}
>> +COMMENT_libsbcl =	@lib
>> +.else
>> +COMMENT_libsbcl =	@comment
>> +.endif
>> +
>>  BUILD_DEPENDS +=	print/texinfo
>>  LIB_DEPENDS +=		archivers/zstd
>>  TEST_DEPENDS +=		devel/capstone/main \
>>  			devel/gmp
>>  
>> -MAKE_ENV +=		CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
>> -			LDFLAGS="-L${LOCALBASE}/lib" \
>> -			LINKFLAGS="-L${LOCALBASE}/lib" \
>> +MAKE_ENV +=		INFO_DIR="${PREFIX}/info/" \
>> +			LIBsbcl_VERSION="${LIBsbcl_VERSION}" \
>>  			MAKEINFO=${PREFIX}/bin/gmakeinfo \
>>  			MAN_DIR="${PREFIX}/man/" \
>> -			INFO_DIR="${PREFIX}/info/" \
>>  			SBCL_MAKE_JOBS="-j${MAKE_JOBS}"
>>  
>>  USE_GMAKE =		Yes
>> @@ -115,7 +128,12 @@ do-build:
>>  			--xc-host="${XCHOST_CMD}" \
>>  			--with-sb-core-compression \
>>  			--with-sb-xref-for-internals \
>> +			--with-sb-linkable-runtime \
>>  			${EXTRA_PARAMS}
>> +.if ${LIBSBCL-${MACHINE_ARCH}:MYes}
>> +	umask 022 && cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
>> +		/bin/sh ./make-shared-library.sh
>> +.endif
>>  	umask 022 && cd ${WRKSRC}/doc/manual/ && ${SETENV} ${MAKE_ENV} \
>>  		${GMAKE} info
>>  
>> @@ -126,6 +144,11 @@ do-install:
>>  
>>  post-install:
>>  	rmdir ${PREFIX}/share/doc/sbcl/html/
>> +.if ${LIBSBCL-${MACHINE_ARCH}:MYes}
>> +	# the SONAME is properly configured
>> +	mv ${PREFIX}/lib/libsbcl.so \
>> +		${PREFIX}/lib/libsbcl.so.${LIBsbcl_VERSION}
>> +.endif
>>  
>>  do-test:
>>  	cd ${WRKSRC}/tests/ && ${SETENV} ${MAKE_ENV} /bin/sh ./run-tests.sh
>> Index: distinfo
>> ===================================================================
>> RCS file: /cvs/ports/lang/sbcl/distinfo,v
>> diff -u -p -r1.32 distinfo
>> --- distinfo	8 Apr 2024 15:32:45 -0000	1.32
>> +++ distinfo	1 May 2024 13:41:32 -0000
>> @@ -1,2 +1,2 @@
>> -SHA256 (sbcl-2.4.3-source.tar.bz2) = icmq35K4KtPHSj1PFYoDiJPeoOTzlNyvyWNYPDC3w/I=
>> -SIZE (sbcl-2.4.3-source.tar.bz2) = 8126417
>> +SHA256 (sbcl-2.4.4-source.tar.bz2) = ipMmJ7Px2OlhjxzcIl7csAJFaARpfiyH0UBoN2ShBtU=
>> +SIZE (sbcl-2.4.4-source.tar.bz2) = 8065883
>> Index: patches/patch-src_cold_shared_lisp
>> ===================================================================
>> RCS file: patches/patch-src_cold_shared_lisp
>> diff -N patches/patch-src_cold_shared_lisp
>> --- /dev/null	1 Jan 1970 00:00:00 -0000
>> +++ patches/patch-src_cold_shared_lisp	1 May 2024 13:41:32 -0000
>> @@ -0,0 +1,12 @@
>> +Index: src/cold/shared.lisp
>> +--- src/cold/shared.lisp.orig
>> ++++ src/cold/shared.lisp
>> +@@ -392,7 +392,7 @@
>> +          ("(and cons-profiling (not sb-thread))" ":CONS-PROFILING requires :SB-THREAD")
>> +          ("(and sb-linkable-runtime (not (or arm arm64 x86 x86-64 ppc ppc64)))"
>> +           ":SB-LINKABLE-RUNTIME not supported on selected architecture")
>> +-         ("(and sb-linkable-runtime (not (or darwin freebsd linux win32)))"
>> ++         ("(and sb-linkable-runtime (not (or darwin openbsd freebsd linux win32)))"
>> +           ":SB-LINKABLE-RUNTIME not supported on selected operating system")
>> +          ("(and sb-eval sb-fasteval)"
>> +           ;; It sorta kinda works to have both, but there should be no need,
>> Index: patches/patch-src_runtime_Config_generic-openbsd
>> ===================================================================
>> RCS file: patches/patch-src_runtime_Config_generic-openbsd
>> diff -N patches/patch-src_runtime_Config_generic-openbsd
>> --- /dev/null	1 Jan 1970 00:00:00 -0000
>> +++ patches/patch-src_runtime_Config_generic-openbsd	1 May 2024 13:41:32 -0000
>> @@ -0,0 +1,37 @@
>> +Index: src/runtime/Config.generic-openbsd
>> +--- src/runtime/Config.generic-openbsd.orig
>> ++++ src/runtime/Config.generic-openbsd
>> +@@ -11,17 +11,27 @@
>> + 
>> + LINKFLAGS += -Wl,-z,wxneeded
>> + OS_LIBS += -lutil
>> ++SOFLAGS += -Wl,-soname,libsbcl.so.${LIBsbcl_VERSION}
>> + 
>> + ifdef LISP_FEATURE_SB_THREAD
>> +-CFLAGS += -pthread
>> +-OS_LIBS += -pthread
>> ++  OS_LIBS += -lpthread
>> + endif
>> + 
>> ++ifdef LISP_FEATURE_SB_CORE_COMPRESSION
>> ++  CPPFLAGS += -I/usr/local/include
>> ++  OS_LIBS += -L/usr/local/lib
>> ++endif
>> ++
>> ++ifdef LISP_FEATURE_SB_LINKABLE_RUNTIME
>> ++  LIBSBCL = libsbcl.a
>> ++  USE_LIBSBCL = -Wl,--whole-archive libsbcl.a -Wl,--no-whole-archive
>> ++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
>> ++  CFLAGS += -fno-pie
>> ++  LINKFLAGS += -nopie
>> ++  LDFLAGS += -nopie
>> ++  __LDFLAGS__ += -nopie
>> + endif
>> + endif
>> Index: patches/patch-xperfecthash30_lisp-expr
>> ===================================================================
>> RCS file: patches/patch-xperfecthash30_lisp-expr
>> diff -N patches/patch-xperfecthash30_lisp-expr
>> --- patches/patch-xperfecthash30_lisp-expr	8 Apr 2024 15:32:45 -0000	1.1
>> +++ /dev/null	1 Jan 1970 00:00:00 -0000
>> @@ -1,28 +0,0 @@
>> -Add some missing entries for bootstrapping from no-sbcl on i386
>> -
>> -Index: xperfecthash30.lisp-expr
>> ---- xperfecthash30.lisp-expr.orig
>> -+++ xperfecthash30.lisp-expr
>> -@@ -2322,5 +2322,22 @@
>> - (#(73FB831 85FCC7A 1025CF34 1A13A884 1CA0C5B8)
>> -  "(REAL FLOAT DOUBLE-FLOAT SINGLE-FLOAT RATIONAL)"
>> -  "(  (& (+ (>> val 18) (>> val 22)) 7))")
>> -+(#(B1B342 207D684 20BE5F4 27E4E79 34001B1 34EBEE5 35C8E17 3CC42AC 4BB7808 4C4FB75 5502DD7 70F5EF0 8E1655F 8FFB29F 9D14A2B
>> -+   A8542A3 AD2E8E6 B0580F9 BE9B4CB C042E4D E824A51 EF70D00 FB43EC2 10D39C38 114F77D4 116E414E 118F7907 11AD100A 11E583E7
>> -+   11FF1DFE 12B50090 13B30D76 13D394E1 14287725 159AB905 15E063C2 17AAEED6 17BE5DB2 17D87E68 183A215C 1A66777D 1E25A858
>> -+   1EFFF46E 1F125097)
>> -+ "#(T *FREE-INTERRUPT-CONTEXT-INDEX* *ALLOW-WITH-INTERRUPTS* *INTERRUPTS-ENABLED* *INTERRUPT-PENDING* *IN-WITHOUT-GCING* *GC-INHIBIT* *GC-PENDING* SB-IMPL::*UNWEAKENED-VECTORS* SB-VM::*PINNED-OBJECTS* *GC-PIN-CODE-PAGES* SB-VM:*CURRENT-CATCH-BLOCK* SB-VM::*CURRENT-UNWIND-PROTECT-BLOCK* SB-VM::*IMMOBILE-CODEBLOB-TREE* SB-VM::*IMMOBILE-CODEBLOB-VECTOR* SB-VM::*DYNSPACE-CODEBLOB-TREE* SB-IMPL::**FINALIZER-STORE** SB-IMPL::*FINALIZER-REHASHLIST* SB-IMPL::*FINALIZERS-TRIGGERED* SB-VM:*BINDING-STACK-START* SB-VM:*CONTROL-STACK-START* SB-VM:*CONTROL-STACK-END* *STEPPING* SB-VM::*FREE-TLS-INDEX* SB-VM::+REQUIRED-FOREIGN-SYMBOLS+ *GC-EPOCH* %%DATA-VECTOR-REFFERS%% SB-VM::%%DATA-VECTOR-REFFERS/CHECK-BOUNDS%% %%DATA-VECTOR-SETTERS%% SB-VM::%%DATA-VECTOR-SETTERS/CHECK-BOUNDS%% SB-C:*ALIEN-STACK-POINTER* *PSEUDO-ATOMIC-BITS* SB-VM::*BINDING-STACK-POINTER* SB-VM::*FP-CONSTANT-0D0* SB-VM::*FP-CONSTANT-1D0* SB-VM::*FP-CONSTANT-0F0* SB-VM::*FP-CONSTANT-1F0* SB-VM::*FP-CONSTANT-0L0* SB-VM::*FP-CONSTANT-1L0* SB-VM::*FP-CONSTANT-PI* SB-VM::*FP-CONSTANT-L2T* SB-VM::*FP-CONSTANT-L2E* SB-VM::*FP-CONSTANT-LG2* SB-VM::*FP-CONSTANT-LN2*)"
>> -+ "((let ((tab #a((32) (unsigned-byte 8) 28 28 0 36 34 0 51 0 0 0 34 19 51 41 0 0 19 18 19 0 9 59 46 0 9 16 0 0 11 12 52 57)))
>> -+  (let ((b (& val #x1f)))
>> -+   (let ((a (>> (<< val 9) 27)))
>> -+    (^ a (aref tab b))))))")
>> -+(#(B17EA B621A 765909 CA4AAA 261EC99 2740F12 2DCA563 3338509 4838F98 5408EC3 54FE9F6 620099A AA84B76 BFFC3D4 D514142 DC65EEE
>> -+   E5D1897 EDFD052 FA21765 10E2FDD1 11191CE8 1278BFE6 13632D1F 13FFF4F3 1451524B 169E1DF6 16AAD643 1712EA5F 17A76ECC 1806A438
>> -+   187CC43D 18AD9421 19C62B17 1ABE4E69 1BBA8D9F 1C5C0C65 1CDF5674 1D7BD61D 1DC4409C 1F038512 1F354480 1F7C3062)
>> -+ "#(SUB-GC POST-GC INTERNAL-ERROR CONTROL-STACK-EXHAUSTED-ERROR BINDING-STACK-EXHAUSTED-ERROR ALIEN-STACK-EXHAUSTED-ERROR HEAP-EXHAUSTED-ERROR UNDEFINED-ALIEN-VARIABLE-ERROR MEMORY-FAULT-ERROR UNHANDLED-TRAP-ERROR UNDEFINED-ALIEN-FUN-ERROR SB-DI::HANDLE-BREAKPOINT SB-DI::HANDLE-SINGLE-STEP-TRAP ENTER-ALIEN-CALLBACK TWO-ARG-+ TWO-ARG-- TWO-ARG-* TWO-ARG-/ TWO-ARG-< TWO-ARG-> TWO-ARG-= EQL %NEGATE LENGTH ERROR FORMAT EQUALP SB-C::CHECK-DS-LIST SB-C::CHECK-DS-LIST/&REST WRITE-STRING WRITE-CHAR PRINC HAIRY-DATA-VECTOR-SET HAIRY-DATA-VECTOR-REF VECTOR-HAIRY-DATA-VECTOR-SET VECTOR-HAIRY-DATA-VECTOR-REF HAIRY-DATA-VECTOR-SET/CHECK-BOUNDS HAIRY-DATA-VECTOR-REF/CHECK-BOUNDS VECTOR-HAIRY-DATA-VECTOR-SET/CHECK-BOUNDS VECTOR-HAIRY-DATA-VECTOR-REF/CHECK-BOUNDS %LDB VECTOR-UNSIGNED-BYTE-8-P)"
>> -+ "((let ((tab #a((32) (unsigned-byte 8) 36 46 7 0 0 19 7 0 0 0 0 60 28 0 7 0 0 7 9 26 31 0 9 51 33 59 9 0 13 57 0 9)))
>> -+  (let ((b (& val #x1f)))
>> -+   (let ((a (>> (<< val 9) 27)))
>> -+    (^ a (aref tab b))))))")
>> - )
>> - ;; EOF
>> Index: pkg/PLIST
>> ===================================================================
>> RCS file: /cvs/ports/lang/sbcl/pkg/PLIST,v
>> diff -u -p -r1.17 PLIST
>> --- pkg/PLIST	16 Oct 2023 08:41:24 -0000	1.17
>> +++ pkg/PLIST	1 May 2024 13:41:32 -0000
>> @@ -2,6 +2,7 @@
>>  @bin bin/sbcl
>>  @info info/asdf.info
>>  @info info/sbcl.info
>> +${COMMENT_libsbcl} lib/libsbcl.so.${LIBsbcl_VERSION}
>>  lib/sbcl/
>>  lib/sbcl/contrib/
>>  lib/sbcl/contrib/asdf.fasl
>> @@ -44,6 +45,7 @@ lib/sbcl/contrib/sb-simple-streams.fasl
>>  lib/sbcl/contrib/sb-sprof.asd
>>  lib/sbcl/contrib/sb-sprof.fasl
>>  lib/sbcl/contrib/uiop.fasl
>> +@static-lib lib/sbcl/libsbcl.a
>>  lib/sbcl/sbcl.core
>>  lib/sbcl/sbcl.mk
>>  @man man/man1/sbcl.1

By the way, I would like to create an sbcl flavor for maxima. 
maxima is currently built with ecl, but sbcl-built maxima is considerably faster, and much more popular.

Are such flavors acceptable?

One thing I can't see in the docs is how to deal with the fact that some entries in PLIST are actually dependent on the name of lisp used.
Should I just add templates there, dependent on a Makefile variable?
Say, in Makefile I can set a variable LISP to be either ecl or sbcl, and then in PLIST I'd use ${LISP} in the relevant paths.

Dima