This moves work from the configure to the Make stage where it can
be parallelized and ensures that pkgconfig files are updated when
library versions change.
Bug-Id: 449
---
Makefile | 3 +-
build/.gitignore | 1 +
build/library.mak | 7 +++--
build/pkgconfig_generate.sh | 52 +++++++++++++++++++++++++++++++++++
configure | 67 +++++++++++++++------------------------------
libavcodec/Makefile | 1 +
libavdevice/Makefile | 1 +
libavfilter/Makefile | 1 +
libavformat/Makefile | 1 +
libavresample/Makefile | 1 +
libavutil/Makefile | 1 +
libswscale/Makefile | 1 +
12 files changed, 88 insertions(+), 49 deletions(-)
create mode 100755 build/pkgconfig_generate.sh
diff --git a/Makefile b/Makefile
index a5609b0..1824289 100644
--- a/Makefile
+++ b/Makefile
@@ -67,7 +67,7 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
%.h.c:
$(Q)echo '#include "$*.h"' >$@
-%.c %.h %.ver %.version: TAG = GEN
+%.c %.h %.pc %.ver %.version: TAG = GEN
AVPROGS-$(CONFIG_AVCONV) += avconv
AVPROGS-$(CONFIG_AVPLAY) += avplay
@@ -123,7 +123,6 @@ $(TOOLS): %$(EXESUF): %.o
CONFIGURABLE_COMPONENTS = \
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
- $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/version.h)) \
$(SRC_PATH)/libavcodec/bitstream_filters.c \
$(SRC_PATH)/libavformat/protocols.c \
diff --git a/build/.gitignore b/build/.gitignore
index 693b7aa..38ed170 100644
--- a/build/.gitignore
+++ b/build/.gitignore
@@ -2,3 +2,4 @@
/config.fate
/config.log
/config.mak
+/config.sh
diff --git a/build/library.mak b/build/library.mak
index 0d39e02..e7b088a 100644
--- a/build/library.mak
+++ b/build/library.mak
@@ -9,8 +9,8 @@ INCINSTDIR := $(INCDIR)/lib$(NAME)
INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
-all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
-all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
+all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(NAME).pc
+all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(NAME).pc
LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
@@ -35,6 +35,9 @@ $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
$$(M) $$(SRC_PATH)/build/libversion.sh $(NAME) $$< > $$@
+$(SUBDIR)lib$(NAME).pc: $(SUBDIR)version.h | $(SUBDIR)
+ $$(M) $$(SRC_PATH)/build/pkgconfig_generate.sh $(NAME) "$(DESC)"
+
$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< |
$(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
diff --git a/build/pkgconfig_generate.sh b/build/pkgconfig_generate.sh
new file mode 100755
index 0000000..65e1677
--- /dev/null
+++ b/build/pkgconfig_generate.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+. build/config.sh
+
+if test "$shared" = "yes"; then
+ shared=true
+else
+ shared=false
+fi
+
+#name=$1
+#shortname=${name#lib}
+shortname=$1
+name=lib${shortname}
+comment=$2
+libs=$(eval echo \$extralibs_${shortname})
+requires=$(eval echo \$requires_${shortname})
+requires=${requires%, }
+
+version=$(grep ${name}_VERSION= $name/${name}.version | cut -d= -f2)
+
+cat <<EOF > $name/$name.pc
+prefix=$prefix
+exec_prefix=\${prefix}
+libdir=$libdir
+includedir=$incdir
+
+Name: $name
+Description: $comment
+Version: $version
+Requires: $($shared || echo $requires)
+Requires.private: $($shared && echo $requires)
+Conflicts:
+Libs: -L\${libdir} -l${shortname} $($shared || echo $libs)
+Libs.private: $($shared && echo $libs)
+Cflags: -I\${includedir}
+EOF
+
+cat <<EOF > $name/$name-uninstalled.pc
+prefix=
+exec_prefix=
+libdir=\${pcfiledir}
+includedir=${source_path}
+
+Name: $name
+Description: $comment
+Version: $version
+Requires: $requires
+Conflicts:
+Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
+Cflags: -I\${includedir}
+EOF
diff --git a/configure b/configure
index d8e6b7f..c082f86 100755
--- a/configure
+++ b/configure
@@ -5586,52 +5586,29 @@ lib_version(){
eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
}
-pkgconfig_generate(){
- name=$1
- shortname=${name#lib}
- comment=$2
- version=$3
- libs=$4
- requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
- requires=${requires%, }
- enabled ${name#lib} || return 0
- mkdir -p $name
- cat <<EOF > $name/$name.pc
+cat > build/config.sh <<EOF
+# Automatically generated by configure - do not modify!
+shared=$shared
prefix=$prefix
-exec_prefix=\${prefix}
libdir=$libdir
includedir=$incdir
-
-Name: $name
-Description: $comment
-Version: $version
-Requires: $(enabled shared || echo $requires)
-Requires.private: $(enabled shared && echo $requires)
-Conflicts:
-Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
-Libs.private: $(enabled shared && echo $libs)
-Cflags: -I\${includedir}
+source_path=${source_path}
+LIBPREF=${LIBPREF}
+LIBSUF=${LIBSUF}
+
+requires_avutil="$(map 'lib_version $v' $(echo $avutil_deps))"
+requires_avcodec="$(map 'lib_version $v' $(echo $avcodec_deps))"
+requires_avformat="$(map 'lib_version $v' $(echo $avformat_deps))"
+requires_avdevice="$(map 'lib_version $v' $(echo $avdevice_deps))"
+requires_avfilter="$(map 'lib_version $v' $(echo $avfilter_deps))"
+requires_avresample="$(map 'lib_version $v' $(echo $avresample_deps))"
+requires_swscale="$(map 'lib_version $v' $(echo $swscale_deps))"
+
+extralibs_avutil="$extralibs_avutil"
+extralibs_avcodec="$extralibs_avcodec"
+extralibs_avformat="$extralibs_avformat"
+extralibs_avdevice="$extralibs_avdevice"
+extralibs_avfilter="$extralibs_avfilter"
+extralibs_avresample="$extralibs_avresample"
+extralibs_swscale="$extralibs_swscale"
EOF
- cat <<EOF > $name/$name-uninstalled.pc
-prefix=
-exec_prefix=
-libdir=\${pcfiledir}
-includedir=${source_path}
-
-Name: $name
-Description: $comment
-Version: $version
-Requires: $requires
-Conflicts:
-Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
-Cflags: -I\${includedir}
-EOF
-}
-
-pkgconfig_generate libavutil "Libav utility library"
"$LIBAVUTIL_VERSION" "$extralibs_avutil"
-pkgconfig_generate libavcodec "Libav codec library"
"$LIBAVCODEC_VERSION" "$extralibs_avcodec"
-pkgconfig_generate libavformat "Libav container format library"
"$LIBAVFORMAT_VERSION" "$extralibs_avformat"
-pkgconfig_generate libavdevice "Libav device handling library"
"$LIBAVDEVICE_VERSION" "$extralibs_avdevice"
-pkgconfig_generate libavfilter "Libav video filtering library"
"$LIBAVFILTER_VERSION" "$extralibs_avfilter"
-pkgconfig_generate libavresample "Libav audio resampling library"
"$LIBAVRESAMPLE_VERSION" "$extralibs_avresample"
-pkgconfig_generate libswscale "Libav image rescaling library"
"$LIBSWSCALE_VERSION" "$extralibs_swscale"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 239a4c0..b3cee1d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1,4 +1,5 @@
NAME = avcodec
+DESC = Libav codec library
HEADERS = avcodec.h \
avfft.h \
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 664fa0f..ab8931c 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -1,4 +1,5 @@
NAME = avdevice
+DESC = Libav device handling library
HEADERS = avdevice.h \
version.h \
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 646a5b5..c8d1515 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -1,4 +1,5 @@
NAME = avfilter
+DESC = Libav video filtering library
HEADERS = avfilter.h \
avfiltergraph.h \
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6146cbe..f363955 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -1,4 +1,5 @@
NAME = avformat
+DESC = Libav container format library
HEADERS = avformat.h \
avio.h \
diff --git a/libavresample/Makefile b/libavresample/Makefile
index b9ca491..928b721 100644
--- a/libavresample/Makefile
+++ b/libavresample/Makefile
@@ -1,4 +1,5 @@
NAME = avresample
+DESC = Libav audio resampling library
HEADERS = avresample.h \
version.h \
diff --git a/libavutil/Makefile b/libavutil/Makefile
index f34c799..60e180c 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -1,4 +1,5 @@
NAME = avutil
+DESC = Libav utility library
HEADERS = adler32.h \
aes.h \
diff --git a/libswscale/Makefile b/libswscale/Makefile
index c9b2fc9..a9502f6 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -1,4 +1,5 @@
NAME = swscale
+DESC = Libav image rescaling library
HEADERS = swscale.h \
version.h \
--
2.1.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel