Win32 is going to need relocatable installs, and Unix packagers have
asked for this too.
A relocatable install is one where you can do 'gmake install', tar up
the directory where you installed it, then untar it on to another
machine with the same operating system, but into a different directory
location.
For example, if you use the defaults for directory locations, PostgreSQL
will install into /usr/local/pgsql, and everything will be under that
directory --- bin, lib, include, share. (Not sure about etc, doc, and
man.)
However, right now, if you try to move /usr/local/pgsql to /var/pgsql,
the database will not work because there are hard-coded directory
dependencies in the binaries:
initdb has to find its *.bki files in /shareinitdb has to find the postgres binary in /binpg_dumpall has to find
pg_dumppostgreshas to find shared objects the /libWin32 postgres has to find /share/timezone
Maybe there are more.
Anyway, one idea for relocatable installs is to drive everything off of
the bin directory. We know the full path of the binary we are running
by looking at argv[0] or looking in $PATH. From there, we can find the
needed directories by looking relative to the /bin directory. So, by
default, installs in /usr/local/pgsql have binaries in
/usr/local/pgsql/bin, and the lib directory is ../lib relative to /bin.
This seems like a logical way to allow relocatable installs. The only
problem is with more complex configurations. Suppose you add configure
flags to install binaries in /usr/local/bin, and libs in /usr/local/lib.
Now, if you move your binaries to /usr/bin, it will be looking for libs
in /usr/lib, while they might still be in /usr/local/lib. Even more
complex installs are possible, with binaries in /usr/bin and libraries
in /usr/share/pgsql/lib.
My idea is to write a /port function that uses various methods to find
the needed files. We could look in the relative location first, and if
the needed file is not found, look in the hardcoded directory.
Comments?
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073