Skip to content

Commit

Permalink
Fix local pkg-configs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Austin Clements committed Jan 3, 2016
1 parent 66a93d8 commit 2239556
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions dwarf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ 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"; \
echo "Name: libdwarf++"; \
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
Expand All @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions elf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 2239556

Please sign in to comment.