Subject: pkg/32726: x11/xdm3d fails to build/install
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <kre@munnari.OZ.AU>
List: pkgsrc-bugs
Date: 02/04/2006 06:25:00
>Number:         32726
>Category:       pkg
>Synopsis:       x11/xdm3d fails to build/install (+fix - but not the right way)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 04 06:25:00 +0000 2006
>Originator:     Robert Elz
>Release:        NetBSD 3.99.15
>Organization:
	Prince of Songkla University
>Environment:
	
	
System: NetBSD jade.coe.psu.ac.th 3.99.15 NetBSD 3.99.15 (GENERIC-1.696-20060125) #8: Wed Jan 25 04:59:39 ICT 2006 kre@jade.coe.psu.ac.th:/usr/obj/current/kernels/JADE_ASUS i386
Architecture: i386
Machine: i386

>Description:
	x11/xdm3d makes copies of a bunch of the standard X11 xdm
	configuration files, and for some exotic reason, the xdm
	chooser.   It (the pkgsrc Makefile, not xdm3d itself) expects
	all of those to be found in the same directory.   That was once
	true, but is no longer.   The chooser is now, as it should be,
	in a libexec directory somewhere, whereas the scripts (which users
	might want to change) are in a local configuration directory
	(all of which is as it should be) - other than the xdm3d Makefile
	looking for all of them in he same place..

>How-To-Repeat:
	Use a 3.0 (or later) system (maybe earlier too), and attempt
	to "make install" for x11/xdm3d

	Expect to see a failure along the lines of ...

/usr/bin/install -c -s -o root -g wheel -m 555 /etc/X11/xdm/chooser /usr/pkg/share/xdm3d
install: /etc/X11/xdm/chooser: stat: No such file or directory
*** Error code 1

>Fix:
	The patch below makes this work (at least on 3.0 and beyond,
	it may need some extra fiddling to work on earlier versions of
	NetBSD)   No idea what happens for systems using x.org X11
	(might all just work, might not even come close, I don't have
	such a system to test it with).

	But, this stuff is all wrong.   There's no legitimate reason
	for xdm3d to make its own copy of the chooser - it is a binary,
	no-one is going to go altering it, and no special version is
	needed for xdm3d - rather than copying the chooser into its
	own directory, xdm3d should simply be using the standard one
	(which is required to exist - xdm3d isn't compiling one and
	installing iis own).

	Begind that, if a separate copy is to be made, perhaps so the
	complete standard xdm could be removed (though NetBSD has no
	current procedure to allow that to happen easily) then the
	chooser should be being installed in a libexec directory for
	xdm3d, not in the same directory as the (user alterable)
	scripts.

	And still more, the scripts should, like the standard X11
	xdm versions, be being treated as user configurable per system, and
	should be installed under (and then used from) PKG_SYSCONFBASE
	rather than simply being dumped into the (shareable)
	/usr/pkg/share/* hierarchy.

	But, for what it is worth, here is the patch to the Makefile
	for x11/xdm3d that makes the thing at least build & install for me,
	(I did not check that the PLIST is correct, but as I did not
	alter the locations where anything gets installed, just where
	it is installed from, it should be as correct after this change
	as it was before it).

	There is no need to bump PKGREVISION for this patch, however, if
	this were fixed properly, that should count as a new rev.

--- Makefile.orig	2005-12-29 06:40:24.000000000 +0700
+++ Makefile	2006-02-04 13:11:56.000000000 +0700
@@ -23,10 +23,18 @@
 XDMDIR=/etc/X11/xdm
 .else
 PKG_FAIL_REASON+=	"Cannot find xdm directory."
 .endif
 
+.if exists(${X11BASE}/libexec/chooser)
+XDMCHOOSER=${X11BASE}/libexec/chooser
+.elif exists(${XDMDIR}/chooser)
+XDMCHOOSER=${XDMDIR}/chooser
+.else
+PKG_FAIL_REASON+=	"Cannot find xdm chooser."
+.endif
+
 do-install:
 	echo "${X11BASE} ${XDMDIR}"
 	${INSTALL_PROGRAM} ${WRKSRC}/xdm ${PREFIX}/bin/xdm3d
 	${INSTALL_DATA_DIR} ${PREFIX}/share/xdm3d
 	${INSTALL_DATA} ${XDMDIR}/GiveConsole ${PREFIX}/share/xdm3d
@@ -40,11 +48,11 @@
 	elif [ -r ${XDMDIR}/Xsetup_0 ]; then		\
 		${INSTALL_DATA} ${XDMDIR}/Xsetup_0 ${PREFIX}/share/xdm3d; \
 		sedexpr='-e s|^share/xdm3d/Xsetup$$|@comment\ &|';	\
 	fi;								\
 	${SED} "$$sedexpr" ${PKGDIR}/PLIST > ${PLIST_SRC}
-	${INSTALL_PROGRAM} ${XDMDIR}/chooser ${PREFIX}/share/xdm3d
+	${INSTALL_PROGRAM} ${XDMCHOOSER} ${PREFIX}/share/xdm3d
 	${INSTALL_DATA_DIR} ${PREFIX}/share/xdm3d/authdir
 	${CHMOD} 700 ${PREFIX}/share/xdm3d/authdir
 	${SED} -e 's@${XDMDIR}@${PREFIX}/share/xdm3d@' < \
 		${XDMDIR}/xdm-config > \
 		${PREFIX}/share/xdm3d/xdm-config

>Unformatted:
 	Building using pkg_comp with libkver, and NetBSD version set to 3.0
 	(using NetBSD-3.0 release sets).   If relevant, BSDSRCDIR
 	would have a NetBSD-3.0_STABLE set of sources from about Jan 26
 	(that isn't relevant to this PR).   pkgsrc is current as of
 	a few hours ago.