Subject: bin/10654: pkg_install/ includes bits that host cross-build
To: None <>
From: None <>
List: netbsd-bugs
Date: 07/21/2000 18:32:17
>Number:         10654
>Category:       bin
>Synopsis:       pkg_install/ includes bits that host cross-build
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 21 18:33:00 PDT 2000
>Originator:     Chris Demetriou
>Release:        NetBSD-current as of 2000-07-21
mostly irrelevant, but: cross-compiling NetBSD from Solaris.

The determination and use of 'OPSYS' in usr.sbin/pkg_install/
(1) uses an absolutely undocumented variable to set the 'operating
system being compiled for' (hey, i thought this was a NetBSD
source tree!), and (2) determines that variable (uname) in a way
that breaks cross-compilation.

The right think here isn't to document or check for the variable
more carefully.  This is a NetBSD source tree, and that means
that it's being compiled for NetBSD.  if you want to do magic
for compiling for other operating systems, do it in a way that
doesn't break NetBSD native or cross builds (and doesn't require
any additional cross-build setup; we _already_ require way too much,
and it's not adequately documented).  (This whole random use of
host programs like uname thang reminds me of the joys of attempting
to cross-compile random linux user-land packages!)

Additionally, while the CHMOD, CHOWN, and CHGRP defintions may be
'nice,' they're stylistically very bad.  If there's the need
to hard-code a specific path to a program to execute (and, 
really, unless something's very wrong there shouldn't be), 
then it should be gotten from <paths.h> rather than being hard-coded
in a makefile.
read pkg_install/  try to cross-build from a solaris

Look for any statement about definition or use of "OPSYS" and
find none.  Realize that since you're compiling NetBSD, such a
check shouldn't be necessary.

While you're there, notice the hard-coded paths.
nuke the non-NetBSD cases from the Makefile.

fix the code which needs hard-coded paths to either:

	* not need it (i.e., try a default path if absolutely
	  necessary), or

	* use paths.h as a last resort.