swi-prolog*: Update to 8.0.1

pkgsrc changes:
 - Rename swi-prolog to swipl to follow upstream nomenclature
 - Add all main packages (except X11) to swi-prolog-lite.
   After CMake migration in order to generate the documentation and being able
   to use it (e.g. via help/2) it is needed to add basic, archive, ssl and term
   packages.
   All X11 packages are provided by swi-prolog-packages.
 - Adjust pkgsrc Makefile-s logic to upstream CMake migration:
    o Uncoditionally disable not wanted packages in Makefile.common (to avoid
      possible PLIST mismatches; please note that this will probably disable
      tipc package on Linux!).
      All other installed packages are enabled/disabled via
      swi-prolog-{lite,packages,jpl} Makefile.
    o Add libarchive, ossp-uuid and openssl build dependency to
      swi-prolog-packages.  Despite these are provided by swi-prolog-lite
      they are needed as part of the build of swi-prolog-packages too.
    o Remove no more needed logic to check and eventually start X server to
      build documentation.  Should address PR pkg/42047.
 - Remove an unconditional CHECK_WRKREF_SKIP, this was needed on FreeBSD
   but unfortunately it is not clear why.  If this is still needed please let
   me know in order to try to investigate further and address that.
 - Bump API requirements to 8.0.1 in buildlink3.mk to be on the safe side
   now that shared libraries are provided on all platforms.

Changes:
8.0.1
-----
Indexing on multiple arguments together, indexing inside compounds,
Mode-directed tabling, saved states using ZIP files, many deployment
enhancements. Moved build environment to CMake and removed most of
the build tool dependencies. Builds documentation along with the
binary.

Please note that this is just a short summary. Unfortunately the
complete changelog is very long, full changelog can be found at:

 <http://www.swi-prolog.org/ChangeLog?branch=stable&from=7.6.4&to=8.0.1>
This commit is contained in:
leot 2019-02-25 15:20:44 +00:00
parent af4527b32b
commit 809a0f3982
21 changed files with 1946 additions and 2173 deletions

View file

