Bug 15768

Summary: provide a convenient way to query for addon dir
Product: hal Reporter: Stanislav Brabec <sbrabec>
Component: buildAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: medium CC: danny.kukawka, kay
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 15767    
Attachments: hal-pc-paths.patch
hal-paths.patch

Description Stanislav Brabec 2008-04-30 06:15:04 UTC
Many distributions customize their hal libexecdir. Other packages need this value to be able to install addons to correct location.

The convenient way to do such things is providing the path in the pkgconfig file, which may simplify building of other packages.
Comment 1 Stanislav Brabec 2008-04-30 06:55:26 UTC
Created attachment 16263 [details] [review]
hal-pc-paths.patch

Proposed fix, which will allow:

pkg-config --variable=libexecdir hal
pkg-config --variable=hal_script_dir hal

It uses paths defined in bug 15767 and may need rework, if better path definition mechanism will appear.

For convenience, I can prepare HAL_CHECK configure.ac macro, which may check for hal version and set paths (as it lacks in hal, third parties already do it - e. g. network UPS tools).
Comment 2 David Zeuthen (not reading bugmail) 2008-05-06 12:00:56 UTC
Looks good to me if we change it to

+hal_libexecdir=@libexecdir@
+hal_scriptdir=@libexecdir@/scripts
Comment 3 David Zeuthen (not reading bugmail) 2008-05-06 12:03:31 UTC
(In reply to comment #2)
> Looks good to me if we change it to
> 
> +hal_libexecdir=@libexecdir@
> +hal_scriptdir=@libexecdir@/scripts
> 

Hmm, seems this depends on bug 15767. I think it should be

+hal_libexecdir=@libexecdir@
+hal_scriptdir=@libdir@/hal/scripts

with the ways things currently work.
Comment 4 Stanislav Brabec 2008-09-22 07:54:52 UTC
Created attachment 19102 [details] [review]
hal-paths.patch

Here is much larger patch, which gets rid fixed paths in hal and introduces two new configure options: --with-hald-addon-dir and --with-hald-script-dir

The default behavior after patching is the same as before; this patch does NOT address bug 15767. It will be addresses in a separate patch.

New features introduces:

pkg-config file supports two new options:
pkg-config --variable=hald_scriptdir hal
pkg-config --variable=hald_addondir hal

Provided hal.m4 with a new autoconf macro:
HAL_PATHS_INIT helps to prevent uncertainty of hal paths. For patched hal, it uses hal.pc to detect paths, for old hal it checks probable paths to detect the correct destination.

Tests performed:
Without additional configure options it behaves as before.
--libexecdir works as before
With options, all addons and scripts from snapshot 20080828 are completely moved to defined location.

After applying, you have to check, that the patch is still complete by: --with-hald-addon-dir=/newpath --with-hald-script-dir=/newpath/scripts. The old location must stay empty.
Comment 5 Stanislav Brabec 2009-04-15 05:47:36 UTC
Ping.

The last patch (plus patch in bug 15767) allow clean definition of all HAL paths, but allows distros to stay in old directories.

It also adds a smart way to deteremine addon and script dirs.

Note: I don't know defaults in particular distributions, but maybe adding ${bindir} ${sbindir} /usr/bin /usr/sbin to both search paths would be useful.
Comment 6 Kay Sievers 2009-07-14 13:33:11 UTC
I missed that bug, sorry. A simple solution to use --libexecdir=/usr/lib/hal is now in git HEAD. I hope that is good enough. Otherwise let me know.
Comment 7 Stanislav Brabec 2009-07-15 06:00:11 UTC
The bug asks to "provide a convenient way to query for addon dir". But there is no way to query for libexecdir - 
http://cgit.freedesktop.org/hal/tree/hal.pc.in lacks libexecdir. You need to add it to hal.pc.in:

+libexecdir=@libexecdir@

hal.m4 from the patch may be (after modification of the "new style" pkg-config query) still useful for third party software developers who want to provide addons that should work in all distros with all hal versions. I can provide an updated hal.m4.
Comment 8 Kay Sievers 2009-07-15 06:15:22 UTC
The approach sounds right, but we have always /usr/lib/hal/scripts now, which is good enough I think.

I doubt we will change any package to use that new query. HAL is unmaintained, and will no longer be developed, and the goal is to get rid of it. :)

If it's not solving any real problem we have, please close this bug, otherwise move the discussion to the hal-devel list and check if someone needs that. :)
Comment 9 Stanislav Brabec 2009-07-15 06:33:24 UTC
It was intended to help in packaging of third party addons and scripts, that need to detect correct directory. It would be useful for package like hal or openct.

Even if hal is unmaintained, adding the single line to .pc file may be a good idea.

But if you want to keep things as they are, it is possible to recycle hal.m4 in each third party project that need this detection.
Comment 10 Kay Sievers 2009-07-15 06:36:50 UTC
(In reply to comment #9)
> It was intended to help in packaging of third party addons and scripts, that
> need to detect correct directory. It would be useful for package like hal or
> openct.
> 
> Even if hal is unmaintained, adding the single line to .pc file may be a good
> idea.
> 
> But if you want to keep things as they are, it is possible to recycle hal.m4 in
> each third party project that need this detection.

Sure, as said, if it solves a problem, send it to the list, and let's apply it if people find it useful.

It's just that there should be no new packages using HAL, and old packages likely don't change to the new query now. :)
Comment 11 Kay Sievers 2009-07-15 07:08:22 UTC
Oh, and as you mention openct, that needs to drop HAL support soon, and convert to udev.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.