Re: Locating sharedir in PostgreSQL on Windows - Mailing list pgsql-hackers

From Mark Cave-Ayland
Subject Re: Locating sharedir in PostgreSQL on Windows
Date
Msg-id 1196117360.5818.48.camel@mca-desktop
Whole thread Raw
In response to Re: Locating sharedir in PostgreSQL on Windows  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Locating sharedir in PostgreSQL on Windows  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 2007-11-26 at 17:02 -0500, Tom Lane wrote:

> I believe that that is talking specifically about shared libraries (or
> DLLs in Windows-speak), and not about configuration or data files.
> In particular, nothing under libdir would be a candidate to go under
> sharedir, nor vice versa, since the former is supposed to hold
> architecture-dependent files and the latter architecture-independent
> files.
> 
> Mark hasn't been very clear about whether he wants to store static data
> files or installation-changeable configuration info, so it's not clear
> to me whether Peter's objection to using sharedir is appropriate or not.
> But unless the files are architecture-sensitive (which they might be!),
> libdir doesn't sound right in either case.

Okay, I'll try and expand on this a bit. In order to convert coordinates
between different coordinate systems, PostGIS uses the external PROJ.4
library. Now in order to support a certain category of conversion,
PROJ.4 requires access to a set of library grid reference files which
are effectively "compiled" from source files into a set of data files as
part of the build process. The path to this directory of files is then
built into the DLL at compile time, although it can be overriden with an
API call.

Under Linux, this is fairly easy as the files are normally installed
somewhere under /usr/share/proj, and hence the directory exists at both
compile-time and run-time. Windows is trickier because drive letters and
mappings can change - the default of C:\PROJ\NAD may or may not exist,
or can change depending upon the current drive configuration. I can also
see issues arising if the PostgreSQL installation is moved from the C:\
drive to another.

Hence my idea was to create a directory under $sharedir such as
$sharedir/postgresql/contrib/postgis/nad and install the files there.
Then regardless of the location of the PostgreSQL installation or the
current drive setup, I can use get_share_path() with the PROJ.4 API to
set the new library path the first time the function is called, and
everything will just work.

I can see Peter's argument about not putting files directly in
$sharedir, but I feel the usage suggested above falls under a similar
use case to the tsearch2 data files (which is mostly where I looked for
inspiration).

Hopefully this will help make things a bit clearer - please let me know
if any more information is needed.


Many thanks,

Mark.

-- 
ILande - Open Source Consultancy
http://www.ilande.co.uk




pgsql-hackers by date:

Previous
From: Jacob Rief
Date:
Subject: Table inheritance, unique constraints and foreign key problem
Next
From: "Dave Page"
Date:
Subject: Re: Locating sharedir in PostgreSQL on Windows