@ -1,50 +1,46 @@
# $NetBSD: Makefile,v 1.5 2018/12/10 14:59:50 leot Exp $
# $NetBSD: Makefile,v 1.6 2019/02/25 15:20:44 leot Exp $
.include "../../lang/swi-prolog-lite/Makefile.common"
PKGNAME= swi-prolog-jpl-${SWIPLVERS}
MAINTAINER= pkgsrc-users@NetBSD.org
COMMENT= jpl package for SWI Prolog
COMMENT= Packages for SWI Prolog
GNU_CONFIGURE= yes
USE_TOOLS+= gmake pkg-config
MAKE_JOBS_SAFE= no
USE_TOOLS+= pkg-config
CMAKE_ARGS+= -DSWIPL_PACKAGES_JAVA=ON
CMAKE_ARGS+= -DINSTALL_PACKAGES=OFF
CMAKE_ARGS+= -DINSTALL_DOCUMENTATION=OFF
# Part of swi-prolog-lite
CMAKE_ARGS+= -DSWIPL_PACKAGES_ARCHIVE=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_BASIC=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_SSL=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_TERM=OFF
# Part of swi-prolog-packages
CMAKE_ARGS+= -DSWIPL_PACKAGES_X=OFF
SWIPL_PACKAGES_COMPONENTS+= Java_interface
.include "../../mk/bsd.prefs.mk"
CONFIGURE_ENV+= PL=swi-prolog
CONFIGURE_ENV+= PLARCH=${MACHINE_GNU_PLATFORM} # make PLIST consistent
CONFIGURE_ENV+= PKG=jpl
CONFIGURE_ENV+= JAVAC=${PKG_JAVA_HOME}/bin/javac
CONFIGURE_DIRS+= . packages
BUILD_DIRS+= packages/jpl
INSTALL_DIRS+= packages/jpl
BUILD_TARGET= libjpl.so jpl.jar
INSTALLATION_DIRS= lib/swi-prolog-${PKGVERSION_NOREV}/bin/${MACHINE_GNU_PLATFORM}
CPPFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS
TEST_TARGET= check
pre-configure:
${LN} -sf ${LOCALBASE}/bin/plld ${WRKSRC}/src
${LN} -sf ${LOCALBASE}/bin/swi-prolog ${WRKSRC}/src
post-configure:
${LN} -sf ${LOCALBASE}/bin/plld ${WRKSRC}/src
${LN} -sf ${LOCALBASE}/bin/swi-prolog ${WRKSRC}/src
cd ${WRKSRC}/packages; \
${SETENV} \
CPP=${CPP:Q} \
${GMAKE} PKG=jpl configure
mkdir ${WRKSRC}/include
${LN} -sf ${WRKSRC}/src/SWI-Prolog.h ${WRKSRC}/include
${LN} -sf ${WRKSRC}/src/os/SWI-Stream.h ${WRKSRC}/include
do-install:
.for component in ${SWIPL_PACKAGES_COMPONENTS}
cd ${WRKSRC}/build && \
${PKGSRC_SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
${CMAKE} -DCMAKE_INSTALL_COMPONENT=${component:Q} \
-P cmake_install.cmake
.endfor
.include "../../lang/swi-prolog-lite/buildlink3.mk"
.include "../../mk/java-vm.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../devel/gmp/buildlink3.mk"
.include "../../mk/curses.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.1 2014/05/28 10:33:00 markd Exp $
lib/swi-prolog-${PKGVERSION}/lib/jpl.jar
lib/swi-prolog-${PKGVERSION}/library/jpl.pl
lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libjpl.so
@comment $NetBSD: PLIST,v 1.2 2019/02/25 15:20:44 leot Exp $
lib/swipl/lib/jpl.jar
lib/swipl/lib/${MACHINE_GNU_PLATFORM}/libjpl.so
lib/swipl/library/jpl.pl

View file

@ -6,5 +6,5 @@ on atoms), fast and powerful C/C++ interface, autoloading,
GNU-readline interface. SWI-Prolog supports architectures with 32-bit
or greater (64-bit) word-length.
This is the core package, packages are available in the
swi-prolog-packages package.
This is the core package with basic SWI-Prolog packages.
X11 packages are available via swi-prolog-packages package.

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.28 2018/12/10 14:59:50 leot Exp $
# $NetBSD: Makefile,v 1.29 2019/02/25 15:20:44 leot Exp $
.include "Makefile.common"
@ -7,12 +7,20 @@ PKGNAME= swi-prolog-lite-${SWIPLVERS}
MAINTAINER= pkgsrc-users@NetBSD.org
COMMENT= ISO/Edinburgh-style Prolog compiler
GNU_CONFIGURE= yes
CONFIGURE_DIRS= src
CMAKE_ARGS+= -DSWIPL_INSTALL_MANPAGES=${PKGMANDIR}/man1
CMAKE_ARGS+= -DSWIPL_PACKAGES_BASIC=ON
CMAKE_ARGS+= -DSWIPL_PACKAGES_ARCHIVE=ON
CMAKE_ARGS+= -DSWIPL_PACKAGES_SSL=ON
CMAKE_ARGS+= -DSWIPL_PACKAGES_TERM=ON
CMAKE_ARGS+= -DINSTALL_DOCUMENTATION=ON
CONFIGURE_ENV+= PL=swi-prolog
CONFIGURE_ENV+= PLARCH=${MACHINE_GNU_PLATFORM} # make PLIST consistent
USE_TOOLS+= gmake bash:run
# Part of swi-prolog-jpl
CMAKE_ARGS+= -DSWIPL_PACKAGES_JAVA=OFF
# Part of swi-prolog-packages
CMAKE_ARGS+= -DSWIPL_PACKAGES_X=OFF
USE_TOOLS+= bash:run
.include "../../mk/bsd.prefs.mk"
@ -25,12 +33,23 @@ PLIST_SUBST+= BITS=32
REPLACE_INTERPRETER+= swipl
REPLACE.swipl.old= /usr/bin/swipl
REPLACE.swipl.new= ${PREFIX}/bin/swi-prolog
REPLACE.swipl.new= ${PREFIX}/bin/swipl
REPLACE_FILES.swipl+= library/dialect/sicstus/swipl-lfr.pl
# XXX: editline bindings seems limited and does not support completion, remove
# XXX: them in order to always use readline.pl.
post-install:
${RM} ${DESTDIR}${PREFIX}/lib/swipl/lib/${MACHINE_GNU_PLATFORM}/libedit4pl.so || ${TRUE}
${RM} ${DESTDIR}${PREFIX}/lib/swipl/library/editline.pl || ${TRUE}
TEST_TARGET= check
.include "../../archivers/libarchive/buildlink3.mk"
.include "../../devel/gmp/buildlink3.mk"
.include "../../devel/ossp-uuid/buildlink3.mk"
.include "../../devel/readline/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../mk/curses.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,10 +1,10 @@
# $NetBSD: Makefile.common,v 1.15 2018/12/10 14:59:50 leot Exp $
# $NetBSD: Makefile.common,v 1.16 2019/02/25 15:20:44 leot Exp $
#
# used by lang/swi-prolog/Makefile
# used by lang/swi-prolog-packages/Makefile
# used by lang/swi-prolog-jpl/Makefile
SWIPLVERS= 7.6.4
SWIPLVERS= 8.0.1
DISTNAME= swipl-${SWIPLVERS}
CATEGORIES= lang
MASTER_SITES= http://www.swi-prolog.org/download/stable/src/
@ -17,5 +17,33 @@ DIST_SUBDIR= swi-prolog
DISTINFO_FILE= ${.CURDIR}/../../lang/swi-prolog-lite/distinfo
PATCHDIR= ${.CURDIR}/../../lang/swi-prolog-lite/patches
CONFIGURE_ENV+= CMFLAGS="-fPIC"
CONFIGURE_ENV+= COFLAGS=${CFLAGS:M*:Q}
USE_CMAKE= yes
CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
CMAKE_ARGS+= -DSWIPL_ARCH=${MACHINE_GNU_PLATFORM}
# XXX: Explicitly disable all not wanted packages to avoid possible build
# XXX: failures. For a complete list please see:
# XXX: ${WRKSRC}/cmake/PackageSelection.cmake
CMAKE_ARGS+= -DSWIPL_PACKAGES_ODBC=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_BDB=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_PCRE=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_YAML=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_TIPC=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_QT=OFF
USE_LANGUAGES= c c++
# XXX: That's kludgy, can it be avoided?
MAKE_ENV+= LD_LIBRARY_PATH=${WRKSRC}/build/src
# XXX: Can this be addressed differently without appending to the LDFLAGS?
# XXX: (i.e. it should just work(TM))
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/swipl/lib/${MACHINE_GNU_PLATFORM}
CONFIGURE_DIRS= build
CMAKE_ARG_PATH= ..
PRINT_PLIST_AWK+= { sub("${MACHINE_GNU_PLATFORM}", "$${MACHINE_GNU_PLATFORM}") }
pre-configure:
cd ${WRKSRC} && ${MKDIR} build

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
@comment $NetBSD: PLIST.Darwin,v 1.1 2012/09/28 07:58:06 sbd Exp $
lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libswipl.so
lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libswipl.so.${PKGVERSION}

