Index: lang/ecl-sage/Makefile =================================================================== --- lang/ecl-sage/Makefile +++ lang/ecl-sage/Makefile @@ -5,9 +5,10 @@ PORTVERSION= 16.1.3 CATEGORIES= lang lisp MASTER_SITES= https://common-lisp.net/project/ecl/static/files/release/ +PKGNAMESUFFIX= -sage -MAINTAINER= olgeni@FreeBSD.org -COMMENT= ANSI Common Lisp implementation +MAINTAINER= thierry@FreeBSD.org +COMMENT= ANSI Embeddable Common Lisp implementation for SageMath LICENSE= LGPL20 @@ -15,19 +16,23 @@ BROKEN_mips= fails to build: qemu: uncaught target signal 11 (Segmentation fault) - core dumped BROKEN_mips64= fails to build: qemu: uncaught target signal 11 (Segmentation fault) - core dumped -LIB_DEPENDS= libgmp.so:math/gmp +LIB_DEPENDS= libgmp.so:math/gmp \ + libgc.so:devel/boehm-gc MAKE_JOBS_UNSAFE= yes -USES= gmake perl5 tar:tgz +USES= autoreconf gmake localbase perl5 tar:tgz USE_PERL5= build GNU_CONFIGURE= yes -CONFIGURE_ARGS= --with-system-gmp --with-gmp-prefix=${LOCALBASE} --enable-boehm=system -CFLAGS+= -I${LOCALBASE}/include -LDFLAGS+= -L${LOCALBASE}/lib +AUTORECONF_WRKSRC= ${WRKSRC}/src + +CONFLICTS= ecl-16.* + +CONFIGURE_ARGS= --with-system-gmp --with-gmp-prefix=${LOCALBASE} \ + --enable-boehm=system USE_LDCONFIG= yes OPTIONS_DEFINE= ASDF DFFI SOCKETS THREADS X11 -OPTIONS_DEFAULT=ASDF DFFI SOCKETS THREADS +OPTIONS_DEFAULT=ASDF DFFI SOCKETS ASDF_DESC= Enable ASDF building facility SOCKETS_DESC= Enable socket interface @@ -54,14 +59,16 @@ THREADS_CONFIGURE_ON= --enable-threads=yes THREADS_LDFLAGS= -lpthread THREADS_LIB_DEPENDS= libgc-threaded.so:devel/boehm-gc-threaded +THREADS_LIBS= -lgc-threaded THREADS_CONFIGURE_OFF= --enable-threads=no -THREADS_LIB_DEPENDS_OFF= libgc.so:devel/boehm-gc +THREADS_BOKEN= fails to build: segmentation fault post-patch-THREADS-on: - @${REINPLACE_CMD} -e 's|-lgc|-lgc-threaded|' ${WRKSRC}/src/configure + ${REINPLACE_CMD} -e 's|-lgc|-lgc-threaded|' ${WRKSRC}/src/configure post-install: ${RMDIR} ${STAGEDIR}${PREFIX}/include/ecl/gc/private ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libecl.so.${PORTVERSION} + ${LN} -sf ecl-${PORTVERSION} ${STAGEDIR}${PREFIX}/lib/ecl .include Index: lang/ecl-sage/files/patch-src_Makefile.in =================================================================== --- lang/ecl-sage/files/patch-src_Makefile.in +++ lang/ecl-sage/files/patch-src_Makefile.in @@ -0,0 +1,19 @@ +--- src/Makefile.in.orig 2016-12-19 10:25:00 UTC ++++ src/Makefile.in +@@ -304,10 +304,14 @@ install: + if test -s $$i ; then \ + if echo $$i | grep dll; then \ + $(INSTALL_LIBRARY) $$i $(DESTDIR)$(bindir); \ +- fi; \ +- $(INSTALL_LIBRARY) $$i $(DESTDIR)$(libdir); \ ++ else \ ++ $(INSTALL_LIBRARY) $$i $(DESTDIR)$(libdir); \ ++ fi \ + fi \ + done ++ if [ "x@IMPLIB_NAME@" != "x" -a -f "@IMPLIB_NAME@" ]; then \ ++ $(INSTALL_LIBRARY) @IMPLIB_NAME@ $(DESTDIR)$(libdir); \ ++ fi + if [ "x@SONAME3@" != "x" -a -f "@SONAME3@" ]; then \ + ( $(INSTALL_LIBRARY) @SONAME3@ $(DESTDIR)$(libdir) && \ + cd $(DESTDIR)$(libdir) && $(RM) -f @SONAME2@ @SONAME1@ @SONAME@ && \ Index: lang/ecl-sage/files/patch-src_aclocal.m4 =================================================================== --- lang/ecl-sage/files/patch-src_aclocal.m4 +++ lang/ecl-sage/files/patch-src_aclocal.m4 @@ -0,0 +1,64 @@ +--- src/aclocal.m4.orig 2016-12-19 10:25:00 UTC ++++ src/aclocal.m4 +@@ -231,6 +231,8 @@ AC_SUBST(LIBPREFIX)dnl Name components of a statically + AC_SUBST(LIBEXT) + AC_SUBST(SHAREDEXT)dnl Name components of a dynamically linked library + AC_SUBST(SHAREDPREFIX) ++AC_SUBST(IMPLIB_EXT)dnl Name components of a dynamically linked library import file - borrowed from SageMath ++AC_SUBST(IMPLIB_PREFIX) + AC_SUBST(OBJEXT)dnl These are set by autoconf + AC_SUBST(EXEEXT) + AC_SUBST(INSTALL_TARGET)dnl Which type of installation: flat directory or unix like. +@@ -240,6 +242,8 @@ ECL_GC_DIR=bdwgc + ECL_LDRPATH='' + SHAREDEXT='so' + SHAREDPREFIX='lib' ++IMPLIB_EXT='' ++IMPLIB_PREFIX='' + LIBPREFIX='lib' + LIBEXT='a' + PICFLAG='-fPIC' +@@ -251,6 +255,8 @@ THREAD_OBJ="$THREAD_OBJ c/threads/process c/threads/qu + clibs='-lm' + SONAME='' + SONAME_LDFLAGS='' ++IMPLIB_NAME='' ++IMPLIB_LDFLAGS='' + case "${host_os}" in + linux-androideabi) + thehost='android' +@@ -366,10 +372,14 @@ case "${host_os}" in + shared='yes' + THREAD_CFLAGS='-D_THREAD_SAFE' + THREAD_LIBS='-lpthread' +- SHARED_LDFLAGS="-shared ${LDFLAGS}" +- BUNDLE_LDFLAGS="-shared ${LDFLAGS}" +- SHAREDPREFIX='' ++ SHARED_LDFLAGS="-shared -Wl,--enable-auto-image-base ${LDFLAGS}" ++ BUNDLE_LDFLAGS="-shared -Wl,--enable-auto-image-base ${LDFLAGS}" ++ SHAREDPREFIX='cyg' + SHAREDEXT='dll' ++ IMPLIB_PREFIX='lib' ++ IMPLIB_EXT='dll.a' ++ IMPLIB_NAME="${IMPLIB_PREFIX}ecl.${IMPLIB_EXT}" ++ IMPLIB_LDFLAGS="-Wl,--out-implib,${IMPLIB_NAME}" + PICFLAG='' + if test "x$host_cpu" = "xx86_64" ; then + # Our GMP library is too old and does not support +@@ -387,10 +397,14 @@ case "${host_os}" in + enable_threads='yes' + THREAD_CFLAGS='-D_THREAD_SAFE' + THREAD_GC_FLAGS='--enable-threads=win32' +- SHARED_LDFLAGS='' +- BUNDLE_LDFLAGS='' ++ SHARED_LDFLAGS="-shared -Wl,--enable-auto-image-base ${LDFLAGS}" ++ BUNDLE_LDFLAGS="-shared -Wl,--enable-auto-image-base ${LDFLAGS}" + SHAREDPREFIX='' + SHAREDEXT='dll' ++ IMPLIB_PREFIX='lib' ++ IMPLIB_EXT='dll.a' ++ IMPLIB_NAME="${IMPLIB_PREFIX}ecl.${IMPLIB_EXT}" ++ IMPLIB_LDFLAGS="-Wl,--out-implib,${IMPLIB_NAME}" + PICFLAG='' + INSTALL_TARGET='flatinstall' + TCPLIBS='-lws2_32' Index: lang/ecl-sage/files/patch-src_c_file.d =================================================================== --- lang/ecl-sage/files/patch-src_c_file.d +++ lang/ecl-sage/files/patch-src_c_file.d @@ -0,0 +1,15 @@ +--- src/c/file.d.orig 2016-12-19 10:25:00 UTC ++++ src/c/file.d +@@ -3351,8 +3351,10 @@ output_stream_write_byte8(cl_object strm, unsigned cha + ecl_disable_interrupts(); + do { + out = fwrite(c, sizeof(char), n, IO_STREAM_FILE(strm)); +- } while (out < n && restartable_io_error(strm, "fwrite")); +- ecl_enable_interrupts(); ++ /* Ignore write errors to stderr to avoid an infinite loop - patch from SageMath */ ++ } while (out < n && (IO_STREAM_FILE(strm) != stderr) && restartable_io_error(strm, "fwrite")); ++ ++ ecl_enable_interrupts(); + return out; + } + Index: lang/ecl-sage/files/patch-src_compile.lsp.in =================================================================== --- lang/ecl-sage/files/patch-src_compile.lsp.in +++ lang/ecl-sage/files/patch-src_compile.lsp.in @@ -0,0 +1,13 @@ +--- src/compile.lsp.in.orig 2016-12-19 10:25:00 UTC ++++ src/compile.lsp.in +@@ -142,8 +142,9 @@ + #+:wants-dlopen + ;;; + ;;; We do not need the -rpath flag for the library, nor -lecl. ++;;; Patch borrowed from SageMath + ;;; +-(let* ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @SONAME_LDFLAGS@ @CORE_LIBS@ @FASL_LIBS@ @LIBS@" ++(let* ((c::*ld-shared-flags* #-msvc " @IMPLIB_LDFLAGS@ @SHARED_LDFLAGS@ @LDFLAGS@ @SONAME_LDFLAGS@ @CORE_LIBS@ @FASL_LIBS@ @LIBS@" + #+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@") + (c::*cc-flags* (concatenate 'string "-DECL_API -I@true_builddir@/c " c::*cc-flags*)) + (extra-args nil)) Index: lang/ecl-sage/files/patch-src_configure.ac =================================================================== --- lang/ecl-sage/files/patch-src_configure.ac +++ lang/ecl-sage/files/patch-src_configure.ac @@ -0,0 +1,22 @@ +--- src/configure.ac.orig 2016-12-19 10:25:00 UTC ++++ src/configure.ac +@@ -606,6 +606,19 @@ AC_SUBST(SONAME1) + AC_SUBST(SONAME) + AC_SUBST(SONAME_LDFLAGS) + ++dnl ---------------------------------------------------------------------- ++dnl IMPLIB_NAME is only active when IMPLIB_NAME is non nil ++dnl Patch borrowed from SageMath ++AC_MSG_CHECKING(for import name) ++if test "${enable_soname}" != yes; then ++ IMPLIB_NAME='' ++ AC_MSG_RESULT([none]) ++else ++ AC_MSG_RESULT([${IMPLIB_NAME}]) ++fi ++AC_SUBST(IMPLIB_NAME) ++AC_SUBST(IMPLIB_LDFLAGS) ++ + dnl Related to that, the package version number + ECL_VERSION_NUMBER=$(($PACKAGE_MAJOR * 10000 + $PACKAGE_MINOR * 100 + $PACKAGE_LEAST)) + AC_SUBST(ECL_VERSION_NUMBER) Index: lang/ecl-sage/files/patch-src_lsp_format.lsp =================================================================== --- lang/ecl-sage/files/patch-src_lsp_format.lsp +++ lang/ecl-sage/files/patch-src_lsp_format.lsp @@ -0,0 +1,78 @@ +--- src/lsp/format.lsp.orig 2016-12-19 10:25:00 UTC ++++ src/lsp/format.lsp +@@ -308,11 +308,14 @@ + :start (format-directive-start struct) + :end (format-directive-end struct)))) + ++;; Patch borrowed from SageMath ++(defconstant +format-directive-limit+ (1+ (char-code #\~))) ++ + #+formatter + (defparameter *format-directive-expanders* +- (make-array char-code-limit :initial-element nil)) ++ (make-array +format-directive-limit+ :initial-element nil)) + (defparameter *format-directive-interpreters* +- (make-array char-code-limit :initial-element nil)) ++ (make-array +format-directive-limit+ :initial-element nil)) + + (defparameter *default-format-error-control-string* nil) + (defparameter *default-format-error-offset* nil) +@@ -545,24 +548,24 @@ + (write-string directive stream) + (interpret-directive-list stream (cdr directives) orig-args args)) + (#-ecl format-directive #+ecl vector ++ (multiple-value-bind ++ (new-directives new-args) ++ (let* ((code (char-code (format-directive-character directive))) ++ (function ++ (and (< code +format-directive-limit+) ++ (svref *format-directive-interpreters* code))) ++ (*default-format-error-offset* ++ (1- (format-directive-end directive)))) ++ (unless function ++ (error 'format-error ++ :complaint "Unknown format directive.")) + (multiple-value-bind + (new-directives new-args) +- (let ((function +- (svref *format-directive-interpreters* +- (char-code (format-directive-character +- directive)))) +- (*default-format-error-offset* +- (1- (format-directive-end directive)))) +- (unless function +- (error 'format-error +- :complaint "Unknown format directive.")) +- (multiple-value-bind +- (new-directives new-args) +- (funcall function stream directive +- (cdr directives) orig-args args) +- (values new-directives new-args))) +- (interpret-directive-list stream new-directives +- orig-args new-args))))) ++ (funcall function stream directive ++ (cdr directives) orig-args args) ++ (values new-directives new-args))) ++ (interpret-directive-list stream new-directives ++ orig-args new-args))))) + args)) + + +@@ -634,11 +637,12 @@ + (values `(write-string ,directive stream) + more-directives)) + (format-directive +- (let ((expander +- (aref *format-directive-expanders* +- (char-code (format-directive-character directive)))) +- (*default-format-error-offset* +- (1- (format-directive-end directive)))) ++ (let* ((code (char-code (format-directive-character directive))) ++ (expander ++ (and (< code +format-directive-limit+) ++ (svref *format-directive-expanders* code))) ++ (*default-format-error-offset* ++ (1- (format-directive-end directive)))) + (if expander + (funcall expander directive more-directives) + (error 'format-error Index: lang/ecl-sage/pkg-descr =================================================================== --- lang/ecl-sage/pkg-descr +++ lang/ecl-sage/pkg-descr @@ -3,4 +3,7 @@ (Common-Lisp Object System), conditions, loops, etc, plus a translator to C, which can produce standalone executables. +This a speciallly patched version for a dynamically linked library, to be +used with SageMath. + WWW: https://common-lisp.net/project/ecl/main.html Index: lang/ecl-sage/pkg-plist =================================================================== --- lang/ecl-sage/pkg-plist +++ lang/ecl-sage/pkg-plist @@ -84,6 +84,7 @@ include/ecl/object.h include/ecl/page.h include/ecl/stacks.h +lib/ecl lib/ecl-%%VERSION%%/COPYING lib/ecl-%%VERSION%%/LICENSE lib/ecl-%%VERSION%%/TAGS