Subject: pkg/28946: new package: lang/agfl
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Rhialto <rhialto@azenomei.knuffel.net>
List: pkgsrc-bugs
Date: 01/12/2005 17:15:00
>Number:         28946
>Category:       pkg
>Synopsis:       new package: lang/agfl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 12 17:15:00 +0000 2005
>Originator:     Rhialto
>Release:        NetBSD 2.0
>Organization:
	
>Environment:
System: NetBSD azenomei.falu.nl 2.0 NetBSD 2.0 (AZENOMEI) #1: Wed Dec 29 16:09:12 CET 2004 root@azenomei.falu.nl:/usr/src/sys/arch/alpha/compile/AZENOMEI alpha
Architecture: alpha
Machine: alpha
>Description:
	Contains a new package for a compiler of the AGFL formalism.
	Also contains a buildlink3.mk file for the lang/cdl3 package,
	since it depends on it.
	I submitted the buildlink3.mk to the maintainer of cdl3 but
	received no reply so far.
>How-To-Repeat:
>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	lang/agfl
#	lang/agfl/Makefile
#	lang/agfl/patches
#	lang/agfl/patches/patch-aa
#	lang/agfl/patches/patch-ab
#	lang/agfl/patches/patch-ac
#	lang/agfl/patches/patch-ad
#	lang/agfl/patches/patch-ae
#	lang/agfl/patches/patch-af
#	lang/agfl/patches/patch-ag
#	lang/agfl/patches/patch-ah
#	lang/agfl/patches/patch-ai
#	lang/agfl/patches/patch-aj
#	lang/agfl/distinfo
#	lang/agfl/PLIST
#	lang/agfl/buildlink3.mk
#	lang/agfl/DESCR
#	lang/cdl3/buildlink3.mk
#
echo c - lang/agfl
mkdir -p lang/agfl > /dev/null 2>&1
echo x - lang/agfl/Makefile
sed 's/^X//' >lang/agfl/Makefile << 'END-of-lang/agfl/Makefile'
X# $NetBSD$
X
XDISTNAME=	agfl-${AGFL_VERSION}
XAGFL_VERSION=	2.3
XCATEGORIES=	lang
XMASTER_SITES=	ftp://ftp.cs.ru.nl/pub/agfl/${AGFL_VERSION}/unix/sources/
X
XMAINTAINER=	olafs@cs.ru.nl
XHOMEPAGE=	http://www.cs.ru.nl/agfl/
XCOMMENT=	formalism for the syntactic description of Natural Languages
X
XPKG_INSTALLATION_TYPES=	pkgviews overwrite 
X
XCONFIGURE_ARGS += --with-cdl3=${BUILDLINK_PREFIX.cdl3}
X
X# We use ${PREFIX}/lib but also ${VIEWBASE}/lib for the rpath to have
X# a better chance that compiled grammars keep working if you upgrade
X# to a newer version of AGFL. It's not perfect though.
XSUBST_CLASSES += rpath
XSUBST_STAGE.rpath = post-patch
XSUBST_MESSAGE.rpath = Editing rpath ${PREFIX}/lib and ${VIEWBASE}/lib into gen
XSUBST_FILES.rpath = gen/src/gen.c
XSUBST_SED.rpath = "s!define RPATH.*\"\"!define RPATH \"-Wl,-R ${PREFIX}/lib -Wl,-R ${VIEWBASE}/lib \"!"
X
Xpost-install:
X	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/agfl
X	${INSTALL_DATA} ${WRKSRC}/doc/userdoc/manual.ps ${PREFIX}/share/doc/agfl/manual.ps
X
XUSE_BUILDLINK3=		yes
XUSE_GNU_TOOLS+=		make
XUSE_LIBTOOL=		yes
XGNU_CONFIGURE=		yes
X
X.include "../../devel/glib/buildlink3.mk"
X.include "../../lang/cdl3/buildlink3.mk"
X.include "../../mk/bsd.pkg.mk"
END-of-lang/agfl/Makefile
echo c - lang/agfl/patches
mkdir -p lang/agfl/patches > /dev/null 2>&1
echo x - lang/agfl/patches/patch-aa
sed 's/^X//' >lang/agfl/patches/patch-aa << 'END-of-lang/agfl/patches/patch-aa'
XAdd system detection.
X
X+++ configure	2005-01-05 18:09:46.000000000 +0100
X@@ -4245,6 +4245,14 @@
X 
X echo 'Checking which machdep to use...'
X MACHDEPHOSTVAL=""
X+if test "`uname -m`" = "alpha"; then
X+  if test `uname -s` = "NetBSD" ; then
X+    MACHDEPHOSTVAL=machdep.alpha-netbsd
X+  fi
X+  if test "X$MACHDEPHOSTVAL" = "X" ; then
X+    echo '-- Unsupported OS on Alpha architecture'
X+  fi
X+fi
X if test "`uname -m`" = "sun4u" -o "`uname -m`" = "sun4m" -o "`uname -m`" = "sparc"; then
X   if test `uname -s` = "SunOS" ; then
X     MACHDEPHOSTVAL=machdep.sparc-solaris
X@@ -4266,6 +4274,9 @@
X   if test "`uname -s`" = 'dos' ; then
X     MACHDEPHOSTVAL=machdep.dos
X   fi
X+  if test "`uname -s`" = 'NetBSD'; then
X+    MACHDEPHOSTVAL=machdep.i386-netbsd
X+  fi
X   if test "`uname -s`" = 'FreeBSD'; then
X     MACHDEPHOSTVAL=machdep.i386-freebsd
X   fi
END-of-lang/agfl/patches/patch-aa
echo x - lang/agfl/patches/patch-ab
sed 's/^X//' >lang/agfl/patches/patch-ab << 'END-of-lang/agfl/patches/patch-ab'
XA "negative" unsigned value is not a good idea.
X
X+++ gen/rts/posmemo.c	2005-01-05 23:16:03.000000000 +0100
X@@ -447,7 +447,7 @@
X     };
X     /* copy sons by copying PMPROD entries from frame */
X     for(i = 0;i < nr_sons;i++) {
X-	VALUE son = variables[-(nr_formals+nr_locals+i)];
X+	VALUE son = variables[-(long)(nr_formals+nr_locals+i)];
X 	if (pointsIntoStack((VALUE *)(son.text_par)))
X 	    /* copy the PMPROD entry */
X 	    new_memo->variables[nr_formals+nr_locals+i] = 
END-of-lang/agfl/patches/patch-ab
echo x - lang/agfl/patches/patch-ac
sed 's/^X//' >lang/agfl/patches/patch-ac << 'END-of-lang/agfl/patches/patch-ac'
XA "negative" unsigned value is not a good idea.
X
X+++ rtsagfl.c	2005-01-06 11:02:11.000000000 +0100
X@@ -278,7 +278,7 @@
X #endif /* DEBUG_NEGMEMO */
X 
X /*#define DEBUG_POSMEMO*/
X-#ifdef DEBUG_POSMEMO
X+#if defined(PMRTS) && defined(DEBUG_POSMEMO)
X     if (pos_memo_option) {
X         posmemo_dump_table(trellis);
X     }
X@@ -367,11 +367,11 @@
X 
X #define NR_FORMALS      (fp[NR_FORMALS_OFF].arg)
X #define NR_LOCALS       (fp[NR_LOCALS_OFF].arg)
X-#define VARIABLE(nr)    (fp[- (VAR_OFFSET + nr)])
X+#define VARIABLE(nr)    (fp[-(long)(VAR_OFFSET + (nr))])
X 
X #define NR_SONS         (fp[NR_SONS_OFF].arg)
X #define NONT_NR         (fp[NONT_NR_OFF].arg)
X-#define SON_FP(nr)      (fp[-(VAR_OFFSET + NR_FORMALS + NR_LOCALS + nr)].data)
X+#define SON_FP(nr)      (fp[-(long)(VAR_OFFSET + NR_FORMALS + NR_LOCALS + (nr))].data)
X 
X #define START_INPUT_STATE (fp[ISTATE].input_state)
X 
X@@ -2186,7 +2186,7 @@
X                                                           trellis);
X #ifdef TRACE_MATCH
X                 fprintf(stderr, "new state = %p pos=%u\n",
X-                                      i_state, STATE_POS(i_state));
X+			    i_state, i_state ? STATE_POS(i_state) : -1);
X 
X #endif /* TRACE_MATCH */
X 
END-of-lang/agfl/patches/patch-ac
echo x - lang/agfl/patches/patch-ad
sed 's/^X//' >lang/agfl/patches/patch-ad << 'END-of-lang/agfl/patches/patch-ad'
XAn apparent typo.
X
X+++ gen/rts/rtslex.h	2005-01-05 20:52:10.000000000 +0100
X@@ -328,7 +328,7 @@
X typedef Position StateIndicator;
X #  define STATE_POS(ind)	(ind)
X #  define STATE_MEMOS(trel,ind)	(trel->states_row[ind]->neg_memos)
X-#  define SET_FIRST_POS(trel,pos)  trellis->first_pos = pos
X+#  define SET_FIRST_POS(trel,pos)  trel->first_pos = pos
X #  define GET_FIRST_STATE_INDICATOR(trel)  (trel->first_pos)
X #  define GET_FIRST_STATE_PTR(trel)	   (trel->states_row[trel->first_pos])
X #else
END-of-lang/agfl/patches/patch-ad
echo x - lang/agfl/patches/patch-ae
sed 's/^X//' >lang/agfl/patches/patch-ae << 'END-of-lang/agfl/patches/patch-ae'
XAvoid double definitions.
X
X+++ gen/src/pattern.c	2005-01-05 18:02:07.000000000 +0100
X@@ -82,7 +82,6 @@
X #endif /* RTS */
X 
X #include "regex.h"
X-#include "regex.c"
X 
X 
X RegExp*
END-of-lang/agfl/patches/patch-ae
echo x - lang/agfl/patches/patch-af
sed 's/^X//' >lang/agfl/patches/patch-af << 'END-of-lang/agfl/patches/patch-af'
XPatch in RPATH; it will be edited again from make post-patch.
Xmygen.c depends on and is made from gen.c
X
X+++ gen/src/gen.c	2005-01-05 21:01:30.000000000 +0100
X@@ -505,15 +505,18 @@
X #define GENBIN		DIR_SEP "bin"
X #define GENLIB		DIR_SEP "lib"
X #define GENINCLUDE	DIR_SEP "include"
X+#ifndef RPATH
X+#define RPATH		""
X+#endif
X 
X #define LEXGEN		GENBIN DIR_SEP "lexgen" EXE
X #define AGFL		GENBIN DIR_SEP "gra2o" EXE
X #define LIBNMRTS	GENLIB DIR_SEP "libnmrts.a"
X-#define LINKNMRTS       "-lnmrts"
X+#define LINKNMRTS       RPATH "-lnmrts"
X #define LIBPMRTS	GENLIB DIR_SEP "libpmrts.a"
X-#define LINKPMRTS       "-lpmrts"
X+#define LINKPMRTS       RPATH "-lpmrts"
X #define LIBRTSLOG	GENLIB DIR_SEP "librtslog.a"
X-#define LINKGENRTS      "-lgenrts"
X+#define LINKGENRTS      RPATH "-lgenrts"
X #define LIBGENRTS       GENLIB DIR_SEP "libgenrts.a"
X #define LINKDEBUGRTS    "-ldebugrts -lpthread -lgtk -lgdk -lgthread"
X #define LIBDEBUGRTS     GENLIB DIR_SEP "libdebugrts.a"
END-of-lang/agfl/patches/patch-af
echo x - lang/agfl/patches/patch-ag
sed 's/^X//' >lang/agfl/patches/patch-ag << 'END-of-lang/agfl/patches/patch-ag'
XMachdep file for NetBSD/alpha
X
X+++ gen/src/machdep.alpha-netbsd	2005-01-05 18:14:54.000000000 +0100
X@@ -0,0 +1,30 @@
X+/* machdep.alpha-netbsd -- NetBSD/alpha specific part of machdep.h 
X+ *
X+ * Copyright 2005, Rhialto.
X+ *
X+ * This program is free software; you can redistribute it and/or modify
X+ * it under the terms of the GNU General Public License as published by
X+ * the Free Software Foundation; either version 2 of the License, or
X+ * (at your option) any later version.
X+ *
X+ * This program is distributed in the hope that it will be useful,
X+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
X+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X+ * GNU Library General Public License for more details.
X+ *
X+ * You should have received a copy of the GNU Library General Public License
X+ * along with this program; if not, write to the Free Software
X+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
X+ */
X+
X+/* $Id: machdep.i386-freebsd,v 1.1 2001/10/17 12:47:00 ejv Exp $ */
X+
X+#define LONG_MAX				0x7fffffffffffffff
X+#define GLOBAL(name)				.globl	name
X+#define	LONG(nr)				.quad	nr
X+#define BYTE(nr)				.byte	nr
X+#define	TEXT(string)				.asciz	string
X+#define ALIGN					.align	8
X+#define	STARTCODE				.data 
X+#define	ENDCODE					.quad	0
X+#define	INSTR					.quad
END-of-lang/agfl/patches/patch-ag
echo x - lang/agfl/patches/patch-ah
sed 's/^X//' >lang/agfl/patches/patch-ah << 'END-of-lang/agfl/patches/patch-ah'
XMachdep file for NetBSD/i386
X
X+++ gen/src/machdep.i386-netbsd	2005-01-05 18:13:34.000000000 +0100
X@@ -0,0 +1,30 @@
X+/* machdep.i386-netbsd -- NetBSD/i386 specific part of machdep.h 
X+ *
X+ * Copyright 2001, KUN.
X+ *
X+ * This program is free software; you can redistribute it and/or modify
X+ * it under the terms of the GNU General Public License as published by
X+ * the Free Software Foundation; either version 2 of the License, or
X+ * (at your option) any later version.
X+ *
X+ * This program is distributed in the hope that it will be useful,
X+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
X+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X+ * GNU Library General Public License for more details.
X+ *
X+ * You should have received a copy of the GNU Library General Public License
X+ * along with this program; if not, write to the Free Software
X+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
X+ */
X+
X+/* $Id: machdep.i386-freebsd,v 1.1 2001/10/17 12:47:00 ejv Exp $ */
X+
X+#define LONG_MAX				2147483647
X+#define GLOBAL(name)				.globl	name
X+#define	LONG(nr)				.long	nr
X+#define BYTE(nr)				.byte	nr
X+#define	TEXT(string)				.asciz	string
X+#define ALIGN					.align	8
X+#define	STARTCODE				.data 
X+#define	ENDCODE					.long	0
X+#define	INSTR					.long
END-of-lang/agfl/patches/patch-ah
echo x - lang/agfl/patches/patch-ai
sed 's/^X//' >lang/agfl/patches/patch-ai << 'END-of-lang/agfl/patches/patch-ai'
XAvoid a warning, potential error.
X
X+++ lexgen/src/insout.h	2005-01-05 18:37:42.000000000 +0100
X@@ -139,7 +139,7 @@
X template<class T, class Iterator> inline const InsOutNode<T>*
X InsOutTable<T, Iterator>::enter(const T& elem, const InsOutNode<T>* next)
X {
X+    pair<typename InsOutTable::iterator, bool> p = insert(InsOutNode<T>(elem, next));
X 
X     nr_requested++;
X 
X@@ -152,7 +152,7 @@
X     const InsOutNode<T>* next = 0;
X 
X     while (first < last) {
X+        pair<typename InsOutTable::iterator, bool> p = insert(InsOutNode<T>(*--last, next));
X 
X         nr_requested++;
END-of-lang/agfl/patches/patch-ai
echo x - lang/agfl/patches/patch-aj
sed 's/^X//' >lang/agfl/patches/patch-aj << 'END-of-lang/agfl/patches/patch-aj'
XMake one of the examples actually work.
X
X+++ gen/test/verb.gra	2005-01-05 20:26:08.000000000 +0100
X@@ -1,3 +1,5 @@
X+GRAMMAR verb.
X+
X ROOT sentence.
X 
X PERSON :: first | second | third.
END-of-lang/agfl/patches/patch-aj
echo x - lang/agfl/distinfo
sed 's/^X//' >lang/agfl/distinfo << 'END-of-lang/agfl/distinfo'
X$NetBSD$
X
XSHA1 (agfl-2.3.tar.gz) = 2d1fc5ea1259e71bdcbeb61da7b134538466a4a0
XSize (agfl-2.3.tar.gz) = 1022438 bytes
XSHA1 (patch-aa) = 8961b2014fbcd3479dbe5a42fc5fc439a8306ba6
XSHA1 (patch-ab) = 4dbc5782be18bd3b89a33d26fb00e3a8ae758a87
XSHA1 (patch-ac) = 0a27ce66a3a5e7f24507a886af16c7066c496e8e
XSHA1 (patch-ad) = a6530ba2e7ff7ff8087dd5967355ebb7de2a00ec
XSHA1 (patch-ae) = 218583efb287d45c5896e18f2857495a9e7ec3ea
XSHA1 (patch-af) = c938bd3fc8171e170bdbbc11cb07a9d63d89cad3
XSHA1 (patch-ag) = 5bca9999a6a1eefefa44d0507ead53a21c4e43c9
XSHA1 (patch-ah) = 8b98950b55f8f4b2f91737da05a4c5c00368cbcf
XSHA1 (patch-ai) = 2d08756cdd8403126602bf7e5f4571eb17430e1d
XSHA1 (patch-aj) = f3501795606193a2c0b54e440e768cc957379b50
END-of-lang/agfl/distinfo
echo x - lang/agfl/PLIST
sed 's/^X//' >lang/agfl/PLIST << 'END-of-lang/agfl/PLIST'
Xbin/datconvert
Xbin/gen
Xbin/gra2o
Xbin/lexgen
Xbin/mygen
Xinclude/lexicon.h
Xinclude/lexiconutil.h
Xinclude/str_util.h
Xlib/liblexicon.la
Xlib/libnmrts.la
Xlib/libpmrts.la
Xman/man1/agfl.1
Xman/man1/gen.1
Xman/man1/gra2o.1
Xman/man1/lexgen.1
Xshare/doc/agfl/manual.ps
END-of-lang/agfl/PLIST
echo x - lang/agfl/buildlink3.mk
sed 's/^X//' >lang/agfl/buildlink3.mk << 'END-of-lang/agfl/buildlink3.mk'
X# $NetBSD$
X#
X# This buildlink file is needed because the AGFL compiler calls gcc
X# and gcc is subject to the buildlink tricks.
X# XXX How to add gen to the list of wrapped tools?
X
XBUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
XAGFL_BUILDLINK3_MK:=    ${AGFL_BUILDLINK3_MK}+
X
X.include "../../mk/bsd.prefs.mk"
X
X.if !empty(BUILDLINK_DEPTH:M+)
XBUILDLINK_DEPENDS+=     agfl
X.endif
X
XBUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Nagfl}
XBUILDLINK_PACKAGES+=    agfl
X
X.if !empty(AGFL_BUILDLINK3_MK:M+)
XBUILDLINK_DEPENDS.agfl+=        agfl>=2.3
XBUILDLINK_PKGSRCDIR.agfl?=      ../../lang/agfl
X
X# Packages that link against shared libraries need a full dependency,
X# and agfl-programs need the runtime library.
XBUILDLINK_DEPMETHOD.agfl+=      full
X.endif  # AGFL_BUILDLINK3_MK
X
XBUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
END-of-lang/agfl/buildlink3.mk
echo x - lang/agfl/DESCR
sed 's/^X//' >lang/agfl/DESCR << 'END-of-lang/agfl/DESCR'
XThe AGFL formalism for the syntactic description of Natural Languages
Xhas been developed by the Computer Science Department of the Radboud
XUniversity of Nijmegen.  It is a formalism in which large context free
Xgrammars can be described in a compact way. AGFLs belong to the family
Xof two level grammars, along with attribute grammars: a first,
Xcontext-free level is augmented with set-valued features for expressing
Xagreement between parts of speech.
X
XThe AGFL parser generation system for Natural Languages generates
Xefficient parsers from AGFL grammars. It includes a lexicon system
Xsuitable for the large lexica needed in real-life NLP applications.
END-of-lang/agfl/DESCR
echo x - lang/cdl3/buildlink3.mk
sed 's/^X//' >lang/cdl3/buildlink3.mk << 'END-of-lang/cdl3/buildlink3.mk'
X# $NetBSD$
X#
X# This buildlink file is needed because the CDL3 compiler calls gcc
X# and gcc is subject to the buildlink tricks.
X# In case of a call cdlc -L /usr/pkg/include/ general.k3,
X# predef.k3 is read from /usr/pkg/include/ .
X# XXX How to add cdlc to the list of wrapped tools?
X
XBUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
XCDL3_BUILDLINK3_MK:=    ${CDL3_BUILDLINK3_MK}+
X
X.include "../../mk/bsd.prefs.mk"
X
X.if !empty(BUILDLINK_DEPTH:M+)
XBUILDLINK_DEPENDS+=     cdl3
X.endif
X
XBUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ncdl3}
XBUILDLINK_PACKAGES+=    cdl3
X
X.if !empty(CDL3_BUILDLINK3_MK:M+)
XBUILDLINK_DEPENDS.cdl3+=        cdl3>=1.2.5
XBUILDLINK_PKGSRCDIR.cdl3?=      ../../lang/cdl3
X
X# Packages that link against shared libraries need a full dependency,
X# and cdl3-programs need the runtime library.
XBUILDLINK_DEPMETHOD.cdl3+=      full
X.endif  # CDL3_BUILDLINK3_MK
X
XBUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
END-of-lang/cdl3/buildlink3.mk
exit

-Olaf.
-- 
                           -- Ceterum censeo "authored[1]" delendum esse.
___ Olaf 'Rhialto' Seibert -- [1] Ugly English neologism[2].
\X/ rhialto/at/xs4all.nl   -- [2] For lawyers whose English/Latin is below par.