Generate a vpx.pc file for pkg-config.
authorRalph Giles <giles@entropywave.com>
Mon, 28 Mar 2011 19:04:51 +0000 (12:04 -0700)
committerRalph Giles <giles@entropywave.com>
Thu, 31 Mar 2011 03:56:16 +0000 (20:56 -0700)
Rules are added to libs.mk to generate a vpx.pc, which is
installed as pkgconfig/vpx.pc under the target library directory.
This also requires the install path prefix be exported directly
in config.mk.

Some systems use a tool called pkg-config to query information
about intalled libraries or other resources, based on database
files provided by the packages themselves at install time.

Providing such a file for libvpx simplifies integration with
other build systems, and provides an easy avenue for developers
to test against their own builds of the library.

Change-Id: I4e32a8fbb53fc331aa95eb207c63dd70a76d18ed

configure
libs.mk

index c1e9ace..ab3936d 100755 (executable)
--- a/configure
+++ b/configure
@@ -386,6 +386,8 @@ process_targets() {
         VERSION_MAJOR=${ver%.*}
     fi
     enabled child || cat <<EOF >> config.mk
+
+PREFIX=${prefix}
 ifeq (\$(MAKECMDGOALS),dist)
 DIST_DIR?=${DIST_DIR}
 else
diff --git a/libs.mk b/libs.mk
index 6a5dc18..2cb7f49 100644 (file)
--- a/libs.mk
+++ b/libs.mk
@@ -204,6 +204,26 @@ $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)):
 
 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
+
+LIBS-$(BUILD_LIBVPX) += vpx.pc
+vpx.pc: config.mk libs.mk
+       @echo "    [CREATE] $@"
+       $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
+       $(qexec)echo 'prefix=$(PREFIX)' >> $@
+       $(qexec)echo 'exec_prefix=$${prefix}' >> $@
+       $(qexec)echo 'libdir=$${prefix}/lib' >> $@
+       $(qexec)echo 'includedir=$${prefix}/include' >> $@
+       $(qexec)echo '' >> $@
+       $(qexec)echo 'Name: vpx' >> $@
+       $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
+       $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
+       $(qexec)echo 'Requires:' >> $@
+       $(qexec)echo 'Conflicts:' >> $@
+       $(qexec)echo 'Libs: -L$${libdir} -lvpx' >> $@
+       $(qexec)echo 'Cflags: -I$${includedir}' >> $@
+INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
+INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
+CLEAN-OBJS += vpx.pc
 endif
 
 LIBS-$(LIPO_LIBVPX) += libvpx.a