summaryrefslogtreecommitdiff
path: root/avbuild
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-12-20 14:27:19 +0100
committerDiego Biurrun <diego@biurrun.de>2016-12-22 12:30:54 +0100
commit92db5083077a8b0f8e1050507671b456fd155125 (patch)
tree142d95a9446bfeca63688f4751c8272615e5af8c /avbuild
parentedb434873238876790f6a17bb65490cc29a1d176 (diff)
build: Generate pkg-config files from Make and not from configure
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
Diffstat (limited to 'avbuild')
-rw-r--r--avbuild/.gitignore1
-rw-r--r--avbuild/library.mak7
-rwxr-xr-xavbuild/pkgconfig_generate.sh50
3 files changed, 56 insertions, 2 deletions
diff --git a/avbuild/.gitignore b/avbuild/.gitignore
index 693b7aa0d3..38ed170752 100644
--- a/avbuild/.gitignore
+++ b/avbuild/.gitignore
@@ -2,3 +2,4 @@
/config.fate
/config.log
/config.mak
+/config.sh
diff --git a/avbuild/library.mak b/avbuild/library.mak
index 45152bebe8..e5f6d7d288 100644
--- a/avbuild/library.mak
+++ b/avbuild/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)/avbuild/libversion.sh $(NAME) $$< > $$@
+$(SUBDIR)lib$(NAME).pc: $(SUBDIR)version.h | $(SUBDIR)
+ $$(M) $$(SRC_PATH)/avbuild/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/avbuild/pkgconfig_generate.sh b/avbuild/pkgconfig_generate.sh
new file mode 100755
index 0000000000..33e188f5ea
--- /dev/null
+++ b/avbuild/pkgconfig_generate.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+. avbuild/config.sh
+
+if test "$shared" = "yes"; then
+ shared=true
+else
+ shared=false
+fi
+
+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