diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-04-29 04:02:22 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-04-29 04:02:22 +0000 |
| commit | 8ccf1783ae3f41b9675e4ad47b844e837a65a2fd (patch) | |
| tree | 193e45018340285ced3881cad13c268229a0c49f /tools | |
| parent | e92e5cbc9c42a7f926eb4b25fdf6e52ec9d2fa4c (diff) | |
| download | skalibs-8ccf1783ae3f41b9675e4ad47b844e837a65a2fd.tar.gz | |
Add pkg-config support
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/gen-dotpc.sh | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/tools/gen-dotpc.sh b/tools/gen-dotpc.sh new file mode 100755 index 0000000..a9e344a --- /dev/null +++ b/tools/gen-dotpc.sh @@ -0,0 +1,80 @@ +#!/bin/sh -e + +isunique () { + x=$1 + set -- $2 + while test "$#" -gt 0 ; do + if test "$x" = "$1" ; then + return 1 + fi + shift + done + return 0 +} + +uniqit () { + res= + while test "$#" -gt 0 ; do + if isunique "$1" "$res" ; then + res="${res}${res:+ }${1}" + fi + shift + done + printf %s\\n "$res" +} + +filterout () { + res= + filter="$1" + shift + while test "$#" -gt 0 ; do + if isunique "$1" "$filter" ; then + res="${res}${res:+ }${1}" + fi + shift + done + printf %s\\n "$res" +} + +. package/info + +ilist= +dlist= +slist= + +if test "${includedir}" != /usr/include ; then + ilist="-I${includedir}" +fi +if test -n "${extra_includedirs}" ; then + ilist="${ilist}${ilist:+ }${extra_includedirs}" +fi +ilist=`uniqit ${ilist}` + +if test "${dynlibdir}" != /usr/lib && test "${dynlibdir}" != /lib ; then + dlist="-L${dynlibdir}" +fi + +if test "${libdir}" != /usr/lib && test "${libdir}" != /lib ; then + slist="-L${libdir}" +fi +if test -n "${extra_libdirs}" ; then + slist="${slist}${slist:+ }${extra_libdirs}" +fi +slist="$(filterout "${dlist}" $(uniqit ${slist}))" + +echo "prefix=${prefix}" +echo "includedir=${includedir}" +echo "libdir=${libdir}" +echo "dynlibdir=${dynlibdir}" +echo +echo "Name: lib${library}" +echo "Version: ${version}" +echo "Description: ${description:-The ${library} library.}" +echo "URL: ${url:-https://skarnet.org/software/${package}/}" +if test -n "$ilist" ; then + echo "Cflags: ${ilist}" +fi +echo "Libs: ${dlist}${dlist:+ }-l${library}${ldlibs:+ }${ldlibs}" +if test -n "${extra_libs}" ; then + echo "Libs.private: ${slist}${slist:+ }${extra_libs}" +fi |
