diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-08-20 23:37:54 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-08-21 06:38:45 +0000 |
commit | 92b4cd586e179dcf5b17f9f5d4f1dfad48f89b57 (patch) | |
tree | 3ecd0a76afb23b54d36697b5b4e8d8b3c02c4d30 | |
parent | 76ada76427e8fcc28b6addefed7591f58a86142b (diff) |
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>
-rwxr-xr-x | tools/bsd-setup.sh | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/bsd-setup.sh b/tools/bsd-setup.sh index 0b409b7524..d280d3f0bf 100755 --- a/tools/bsd-setup.sh +++ b/tools/bsd-setup.sh @@ -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 |