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