Subject: pkg/14861: games/craft wants data files under X11R6 even with xpkgwedge
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 12/06/2001 20:16:58
>Number:         14861
>Category:       pkg
>Synopsis:       games/craft still looks under /usr/X11R6 with xpkgwedge
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 06 21:46:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Robert Elz
>Release:        NetBSD-current 20011127  (pkgsrc of 20011205)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD fuchsia 1.5Y NetBSD 1.5Y (FUCHSIA) #2: Mon Nov 26 13:41:27 ICT 2001     kre@fuchsia:/usr/obj/sys/FUCHSIA i386


>Description:
	games/craft makes explicit reference to /usr/X11R6 

fuchsia# grep X11R6 *[ch]
win.hc:         system ("cp /usr/X11R6/share/craft/.windefaults.params ~/.windefaults.params");

>How-To-Repeat:
	cd pkgsrc/pkgtools/xpkgwedge
	make install
	cd ../../games/craft
	make install

	Then as some user who has never used this program before...

	craft

watch for ...

fuchsia$ craft
CRAFT Version 3.5 (http://set.gmd.de/~hua) started
cp: /usr/X11R6/share/craft/.windefaults.params: No such file or directory
ERROR (1) : PARAMREADER : .windefaults : parameter file unknown : - : -
Abort trap

Note:
fuchsia$ ls -la /usr/pkg/share/craft
total 60
dr-xr-xr-x    4 root  wheel    512 Dec  6 19:22 .
drwxr-xr-x  132 root  wheel   3072 Dec  6 19:22 ..
-r--r--r--    1 root  wheel   1231 Dec  6 19:22 .windefaults.params
drwxr-xr-x    2 root  wheel   1024 Dec  6 19:22 buttons
drwxr-xr-x    3 root  wheel  54272 Dec  6 19:22 hcraft

>Fix:

Replace patches/patch-ab with ...


--- win.hc.orig	Wed Mar 19 21:21:21 1997
+++ win.hc	Thu Dec  6 19:37:48 2001
@@ -118,8 +118,8 @@
 
 .  perform_init
      {win_handler_init = true;
-      if (! f_exists (".windefaults.params"))
-         system ("cp /home/hua/craft/.windefaults.params .");
+      if (! f_exists ("~/.windefaults.params"))
+         system ("cp " CRAFT_DIR ".windefaults.params ~/.windefaults.params");
       win_defaults = new paramreader (".windefaults");
      }.
 
Note 'system("cp ...");' is hardly a great way to copy a ~ 1K file...
And relying uypon the shell that runs system(3) supporting '~' is
close to folly - but at least the file will be fetched from the right
place.   (Perhaps ${HOME} would be better than ~)

Alternatively, do the same @PREFIX@ trick that patch-a[cde] use for
similar purposes.

If my patch above is used, files/Makefile needs to be adjusted as ...

--- Makefile.ORIG	Thu Aug 12 05:20:57 1999
+++ Makefile	Thu Dec  6 19:50:45 2001
@@ -9,7 +9,7 @@
 GPP=g++
 
 XLIB=${X11BASE}/lib
-CPPFLAGS=-I${X11BASE}/include -DCRAFT_DIR=\"${PREFIX}/share/craft/\"
+CPPFLAGS=-I${X11BASE}/include -DCRAFT_DIR=\\\"${PREFIX}/share/craft/\\\"
 
 #
 #--------------------------------------------------------------------

The only reason this worked before was that CRAFT_DIR wasn't atually
used anywhere, so the missing "'s in the value passed to gcc were
harmless.   An extra level of quoting is required because of the weird
hcc/hcc thing that is used to compile these files.

To make it correct, this should either be fixed, or the -DCRAFT_DIR
simply deleted from CPPFLAGS, even if the @PREFIX@ technique is used
in patch-ab.
>Release-Note:
>Audit-Trail:
>Unformatted: