[comp.windows.x] difficulty installing in other than /usr/[bin,lib,include]/X11

wine@maui.cs.ucla.edu (David Wine) (11/21/89)

I have a problem configuring.

I tried to make X to sit in /n/color/share/usr/bin/X11R3, with
the obvious lib and include libraries.  I used the site.def file
which follows and made the World.  To install I did
make DESTDIR=/n/color/share install.  The files all went to
the expected places (/n/color/share/usr/.../X11R3/...) but
X can't find its fonts.  What did I do wrong?

--David


/**/# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $

/*****************************************************************************
 *                                                                           *
 *			   SITE-SPECIFIC DEFINITIONS                         *
 *                                                                           *
 * Override any of the defaults in def.def here.  Use ifndef so that servers *
 * can override you if necessary:                                            *
 *                                                                           *
 *     #ifndef ABuildParameter                                               *
 *     #define ABuildParameter myvalue                                       *
 *     #endif                                                                *
 *                                                                           *
 * We strongly recommend that you don't change the installation directories  *
 * and just use symbolic links if you want things to be installed on a       *
 * different partition.  For example,                                        *
 *                                                                           *
 *     # cd directory_containing_X_distribution                              *
 *     # make World                                                          *
 *     # mkdir /otherdisk/X                                                  *
 *     # foreach i (bin lib include)                                         *
 *     >     mkdir /otherdisk/X/$i                                           *
 *     >     ln -s /otherdisk/X/$i /usr/$i/X11                               *
 *     > end                                                                 *
 *     # make install                                                        *
 *                                                                           *
 * Note on using DESTDIR:  If you want to install into a scratch directory   *
 * but will eventually move the tree back to the root, compile with DESTDIR  *
 * blank and install with "make install DESTDIR=directory".                  *
 *                                                                           *
 *****************************************************************************/

/*
 * place site-specific definitions here
 */

/* added Oct 1989 D. Wine */

#ifndef ibm032
#define ibm032		/* as nothing */
#endif

			/* new video DAC in all our mpels */
#ifndef DAC_MPEL16M
#define DAC_MPEL16M	/* as nothing */
#endif

#ifndef PrimaryScreenResolution
#define PrimaryScreenResolution	91	/* for mpel */
#endif

#ifndef ManDirectoryRoot
#define ManDirectoryRoot /usr/local/man
#endif


#ifndef DestDir
#define DestDir /* as nothing */
#endif
#ifndef UsrLibDir
#define UsrLibDir $(DESTDIR)/usr/lib
#endif
#ifndef BinDir
#define BinDir $(DESTDIR)/usr/bin/X11R3
#endif
#ifndef IncDir
#define IncDir $(DESTDIR)/usr/include/X11R3
#endif
#ifndef LibDir
#define LibDir $(USRLIBDIR)/X11R3
#endif

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (11/21/89)

    I tried to make X to sit in /n/color/share/usr/bin/X11R3, with
    the obvious lib and include libraries.  I used the site.def file
    which follows and made the World.  To install I did
    make DESTDIR=/n/color/share install.  The files all went to
    the expected places (/n/color/share/usr/.../X11R3/...) but
    X can't find its fonts.  What did I do wrong?

If you are going to leave the installed stuff under /n/color/share/ instead of
later moving it to /, you'll have to have DESTDIR set during "make World" as
well.

abair@turbinia.oakhill.uucp (Alan Bair) (11/21/89)

In article <29336@shemp.CS.UCLA.EDU> wine@maui.cs.ucla.edu (David Wine) writes:

   I tried to make X to sit in /n/color/share/usr/bin/X11R3, with
   the obvious lib and include libraries.  I used the site.def file
   which follows and made the World.  To install I did
   make DESTDIR=/n/color/share install.  The files all went to
   the expected places (/n/color/share/usr/.../X11R3/...) but
   X can't find its fonts.  What did I do wrong?

   --David

(deleted code)
   #ifndef DestDir
   #define DestDir /* as nothing */
   #endif
   #ifndef UsrLibDir
   #define UsrLibDir $(DESTDIR)/usr/lib
   #endif
   #ifndef BinDir
   #define BinDir $(DESTDIR)/usr/bin/X11R3
   #endif
   #ifndef IncDir
   #define IncDir $(DESTDIR)/usr/include/X11R3
   #endif
   #ifndef LibDir
   #define LibDir $(USRLIBDIR)/X11R3
   #endif

