2
0

pkgconfig_generate.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. . ffbuild/config.sh
  3. if test "$shared" = "yes"; then
  4. shared=true
  5. else
  6. shared=false
  7. fi
  8. shortname=$1
  9. name=lib${shortname}
  10. fullname=${name}${build_suffix}
  11. comment=$2
  12. libs=$(eval echo \$extralibs_${shortname})
  13. deps=$(eval echo \$${shortname}_deps)
  14. for dep in $deps; do
  15. depname=lib${dep}
  16. fulldepname=${depname}${build_suffix}
  17. . ${depname}/${depname}.version
  18. depversion=$(eval echo \$${depname}_VERSION)
  19. requires="$requires ${fulldepname} >= ${depversion}, "
  20. done
  21. requires=${requires%, }
  22. version=$(grep ${name}_VERSION= $name/${name}.version | cut -d= -f2)
  23. cat <<EOF > $name/$fullname.pc
  24. prefix=$prefix
  25. exec_prefix=\${prefix}
  26. libdir=$libdir
  27. includedir=$incdir
  28. Name: $fullname
  29. Description: $comment
  30. Version: $version
  31. Requires: $($shared || echo $requires)
  32. Requires.private: $($shared && echo $requires)
  33. Conflicts:
  34. Libs: -L\${libdir} $rpath -l${fullname#lib} $($shared || echo $libs)
  35. Libs.private: $($shared && echo $libs)
  36. Cflags: -I\${includedir}
  37. EOF
  38. mkdir -p doc/examples/pc-uninstalled
  39. includedir=${source_path}
  40. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  41. cat <<EOF > doc/examples/pc-uninstalled/${name}-uninstalled.pc
  42. prefix=
  43. exec_prefix=
  44. libdir=\${pcfiledir}/../../../$name
  45. includedir=${source_path}
  46. Name: $fullname
  47. Description: $comment
  48. Version: $version
  49. Requires: $requires
  50. Conflicts:
  51. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${fullname#lib} $($shared || echo $libs)
  52. Cflags: -I\${includedir}
  53. EOF