Hi Joshua,

the attached patch enables threading support in lang/sbcl, which is
disabled by default for systems other than Linux.

I briefly tested the results with bordeaux-threads, which seems to work
fine now.

The only downside of the change that I have noticed is that it changes
*FEATURES*, which invalidates precompiled Lisp bytecode. This could be
cumbersome for unprepared users because it also applies to the REPL, but
removing cached bytecode in ~/.cache/common-lisp/sbcl* fixes that.

-- 
        Gregor Best
diff -Nur /usr/ports/lang/sbcl/Makefile lang/sbcl/Makefile
--- /usr/ports/lang/sbcl/Makefile       Fri Dec 13 13:07:12 2013
+++ lang/sbcl/Makefile  Tue Feb 18 15:30:05 2014
@@ -10,6 +10,7 @@
 PKGNAME=               sbcl-${V}
 WRKDIST=               ${WRKDIR}/sbcl-${V}
 EXTRACT_SUFX=          .tar.bz2
+REVISION=      1
 
 CATEGORIES=            lang
 HOMEPAGE=              http://www.sbcl.org/
@@ -41,8 +42,8 @@
 PORTHOME=              ${TMPDIR}
 MAKE_ENV=              GNUMAKE=${GMAKE} INSTALL_ROOT=${PREFIX} \
                        MAN_DIR=${PREFIX}/man INFO_DIR=${PREFIX}/info \
-                       LINKFLAGS="-nopie" LDFLAGS="-nopie"
-CFLAGS +=              -fno-pie
+                       LINKFLAGS="-nopie -pthread" LDFLAGS="-nopie -pthread"
+CFLAGS +=              -fno-pie -pthread
 
 # Upstream asks that packagers append something like this to the
 # version to distinguish official tarballs from third-party packages.
@@ -60,7 +61,8 @@
 
 do-build:
        cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} SBCL_CONTRIB_TARGET=all \
-               /bin/sh make.sh --prefix=${PREFIX} --xc-host="${BOOTSTRAP_CMD}"
+               /bin/sh make.sh --prefix=${PREFIX} --xc-host="${BOOTSTRAP_CMD}" 
\
+                       --with-sb-thread
        cd ${WRKSRC}/doc/manual && touch sbcl.texinfo && \
                ${SETENV} ${MAKE_ENV} ${GMAKE} asdf.info sbcl.info html
 
diff -Nur /usr/ports/lang/sbcl/patches/patch-src_runtime_bsd-os_h 
lang/sbcl/patches/patch-src_runtime_bsd-os_h
--- /usr/ports/lang/sbcl/patches/patch-src_runtime_bsd-os_h     Thu Jan  1 
01:00:00 1970
+++ lang/sbcl/patches/patch-src_runtime_bsd-os_h        Tue Feb 18 15:45:00 2014
@@ -0,0 +1,11 @@
+--- src/runtime/bsd-os.h.old   Tue Feb 18 15:26:08 2014
++++ src/runtime/bsd-os.h       Tue Feb 18 15:26:33 2014
+@@ -69,6 +69,8 @@
+ extern int openbsd_use_fxsave;
+ #endif
+ 
++#define SIG_STOP_FOR_GC (SIGUSR2)
++
+ #elif defined __NetBSD__
+ 
+ #include <ucontext.h>

Reply via email to