I wanted to do a similar thing.  Install the code in /usr/local/..., mount
/usr/local on all the nodes and use the appropriate -I/... options when
compiling.  This looked a lot easier to maintain, instead of creating links
in /usr/include & /usr/lib on our nodes.  It does work.

I think the problem you are having and why the install notes strongly suggest
you use the link method, is due to certain uses of the xxxDir defines above.
I know that at least the LibDir define is used in compiling certain X
functions, so it knows where the X library is.  So when you try to do what
you did, without the links, some of the code looks in /usr/bin/X11R3 for
example.  There is no link from here to where the code actually is, so it
fails.

I solved this by coding in the complete path for the defines.  Now the path
is in the compiled code and it gets installed where it will be looked for.
This does violate the suggestions, but I think it is a lot cleaner, especially
in a networking environment like I am in.

One other point, which I think is what the link suggestion was for.  I am
starting to run out of space in the /usr/local filesystem, so I may have
to keep the code somewhere else.  Well with my method I can still handle that.
I move the code from /usr/local to somewhere else and put links in place.
However, now I only have to make the links in one place and if I used a
commonly mounted filesystem for the alternate location , I do not even have
to update any mountings.  I suppose I could even use the DESTDIR method to
install in the new location.

Hope this helps.  If anyone else has a better idea, please let me know.


--
Alan Bair
SPS CAD                   Logic Simulation & Test
Motorola, Inc.            Austin, Texas
...!cs.utexas.edu!oakhill!turbinia!abair

kochmar@b.sei.cmu.edu (John Kochmar) (11/21/89)

I also installed X11R3 under someplace other than the "recommended" area.  There
are a lot more things you have to change other than DESTDIR.  I had to go in and
patch most of the few man pages, some source code (I don't remember which, my
note book is at the office, and I am on vacation this week), and God help you
when you start with the contributed stuff.

Sure, it will "install" into a directory other than /usr/{bin,lib}/X11, but that
doesn't mean that it is installed correctly. 


#=============================================================================#
# John Kochmar 					  	  kochmar@sei.cmu.edu #
# Systems Programmer   						    SEI / CMU #
# I'll PROVE I'm a systems programmer!  Get me a system, and I'll program it! #
# You DO have a system, don't you?					      #

datri@concave.uucp (Anthony A. Datri) (11/21/89)

>I tried to make X to sit in /n/color/share/usr/bin/X11R3, with

I'd suggest just making /usr/bin/X11, /usr/lib/X11, and /usr/include/X11
links to directories where you want things to really be.

casey@gauss.llnl.gov (Casey Leedom) (11/22/89)

  It isn't hard to do what you want at all.  It's only slightly confused
by a problem in the meaning of DESTDIR in the distributed Makefile
template.

  Basically, the traditional meaning of DESTDIR has been: when you
actually perform the installation of files into BINDIR, LIBDIR, INCDIR,
etc., prepend DESTDIR to the installation directory targets.  This allows
you to install a rooted installation tree somewhere other than root.
This is useful if you're building a new system or distribution.

  This is done for 4BSD distributions when a new distribution tape is
cut.  CSRG still has to be able to work on the machines, but they
obviously don't want to distribute a copy of their system.  So the build
a pristine distribution under /nbsd.  Also obvious is the fact that they
can't have all the Makefiles targeting into /nbsd or all the applications
would try to find things under /nbsd instead of /, etc.  So they compile
everything normally, but then install by saying ``make install
DESTDIR=/nbsd'' - DESTDIR is passed down automatically by Makefiles when
subdirectories are recursively made.

  The problem with the X11.3 Makefile template is that it has lines in it
of the form ``BINDIR=$(DESTDIR)/...'' when they should really read
``BINDIR=/...'' and the "install" target should prepend $(DESTDIR) as it
installs files.  Hopefully this will be fixed in R4.

  Luckily, since the R3 Makefile template passes DESTDIR down
automatically just as the 4BSD Makefiles do, you can just configure and
compile R3 with DESTDIR set to nothing and then use ``make install
DESTDIR=/...'' when you install to pick where you want things actually
installed.  There may still be a couple of applications which give you
problems: some applications automatically recompile themselves on an
install even though already fully compiled because of weird
dependencies.  Those you'll just have to deal with by hand.  Off hand I
can't think of anything in the core distribution that has this problem.

  It also isn't that hard to change the default installation directories
