Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 2020 13:26:15 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r556106 - in head: . lang lang/gprolog lang/gprolog/files
Message-ID:  <202011231326.0ANDQFDP056545@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen
Date: Mon Nov 23 13:26:14 2020
New Revision: 556106
URL: https://svnweb.freebsd.org/changeset/ports/556106

Log:
  lang/gprolog: recover GNU Prolog under FreeBSD.
  
  Update to version 1.4.5 released in 2020.
  Make it build and run with Clang 10:
  
  - clang has no register reservation for x86, hence patch-EnginePl_machine.h
    and -DNO_MACHINE_REG_FOR_REG_BANK to prevent using missing feature;
  - add patch-Ma2Asm_x86__64__any.c fetched from upstream SourceForge
    post-release commit dealing with PIC issues;
  - disable usage of spinlocks that results in a hang eating all available
    CPU cycles; fixed with -DUSE_LOCKS=1 -DUSE_RECURSIVE_LOCKS=1
    -DUSE_SPIN_LOCKS=0;
  - the software uses bundled dlmalloc dated back 2011 that replaces
    functions like calloc() with own implemenations and it's calloc()
    sometimes fails to clear allocated memory; this results in SIGSEGV
    when its own hash-table implementation dereferences junk that
    supposed to be NULL pointer, so it fails to complete build;
    fixed with MMAP_CLEARS=0.
  
  PR:		231393

Added:
  head/lang/gprolog/
     - copied from r507372, head/lang/gprolog/
  head/lang/gprolog/files/
  head/lang/gprolog/files/patch-EnginePl_machine.h   (contents, props changed)
  head/lang/gprolog/files/patch-Ma2Asm_x86__64__any.c   (contents, props changed)
Modified:
  head/MOVED
  head/lang/Makefile
  head/lang/gprolog/Makefile
  head/lang/gprolog/distinfo

Modified: head/MOVED
==============================================================================
--- head/MOVED	Mon Nov 23 11:55:46 2020	(r556105)
+++ head/MOVED	Mon Nov 23 13:26:14 2020	(r556106)
@@ -12845,7 +12845,6 @@ textproc/rubygem-gitlab-linguist|textproc/rubygem-gith
 textproc/rubygem-html-pipeline1|textproc/rubygem-html-pipeline|2019-08-31|Has expired: Use textproc/rubygem-html-pipeline instead
 devel/pure-stldict||2019-09-01|Has expired: Depends on expiring devel/llvm35
 lang/dmd1||2019-09-01|Has expired: No longer supported upstream
-lang/gprolog||2019-09-01|Has expired: Abandonware upstream (more than five years), fails in various ways with remotely recent compilers
 math/pure-mpfr||2019-09-01|Has expired: Depends on expiring devel/llvm35
 math/pure-rational||2019-09-01|Has expired: Depends on expiring devel/llvm35
 net/pure-sockets||2019-09-01|Has expired: Depends on expiring devel/llvm35

Modified: head/lang/Makefile
==============================================================================
--- head/lang/Makefile	Mon Nov 23 11:55:46 2020	(r556105)
+++ head/lang/Makefile	Mon Nov 23 13:26:14 2020	(r556106)
@@ -116,6 +116,7 @@
     SUBDIR += go
     SUBDIR += go-devel
     SUBDIR += gomacro
+    SUBDIR += gprolog
     SUBDIR += gravity
     SUBDIR += groovy
     SUBDIR += gscheme

Modified: head/lang/gprolog/Makefile
==============================================================================
--- head/lang/gprolog/Makefile	Fri Jul 26 20:46:53 2019	(r507372)
+++ head/lang/gprolog/Makefile	Mon Nov 23 13:26:14 2020	(r556106)
@@ -2,8 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	gprolog
-PORTVERSION=	1.4.4
-PORTREVISION=	9
+PORTVERSION=	1.4.5
 CATEGORIES=	lang
 MASTER_SITES=	http://www.gprolog.org/
 
@@ -12,17 +11,12 @@ COMMENT=	Free Prolog compiler
 
 LICENSE=	GPLv2
 
-BROKEN=		fails to build
-DEPRECATED=		Abandonware upstream (more than five years), fails in various ways with remotely recent compilers
-# Bumped EXPIRATION date due to new release
-# and efforts to get it in: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231393
-EXPIRATION_DATE=	2019-08-31
+ONLY_FOR_ARCHS=	amd64 i386
 
-ONLY_FOR_ARCHS=	i386 amd64
-
 USES=		gmake
-USE_GCC=	any
-CFLAGS+=	-O3 # gcc5/gcc6 + -O2 = pl2wam hangs
+CFLAGS+=	-DUSE_LOCKS=1 -DUSE_RECURSIVE_LOCKS=1 -DUSE_SPIN_LOCKS=0 \
+		-DMMAP_CLEARS=0 -DNO_MACHINE_REG_FOR_REG_BANK
+
 PLIST_SUB=	GPROLOG_VER=${PORTVERSION}
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-c-flags="${CFLAGS}" \
@@ -38,14 +32,6 @@ OPTIONS_SUB=		yes
 
 FD_DESC=		Enable finite domain constraint solver
 FD_CONFIGURE_OFF=	--disable-fd-solver
-
-.include <bsd.port.options.mk>
-
-# Disable registers on i386. This fixes build with gcc6.
-# See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852008
-.if ${ARCH} == i386
-CONFIGURE_ARGS+=		--disable-regs
-.endif
 
 post-patch:
 	@${REINPLACE_CMD} \

