From 2239556c3d313c3120e968cdf98eadf5c89f7f00 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 2 Jan 2016 23:34:46 -0500 Subject: [PATCH] Fix local pkg-configs Commit f8eac5a changed the install and the pkg-config to use proper library and include paths, but added these to the *local* pkg-config, rather than introducing them at the point when the pkg-config was installed. As a result, building against the uninstalled .pc file (such as what mtrace-tools does when cloned next to libelfin) no longer worked because it referred to the wrong paths. Fix this by reverting the changes to the local .pc file and introducing the lib and include paths only when installing the .pc file globally. --- dwarf/Makefile | 8 +++++--- elf/Makefile | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dwarf/Makefile b/dwarf/Makefile index 40c398b..04685c8 100644 --- a/dwarf/Makefile +++ b/dwarf/Makefile @@ -28,6 +28,8 @@ to_string.cc: ../elf/enum-print.py dwarf++.hh data.hh Makefile @echo 'DWARFPP_END_NAMESPACE' >> to_string.cc CLEAN += to_string.cc +# Create pkg-config for local library and headers. This will be +# transformed in to the correct global pkg-config by install. libdwarf++.pc: always @(VER=$$(git describe --match 'v*' | sed -e s/^v//); \ echo "prefix=$$PWD"; \ @@ -35,8 +37,8 @@ libdwarf++.pc: always echo "Description: C++11 DWARF library"; \ echo "Version: $$VER"; \ echo "Requires: libelf++ = $$VER"; \ - echo "Libs: -L\$${prefix}/lib -ldwarf++"; \ - echo "Cflags: -I\$${prefix}/include") > $@ + echo "Libs: -L\$${prefix} -ldwarf++"; \ + echo "Cflags: -I\$${prefix}") > $@ CLEAN += libdwarf++.pc .PHONY: always @@ -48,7 +50,7 @@ install: libdwarf++.a libdwarf++.pc install -t $(PREFIX)/lib libdwarf++.a install -d $(PREFIX)/include/libelfin/dwarf install -t $(PREFIX)/include/libelfin/dwarf data.hh dwarf++.hh small_vector.hh - sed 's,^prefix=.*,prefix=$(PREFIX),' libdwarf++.pc \ + sed 's,^prefix=.*,prefix=$(PREFIX),;s,-L${prefix},&/lib,;s,-I${prefix},&/include,' libdwarf++.pc \ > $(PREFIX)/lib/pkgconfig/libdwarf++.pc clean: diff --git a/elf/Makefile b/elf/Makefile index 83bff7d..a955976 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -27,14 +27,16 @@ to_string.cc: enum-print.py data.hh Makefile @echo 'ELFPP_END_NAMESPACE' >> to_string.cc CLEAN += to_string.cc +# Create pkg-config for local library and headers. This will be +# transformed in to the correct global pkg-config by install. libelf++.pc: always @(VER=$$(git describe --match 'v*' | sed -e s/^v//); \ echo "prefix=$$PWD"; \ echo "Name: libelf++"; \ echo "Description: C++11 ELF library"; \ echo "Version: $$VER"; \ - echo "Libs: -L\$${prefix}/lib -lelf++"; \ - echo "Cflags: -I\$${prefix}/include") > $@ + echo "Libs: -L\$${prefix} -lelf++"; \ + echo "Cflags: -I\$${prefix}") > $@ CLEAN += libelf++.pc .PHONY: always @@ -46,7 +48,7 @@ install: libelf++.a libelf++.pc install -t $(PREFIX)/lib libelf++.a install -d $(PREFIX)/include/libelfin/elf install -t $(PREFIX)/include/libelfin/elf common.hh data.hh elf++.hh - sed 's,^prefix=.*,prefix=$(PREFIX),' libelf++.pc \ + sed 's,^prefix=.*,prefix=$(PREFIX),;s,-L${prefix},&/lib,;s,-I${prefix},&/include,' libelf++.pc \ > $(PREFIX)/lib/pkgconfig/libelf++.pc clean: