Subject: How to compile X11 pkgs into /usr/pkg
To: Tim Rightnour <root@garbled.net>
From: Todd Vierling <tv@pobox.com>
List: tech-userlevel
Date: 06/21/1998 10:16:05
[packages@netbsd.org added to thread as some may not read tech-userlevel]

On Sun, 21 Jun 1998, Tim Rightnour wrote:

: ldconfig the new libs,
: set up site.def to point motif stuff at /usr/local,
: set the XAPPLRESDIR in the xdm server startup scripts

The following procedure should give you an integrated X11-to-/usr/pkg
system, recapped here for the interests of users who haven't kept up on the
thread.  This is something I'll write up a doc to put in the Packages.txt. 
(Note that it assumes that /usr/pkg/lib is already in ld.so.conf for a.out
platforms.) 

- Install the file below into /usr/X11R6/lib/X11/config/host.def
- Add the line:
    X11BASE=${LOCALBASE}
  to /etc/mk.conf
- Set the env variable XAPPLRESDIR to /usr/pkg/lib/X11/app-defaults in login
  scripts (such as /etc/profile and /etc/csh.login), xdm startup scripts,
  or .xinitrc/.xstartup files

: What we want to derrive from a public discussion, is a way that we can "fix"
: netbsd's X implementation, to allow pkgs to go to /usr/pkg instead of forcing
: them upon X11R6. Setting these things up in the NetBSD supplied X distribution
: allows us to take advantage of that, and *completely* segregate third party
: applications from NetBSD supplied applications, and allow me my nirvanna, which
: is, /usr/X11R6 mounted read-only.

However, we _need_ to remain compatible with the 1.3 distribution in
pkgsrc.  If that means requiring users of pkgsrc install the below host.def,
that could be OK, or we could leave the default behavior of installing into
${X11BASE} and let the addition of the X11BASE=${LOCALBASE} line in mk.conf
dictate the change.

/********** CUT host.def **********/
#ifdef AfterVendorCF

/*
 * The following defines inject a "PREFIX=" make-time option that lets the
 * user twiddle the ProjectRoot setting with a single switch.  This makes
 * the command "make PREFIX=/path/to/install all install" work as expected.
 *
 * Note that ?= is a special Pmake construct and probably will not work on
 * other makes.
 */

#ifndef ProjectRoot
/*
 * Assume the worst:  this should not happen in practice, as this setup
 * does not work with the classical /usr/{include,lib}/X11 layout.
 */
#define ProjectRoot /usr/X11
#endif

PREFIX ?= ProjectRoot
X11_ROOT = ProjectRoot
#undef ProjectRoot
#define ProjectRoot $(PREFIX)

/*
 * This emits dual -I and -L options to cc automatically, one for the actual
 * X11 root, and one for the user-set prefix.
 */
#define X11ProjectRoot $(X11_ROOT)

#endif
/********** CUT host.def **********/

: # There are some pre-configure pkg targets out there that use sed to
: # substitute ${X11BASE} into Imakefiles; these need to be changed to use
: # ${PREFIX} properly.  Once fixed, these sed manipulations would work with
: # either /usr/X11R6 or /usr/pkg as ${PREFIX}.

Oh, and this becomes rather moot if X11BASE=${LOCALBASE} in mk.conf.  But 
I still think these pkgs should make use of ${PREFIX} and not ${*BASE}.  8-)

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)