[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Using xdg-utils instead of htmlview, other hardwired apps

When I was updating my package to use xdg-utils I noticed that xdg-utils is not in RHEL5. I bet I'm not the only one who needs to maintain a package for both Fedora and RHEL, so for those who are interested this is how I solved it, you will need to modify the approach for your particulars.

In configure.ac add:

AC_PATH_PROGS([html_browser_open], [xdg-open htmlview])
if test -z $html_browser_open; then
    AC_MSG_ERROR([cannot find utility to launch browser])

Somewhere in your code that is processed by config.status add something
like this:

web_browser_launcher = '@html_browser_open@'

In the spec file add:

%if 0%{?fedora}
BuildRequires: xdg-utils
Requires: xdg-utils

%if 0%{?rhel}
BuildRequires: htmlview
Requires: htmlview

What all this does is the following: AC_PATH_PROGS finds the full path
of xdg-open if its installed otherwise htmlview if its installed, and stores the result in the config shell variable html_browser_open. If neither is found the variable will be set to the empty string. You may or may not want to abort in this situation, the code above does abort, if you don't want to abort don't use the 3 lines following AC_PATH_PROGS.

Then config.status will substitute that value in your
source code or config file. The spec file does a conditional requires
depending on whether its fedora or rhel. You need the BuildRequires in
addition to the Requires because configure is run on the build host and
that is where the AC_PATH_PROGS expansion is evaluated.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]