Modified: head/lang/gprolog/distinfo
==============================================================================
--- head/lang/gprolog/distinfo	Fri Jul 26 20:46:53 2019	(r507372)
+++ head/lang/gprolog/distinfo	Mon Nov 23 13:26:14 2020	(r556106)
@@ -1,2 +1,3 @@
-SHA256 (gprolog-1.4.4.tar.gz) = 18c0e9644b33afd4dd3cdf29f94c099ad820d65e0c99da5495b1ae43b4f2b18e
-SIZE (gprolog-1.4.4.tar.gz) = 3538152
+TIMESTAMP = 1606049432
+SHA256 (gprolog-1.4.5.tar.gz) = ce5335d1607f0b01d5567252211ae2b19e6a5e52b62978717880524748afb9a2
+SIZE (gprolog-1.4.5.tar.gz) = 3585704

Added: head/lang/gprolog/files/patch-EnginePl_machine.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/gprolog/files/patch-EnginePl_machine.h	Mon Nov 23 13:26:14 2020	(r556106)
@@ -0,0 +1,20 @@
+--- EnginePl/machine.h.orig	2015-01-13 18:00:19 UTC
++++ EnginePl/machine.h
+@@ -124,7 +124,7 @@ void M_Check_Magic_Words(void); /* not c
+ #    define M_USED_REGS            {"$9", "$10", "$11", "$12", "$13", "$14", 0}
+ 
+ /* on M_ix86_darwin : %ebx is used by gcc for pic base */
+-#elif defined(M_ix86) && !defined(_MSC_VER) && !defined(M_ix86_darwin)
++#elif defined(M_ix86) && !defined(_MSC_VER) && !defined(M_ix86_darwin) && !defined(__clang__)
+ 
+ #ifdef NO_USE_EBP
+ #    define M_USED_REGS            {"ebx", 0}
+@@ -137,7 +137,7 @@ void M_Check_Magic_Words(void); /* not c
+ #    define M_USED_REGS            {"15", "20", 0}
+ 
+ /* on M_x86_64_darwin Lion r12-r15 do not work (why ?) */
+-#elif defined(M_x86_64) && !defined(_MSC_VER) && !defined(M_x86_64_darwin)
++#elif defined(M_x86_64) && !defined(_MSC_VER) && !defined(M_x86_64_darwin) && !defined(__clang__)
+ 
+ #    define M_USED_REGS            {"r12", "r13", "r14", "r15", 0}
+ 

Added: head/lang/gprolog/files/patch-Ma2Asm_x86__64__any.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/gprolog/files/patch-Ma2Asm_x86__64__any.c	Mon Nov 23 13:26:14 2020	(r556106)
@@ -0,0 +1,57 @@
+--- Ma2Asm/x86_64_any.c.orig	2018-10-23 15:17:17 UTC
++++ Ma2Asm/x86_64_any.c
+@@ -112,6 +112,9 @@
+  * Global Variables                *
+  *---------------------------------*/
+ 
++int can_produce_pic_code = 1;	/* overwritte var of ma2asm.c */
++extern int pic_code;
++
+ static double dbl_tbl[MAX_DOUBLES_IN_PRED];
+ static int nb_dbl = 0;
+ static int dbl_lc_no = 0;
+@@ -149,7 +152,6 @@ static const char *fpr_arg[MAX_FPR_ARGS]
+ #endif
+           /* variables for ma_parser.c / ma2asm.c */
+ 
+-int can_produce_pic_code = 1;
+ char *comment_prefix = "#";
+ #ifdef M_x86_64_darwin
+ char *local_symb_prefix = "L";
+@@ -210,10 +212,8 @@ Asm_Start(void)
+   strcpy(asm_reg_cp, Off_Reg_Bank(MAP_OFFSET_CP));
+ #endif
+ 
+-#if defined(M_x86_64_darwin) || defined(M_x86_64_bsd)
+-  pic_code = 1;                 /* NB: on darwin and BSD everything is PIC code */
+-#elif defined(M_x86_64_linux) && __GNUC__ >= 6 /* gcc >= 6 needs PIC for linux */
+-  pic_code = 1;
++#ifdef M_x86_64_darwin
++  pic_code = 1;			/* NB: on darwin everything is PIC code */
+ #elif defined(_WIN32)
+   pic_code = 0;			/* NB: on MinGW nothing is needed for PIC code */
+ #endif
+@@ -1199,9 +1199,9 @@ Dico_Long(char *name, int global, VType 
+       size_bytes = value * 8;
+ #ifdef M_x86_64_darwin
+       if (!global)
+-        Label_Printf(".zerofill __DATA,__bss," UN "%s,%" PL_FMT_d ",4", name, size_bytes);
++        Label_Printf(".zerofill __DATA,__bss," UN "%s,%" PL_FMT_d ",3", name, size_bytes);
+       else
+-        Inst_Printf(".comm", UN "%s,%" PL_FMT_d ",4", name, size_bytes);
++        Inst_Printf(".comm", UN "%s,%" PL_FMT_d ",3", name, size_bytes);
+ #else
+ #if defined(M_x86_64_linux) || defined(M_x86_64_sco) || \
+     defined(M_x86_64_solaris) || defined(M_x86_64_bsd)
+@@ -1226,11 +1226,6 @@ Dico_Long(char *name, int global, VType 
+     case INITIAL_VALUE:
+       if (global)
+         Inst_Printf(".globl", UN "%s", name);
+-#ifdef M_x86_64_darwin
+-      Inst_Printf(".align", "3");
+-#else
+-      Inst_Printf(".align", "8");
+-#endif
+ #if !(defined(M_x86_64_darwin) || defined(_WIN32))
+       Inst_Printf(".size", UN "%s,8", name);
+ #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011231326.0ANDQFDP056545>