Fix search for pkg-config on FreeBSD.
1) At least with FreeBSD's "pkg search", the search does *not* do a prefix match, so if you look for "pkg-config", you can find packages whose name is *not* pkg-config but that has "pkg-config" in the middle of the name. This means that we think we have a "pkg-config" package, but we don't, and fail when we try to install it. So we force a prefix match. 2) FreeBSD 11 doesn't have a "pkg-config" packate, but has a "pkgconf" package. If we don't find "pkg-config", look for "pkgconf". Change-Id: Iad5ef9d5630981958830c03e4cb90fe2d01ce1d0 Reviewed-on: https://code.wireshark.org/review/29213 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
76ada76427
commit
92b4cd586e
|
@ -61,14 +61,17 @@ case $PM in
|
|||
*/pkgin)
|
||||
PM_OPTIONS="install"
|
||||
PM_SEARCH="pkgin search"
|
||||
PM_MUST_GLOB=no
|
||||
;;
|
||||
*/pkg)
|
||||
PM_OPTIONS="install"
|
||||
PM_SEARCH="pkg search"
|
||||
PM_MUST_GLOB=yes
|
||||
;;
|
||||
*/pkg_add)
|
||||
PM_OPTIONS=""
|
||||
PM_SEARCH="pkg_info"
|
||||
PM_MUST_GLOB=no
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -80,14 +83,32 @@ add_package() {
|
|||
local list="$1" pkgname="$2"
|
||||
|
||||
# fail if the package is not known
|
||||
$PM_SEARCH "$pkgname" >& /dev/null || return 1
|
||||
if [[ "$PM_MUST_GLOB" == yes ]]
|
||||
then
|
||||
#
|
||||
# We need to do a glob search, with a "*" at the
|
||||
# end, so we only find packages that *begin* with
|
||||
# the name; otherwise, searching for pkg-config
|
||||
# could find packages that *don't* begin with
|
||||
# pkg-config, but have it later in the name
|
||||
# (FreeBSD 11 has one such package), so when
|
||||
# we then try to install it, that fails. Doing
|
||||
# an *exact* search fails, as that requires that
|
||||
# the package name include the version number.
|
||||
#
|
||||
$PM_SEARCH -g "$pkgname*" >& /dev/null || return 1
|
||||
else
|
||||
$PM_SEARCH "$pkgname" >& /dev/null || return 1
|
||||
fi
|
||||
|
||||
# package is found, append it to list
|
||||
eval "${list}=\"\${${list}} \${pkgname}\""
|
||||
}
|
||||
|
||||
# pkg-config: NetBSD
|
||||
# pkgconf: FreeBSD
|
||||
add_package BASIC_LIST pkg-config ||
|
||||
add_package BASIC_LIST pkgconf ||
|
||||
echo "pkg-config is unavailable"
|
||||
|
||||
# c-ares: FreeBSD
|
||||
|
|
Loading…
Reference in New Issue