pkg-config libdivecomputer / subsurface makefile / confusion
Grischa Toedt
toedt at embl.de
Tue Jul 10 07:23:54 PDT 2012
Given the current setup of libdivecomputer and subsurface i can't compile subsurface on Mac OS X.
Background:
a) the libdivecomputer.pc looks like:
---
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libdivecomputer
Description: A library for communication with various dive computers.
Version: 0.2.0-devel
Requires.private: libusb-1.0
Libs: -L${libdir} -ldivecomputer
Cflags: -I${includedir}
---
and if I use pkg-config, i get the following infos:
---
sh-3.2# PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" pkg-config --cflags libdivecomputer
-I/usr/local/include -I/opt/local/include/libusb-1.0
---
b) the subsurface makefile uses pkg-config to identify the include path:
--- line 43 ---
else ifeq ($(UNAME), darwin)
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
---
and in libdivecomputer.h files are included with:
--- line 4 ---
/* libdivecomputer */
#include <device.h>
#include <suunto.h>
---
so the resulting mappings are wrong ==> can't compile!
Question:
a) should libdivecomputer.pc replace the cflag line with:
---
Cflags: -I${includedir}/libdivecomputer
---
because thats the compiler flag specific to this package and tells where the includes are,
b) or should the makefile be adopted accordingly, by removing lines (43:45):
--- Line 43 ---
else ifeq ($(UNAME), darwin)
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
---
since the libdc tests in the makefile detect the right paths anyway,
---
ifneq ($(strip $(libdc-local)),)
LIBDIVECOMPUTERDIR = /usr/local
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
---
c) or should the subsurface libdivecomputer.h include the files via:
---
#include <libdivecompuer/device.h>
#include <libdivecompuer/suunto.h>
…
---
and the makefile adopted accordingly > adjusting all include paths by removing libdivecomputer from them.
"...to prevent trouble if there are two unrelated libraries which have both a header file named header.h" [Jef]
Whats the right way of fixing this?
Grischa
More information about the subsurface
mailing list