View file

@ -1,4 +0,0 @@
@comment $NetBSD: PLIST.Linux-x86_64,v 1.2 2019/01/06 08:55:47 markd Exp $
lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libswipl.so
lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libswipl.so.7.6
lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libswipl.so.${PKGVERSION}

View file

@ -1,12 +1,11 @@
# $NetBSD: buildlink3.mk,v 1.13 2018/12/10 14:59:50 leot Exp $
# $NetBSD: buildlink3.mk,v 1.14 2019/02/25 15:20:44 leot Exp $
BUILDLINK_TREE+= swi-prolog-lite
.if !defined(SWI_PROLOG_LITE_BUILDLINK3_MK)
SWI_PROLOG_LITE_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.swi-prolog-lite+= swi-prolog-lite>=5.2.9
BUILDLINK_ABI_DEPENDS.swi-prolog-lite+= swi-prolog-lite>=6.6.6nb2
BUILDLINK_API_DEPENDS.swi-prolog-lite+= swi-prolog-lite>=8.0.1
BUILDLINK_PKGSRCDIR.swi-prolog-lite?= ../../lang/swi-prolog-lite
.endif # SWI_PROLOG_LITE_BUILDLINK3_MK

View file

@ -1,14 +1,7 @@
$NetBSD: distinfo,v 1.23 2019/01/06 08:55:47 markd Exp $
$NetBSD: distinfo,v 1.24 2019/02/25 15:20:44 leot Exp $
SHA1 (swi-prolog/swipl-7.6.4.tar.gz) = 655acec1abb62a2d09edc85f52a08101a9665379
RMD160 (swi-prolog/swipl-7.6.4.tar.gz) = 26e4358d277761380298d9e8c189e9aa1147609c
SHA512 (swi-prolog/swipl-7.6.4.tar.gz) = f0ed16e4f1436115651c38a0bb37008d0dadad5a19b0f09894fcfc51dd3d429f86488e89cce00788c3c36cc2f0cd2957f92df47d5441133a6f8ea9d91ca5470f
Size (swi-prolog/swipl-7.6.4.tar.gz) = 16777875 bytes
SHA1 (patch-ad) = f5e7ec0cce757963e021539a397af387eff5cf8f
SHA1 (patch-packages_Dialect.defs.in) = 7ef29c29efc62e9162c53e88efc1f3e9ec987198
SHA1 (swi-prolog/swipl-8.0.1.tar.gz) = 968fd2ff33d6b7b7d6d3d8131fc3362dcdd7652e
RMD160 (swi-prolog/swipl-8.0.1.tar.gz) = d55cd4c359c71c2bc0f0eb6eefc5e7faa0802462
SHA512 (swi-prolog/swipl-8.0.1.tar.gz) = 40ffb9ecf213ae49b397e5a37d6fb90b83fc353a8408662e193e289c87de9e851427f6523061f067050b258ddad1ded157caf8124149c0335203b9bf08e7baf6
Size (swi-prolog/swipl-8.0.1.tar.gz) = 10364104 bytes
SHA1 (patch-packages_clib_sha1_brg_endian.h) = e7bc21953cedafce67e0070b9ec326446bf474fa
SHA1 (patch-src_configure) = 97a016c8377dd093a03194701c0adb567c275d56
SHA1 (patch-src_os_pl-files.c) = 222a9a4682808fc62e410b01f38e31c4dcc62f53
SHA1 (patch-src_pl-funcs.h) = fd821e245ca49a42e595096d05a21ee20d25c41c
SHA1 (patch-src_pl-rsort.c) = 233430c9ead3e1361f40ae541d0527408a141d6e
SHA1 (patch-src_pl-thread.c) = d45bb808e8fc80ab0766720415677328bd9bee1c

