sbcl: Honor UNLIMIT_RESOURCES and address PaX problems

- Due custom do-{build,test,install} UNLIMIT_RESOURCES were not honored leading
  to:

      //slurp-ucd
       *** - No more room for LISP objects

  errors. Adjust these target to honor UNLIMIT_RESOURCES.
- sbcl does not work with PaX MPROTECT because mmap()s by OR'ing all
  PROT_{EXEC,READ,WRITE}. Unfortunately src/runtime/sbcl is also
  used as part of building needing also `${PAXCTL} +m' in the middle
  of the build.
  Introduce an SBCL_PAXCTL variable (by default `:') via
  patch-src_runtime_GNUmakefile that execute a program against src/runtime/sbcl
  and define it for platforms that have a paxctl tool.
  Mark bin/sbcl with NOT_PAX_MPROTECT_SAFE too.
- Refactor the environment variables injection logic in do-{build,test,install}
  to honor MAKE_ENV and INSTALL_ENV.
- Minor mostly cosmetic adjustments (use ${RM}, not rm)

Bump PKGREVISION
This commit is contained in:
leot 2018-10-17 12:59:49 +00:00
parent dba7653756
commit d40a688ae3
3 changed files with 49 additions and 8 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.77 2018/01/04 14:47:17 jperkin Exp $
# $NetBSD: Makefile,v 1.78 2018/10/17 12:59:49 leot Exp $
DISTNAME= ${PKGNAME_NOREV}-source
PKGNAME= sbcl-1.4.3
PKGREVISION= 1
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=sbcl/}
EXTRACT_SUFX= .tar.bz2
@ -72,6 +73,17 @@ SUBST_FILES.fix-bins+= src/runtime/Config.x86-sunos
SUBST_SED.fix-bins= -e 's,nm ,/usr/bin/nm ,'
SUBST_SED.fix-bins+= -e 's,ggrep,grep,'
.if defined(TOOLS_PLATFORM.paxctl)
SBCL_PAXCTL= ${PAXCTL} +m
MAKE_ENV+= SBCL_PAXCTL=${SBCL_PAXCTL:Q}
.endif
INSTALL_ENV+= BUILD_ROOT=${DESTDIR:Q}
INSTALL_ENV+= INSTALL_ROOT=${PREFIX:Q}
INSTALL_ENV+= MAN_DIR=${PREFIX:Q}/${PKGMANDIR}
NOT_PAX_MPROTECT_SAFE+= bin/sbcl
.if !empty(MACHINE_PLATFORM:MSunOS-*-i386)
SBCL_ARCH_ARGS= "--arch=x86"
.elif !empty(MACHINE_PLATFORM:MSunOS-*-x86_64)
@ -79,20 +91,23 @@ SBCL_ARCH_ARGS= "--arch=x86-64"
.endif
do-build:
cd ${WRKSRC} && ${SH} make.sh --prefix=${PREFIX} ${SBCL_ARCH_ARGS} --xc-host=${SBCL_BOOT_SYSTEM:Q}
${RUN} ${_ULIMIT_CMD} \
cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${SH} make.sh --prefix=${PREFIX} ${SBCL_ARCH_ARGS} --xc-host=${SBCL_BOOT_SYSTEM:Q}
post-build:
cd ${WRKSRC} && ${RM} -f contrib/sb-cover/test-output/*
do-install:
cd ${WRKSRC} && BUILD_ROOT=${DESTDIR:Q} INSTALL_ROOT=${PREFIX:Q} MAN_DIR=${PREFIX:Q}/${PKGMANDIR} ${SH} install.sh
rm -f ${DESTDIR}${PREFIX}/lib/sbcl/sb-posix/test-output/write-test.txt
rm -f ${DESTDIR}${PREFIX}/lib/sbcl/sb-posix/test-output/read-test.txt
rm -f ${DESTDIR}${PREFIX}/lib/sbcl/asdf-install/installer.lisp.orig
${RUN} ${_ULIMIT_CMD} \
cd ${WRKSRC} && ${PKGSRC_SETENV} ${INSTALL_ENV} ${SH} install.sh
${RM} -f ${DESTDIR}${PREFIX}/lib/sbcl/sb-posix/test-output/write-test.txt
${RM} -f ${DESTDIR}${PREFIX}/lib/sbcl/sb-posix/test-output/read-test.txt
${RM} -f ${DESTDIR}${PREFIX}/lib/sbcl/asdf-install/installer.lisp.orig
do-test:
# for f in compiler.pure.lisp interface.pure.lisp compiler.impure.lisp debug.impure.lisp interface.impure.lisp; do mv ${WRKSRC}/tests/$$f ${WRKSRC}/tests/$$f.off || :; done
cd ${WRKSRC}/tests && ${SH} ./run-tests.sh
${RUN} ${_ULIMIT_CMD} \
cd ${WRKSRC}/tests && ${PKGSRC_SETENV} ${TEST_ENV} ${SH} ./run-tests.sh
.if ${MACHINE_ARCH} == "x86_64"
PLIST_SUBST+= SUFX64=-64

View file

@ -1,10 +1,11 @@
$NetBSD: distinfo,v 1.56 2018/01/04 14:47:17 jperkin Exp $
$NetBSD: distinfo,v 1.57 2018/10/17 12:59:49 leot Exp $
SHA1 (sbcl-1.4.3-source.tar.bz2) = cf610061ee2e8bf90efcf830f45412b68f43d0dc
RMD160 (sbcl-1.4.3-source.tar.bz2) = eb3024ae6980239c6784ee4d234874782870cca4
SHA512 (sbcl-1.4.3-source.tar.bz2) = e730f4f095e2c3b52836df0beae08219a2e3883b4e20ba7303f24d8e51aec7c6d278ad6f9d57fac36b5aebec3fefb118d07bfd4ca48a44a3324345f2993fca62
Size (sbcl-1.4.3-source.tar.bz2) = 5953041 bytes
SHA1 (patch-ab) = b087921f7317523fd78396518dfd2cb1c8e6d5f9
SHA1 (patch-src_runtime_GNUmakefile) = bb1fffdaa90897d4ddcaedc3d480778917348281
SHA1 (patch-src_runtime_backtrace.c) = ba3d7d152b279652d7074ebc9ba615c9d899f35c
SHA1 (patch-src_runtime_breakpoint.c) = 019d98692411b5701ce14c023ed3afab71033323
SHA1 (patch-src_runtime_bsd-os.c) = 1c2bb3ce517aea03bbc4f09708e8300085253286

View file

@ -0,0 +1,25 @@
$NetBSD: patch-src_runtime_GNUmakefile,v 1.1 2018/10/17 12:59:49 leot Exp $
Add support to invoke paxctl(8) or similar programs to adjust PaX
permissions of src/runtime/sbcl during the build phase.
--- src/runtime/GNUmakefile.orig 2017-12-29 09:55:08.000000000 +0000
+++ src/runtime/GNUmakefile
@@ -14,6 +14,9 @@
all: targets tags
TARGET=sbcl
+# paxctl(8) or similar programs to adjust PaX permissions of src/runtime/sbcl
+SBCL_PAXCTL ?= :
+
# Defaults which might be overridden or modified by values in the
# Config file. Most of them are same on most systems right now.
# If you need to override one of these, do it in Config.
@@ -78,6 +81,7 @@ targets: $(TARGET) $(OBJTARGET) sbcl.nm
$(TARGET): $(LIBSBCL)
$(CC) ${LINKFLAGS} -o $@ $(USE_LIBSBCL) $(LIBS)
+ $(SBCL_PAXCTL) $@
# ld -r -o sbcl.o works on Linux, but not on other platforms.
# On macOS, it fails to keep debug sections.