On 12/14/23 19:51, Randy Pfeifer wrote:
Hello, I'm attempting to create and cross-build a package with a simple Makefile using pkg-config to set linking options. I found a solution in theCrossBuildPackagingGuidelines wiki page: In Makefile: include /usr/share/dpkg/buildtools.mk PKG_CONFIG?=pkg-config LDLIBS += $(shell $(PKG_CONFIG) --libs <lib...>) This works, but the include makes the upstream package (Makefile) non-portable (debian specific). Is there a better way to accomplish this ?
i see two ways:1. just patch the makefile for Debian packaging (it's a bit unclear whether your context is actually Debian packaging, but since you quote CrossBuildPackagingGuidelines, I assume it is)
2. just pass the PKG_CONFIG manually when invoking 'make'. use the power of /usr/share/dpkg/buildtools.mk from within your meta-buildsystem (e.g. d/rules) and call the actual build with 'make PKG_CONFIG=$(PKG_CONFIG)' or similar.
3. (as upstream) do an *optional* include if the buildtools.mk: ``` -include /usr/share/dpkg/buildtools.mk PKG_CONFIG?=pkg-config ``` (note the trailing dash before the 'include')this way, if /usr/share/dpkg/buildtools.mk exists it will be included and otherwise ignored.
gmafds IOhannes