When I try to build up my application tool which has dependence on libpulse.
So, I would like use PKG_CONFIG on my Makefile to link correct libraries.
My Makefile is
# define external ld flag
PLATFORM_LD_FLAGS:=$(shell $(PKG_CONFIG) --libs --static libpulse) -lpulse-simple -lpthread -lm
$(MAKE) -C $(PKG_BUILD_DIR) \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -Wall $(PLATFORM_FLAGS) $(BUILD_FLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) $(PLATFORM_LD_FLAGS)" \
$(shell $(PKG_CONFIG) --libs --static libpulse) did not work.
How can I use PKG_CONFIG correctly and pass results into src/Makefile?
Please help. Thanks.
By default, it'll call
./configure in the build directory (unless you tell it different, see below). If your package uses
./configure, you can pass variables and arguments to it by the
CONFIGURE_VARS are environmental flags, CONFIGURE_ARGS is for arguments.
Example from my rust package:
CONFIGURE_VARS += \
CONFIGURE_ARGS = \
Second way, if your package doesn't use
./configure or needs custom commands, you use
You can use $(call Build/Configure/Default) inside it to call the default ./configure routine. You could use this if you needed to setup an environment prior to calling
./configure (like having to call
./bootstrap or something similar)
An example, where the package doesn't use
$(BUILD_DIR_HOST)/$(PKG_SOURCE_SUBDIR)/rustup-init.sh -y -v $(RUSTUP_INIT_ARGS)
Thanks. Since my package did not have configure file and we don't want to run pkg_config in src/Makefile. Is it possible to create PLATFORM_LD_FLAGS with the result of pkg_config and the PLATFORM_LD_FLAGS is announced out of the Build/xxx function, just like CONFIGURE_VARS? Thanks.
I'm not sure I understand what you are trying to do.
If you had to do what you need to do via a CLI, what would you need to do (and what directories, etc).
If you can give me that, I can maybe tell you how to do it.
Thanks. Please check this package, it is an example. https://we.tl/t-5oyGT9F8Ih
What I want to do is simple. I want to prepare all parameters on Makefile and pass it to src/Makefile. You can see I try to add library to PLATFORM_LD_FLAGS, but I want the result is coming from pkg-config.
Thanks for your kindly help.
I've been fighting with package issues myself, so I've not been able to look at it. You can put
LD_FLAGS += \
I'm not sure what/where
$(PKG_CONFIG) is coming from though.
are the only
$(PKG_CONFIG) I can't find at all.
Thanks. PKG_CONFIG is new definition in my env, sorry about that.
I will double check how to use LD_FLAGS. Thanks. Have a good day.
Add these to your makefile and place what you need there.
That will append it everywhere it's needed.
That is a binary.
There is a
pkg-config you can add to your DEPENDS if you need it, but I think that it's used by the build system itself. I'm not actually at my build system at the moment, but I'm still not sure what you are trying to actually do, and I apologize.
If you need to utilize pkg-config in your package, add a
DEPENDS=+pkg-config to the package info.
I don't know if I'm completely missing what you are trying to do (always a possibility), but are you sure you need to call pkg-config directly?
If you are trying to pass CFLAGS or LD_FLAGS, the
TARGET_LDFLAGS will add them to the make calls in
Build/Configure, as well, I believe)