from /usr/lib, etc.  You can do it all from site.def quite easily.  I
really hope that R4 drops the comment that they consider this to be a bad
practice.  It's unreasonable to expect that one choice of directories
will work for everyone.  Personally I install all non-stock software
under /usr/local/{bin,lib,include}.  Other sites have other reasons for
installing software elsewhere ...

Casey

wine@CS.UCLA.EDU (David Wine) (11/22/89)

> If you are going to leave the installed stuff under /n/color/share/ instead of
> later moving it to /, you'll have to have DESTDIR set during "make World" as
> well.

Thanks for your help.  I think I made some other transient mistake
because now when I start X it works fine.

I didn't set DESTDIR during "make World" because I planned to use
symbolic links from /usr/.../X11R3 to /n/color/share/usr/../X11R3.
(I know, it sounds a little contorted but I thought it was cleaner
that users' PATH would be set to /usr/bin/X11R3.)

Anyway, thanks again.

--David

wine@maui.cs.ucla.edu (David Wine) (11/22/89)

> I'd suggest just making /usr/bin/X11, /usr/lib/X11, and /usr/include/X11
> links to directories where you want things to really be.

This would certainly be the most straightforward approach, but I don't
want to be messing with things while people are using release 2.
They'll come in in the morning and X won't start properly for them.
Besides making transition more painless, release 3 from MIT runs much
slower on some of our RTs than release 2 from IBM (probably paging
a lot more).  I'm not sure yet I want to take away people's option
of using release 2 for this reason.

-David

casey@gauss.llnl.gov (Casey Leedom) (11/23/89)

| From: datri@convex.COM (Anthony A. Datri)
| 
| >I tried to make X to sit in /n/color/share/usr/bin/X11R3, with
| 
| I'd suggest just making /usr/bin/X11, /usr/lib/X11, and /usr/include/X11
| links to directories where you want things to really be.

  This isn't necessary in the least.  We've been running with X11.3
installed under /usr/local/{bin,lib,include} for nearly a year now with
no problems.  Two csh aliases will help you on Berkeley systems if you do
a lot of compiling:

	% alias cc "cc -I/usr/local/include -L/usr/local/lib/X11"
	% alias ld "ld  -L/usr/local/lib/X11"

Note that some Berkeley systems (like Alliant Concentrix) don't support
the -L switch, but do allow you to specify directories to search for
libraries in different ways (Alliant Concentrix uses the environment
variable LD_PATH).

  Things would be even easier if R4 installed "imake" when one did ``make
install'' and made imake capable of differentiating a ``stand alone
compile'' from a ``production compile'' (i.e. compiling from within the
X11 source tree for boot strapping or development purposes as opposed to
using installed include and library files) ... (hint hint) We'd certainly
see more people using imake ...

  I would say that one of the nicest ways of doing this would be to give
imake a default include path to search for a default Makefile template
(ex:  $(INCDIR)/imake and "Imake.tmpl") and use something like ``imake
-DSTAND_ALONE ...'' which Imake.tmpl would use to properly construct a
Makefile for stand alone purposes.  ``make World'' would then use ``imake
-DSTAND_ALONE -T $(TOP)/util/imake.includes/Imake.tmpl''.  If people
doing Imake.tmpl development wanted to test out new template files they
could just have an Imake.tmpl, site.def, etc. files in the current
directory which would match the include specification before those in
$(INCDIR)/imake ...

  Makedepend also needs to be installed obviously, but I think we should
be thinking about using available tools here.  Berkeley now uses the shell
script "mkdep" to do this job and distributed it with 4.3-tahoe.  It
would be nice if we could get together on this.

  Just something I'd like to see in R4 ... :-) (P.S. I'll do the work for
this if no one in the X development group has the time.)

Casey

