Wireshark-dev: Re: [Wireshark-dev] RFC: Add fallback path to get_datafile_dir
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 31 Aug 2011 19:44:05 -0700
On Aug 31, 2011, at 1:49 PM, Jeff Morriss wrote:

> This would solve https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5664
> 
> which would make me quite happy because I rarely build in-source-tree.

I see two possibilities here:

	1) have WIRESHARK_SRC_DIR as an override;

	2) have the build process copy the data files to a subdirectory of the build directory, in a directory tree that parallels the directory tree into which they're installed by "make install", and have Wireshark look there when run from the build directory.

The former is pretty simple; I've just checked in a change to do that.

The latter might be a bit more complicated, especially if we want to make sure it handles *all* installed files, both with auto* and with CMake.

> But: could it be done automagically?  For example, 'configure' sets up $top_srcdir appropriately; could we somehow get that variable passed into the libtool script (./wireshark) or...?

I'm not sure - I don't think the libtool wrappers are arbitrarily customizable, but I'll check.

> I suppose it would not be a good idea to embed $top_srcdir in the resulting binaries and the libtool script only exists when using auto*,

So CMake handles shared libraries on multiple platforms its own way, without the aid of libtool?  "Multiple platforms" here includes:

	systems with GCC-compatible compilers and the GNU linker (Linux distributions, the *BSDs);

	systems with GCC-compatible compilers and other linkers (e.g., Mac OS X);

	systems with other compilers and other linkers (e.g., commercial UN*Xes when compiled with the vendor's compiler).

Does CMake handle all of those?

> so I guess your approach does make the most sense.

We already support automagic detection of "running from the build directory" based on the way libtool works, so I don't see supporting automagic determination of the source directory based on the way libtool works; we have environment variables to override both of them.

Does CMake support running from the build directory, if it doesn't use libtool?  At least one of the purposes of the libtool wrapper is to run the binary with shared libraries from the build tree rather than installed shared libraries; does CMake have its own way of doing that and still having the installed binaries use the installed libraries?