2
0
mirror of https://codeberg.org/kiss-community/repo synced 2025-01-22 10:24:48 -07:00

nss: Rewrite nss-config

This commit is contained in:
Dylan Araps 2019-07-28 15:04:33 +03:00
parent b16748d844
commit 4616a4c071
2 changed files with 109 additions and 115 deletions

View File

@ -1,3 +1,3 @@
112f05223d1fde902c170966bfc6f011b24a838be16969b110ecf2bb7bc24e8b nss-3.45.tar.gz
f2208c4f70373ff9b60f53d733f8071d4e390c384b776dfc04bf26c306882faf nss.pc.in
e44ac5095b4d88f24ec7b2e6a9f1581560bd3ad41a3d198596d67ef22f67adb9 nss-config.in
24b983f534f90e3b64494915214ec448b027d4fd93c7516c68d1c6c50aa3c20b nss-config.in

View File

@ -6,140 +6,134 @@ major_version=@MOD_MAJOR_VERSION@
minor_version=@MOD_MINOR_VERSION@
patch_version=@MOD_PATCH_VERSION@
usage()
{
cat <<EOF
usage() {
cat <<EOF
Usage: nss-config [OPTIONS] [LIBRARIES]
Options:
[--prefix[=DIR]]
[--exec-prefix[=DIR]]
[--includedir[=DIR]]
[--libdir[=DIR]]
[--version]
[--libs]
[--cflags]
[--prefix[=DIR]]
[--exec-prefix[=DIR]]
[--includedir[=DIR]]
[--libdir[=DIR]]
[--version]
[--libs]
[--cflags]
Dynamic Libraries:
nss
nssutil
ssl
smime
nss
nssutil
ssl
smime
EOF
exit $1
exit
}
if test $# -eq 0; then
usage 1 1>&2
fi
[ $# = 0 ] && usage
lib_ssl=yes
lib_smime=yes
lib_nss=yes
lib_nssutil=yes
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
while [ $# -gt 0 ]; do
case "$1" in
-*=*) optarg=${1##*=} ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
;;
--prefix)
echo_prefix=yes
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--exec-prefix)
echo_exec_prefix=yes
;;
--includedir=*)
includedir=$optarg
;;
--includedir)
echo_includedir=yes
;;
--libdir=*)
libdir=$optarg
;;
--libdir)
echo_libdir=yes
;;
--version)
echo ${major_version}.${minor_version}.${patch_version}
;;
--cflags)
echo_cflags=yes
;;
--libs)
echo_libs=yes
;;
ssl)
lib_ssl=yes
;;
smime)
lib_smime=yes
;;
nss)
lib_nss=yes
;;
nssutil)
lib_nssutil=yes
;;
*)
usage 1 1>&2
;;
esac
shift
case $1 in
--prefix=*)
prefix=$optarg
;;
--prefix)
echo_prefix=yes
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--exec-prefix)
echo_exec_prefix=yes
;;
--includedir=*)
includedir=$optarg
;;
--includedir)
echo_includedir=yes
;;
--libdir=*)
libdir=$optarg
;;
--libdir)
echo_libdir=yes
;;
--version)
printf '%s\n' "${major_version}.${minor_version}.${patch_version}"
;;
--cflags)
echo_cflags=yes
;;
--libs)
echo_libs=yes
;;
ssl)
lib_ssl=yes
;;
smime)
lib_smime=yes
;;
nss)
lib_nss=yes
;;
nssutil)
lib_nssutil=yes
;;
*)
usage
;;
esac
shift
done
# Set variables that may be dependent upon other variables
if test -z "$exec_prefix"; then
exec_prefix=`pkg-config --variable=exec_prefix nss`
fi
if test -z "$includedir"; then
includedir=`pkg-config --variable=includedir nss`
fi
if test -z "$libdir"; then
libdir=`pkg-config --variable=libdir nss`
fi
[ "$exec_prefix" ] || exec_prefix=$(pkg-config --variable=exec_prefix nss)
[ "$includedir" ] || includedir=$(pkg-config --variable=includedir nss)
[ "$libdir" ] || libdir=$(pkg-config --variable=libdir nss)
if test "$echo_prefix" = "yes"; then
echo $prefix
fi
[ "$echo_prefix" = yes ] &&
printf '%s\n' "$prefix"
if test "$echo_exec_prefix" = "yes"; then
echo $exec_prefix
fi
[ "$echo_exec_prefix" = yes ] &&
printf '%s\n' "$exec_prefix"
if test "$echo_includedir" = "yes"; then
echo $includedir
fi
[ "$echo_includedir" = yes ] &&
printf '%s\n' "$includedir"
if test "$echo_libdir" = "yes"; then
echo $libdir
fi
[ "$echo_libdir" = yes ] &&
printf '%s\n' "$libdir"
if test "$echo_cflags" = "yes"; then
echo -I$includedir
fi
[ "$echo_cflags" = yes ] &&
printf '%s\n' "-I$includedir"
if test "$echo_libs" = "yes"; then
libdirs="-Wl,-rpath-link,$libdir -L$libdir"
if test -n "$lib_ssl"; then
libdirs="$libdirs -lssl${major_version}"
fi
if test -n "$lib_smime"; then
libdirs="$libdirs -lsmime${major_version}"
fi
if test -n "$lib_nss"; then
libdirs="$libdirs -lnss${major_version}"
fi
if test -n "$lib_nssutil"; then
libdirs="$libdirs -lnssutil${major_version}"
fi
echo $libdirs
fi
[ "$echo_libs" = yes ] && {
libdirs="-Wl,-rpath-link,$libdir -L$libdir"
[ "$lib_ssl" ] && libdirs="$libdirs -lssl$major_version"
[ "$lib_smime" ] && libdirs="$libdirs -lsmime$major_version"
[ "$lib_nss" ] && libdirs="$libdirs -lnss$major_version"
[ "$lib_nssutil" ] && libdirs="$libdirs -lnssutil$major_version"
printf '%s\n' "$libdirs"
}