2015-02-09 18:16:43 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# MAINTAINER: portmgr@FreeBSD.org
|
|
|
|
# $FreeBSD$
|
|
|
|
|
2016-05-20 21:01:59 +02:00
|
|
|
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_FIND_LIB}" ] && set -x
|
|
|
|
|
2015-02-09 18:16:43 +01:00
|
|
|
if [ -z "${LIB_DIRS}" -o -z "${LOCALBASE}" ]; then
|
|
|
|
echo "LIB_DIRS, LOCALBASE required in environment." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-07-07 08:03:35 +02:00
|
|
|
if [ -f /usr/share/misc/magic.mime -o -f /usr/share/misc/magic.mime.mgc ]; then
|
2015-12-23 12:49:08 +01:00
|
|
|
echo >&2
|
2015-12-22 13:56:28 +01:00
|
|
|
echo "Either /usr/share/misc/magic.mime or /usr/share/misc/magic.mime.mgc exist and must be removed." >&2
|
2015-07-07 08:03:35 +02:00
|
|
|
echo "These are legacy files from an older release and may safely be deleted." >&2
|
|
|
|
echo "Please see UPDATING 20150213 for more details." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-02-09 18:16:43 +01:00
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "$0: no argument provided." >&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
lib=$1
|
|
|
|
dirs="${LIB_DIRS} `cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :`"
|
|
|
|
|
|
|
|
for libdir in ${dirs} ; do
|
|
|
|
test -f ${libdir}/${lib} || continue
|
2015-04-09 08:36:01 +02:00
|
|
|
libfile=${libdir}/${lib}
|
2015-02-09 18:16:43 +01:00
|
|
|
[ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue
|
|
|
|
echo $libfile
|
|
|
|
break
|
|
|
|
done
|