From f90e54b5f81ed8385190d1b2ed4d9b871e1bf6d4 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Tue, 7 Jan 2014 14:00:26 +0100 Subject: [PATCH] Packages: Dependencies on external dynamic libraries are now in pkg-config's Libs.private. --- build/Makebottom | 6 +++--- build/Maketop | 2 ++ build/lib-flags | 2 +- images/Makefile | 3 ++- images/libucw-images.pc | 3 ++- ucw/Makefile | 12 ++++++++++++ ucw/libucw.pc | 21 ++------------------- 7 files changed, 24 insertions(+), 25 deletions(-) diff --git a/build/Makebottom b/build/Makebottom index e2c84027..d882b0a4 100644 --- a/build/Makebottom +++ b/build/Makebottom @@ -63,7 +63,7 @@ endif %.so: $(M)LD $@ - $(Q)$(CC) $(LSHARED) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(BUILDSYS)/lib-flags $^) $(LIBS) + $(Q)$(CC) $(LSHARED) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" PKG_CONFIG_OPTS="$(PKG_CONFIG_OPTS)" $(BUILDSYS)/lib-flags $^) $(LIBS) $(Q)$(call symlink-alias,$@,run/$(SO_RUNDIR),$(*F)$(SONAME_INFIX).so$(SONAME_SUFFIX)) # On Darwin, gcc expects shared libraries in *.dylib instead of *.so. @@ -142,7 +142,7 @@ $(o)/%-tt.o: $(s)/%.c $(o)/autoconf.h $(o)/%-t: $(o)/%-tt.o $(TESTING_DEPS) $(M)LD-TEST $@ - $(Q)$(CC) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(BUILDSYS)/lib-flags $^) $(LIBS) + $(Q)$(CC) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" PKG_CONFIG_OPTS="$(PKG_CONFIG_OPTS)" $(BUILDSYS)/lib-flags $^) $(LIBS) $(o)/%.test: $(s)/%.t $(BUILDSYS)/tester $(M)TEST $@ @@ -154,7 +154,7 @@ BINDIR=bin $(o)/%: $(o)/%.o $(M)LD $@ - $(Q)$(CC) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(BUILDSYS)/lib-flags $^) $(LIBS) + $(Q)$(CC) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" PKG_CONFIG_OPTS="$(PKG_CONFIG_OPTS)" $(BUILDSYS)/lib-flags $^) $(LIBS) $(Q)$(call symlink,$@,run/$(BINDIR)) $(o)/%: $(s)/%.sh $(o)/config.mk $(BUILDSYS)/genconf diff --git a/build/Maketop b/build/Maketop index 93161aeb..b45187ab 100644 --- a/build/Maketop +++ b/build/Maketop @@ -39,9 +39,11 @@ endif ifdef CONFIG_SHARED LS=$(DYNAMIC_LIBRARIES) OS=oo +PKG_CONFIG_OPTS= else LS=a OS=o +PKG_CONFIG_OPTS=--static endif LV=$(UCW_ABI_SUFFIX) diff --git a/build/lib-flags b/build/lib-flags index 97d89566..29bb4e83 100755 --- a/build/lib-flags +++ b/build/lib-flags @@ -20,5 +20,5 @@ while [ -n "$1" ] ; do done if [ -n "$PC" ] ; then echo -n " " - PKG_CONFIG_PATH="$PKG_CONFIG_PATH:obj/pkgconfig" pkg-config --libs $PC + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:obj/pkgconfig" pkg-config $PKG_CONFIG_OPTS --libs $PC fi diff --git a/images/Makefile b/images/Makefile index 2bd18ca6..8b4bba34 100644 --- a/images/Makefile +++ b/images/Makefile @@ -6,7 +6,7 @@ LIBIMAGES_PROGS=$(o)/images/ucw-image-tool $(o)/images/ucw-color-tool LIBIMAGES_CONFIGS+=images LIBIMAGES_MODS=math config context image scale color io-main LIBIMAGES_INCLUDES=images.h error.h color.h math.h -export LIBIMAGES_LIBS= +export LIBIMAGES_LIBS=-lm ifdef CONFIG_SHERLOCK LIBIMAGES_MODS+=object @@ -71,6 +71,7 @@ $(o)/images/libucw-images$(LV).a: $(addsuffix .o,$(addprefix $(o)/images/,$(LIBI $(o)/images/libucw-images$(LV)-pic.a: $(addsuffix .oo,$(addprefix $(o)/images/,$(LIBIMAGES_MODS))) $(o)/images/libucw-images$(LV).so: $(addsuffix .oo,$(addprefix $(o)/images/,$(LIBIMAGES_MODS))) $(o)/images/libucw-images$(LV).so: SONAME_SUFFIX=.$(UCW_ABI_MAJOR) +$(o)/images/libucw-images$(LV).so: LIBS+=$(LIBIMAGES_LIBS) $(o)/images/libucw-images.pc: $(LIBIMAGES_DEPS) $(o)/images/ucw-image-tool: $(o)/images/ucw-image-tool.o $(LIBIMAGES) diff --git a/images/libucw-images.pc b/images/libucw-images.pc index 3c54e1f2..445a0d0f 100644 --- a/images/libucw-images.pc +++ b/images/libucw-images.pc @@ -10,5 +10,6 @@ Name: libucw-images Description: UCW image library Version: @UCW_VERSION@ Cflags: -I${incdir} -Libs: -L${libdir} -lucw-images@UCW_ABI_SUFFIX@${picsuffix} -lm -lpthread @LIBIMAGES_LIBS@ +Libs: -L${libdir} -lucw-images@UCW_ABI_SUFFIX@${picsuffix} +Libs.private: @LIBIMAGES_LIBS@ Requires: @DEPS@ diff --git a/ucw/Makefile b/ucw/Makefile index 1dbcf8cf..88b7064a 100644 --- a/ucw/Makefile +++ b/ucw/Makefile @@ -87,10 +87,22 @@ include $(s)/ucw/doc/Makefile LIBUCW_MOD_PATHS=$(addprefix $(o)/ucw/,$(LIBUCW_MODS)) +export LIBUCW_LIBS= +#ifdef CONFIG_UCW_THREADS +LIBUCW_LIBS+=-lpthread +#endif +#ifdef CONFIG_UCW_PCRE +LIBUCW_LIBS+=-lpcre +#endif +#ifdef CONFIG_UCW_MONOTONIC_CLOCK +LIBUCW_LIBS+=-lrt +#endif + $(o)/ucw/libucw$(LV).a: $(addsuffix .o,$(LIBUCW_MOD_PATHS)) $(o)/ucw/libucw$(LV)-pic.a: $(addsuffix .oo,$(LIBUCW_MOD_PATHS)) $(o)/ucw/libucw$(LV).so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS)) $(o)/ucw/libucw$(LV).so: SONAME_SUFFIX=.$(UCW_ABI_MAJOR) +$(o)/ucw/libucw$(LV).so: LIBS+=$(LIBUCW_LIBS) ifdef CONFIG_STATIC_PIC $(o)/ucw/libucw.pc: $(o)/ucw/libucw$(LV)-pic.a diff --git a/ucw/libucw.pc b/ucw/libucw.pc index afaee036..546dcb0d 100644 --- a/ucw/libucw.pc +++ b/ucw/libucw.pc @@ -3,24 +3,6 @@ libdir=@LIBDIR@ incdir=. -#ifdef CONFIG_UCW_THREADS -threads=-lpthread -#else -threads= -#endif - -#ifdef CONFIG_UCW_PCRE -regex=-lpcre -#else -regex= -#endif - -#ifdef CONFIG_UCW_MONOTONIC_CLOCK -rt=-lrt -#else -rt= -#endif - # Override if you want to use the -pic version picsuffix= @@ -32,4 +14,5 @@ Name: libucw Description: A library of utility functions and data structures Version: @UCW_VERSION@ Cflags: -I${incdir} -Libs: -L${libdir} -lucw@UCW_ABI_SUFFIX@${picsuffix} ${threads} ${regex} ${rt} +Libs: -L${libdir} -lucw@UCW_ABI_SUFFIX@${picsuffix} +Libs.private: @LIBUCW_LIBS@ -- 2.39.2