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
... | ... |
@@ -67,7 +67,7 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC) |
67 | 67 |
%.h.c: |
68 | 68 |
$(Q)echo '#include "$*.h"' >$@ |
69 | 69 |
|
70 |
-%.c %.h %.ver %.version: TAG = GEN |
|
70 |
+%.c %.h %.pc %.ver %.version: TAG = GEN |
|
71 | 71 |
|
72 | 72 |
AVPROGS-$(CONFIG_AVCONV) += avconv |
73 | 73 |
AVPROGS-$(CONFIG_AVPLAY) += avplay |
... | ... |
@@ -125,7 +125,6 @@ tools/cws2fws$(EXESUF): ELIBS = $(ZLIB) |
125 | 125 |
|
126 | 126 |
CONFIGURABLE_COMPONENTS = \ |
127 | 127 |
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \ |
128 |
- $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/version.h)) \ |
|
129 | 128 |
$(SRC_PATH)/libavcodec/bitstream_filters.c \ |
130 | 129 |
$(SRC_PATH)/libavformat/protocols.c \ |
131 | 130 |
|
... | ... |
@@ -9,8 +9,8 @@ INCINSTDIR := $(INCDIR)/lib$(NAME) |
9 | 9 |
|
10 | 10 |
INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%) |
11 | 11 |
|
12 |
-all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) |
|
13 |
-all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) |
|
12 |
+all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(NAME).pc |
|
13 |
+all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(NAME).pc |
|
14 | 14 |
|
15 | 15 |
LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS) |
16 | 16 |
$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H |
... | ... |
@@ -35,6 +35,9 @@ $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o |
35 | 35 |
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR) |
36 | 36 |
$$(M) $$(SRC_PATH)/avbuild/libversion.sh $(NAME) $$< > $$@ |
37 | 37 |
|
38 |
+$(SUBDIR)lib$(NAME).pc: $(SUBDIR)version.h | $(SUBDIR) |
|
39 |
+ $$(M) $$(SRC_PATH)/avbuild/pkgconfig_generate.sh $(NAME) "$(DESC)" |
|
40 |
+ |
|
38 | 41 |
$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS) |
39 | 42 |
$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@ |
40 | 43 |
|
41 | 44 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,50 @@ |
0 |
+#!/bin/sh |
|
1 |
+ |
|
2 |
+. avbuild/config.sh |
|
3 |
+ |
|
4 |
+if test "$shared" = "yes"; then |
|
5 |
+ shared=true |
|
6 |
+else |
|
7 |
+ shared=false |
|
8 |
+fi |
|
9 |
+ |
|
10 |
+shortname=$1 |
|
11 |
+name=lib${shortname} |
|
12 |
+comment=$2 |
|
13 |
+libs=$(eval echo \$extralibs_${shortname}) |
|
14 |
+requires=$(eval echo \$requires_${shortname}) |
|
15 |
+requires=${requires%, } |
|
16 |
+ |
|
17 |
+version=$(grep ${name}_VERSION= $name/${name}.version | cut -d= -f2) |
|
18 |
+ |
|
19 |
+cat <<EOF > $name/$name.pc |
|
20 |
+prefix=$prefix |
|
21 |
+exec_prefix=\${prefix} |
|
22 |
+libdir=$libdir |
|
23 |
+includedir=$incdir |
|
24 |
+ |
|
25 |
+Name: $name |
|
26 |
+Description: $comment |
|
27 |
+Version: $version |
|
28 |
+Requires: $($shared || echo $requires) |
|
29 |
+Requires.private: $($shared && echo $requires) |
|
30 |
+Conflicts: |
|
31 |
+Libs: -L\${libdir} -l${shortname} $($shared || echo $libs) |
|
32 |
+Libs.private: $($shared && echo $libs) |
|
33 |
+Cflags: -I\${includedir} |
|
34 |
+EOF |
|
35 |
+ |
|
36 |
+cat <<EOF > $name/$name-uninstalled.pc |
|
37 |
+prefix= |
|
38 |
+exec_prefix= |
|
39 |
+libdir=\${pcfiledir} |
|
40 |
+includedir=${source_path} |
|
41 |
+ |
|
42 |
+Name: $name |
|
43 |
+Description: $comment |
|
44 |
+Version: $version |
|
45 |
+Requires: $requires |
|
46 |
+Conflicts: |
|
47 |
+Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs |
|
48 |
+Cflags: -I\${includedir} |
|
49 |
+EOF |
... | ... |
@@ -5402,52 +5402,29 @@ lib_version(){ |
5402 | 5402 |
eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \"" |
5403 | 5403 |
} |
5404 | 5404 |
|
5405 |
-pkgconfig_generate(){ |
|
5406 |
- name=$1 |
|
5407 |
- shortname=${name#lib} |
|
5408 |
- comment=$2 |
|
5409 |
- version=$3 |
|
5410 |
- libs=$4 |
|
5411 |
- requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps)) |
|
5412 |
- requires=${requires%, } |
|
5413 |
- enabled ${name#lib} || return 0 |
|
5414 |
- mkdir -p $name |
|
5415 |
- cat <<EOF > $name/$name.pc |
|
5405 |
+cat > avbuild/config.sh <<EOF |
|
5406 |
+# Automatically generated by configure - do not modify! |
|
5407 |
+shared=$shared |
|
5416 | 5408 |
prefix=$prefix |
5417 |
-exec_prefix=\${prefix} |
|
5418 | 5409 |
libdir=$libdir |
5419 | 5410 |
includedir=$incdir |
5420 |
- |
|
5421 |
-Name: $name |
|
5422 |
-Description: $comment |
|
5423 |
-Version: $version |
|
5424 |
-Requires: $(enabled shared || echo $requires) |
|
5425 |
-Requires.private: $(enabled shared && echo $requires) |
|
5426 |
-Conflicts: |
|
5427 |
-Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs) |
|
5428 |
-Libs.private: $(enabled shared && echo $libs) |
|
5429 |
-Cflags: -I\${includedir} |
|
5411 |
+source_path=${source_path} |
|
5412 |
+LIBPREF=${LIBPREF} |
|
5413 |
+LIBSUF=${LIBSUF} |
|
5414 |
+ |
|
5415 |
+requires_avutil="$(map 'lib_version $v' $(echo $avutil_deps))" |
|
5416 |
+requires_avcodec="$(map 'lib_version $v' $(echo $avcodec_deps))" |
|
5417 |
+requires_avformat="$(map 'lib_version $v' $(echo $avformat_deps))" |
|
5418 |
+requires_avdevice="$(map 'lib_version $v' $(echo $avdevice_deps))" |
|
5419 |
+requires_avfilter="$(map 'lib_version $v' $(echo $avfilter_deps))" |
|
5420 |
+requires_avresample="$(map 'lib_version $v' $(echo $avresample_deps))" |
|
5421 |
+requires_swscale="$(map 'lib_version $v' $(echo $swscale_deps))" |
|
5422 |
+ |
|
5423 |
+extralibs_avutil="$LIBRT $LIBM" |
|
5424 |
+extralibs_avcodec="$extralibs" |
|
5425 |
+extralibs_avformat="$extralibs" |
|
5426 |
+extralibs_avdevice="$extralibs" |
|
5427 |
+extralibs_avfilter="$extralibs" |
|
5428 |
+extralibs_avresample="$LIBM" |
|
5429 |
+extralibs_swscale="$LIBM" |
|
5430 | 5430 |
EOF |
5431 |
- cat <<EOF > $name/$name-uninstalled.pc |
|
5432 |
-prefix= |
|
5433 |
-exec_prefix= |
|
5434 |
-libdir=\${pcfiledir} |
|
5435 |
-includedir=${source_path} |
|
5436 |
- |
|
5437 |
-Name: $name |
|
5438 |
-Description: $comment |
|
5439 |
-Version: $version |
|
5440 |
-Requires: $requires |
|
5441 |
-Conflicts: |
|
5442 |
-Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs |
|
5443 |
-Cflags: -I\${includedir} |
|
5444 |
-EOF |
|
5445 |
-} |
|
5446 |
- |
|
5447 |
-pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM" |
|
5448 |
-pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" |
|
5449 |
-pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" |
|
5450 |
-pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" |
|
5451 |
-pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" |
|
5452 |
-pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM" |
|
5453 |
-pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" |