Subject: problems with textproc/dict-server
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 10/19/2002 23:35:50
It would seem there's some inconsistency in textproc/dict-server --
perhaps what's been checked in was never tested and there are some
uncommitted changes still sitting somewhere.

First off my working directory had patches/patch-a[af], but they were
not in distinfo (and for good reason I guess -- they fail to apply).

=> Checksum OK for dictd-1.8.0.tar.gz.
=> Checksum OK for dict-gazetteer-1.3.tar.gz.
=> Checksum OK for dict-misc-1.5.tar.gz.
=> Checksum OK for dict-web1913-1.4.tar.gz.
=> Checksum OK for web1913-0.46-a.tar.gz.
=> Checksum OK for dict-wn-1.5.tar.gz.
===> Extracting for dict-server-1.8.0
===> Required runtime package libtool-base-1.4.20010614nb9 installed OK (need libtool-base>=1.4.20010614nb9)
===> Required build-only package gmake-3.79.1 installed OK (need gmake>=3.78)
===> Required build-only package m4-1.4 installed OK (need m4>=1.4)
===> Patching for dict-server-1.8.0
===> Applying NetBSD patches for dict-server-1.8.0
**************************************
Ignoring unknown patch file: /work/woods/m-NetBSD-pkgsrc/textproc/dict-server/patches/patch-aa
**************************************
**************************************
Ignoring unknown patch file: /work/woods/m-NetBSD-pkgsrc/textproc/dict-server/patches/patch-af
**************************************


However distinfo does claim to have patch-al, but it's not anywhere in
the CVS repository (i.e. not live, and not dead or on a branch in the
Attic) and after "make mps" I have this:

Index: textproc/dict-server/distinfo
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/textproc/dict-server/distinfo,v
retrieving revision 1.5
diff -c -r1.5 distinfo
*** textproc/dict-server/distinfo	11 Oct 2002 00:47:29 -0000	1.5
--- textproc/dict-server/distinfo	20 Oct 2002 02:50:04 -0000
***************
*** 21,24 ****
  SHA1 (patch-ai) = 21b2c9ace814e005139c64c4b6890e8b7e249f29
  SHA1 (patch-aj) = 76527be1d4ff89aeec72606d9575a99e6a8e2d3b
  SHA1 (patch-ak) = 4167c9007ed7b31ff9a29b368d82154bc95893cf
- SHA1 (patch-al) = 5fe89cafc86aea846f949566739d2dfde2b74adf
--- 21,23 ----


But perhaps there's an uncomitted patch-al sitting in someone else's
working directory because when I apply the fixes below and try to build
I eventually get:

flex  -owebfilter.c webfilter.l
gcc -Wall  -Ilibmaa -DHAVE_CONFIG_H  -I. -g -O  \
        -Wno-unused -o webfilter webfilter.c -Llibmaa -lmaa
/usr/bin/ld: cannot open -lmaa: No such file or directory
collect2: ld returned 1 exit status
gmake: *** [webfilter] Error 1
*** Error code 2

Stop.
make: stopped in /work/woods/m-NetBSD-pkgsrc/textproc/dict-server
*** Error code 1



At this point the last few lines in work/.buildlink/.wrapper.log are:

/usr/bin/cc -c -Ilibmaa -DHAVE_CONFIG_H -I/var/package-obj/textproc/dict-server/work/.buildlink/include -I. -g -DDICT_VERSION=\"1.8.0\" -DDICT_CONFIG_PATH=\"/usr/pkg/etc/\" utf8_ucs4.c
/usr/bin/cc -Ilibmaa -DHAVE_CONFIG_H -I/var/package-obj/textproc/dict-server/work/.buildlink/include -I. -g -DDICT_VERSION=\"1.8.0\" -DDICT_CONFIG_PATH=\"/usr/pkg/etc/\" -Wl,-R/usr/pkg/lib -L/var/package-obj/textproc/dict-server/work/.buildlink/lib -o dictd dictd.c daemon.o net.o servscan.o servparse.o md5.o index.o data.o utf8_ucs4.o -Llibmaa -lmaa -lz -lltdl
/usr/bin/cc -Ilibmaa -DHAVE_CONFIG_H -I/var/package-obj/textproc/dict-server/work/.buildlink/include -I. -g -DDICT_VERSION=\"1.8.0\" -DDICT_CONFIG_PATH=\"/usr/pkg/etc/\" -Wl,-R/usr/pkg/lib -L/var/package-obj/textproc/dict-server/work/.buildlink/lib -o dictzip dictzip.c index.o data.o utf8_ucs4.o -Llibmaa -lmaa -lz -lltdl


