Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: lang/sbcl - building and installing libsbcl.so ?
To:
Dima Pasechnik <dima@sagemath.org>
Cc:
Theo Buehler <tb@theobuehler.org>, George Koehler <kernigh@gmail.com>, ports@openbsd.org, Sebastien Marie <semarie@kapouay.eu.org>
Date:
Fri, 26 Apr 2024 00:11:31 +0200

Download raw body.

Thread
On Thu, 25 Apr 2024 23:28:27 +0200,
Dima Pasechnik wrote:
>  
> +SHARED_LIBS +=  sbcl                              0.0

I suggest to match library version with sbcl version to avoid nightmare, as
far as I recall upstream doesn't care about ABI stability between releases,
and, for example, .fasl should be recompiled each new release.

>  @info info/sbcl.info
> +@so lib/libsbcl.so.0.0

Without symlink libsbcl.so -> libsbcl.so.0.0 linking agains that library
will be quite tricky.

Minor remarks:
- minus sign as the first character inside the patch should be ok, but may
  be considered quite suspicious.
- you also need to increase reviosion with that changes.
- I suggest to add diff.noprefix=true to port's git config to avoid prefix

Something like this:

diff --git lang/sbcl/Makefile lang/sbcl/Makefile
index 9c849a70c4e..d064d85e5c3 100644
--- lang/sbcl/Makefile
+++ lang/sbcl/Makefile
@@ -7,9 +7,12 @@ COMMENT =	high performance Common Lisp compiler
 V =		2.4.3
 DISTNAME =	sbcl-${V}-source
 PKGNAME =	sbcl-${V}
+REVISION =	0
 
 CATEGORIES =	lang
 
+SHARED_LIBS +=  sbcl                              ${V}
+
 HOMEPAGE =	https://www.sbcl.org/
 
 MAINTAINER =	Sebastien Marie <semarie@kapouay.eu.org>
@@ -90,7 +93,8 @@ MAKE_ENV +=		CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
 			MAKEINFO=${PREFIX}/bin/gmakeinfo \
 			MAN_DIR="${PREFIX}/man/" \
 			INFO_DIR="${PREFIX}/info/" \
-			SBCL_MAKE_JOBS="-j${MAKE_JOBS}"
+			SBCL_MAKE_JOBS="-j${MAKE_JOBS}" \
+			LIBsbcl_VERSION="${LIBsbcl_VERSION}"
 
 USE_GMAKE =		Yes
 
@@ -116,6 +120,8 @@ do-build:
 			--with-sb-core-compression \
 			--with-sb-xref-for-internals \
 			${EXTRA_PARAMS}
+	umask 022 && cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+	        /bin/sh ./make-shared-library.sh
 	umask 022 && cd ${WRKSRC}/doc/manual/ && ${SETENV} ${MAKE_ENV} \
 		${GMAKE} info
 
diff --git lang/sbcl/patches/patch-install_sh lang/sbcl/patches/patch-install_sh
new file mode 100644
index 00000000000..aa619d122a4
--- /dev/null
+++ lang/sbcl/patches/patch-install_sh
@@ -0,0 +1,15 @@
+- install .so with correct version suffix
+
+Index: install.sh
+--- install.sh.orig
++++ install.sh
+@@ -114,7 +114,8 @@ test -f "$BUILD_ROOT$SBCL_HOME"/sbcl.core && \
+ cp src/runtime/$RUNTIME "$BUILD_ROOT$INSTALL_ROOT"/bin/
+ cp output/sbcl.core "$BUILD_ROOT$SBCL_HOME"/sbcl.core
+ test -f src/runtime/libsbcl.so && \
+-    cp src/runtime/libsbcl.so "$BUILD_ROOT$INSTALL_ROOT"/lib/
++    cp src/runtime/libsbcl.so "$BUILD_ROOT$INSTALL_ROOT"/lib/libsbcl.so.${LIBsbcl_VERSION} && \
++    ln -sf libsbcl.so.${LIBsbcl_VERSION} "$BUILD_ROOT$INSTALL_ROOT"/lib/libsbcl.so
+ 
+ cp src/runtime/sbcl.mk "$BUILD_ROOT$SBCL_HOME"/sbcl.mk
+ for i in $(grep '^LIBSBCL=' src/runtime/sbcl.mk | cut -d= -f2-) ; do
diff --git lang/sbcl/patches/patch-src_runtime_GNUmakefile lang/sbcl/patches/patch-src_runtime_GNUmakefile
index 887d4d2ff6d..8f8d37e638e 100644
--- lang/sbcl/patches/patch-src_runtime_GNUmakefile
+++ lang/sbcl/patches/patch-src_runtime_GNUmakefile
@@ -13,3 +13,12 @@ Index: src/runtime/GNUmakefile
  ASFLAGS += $(CFLAGS)
  CPPFLAGS += -I.
  
+@@ -133,7 +133,7 @@ libsbcl.a: $(OBJS)
+ 
+ PIC_OBJS = $(subst .o,.pic.o,$(OBJS))
+ libsbcl.so: $(PIC_OBJS)
+-	$(CC) -shared -o $@ $^ $(LIBS) $(SOFLAGS)
++	$(CC) -shared -fPIC -o $@ $^ $(LDFLAGS) $(LIBS) $(SOFLAGS)
+ # for this to work, you must have with-gcc-tls in your build features already.
+ # can't define it here because then it conflicts if you have it in both places.
+ %.pic.o: %.c
diff --git lang/sbcl/pkg/PLIST lang/sbcl/pkg/PLIST
index 8eece6b846e..512e9e46b65 100644
--- lang/sbcl/pkg/PLIST
+++ lang/sbcl/pkg/PLIST
@@ -2,6 +2,8 @@
 @bin bin/sbcl
 @info info/asdf.info
 @info info/sbcl.info
+@so lib/libsbcl.so
+@bin lib/libsbcl.so.2.4.3
 lib/sbcl/
 lib/sbcl/contrib/
 lib/sbcl/contrib/asdf.fasl


-- 
wbr, Kirill