View file

@ -1,19 +0,0 @@
$NetBSD: patch-ad,v 1.6 2018/12/10 14:59:50 leot Exp $
Split install target.
--- packages/Makefile.in.orig 2018-01-12 12:04:38.000000000 +0000
+++ packages/Makefile.in
@@ -112,9 +112,11 @@ install::
$(MAKE) -C $$p $@ || echo $$p >> .failed.$@; \
fi; \
done
- $(FORCE_MKINDEX)
$(END_FORPKG)
+post-install::
+ $(FORCE_MKINDEX)
+
rpm-install: html-install
$(BEGIN_FORPKG)
for p in $(PKG); do \

View file

@ -1,15 +0,0 @@
$NetBSD: patch-packages_Dialect.defs.in,v 1.2 2018/12/10 14:59:50 leot Exp $
Adjust LDFLAGS to link with installed libraries.
--- packages/Dialect.defs.in.orig 2014-05-27 12:23:38.000000000 +0000
+++ packages/Dialect.defs.in
@@ -57,7 +57,7 @@ else
LIBPLSO=$(LIBPLEMBED)
endif
-PLLDFLAGS=@LDFLAGS@ -L@abs_top_builddir@/../lib/$(PLARCH)
+PLLDFLAGS=@LDFLAGS@ -L$(PLBASE)/lib/$(PLARCH)
LDSOFLAGS=@SO_LDFLAGS@ $(PLLDFLAGS) $(PKGLDFLAGS)
LDFLAGS=$(PLLDFLAGS) $(PKGLDFLAGS)