meo@stiatl.UUCP (Miles O'Neal) (11/29/89)

Try

make world -DDESTDIR=/n/color/foo

or whatever directory you want.

I spent time on this, too, and a cohort of mine
(hi, Susan Liebeskind) figured it out...

-Miles
emory!stiatl!meo

raveling@isi.edu (Paul Raveling) (12/02/89)

In article <29421@shemp.CS.UCLA.EDU>, wine@maui.cs.ucla.edu (David Wine)
writes:
> 
> > I'd suggest just making /usr/bin/X11, /usr/lib/X11, and /usr/include/X11
> > links to directories where you want things to really be.
> 
> This would certainly be the most straightforward approach, but I don't
> want to be messing with things while people are using release 2.

	We're using an awkward but working solution to this problem.
	We usually have 3 versions of X11 simultaneously available
	from the same file server.

	Each workstation has a /private subtree on local disk that's
	referenced from lots of places on the file server's tree via 
	symbolic links.  Many things in /private are symbolic links
	back to the file server, so changing the link in /private
	can select a private version.  For example,

	Directory /usr/bin/X11  -> /private/bin/X11
	                        -> /pd/X11R3/usr/bin

	Back on the file server we have /pd/X11R3, /pd/X11R2.hp, and
	various other trees with a similarly structured usr subtree.
	A shell script selects which X11 version to use by changing
	the symbolic links in /private.

	There are some tricks in setting symbolic links though.  For
	example, /usr/lib/libX11.a and many other libraries must be
	links to /private/lib/<whatnot>.a.  They must be mingled with
	other non-X libraries instead of being neatly segregated into
	a /usr/lib/X11 directory.  This calls for LOTS of caution when
	installing a new OS version on the file server -- a "normal"
	update would overwrite many of the needed links.

	We've also adopted a local convention that X11 manual entries
	go into man1 and man3 subdirectories of /usr/man/X11.  This
	greatly simplifies manual housekeeping, except that "make install.man"
	doesn't normally put things in the right place.  At best this
	means being prepared with a couple more unusual symbolic links;
	at worst it means doing "make -n install.man > install_script",
	then editing and running "install_script".


	For the benefit of anyone with slightly masochistic tendencies
	I'll append a copy of the select_x11 shell script that selects
	which version of X11 any given workstation uses.  A typical
	invocation would be

		select_x11 X11R3

	to select files in the /pd/X11R3/usr subtree on the file server.


----------------
Paul Raveling
Raveling@isi.edu

------------------------------------------------------------------------
#!/bin/csh
#
#	Script to select a version of X11
#	Example:	"select_x11 X11R3" selects MIT's X11R3 release,
#			with installed files rooted at /pd/X11R3/usr
#
#	Paul Raveling	May 19, 1989



if ( -e /private/bin ) then
#	OK if it exists
else
   mkdir /private/bin
endif
if ( -e /private/include ) then
#	OK if it exists
else
   mkdir /private/include
endif
if ( -e /private/lib ) then
#	OK if it exists
else
   mkdir /private/lib
endif
if ( -e /private/man ) then
#	OK if it exists
else
   mkdir /private/man
endif

rm -f				/private/bin/X11
ln -s /pd/$1/usr/bin		/private/bin/X11
rm -f				/private/include/X11
ln -s /pd/$1/usr/include	/private/include/X11
rm -f				/private/lib/X11
ln -s /pd/$1/usr/lib		/private/lib/X11
rm -f				/private/man/X11
ln -s /pd/$1/usr/man		/private/man/X11
rm -f				/private/lib/libX11.a
ln -s /pd/$1/usr/lib/libX11.a	/private/lib/libX11.a
rm -f				/private/lib/libXaw.a
ln -s /pd/$1/usr/lib/libXaw.a	/private/lib/libXaw.a
rm -f				/private/lib/libXext.a
ln -s /pd/$1/usr/lib/libXext.a	/private/lib/libXext.a
rm -f				/private/lib/libXmu.a
ln -s /pd/$1/usr/lib/libXmu.a	/private/lib/libXmu.a
rm -f				/private/lib/libXt.a
ln -s /pd/$1/usr/lib/libXt.a	/private/lib/libXt.a
rm -f				/private/lib/libXw.a
ln -s /pd/$1/usr/lib/libXw.a	/private/lib/libXw.a
rm -f				/private/lib/liboldX.a
ln -s /pd/$1/usr/lib/liboldX.a	/private/lib/liboldX.a

if ( !~ -e /private/lib/X0devices ) then
   cp /pd/$1/usr/lib/X0devices.default /private/lib/X0devices
endif
if ( !~ -e /private/lib/X0screens ) then
   cp /pd/$1/usr/lib/X0screens.default /private/lib/X0screens
endif
##	Should we also do something like this?
##if ( !~ -e /etc/X0.hosts) then
##   cp /pd/$1/usr/lib/X0.hosts.default /etc/X0.hosts
##endif


if ( $1 == "X11R3" ) then
   echo "setenv X11ALTBIN /pd/X11R2.hp/usr/bin" > /private/X11ALTBIN
else
   echo "setenv X11ALTBIN /pd/X11R3/usr/bin" > /private/X11ALTBIN
endif