... so as you can see when it builds dictd and dictzip libmaa is OK, but
of course we're now attempting to build in ${WRKDIR}/dict-misc-1.5, and
so the -Llibmaa is quite wrong -- it needs to point at ../dictd-1.8.0/libmaa.


Whom ever did the initial packaging didn't examine the configuration
scripts and options very well either:  It's claiming to find things that
there are no dependencies listed for, such as:

	checking for perl... perl
	checking for latex2e... no
	checking for latex... latex
	checking for fig2dev... fig2dev
	checking for dvips... dvips
	checking for refbibtex... no
	checking for bibtex... bibtex

I don't know if they will actually be used, but they do make me worry
that a binary package would not work.  Configure scripts must be
carefully examined to be sure they won't accidentally find and use
something that isn't listed as a dependency (run-time or build-time as
appropriate).


There are other problems in the Makefile too, starting with a trivial
minro spelling mistake in a comment, and continuing with a broken shell
'for' statement that causes this failure:

	cc -Ilibmaa -DHAVE_CONFIG_H   -I/usr/pkg/include -I. -g -DDICT_VERSION=\"1.8.0\" -DDICT_CONFIG_PATH=\"/usr/pkg/etc/\"  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -o dictzip dictzip.c  index.o data.o utf8_ucs4.o -Llibmaa -lmaa -lz -lltdl
	cd: can't cd to dict-misc-1.5
	*** Error code 2
	
	Stop.
	make: stopped in /work/woods/m-NetBSD-pkgsrc/textproc/dict-server
	*** Error code 1

That 'for' loop really should be a .for loop, as should several others
later too because the shell loops save no appreciable resources in these
cases and they cause the process to be far too opaque.  I don't see a
"cd" command above, just an error from a hidden "cd"!  Here are the
minimal fixes to get as far as the -Llibmaa linker error above:

Index: textproc/dict-server/Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/textproc/dict-server/Makefile,v
retrieving revision 1.5
diff -c -r1.5 Makefile
*** textproc/dict-server/Makefile	11 Oct 2002 00:47:28 -0000	1.5
--- textproc/dict-server/Makefile	20 Oct 2002 02:43:52 -0000
***************
*** 54,89 ****
  		    $${f}.orig >$$f; \
  	done
  
! # Build dictinaries
  post-build:
  	@${LN} -s ${WRKDIR}/web-1913-0.46a ${WRKDIR}/dict-web1913-1.4/web1913
! 	@for d in dict-misc-1.5 dict-gazetteer-1.3 dict-web1913-1.4 dict-wn-1.5; do \
! 		(cd $$d; \
! 		    ${SH} configure; \
! 		    ${MAKE_PROGRAM} db; \
! 		); \
! 	done
  
  post-install:
  	${SED} "s#/usr/lib/dict#${PREFIX}/share/dictd#" \
  		${WRKSRC}/dictd.conf >${PREFIX}/etc/dictd.conf
  	${INSTALL_DATA_DIR} ${PREFIX}/share/dictd
! 	for f in ${LEXICONS}; do \
! 		${INSTALL_DATA} ${WRKDIR}/dict-misc-1.5/$$f \
! 		    ${PREFIX}/share/dictd; \
! 	done
! 	for f in ${GAZETTEER}; do \
! 		${INSTALL_DATA} ${WRKDIR}/dict-gazetteer-1.3/$$f \
! 		    ${PREFIX}/share/dictd; \
! 	done
! 	for f in ${WEB1913}; do \
  		${INSTALL_DATA} ${WRKDIR}/dict-web1913-1.4/$$f \