View file

@ -1,15 +0,0 @@
$NetBSD: patch-src_configure,v 1.1 2019/01/06 08:55:47 markd Exp $
Fix rpath setting
--- src/configure.orig 2017-12-12 11:18:30.000000000 +0000
+++ src/configure
@@ -6481,7 +6481,7 @@ SO_pic="-fpic"
SO_PIC="-fPIC"
SO_LD="$CC"
SO_EXT="so"
-SO_RPATH="-Wl,-rpath=$PLBASE/lib/$PLARCH$RPATH_EXTRA"
+SO_RPATH="-Wl,-rpath,$PLBASE/lib/$PLARCH$RPATH_EXTRA"
DLLIBVAR=LD_LIBRARY_PATH
MINGW="false"

View file

@ -1,40 +0,0 @@
$NetBSD: patch-src_os_pl-files.c,v 1.1 2018/12/10 14:59:50 leot Exp $
Avoid overlapping `src' and `dst' in strcpy(3).
This is reproducible via:
% ln -s `which swi-prolog` swipl-l
% ./swipl-l
...and was also triggered similarly as part of building swi-prolog-packages.
--- src/os/pl-files.c.orig 2018-01-12 12:04:38.000000000 +0000
+++ src/os/pl-files.c
@@ -273,6 +273,7 @@ ReadLink(const char *f, char *buf)
static char *
DeRefLink1(const char *f, char *lbuf)
{ char buf[MAXPATHLEN];
+ char tmpbuf[MAXPATHLEN];
char *l;
if ( (l=ReadLink(f, buf)) )
@@ -282,13 +283,14 @@ DeRefLink1(const char *f, char *lbuf)
} else
{ char *q;
- strcpy(lbuf, f);
- q = &lbuf[strlen(lbuf)];
- while(q>lbuf && q[-1] != '/')
+ strcpy(tmpbuf, f);
+ q = &tmpbuf[strlen(tmpbuf)];
+ while(q>tmpbuf && q[-1] != '/')
q--;
strcpy(q, l);
- canonicaliseFileName(lbuf);
+ canonicaliseFileName(tmpbuf);
+ strcpy(lbuf, tmpbuf);
return lbuf;
}

View file

@ -1,16 +0,0 @@
$NetBSD: patch-src_pl-funcs.h,v 1.2 2014/05/28 10:29:12 markd Exp $
Don't change visibility of a system prototype.
--- src/pl-funcs.h.orig 2014-04-25 14:06:38.000000000 +0000
+++ src/pl-funcs.h
@@ -347,7 +347,9 @@ COMMON(void) setOSPrologFlags(void);
COMMON(void) RemoveTemporaryFiles(void);
COMMON(bool) OpenStream(int fd);
COMMON(char *) expandVars(const char *pattern, char *expanded, int len);
+#ifndef HAVE_GETWD
COMMON(char *) getwd(char *buf);
+#endif
COMMON(char *) AbsoluteFile(const char *spec, char *path);
COMMON(int) IsAbsolutePath(const char *spec);
COMMON(char *) BaseName(const char *f);

View file

