From 5c7a808bbddb92743ab49fe08aa62afafcfb0e74 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 29 Jul 2015 02:26:20 +0200 Subject: [PATCH] build: Generate a pkg-conf file --- src/Makefile | 25 ++++++++++++++++++------- src/kvazaar.pc.in | 10 ++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 src/kvazaar.pc.in diff --git a/src/Makefile b/src/Makefile index 2513fac0..9dbc2778 100644 --- a/src/Makefile +++ b/src/Makefile @@ -66,6 +66,8 @@ endif CFLAGS += -m$(TARGET_CPU_BITS) LDFLAGS += -m$(TARGET_CPU_BITS) +INSTALL_TARGETS = install-prog install-pc + # Windows (cygwin/mingw) specific flags ifeq ($(SYSTEM), Windows) ifeq ($(ARCH), x86_64) @@ -78,7 +80,7 @@ ifeq ($(SYSTEM), Windows) endif CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 ALL_TARGETS = $(PROG) $(DLL) - INSTALL_TARGETS = install-prog install-dll + INSTALL_TARGETS += install-dll # OS X specific flags else ifeq ($(SYSTEM), Darwin) @@ -89,18 +91,18 @@ else ifeq ($(SYSTEM), Darwin) endif ASFLAGS += -DPREFIX ALL_TARGETS = $(PROG) $(DYLIB) - INSTALL_TARGETS = install-prog install-dylib + INSTALL_TARGETS += install-dylib # Default to Linux/elf specific flags else - LDFLAGS += -lrt + LIBS += -lrt ifeq ($(ARCH), x86_64) ASFLAGS += -f elf64 else ASFLAGS += -f elf32 endif ALL_TARGETS = $(PROG) $(LIB) - INSTALL_TARGETS = install-prog install-lib + INSTALL_TARGETS += install-lib endif # Flags shared across systems @@ -236,13 +238,13 @@ $(DYLIB): LDFLAGS += -dynamiclib \ -compatibility_version $(VER_MAJOR) \ -install_name $(LIBDIR)/$@ $(LIB) $(DLL) $(DYLIB): $(OBJS) - $(LD) $^ $(LDFLAGS) -o $@ + $(LD) $^ $(LDFLAGS) $(LIBS) -o $@ $(DEBUG): $(DEBUG_OBJS) - $(LD) $^ $(LDFLAGS) -o $@ + $(LD) $^ $(LDFLAGS) $(LIBS) -o $@ $(TESTS): $(TESTS_OBJS) - $(LD) $^ $(LDFLAGS) -o $@ + $(LD) $^ $(LDFLAGS) $(LIBS) -o $@ %.o %_debug.o: %.asm Makefile $(AS) $(ASFLAGS) -o $@ $< @@ -250,12 +252,21 @@ $(TESTS): $(TESTS_OBJS) %.o %_debug.o: %.c Makefile $(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@ +kvazaar.pc: kvazaar.pc.in Makefile + sed -e "s;@prefix@;$(PREFIX);" -e "s;@libdir@;$(LIBDIR);" \ + -e "s;@VERSION@;$(VER_MAJOR).$(VER_MINOR).$(VER_RELEASE);" \ + -e "s;@LIBS@;$(LIBS);" kvazaar.pc.in > $@ + init_submodules: git submodule init git submodule update install: $(INSTALL_TARGETS) +install-pc: kvazaar.pc + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pkgconfig + $(INSTALL) -m644 $^ $(DESTDIR)$(LIBDIR)/pkgconfig + install-prog: $(PROG) $(INSTALL) -d $(DESTDIR)$(BINDIR) $(INSTALL) -m755 $(PROG) $(DESTDIR)$(BINDIR) diff --git a/src/kvazaar.pc.in b/src/kvazaar.pc.in new file mode 100644 index 00000000..838a2325 --- /dev/null +++ b/src/kvazaar.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +incdir=${prefix}/include + +Name: libkvazaar +Description: Open-source HEVC encoder +Version: @VERSION@ +Libs: -L${libdir} -lkvazaar -lm @LIBS@ +Cflags: -I${incdir}