! 		    ${PREFIX}/share/dictd; \
! 	done
! 	for f in ${WN}; do \
  		${INSTALL_DATA} ${WRKDIR}/dict-wn-1.5/$$f \
! 		    ${PREFIX}/share/dictd; \
! 	done
  
  .include "../../devel/libtool/buildlink2.mk"
  .include "../../mk/bsd.pkg.mk"
--- 54,86 ----
  		    $${f}.orig >$$f; \
  	done
  
! # Build dictionaries
  post-build:
  	@${LN} -s ${WRKDIR}/web-1913-0.46a ${WRKDIR}/dict-web1913-1.4/web1913
! .for dictdir in dict-misc-1.5 dict-gazetteer-1.3 dict-web1913-1.4 dict-wn-1.5
! 	cd ${WRKDIR}/${dictdir} && ${SH} configure && ${MAKE_PROGRAM} db
! .endfor
  
  post-install:
  	${SED} "s#/usr/lib/dict#${PREFIX}/share/dictd#" \
  		${WRKSRC}/dictd.conf >${PREFIX}/etc/dictd.conf
  	${INSTALL_DATA_DIR} ${PREFIX}/share/dictd
! .for f in ${LEXICONS}
! 		${INSTALL_DATA} ${WRKDIR}/dict-misc-1.5/${f} \
! 		    ${PREFIX}/share/dictd
! .endfor
! .for f in ${GAZETTEER}
! 		${INSTALL_DATA} ${WRKDIR}/dict-gazetteer-1.3/${f} \
! 		    ${PREFIX}/share/dictd
! .endfor
! .for f in ${WEB1913}
  		${INSTALL_DATA} ${WRKDIR}/dict-web1913-1.4/$$f \
! 		    ${PREFIX}/share/dictd
! .endfor
! .for f in ${WN}
  		${INSTALL_DATA} ${WRKDIR}/dict-wn-1.5/$$f \
! 		    ${PREFIX}/share/dictd
! .endfor
  
  .include "../../devel/libtool/buildlink2.mk"
  .include "../../mk/bsd.pkg.mk"



FYI:

$ ident DESCR Makefile PLIST distinfo patches/patch-*    
DESCR:
ident warning: no id keywords in DESCR

Makefile:
     $NetBSD: Makefile,v 1.5 2002/10/11 00:47:28 uebayasi Exp $

PLIST:
     $NetBSD: PLIST,v 1.2 2002/10/11 00:47:28 uebayasi Exp $

distinfo:
     $NetBSD: distinfo,v 1.5 2002/10/11 00:47:29 uebayasi Exp $

patches/patch-ab:
     $NetBSD: patch-ab,v 1.3 2002/10/11 00:47:29 uebayasi Exp $

patches/patch-ac:
     $NetBSD: patch-ac,v 1.3 2002/10/11 00:47:29 uebayasi Exp $

patches/patch-ad:
     $NetBSD: patch-ad,v 1.1.1.1 1999/07/28 16:17:20 tron Exp $

patches/patch-ae:
     $NetBSD: patch-ae,v 1.2 2001/10/12 10:51:52 simonb Exp $

patches/patch-ag:
     $NetBSD: patch-ag,v 1.1 2000/06/26 21:02:06 dmcmahill Exp $

patches/patch-ah:
     $NetBSD: patch-ah,v 1.2 2001/10/12 10:51:52 simonb Exp $

patches/patch-ai:
     $NetBSD: patch-ai,v 1.1 2000/06/26 21:02:08 dmcmahill Exp $

patches/patch-aj:
     $NetBSD: patch-aj,v 1.1 2000/06/26 21:02:09 dmcmahill Exp $

patches/patch-ak:
     $NetBSD: patch-ak,v 1.1 2001/08/16 07:03:22 agc Exp $


-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>