@ -1,217 +0,0 @@
$NetBSD: patch-src_pl-rsort.c,v 1.1 2018/12/10 14:59:50 leot Exp $
Use FreeBSD qsort_r(3) if not available instead of using nested
functions.
--- src/pl-rsort.c.orig 2018-01-12 12:04:38.000000000 +0000
+++ src/pl-rsort.c
@@ -65,43 +65,177 @@ from pl-list.c.
#if !defined(HAVE_QSORT_R) && !defined(HAVE_QSORT_S)
-#ifdef QSORT_R_WITH_NESTED_FUNCTIONS
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+typedef int cmp_t(void *, const void *, const void *);
+static inline char *med3(char *, char *, char *, cmp_t *, void *);
+
+#define MIN(a, b) ((a) < (b) ? a : b)
+
+/*
+ * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
+ */
-void
-sort_r(void *base, size_t nel, size_t width,
- int (*compar)(const void *a1, const void *a2, void *aarg), void *arg)
-{ int nested_cmp(const void *a, const void *b)
- {
- return compar(a, b, arg);
- }
+static inline void
+swapfunc(char *a, char *b, size_t es)
+{
+ char t;
- qsort(base, nel, width, nested_cmp);
+ do {
+ t = *a;
+ *a++ = *b;
+ *b++ = t;
+ } while (--es > 0);
}
-#else
+#define vecswap(a, b, n) \
+ if ((n) > 0) swapfunc(a, b, n)
-static void *sort_r_ctx;
-static int (*sort_r_compar)(const void *a1, const void *a2, void *aarg);
+#define CMP(t, x, y) (cmp((t), (x), (y)))
-int
-nested_cmp(const void *a, const void *b)
-{ return (*sort_r_compar)(a, b, sort_r_ctx);
+static inline char *
+med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
+)
+{
+ return CMP(thunk, a, b) < 0 ?
+ (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
+ :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
}
void
-sort_r(void *base, size_t nel, size_t width,
- int (*compar)(const void *a1, const void *a2, void *aarg), void *arg)
-{ PL_LOCK(L_SORTR);
- sort_r_ctx = arg;
- sort_r_compar = compar;
-
- qsort(base, nel, width, nested_cmp);
- PL_UNLOCK(L_SORTR);
+qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+{
+ char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
+ size_t d1, d2;
+ int cmp_result;
+ int swap_cnt;
+
+loop:
+ swap_cnt = 0;
+ if (n < 7) {
+ for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
+ for (pl = pm;
+ pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
+ pl -= es)
+ swapfunc(pl, pl - es, es);
+ return;
+ }
+ pm = (char *)a + (n / 2) * es;
+ if (n > 7) {
+ pl = a;
+ pn = (char *)a + (n - 1) * es;
+ if (n > 40) {
+ size_t d = (n / 8) * es;
+
+ pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
+ pm = med3(pm - d, pm, pm + d, cmp, thunk);
+ pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
+ }
+ pm = med3(pl, pm, pn, cmp, thunk);
+ }
+ swapfunc(a, pm, es);
+ pa = pb = (char *)a + es;
+
+ pc = pd = (char *)a + (n - 1) * es;
+ for (;;) {
+ while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
+ if (cmp_result == 0) {
+ swap_cnt = 1;
+ swapfunc(pa, pb, es);
+ pa += es;
+ }
+ pb += es;
+ }
+ while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
+ if (cmp_result == 0) {
+ swap_cnt = 1;
+ swapfunc(pc, pd, es);
+ pd -= es;
+ }
+ pc -= es;
+ }
+ if (pb > pc)
+ break;
+ swapfunc(pb, pc, es);
+ swap_cnt = 1;
+ pb += es;
+ pc -= es;
+ }
+ if (swap_cnt == 0) { /* Switch to insertion sort */
+ for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
+ for (pl = pm;
+ pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
+ pl -= es)
+ swapfunc(pl, pl - es, es);
+ return;
+ }
+
+ pn = (char *)a + n * es;
+ d1 = MIN(pa - (char *)a, pb - pa);
+ vecswap(a, pb - d1, d1);
+ d1 = MIN(pd - pc, pn - pd - es);
+ vecswap(pb, pn - d1, d1);
+
+ d1 = pb - pa;
+ d2 = pd - pc;
+ if (d1 <= d2) {
+ /* Recurse on left partition, then iterate on right partition */
+ if (d1 > es) {
+ qsort_r(a, d1 / es, es, thunk, cmp);
+ }
+ if (d2 > es) {
+ /* Iterate rather than recurse to save stack space */
+ /* qsort(pn - d2, d2 / es, es, cmp); */
+ a = pn - d2;
+ n = d2 / es;
+ goto loop;
+ }
+ } else {
+ /* Recurse on right partition, then iterate on left partition */
+ if (d2 > es) {
+ qsort_r(pn - d2, d2 / es, es, thunk, cmp);
+ }
+ if (d1 > es) {
+ /* Iterate rather than recurse to save stack space */
+ /* qsort(a, d1 / es, es, cmp); */
+ n = d1 / es;
+ goto loop;
+ }
+ }
}
-#endif
+#define HAVE_QSORT_R
-#else /*HAVE_QSORT_R|HAVE_QSORT_S*/
+#endif /* !defined(HAVE_QSORT_R) && !defined(HAVE_QSORT_S) */
#ifndef QSORT_R_GNU
struct sort_r_data
@@ -132,6 +266,3 @@ sort_r(void *base, size_t nel, size_t wi
qsort_s(base, nel, width, &sort_r_arg_swap, &tmp);
#endif
}
-
-#endif /*HAVE_QSORT_R|HAVE_QSORT_S*/
-

View file

@ -1,22 +0,0 @@
$NetBSD: patch-src_pl-thread.c,v 1.1 2018/12/10 14:59:50 leot Exp $
Add support for NetBSD pthread_setname_np(3).
--- src/pl-thread.c.orig 2018-01-12 12:04:38.000000000 +0000
+++ src/pl-thread.c
@@ -1635,10 +1635,15 @@ set_os_thread_name_from_charp(const char
if ( pthread_setname_np(name) == 0 )
return TRUE;
#else
+#if defined(__NetBSD__)
+ if ( pthread_setname_np(pthread_self(), "%s", (void *)name) == 0 )
+ return TRUE;
+#else
if ( pthread_setname_np(pthread_self(), name) == 0 )
return TRUE;
#endif
#endif
+#endif
return FALSE;
}

View file

@ -1,2 +1,2 @@
Packages for TCP/IP, XML/SGML, RDF, and the GUI toolkit XPCE for
swi-prolog, an ISO/Edinburgh-style Prolog compiler.
Packages for the GUI toolkit XPCE for swi-prolog, an ISO/Edinburgh-style
Prolog compiler.

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.51 2018/12/10 14:59:50 leot Exp $
# $NetBSD: Makefile,v 1.52 2019/02/25 15:20:45 leot Exp $
.include "../../lang/swi-prolog-lite/Makefile.common"
@ -7,91 +7,47 @@ PKGNAME= swi-prolog-packages-${SWIPLVERS}
MAINTAINER= pkgsrc-users@NetBSD.org
COMMENT= Packages for SWI Prolog
GNU_CONFIGURE= yes
USE_TOOLS+= gmake pkg-config
MAKE_JOBS_SAFE= no
USE_TOOLS+= pkg-config
CMAKE_ARGS+= -DINSTALL_PACKAGES=ON
CMAKE_ARGS+= -DINSTALL_DOCUMENTATION=ON
# Part of swi-prolog-lite
CMAKE_ARGS+= -DSWIPL_PACKAGES_BASIC=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_SSL=OFF
CMAKE_ARGS+= -DSWIPL_PACKAGES_TERM=OFF
# Part of swi-prolog-lite... ...but needed to build documentation.
CMAKE_ARGS+= -DSWIPL_PACKAGES_ARCHIVE=ON
# Part of swi-prolog-jpl
CMAKE_ARGS+= -DSWIPL_PACKAGES_JAVA=OFF
SWIPL_PACKAGES_COMPONENTS+= Graphics_subsystem
.include "../../mk/bsd.prefs.mk"
.if ${X11_TYPE} == "modular"
BUILD_DEPENDS+= modular-xorg-server-[0-9]*:../../x11/modular-xorg-server
.endif
CONFIGURE_ENV+= PL=swi-prolog
CONFIGURE_ENV+= PLARCH=${MACHINE_GNU_PLATFORM} # make PLIST consistent
CONFIGURE_ARGS+= --without-jpl
CONFIGURE_DIRS+= . packages
BUILD_DIRS+= packages
INSTALL_DIRS+= packages
INSTALLATION_DIRS= bin lib/swi-prolog-${PKGVERSION_NOREV}/include ${PKGMANDIR}/man1
CPPFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS
TEST_TARGET= check
pre-configure:
${LN} -sf ${LOCALBASE}/bin/plld ${WRKSRC}/src
${LN} -sf ${LOCALBASE}/bin/swi-prolog ${WRKSRC}/src
do-install:
.for component in ${SWIPL_PACKAGES_COMPONENTS}
cd ${WRKSRC}/build && \
${PKGSRC_SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
${CMAKE} -DCMAKE_INSTALL_COMPONENT=${component:Q} \
-P cmake_install.cmake
.endfor
post-configure:
${LN} -sf ${LOCALBASE}/bin/plld ${WRKSRC}/src
${LN} -sf ${LOCALBASE}/bin/swi-prolog ${WRKSRC}/src
cd ${WRKSRC}/packages; \
${SETENV} \
CPP=${CPP:Q} \
${GMAKE} configure
mkdir ${WRKSRC}/include
${LN} -sf ${WRKSRC}/src/SWI-Prolog.h ${WRKSRC}/include
${LN} -sf ${WRKSRC}/src/os/SWI-Stream.h ${WRKSRC}/include
pre-install: checkforx
# Based on misc/openoffice:
DISPLAY?= #empty, if unset
checkforx:
.if ${DISPLAY} == "" || ${DISPLAY_OK:!${X11BASE}/bin/xdpyinfo >/dev/null 2>&1 && ${ECHO} YES || ${ECHO} NO!} == "NO"
. if exists(${X11BASE}/bin/Xvfb)
-${X11BASE}/bin/Xvfb :2 & \
${ECHO} $$! >${WRKDIR}/.Xvfb.pid
${ECHO} checkforx: Xvfb-PID: `${CAT} ${WRKDIR}/.Xvfb.pid`
sleep 5
DISPLAY= :2
. else
@${ECHO} "Error: Environment variable DISPLAY must be set"
@${ECHO} " and point to a connectible X server."
@${FALSE}
. endif #Xvfb
.endif #DISPLAY
MAKE_ENV+= DISPLAY=${DISPLAY:Q}
# XXX: editline bindings seems limited and does not support completion, remove
# XXX: them in order to always use readline.pl.
post-install: teardownx
${RM} ${DESTDIR}${PREFIX}/lib/swi-prolog-${PKGVERSION}/lib/${MACHINE_GNU_PLATFORM}/libedit4pl.so || ${TRUE}
${RM} ${DESTDIR}${PREFIX}/lib/swi-prolog-${PKGVERSION}/library/editline.pl || ${TRUE}
${RM} -f ${LOCALBASE}/lib/swi-prolog-${SWIPLVERS}/xpce-${XPCE_VERSION}/prolog/lib/.pwd
${INSTALL_DATA} ${WRKSRC}/packages/xpce/man/xpce-client.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/xpce-client.1
${INSTALL_DATA} ${WRKSRC}/packages/xpce/man/xpce.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/xpce.1
teardownx:
${ECHO} teardownx: Xvfb-PID: `${CAT} ${WRKDIR}/.Xvfb.pid`
sleep 5
-kill `${CAT} ${WRKDIR}/.Xvfb.pid`
${RM} -f ${WRKDIR}/.Xvfb.pid
# I need this on FreeBSD, perhaps this depends on GCC behaviour:
CHECK_WRKREF_SKIP= lib/swi-prolog-${SWIPLVERS}/xpce-${XPCE_VERSION}/lib/${MACHINE_GNU_PLATFORM}/pl2xpce.so
.include "../../archivers/libarchive/buildlink3.mk"
.include "../../lang/swi-prolog-lite/buildlink3.mk"
.include "../../mk/jpeg.buildlink3.mk"
.include "../../devel/gmp/buildlink3.mk"
BUILDLINK_DEPMETHOD.libarchive= build
.include "../../archivers/libarchive/buildlink3.mk"
BUILDLINK_DEPMETHOD.ossp-uuid= build
.include "../../devel/ossp-uuid/buildlink3.mk"
.include "../../devel/readline/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../devel/gmp/buildlink3.mk"
.include "../../mk/jpeg.buildlink3.mk"
BUILDLINK_DEPMETHOD.openssl= build
.include "../../security/openssl/buildlink3.mk"
.include "../../x11/libXft/buildlink3.mk"
.include "../../x11/libXinerama/buildlink3.mk"

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.41 2009/04/08 23:11:13 joerg Exp $
# $NetBSD: Makefile,v 1.42 2019/02/25 15:20:44 leot Exp $
META_PACKAGE= # empty
META_PACKAGE= yes
.include "../../lang/swi-prolog-lite/Makefile.common"