ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] RFC: Add fallback path to get_datafile_dir

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Wed, 31 Aug 2011 16:49:21 -0400
Joerg Mayer wrote:
Hello,

as the problem recently popped up how to load auxillary files in the source
directory that have not been installed to their final paths, I've created a
patch that will add a fallback directory path to get_datafile_dir.
So far get_datafile_dir would check wether some magic variable were set to
locate generated (i.e. compiled) stuff inside the build dir instead of the
install dir. This patch allows to override this behaviour to search in the
specified directory relative to the source dir. If the fallback path is
given as NULL, the previous behaviour is used. As the path may now be
different with different invocations, the caching of the path had to go.

Example call:

WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1 WIRESHARK_SRC_DIR=../trunk ./wireshark

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.

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 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 I guess your approach does make the most sense.