diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/gen-deps.sh | 16 | ||||
| -rwxr-xr-x | tools/gen-dotpc.sh | 101 |
2 files changed, 111 insertions, 6 deletions
diff --git a/tools/gen-deps.sh b/tools/gen-deps.sh index befe021..8e944d4 100755 --- a/tools/gen-deps.sh +++ b/tools/gen-deps.sh @@ -59,22 +59,26 @@ echo for dir in $(ls -1 src | grep -v ^include) ; do for file in $(ls -1 src/$dir/deps-lib) ; do deps= + both= libs= while read dep ; do - if echo $dep | grep -q -e ^-l -e '^\${.*_LIB}' ; then + if echo $dep | grep -q '^\${.*_LIB}' ; then libs="$libs $dep" + elif echo $dep | grep -q '^-l' ; then + both="$both $dep" else deps="$deps src/$dir/$dep" fi done < src/$dir/deps-lib/$file echo 'ifeq ($(strip $(STATIC_LIBS_ARE_PIC)),)' - echo "lib${file}.a.xyzzy:$deps" + echo "lib${file}.a.xyzzy:${deps}${both}" echo else - echo "lib${file}.a.xyzzy:$(echo "$deps" | sed 's/\.o/.lo/g')" + echo "lib${file}.a.xyzzy:$(echo "${deps}" | sed 's/\.o/.lo/g')${both}" echo endif if grep -E "^LIB_DEFS [+:]=" package/targets.mak | grep -qF "$file" ; then + echo "lib${file}.pc: EXTRA_LIBS :=${both}${libs}" echo "lib${file}.so.xyzzy: EXTRA_LIBS :=$libs" - echo "lib${file}.so.xyzzy:$(echo "$deps" | sed 's/\.o/.lo/g')" + echo "lib${file}.so.xyzzy:$(echo "${deps}${both}" | sed 's/\.o/.lo/g')" else internal_libs="$internal_libs lib${file}.a.xyzzy" fi @@ -84,10 +88,10 @@ for dir in $(ls -1 src | grep -v ^include) ; do deps= libs= while read dep ; do - if echo $dep | grep -q -- \\.o$ ; then + if echo $dep | grep -q \\.o$ ; then dep="src/$dir/$dep" fi - if echo $dep | grep -q -e ^-l -e '^\${.*_LIB}' ; then + if echo $dep | grep -q '^\${.*_LIB}' ; then libs="$libs $dep" else deps="$deps $dep" diff --git a/tools/gen-dotpc.sh b/tools/gen-dotpc.sh new file mode 100755 index 0000000..b33f348 --- /dev/null +++ b/tools/gen-dotpc.sh @@ -0,0 +1,101 @@ +#!/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" +} + +splitlibs () { + req= + while test "$1" != -lskarnet ; do + if test -z "$1" ; then + echo "gen-dotpc.sh: fatal: can't happen: was called on a library that doesn't depend on libskarnet" 1>&2 + exit 102 + fi + + done +} + +. package/info + +ilist= +dlist= +slist= + +if test "${includedir}" != /usr/include ; then + ilist="-I${includedir}" +fi +if test -n "${buildtime_includedirs}" ; then + ilist="${ilist}${ilist:+ }${buildtime_includedirs}" +fi +ilist=`uniqit ${ilist}` + +if test "${dynlibdir}" != /usr/lib && test "${dynlibdir}" != /lib ; then + dlist="-L${dynlibdir}" +fi +if test -n "${buildtime_dynlibdirs}" ; then + dlist="${dlist}${dlist:+ }${buildtime_dynlibdirs}" +fi +dlist=`uniqit ${dlist}` + +if test "${libdir}" != /usr/lib && test "${libdir}" != /lib ; then + slist="-L${libdir}" +fi +if test -n "${buildtime_libdirs}" ; then + slist="${slist}${slist:+ }${buildtime_libdirs}" +fi +slist="$(filterout "${dlist}" $(uniqit ${slist}))" + +echo "prefix=${prefix}" +echo "includedir=${includedir}" +echo "libdir=${libdir}" +echo "dynlibdir=${dynlibdir}" +echo +echo "Name: ${library}" +echo "Version: ${version}" +echo "Description: ${description:-The ${library} library.}" +echo "URL: ${url:-https://skarnet.org/software/${package}/}" +if test -n "${requires}" ; then + echo "Requires: ${requires}" +fi +if test -n "${requires_private}" ; then + echo "Requires.private: ${requires_private}" +fi +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 |
