Package: libopenhmd-dev Version: 0.2.0-2 Severity: serious Tags: patch Justification: Policy 3.5
libopenhmd-dev contains openhmd.pc, which Requires hidapi-libusb. hidapi-libusb.pc is provided by libhidapi-dev, which is a build-dependency for libopenhmd but is not included in libopenhmd's dependencies. The pkg-config file also contains an incorrect includedir and libdir, because it assumes that the .pc file is installed 2 directories below ${prefix} (typically ${prefix}/lib/pkgconfig), but this is not true in Debian. I attach proposed patches to fix this. Note that they include a non-upstreamed patch for the pkg-config metadata. This class of bug is easy to detect with an autopkgtest that builds and runs a simple program (also included in the attached patches). Regards, smcv
>From f89ce3e8b599cf7783fb5db23d95d15315c1186e Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Wed, 17 Oct 2018 17:14:57 +0100 Subject: [PATCH 1/3] d/tests/build: Add a simple compile/link/execute test --- debian/changelog | 6 ++++++ debian/tests/build | 23 +++++++++++++++++++++++ debian/tests/control | 3 +++ 3 files changed, 32 insertions(+) create mode 100755 debian/tests/build create mode 100644 debian/tests/control diff --git a/debian/changelog b/debian/changelog index fdf402e..6d71daa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libopenhmd (0.2.0-3.1) UNRELEASED; urgency=medium + + * d/tests/build: Add a simple compile/link/execute test + + -- Simon McVittie <s...@debian.org> Wed, 17 Oct 2018 17:14:22 +0100 + libopenhmd (0.2.0-3) unstable; urgency=medium * Fix filename in debian/watch diff --git a/debian/tests/build b/debian/tests/build new file mode 100755 index 0000000..9bb6c12 --- /dev/null +++ b/debian/tests/build @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e +exec 2>&1 +set -u +set -x + +cd "$AUTOPKGTEST_TMP" +cat > example.c <<'EOF' +/* A very much simplified version of examples/simple/simple.c */ +#include <openhmd.h> + +int main(void) +{ + ohmd_context *ctx = ohmd_ctx_create(); + ohmd_ctx_destroy(ctx); + return 0; +} +EOF + +gcc -o example example.c $(pkg-config --cflags --libs openhmd) +test -x ./example +./example diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..9140881 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: build +Restrictions: superficial +Depends: build-essential, libopenhmd-dev, pkg-config -- 2.19.1
>From 66b6c5645d4edadbb2d80121e78a2ef4e901b357 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Wed, 17 Oct 2018 17:44:39 +0100 Subject: [PATCH 2/3] Make libopenhmd-dev depend on libhidapi-dev so the pkg-config metadata will work --- debian/changelog | 2 ++ debian/control | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6d71daa..b7423fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ libopenhmd (0.2.0-3.1) UNRELEASED; urgency=medium * d/tests/build: Add a simple compile/link/execute test + * Make libopenhmd-dev depend on libhidapi-dev so the pkg-config + metadata will work -- Simon McVittie <s...@debian.org> Wed, 17 Oct 2018 17:14:22 +0100 diff --git a/debian/control b/debian/control index 00f2ef4..38d4813 100644 --- a/debian/control +++ b/debian/control @@ -27,7 +27,8 @@ Description: API and drivers for immersive technology (shared library) Package: libopenhmd-dev Architecture: any Section: libdevel -Depends: libopenhmd0 (= ${binary:Version}), +Depends: libhidapi-dev, + libopenhmd0 (= ${binary:Version}), ${misc:Depends} Description: API and drivers for immersive technology (development files) OpenHMD aims to provide a Free and Open Source API and drivers for -- 2.19.1
>From 3bdd4fd30d4dda02dd101a6954379ad45d3d5832 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Wed, 17 Oct 2018 17:53:03 +0100 Subject: [PATCH 3/3] Further fixes to the pkg-config metadata --- debian/changelog | 3 + ...code-the-hidapi-dependency-in-the-pk.patch | 70 +++++++++++++++++++ ...titute-the-correct-libdir-includedir.patch | 27 +++++++ debian/patches/series | 2 + 4 files changed, 102 insertions(+) create mode 100644 debian/patches/Autoconf-do-not-hard-code-the-hidapi-dependency-in-the-pk.patch create mode 100644 debian/patches/pkg-config-Substitute-the-correct-libdir-includedir.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index b7423fd..dec15aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ libopenhmd (0.2.0-3.1) UNRELEASED; urgency=medium * d/tests/build: Add a simple compile/link/execute test * Make libopenhmd-dev depend on libhidapi-dev so the pkg-config metadata will work + * d/p/Autoconf-do-not-hard-code-the-hidapi-dependency-in-the-pk.patch, + d/p/pkg-config-Substitute-the-correct-libdir-includedir.patch: + Further fixes to the pkg-config metadata -- Simon McVittie <s...@debian.org> Wed, 17 Oct 2018 17:14:22 +0100 diff --git a/debian/patches/Autoconf-do-not-hard-code-the-hidapi-dependency-in-the-pk.patch b/debian/patches/Autoconf-do-not-hard-code-the-hidapi-dependency-in-the-pk.patch new file mode 100644 index 0000000..d762b52 --- /dev/null +++ b/debian/patches/Autoconf-do-not-hard-code-the-hidapi-dependency-in-the-pk.patch @@ -0,0 +1,70 @@ +From: Adrien Maglo <mags...@videolan.org> +Date: Fri, 21 Jul 2017 19:53:37 +0200 +Subject: Autoconf: do not hard-code the hidapi dependency in the pkg-config + file + +Let autoconf generate the pkg-config file has hidapi has not the same on +the different platforms (hidapi or hidapi-libusb). + +Origin: upstream, 0.3.0, commit:851bf6993ce9614c249933994000915a9889b3b6 +--- + configure.ac | 3 ++- + pkg-config/openhmd.pc | 11 ----------- + pkg-config/openhmd.pc.in | 11 +++++++++++ + 3 files changed, 13 insertions(+), 12 deletions(-) + delete mode 100644 pkg-config/openhmd.pc + create mode 100644 pkg-config/openhmd.pc.in + +diff --git a/configure.ac b/configure.ac +index 23a1ffb..19ec8e7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -16,6 +16,7 @@ PKG_PROG_PKG_CONFIG([0.24]) + m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + + hidapi="hidapi" ++AC_SUBST(hidapi) + + AC_SUBST(PKG_CONFIG_EXTRA_PATH, "") + AC_SUBST(EXTRA_LD_FLAGS, "") +@@ -103,5 +104,5 @@ AC_PROG_CC + AC_PROG_CC_C99 + + AC_CONFIG_HEADERS([config.h]) +-AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile tests/unittests/Makefile examples/Makefile examples/opengl/Makefile examples/simple/Makefile]) ++AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile tests/unittests/Makefile examples/Makefile examples/opengl/Makefile examples/simple/Makefile pkg-config/openhmd.pc]) + AC_OUTPUT +diff --git a/pkg-config/openhmd.pc b/pkg-config/openhmd.pc +deleted file mode 100644 +index 638e6e0..0000000 +--- a/pkg-config/openhmd.pc ++++ /dev/null +@@ -1,11 +0,0 @@ +-prefix=${pcfiledir}/../.. +-libdir=${prefix}/lib +-includedir=${prefix}/include/openhmd +- +-Name: openhmd +-Description: API and drivers for immersive technology devices such as HMDs +-Version: 0.0.1 +-Requires: hidapi-libusb +-Conflicts: +-Libs: -L${libdir} -lopenhmd +-Cflags: -I${includedir} +diff --git a/pkg-config/openhmd.pc.in b/pkg-config/openhmd.pc.in +new file mode 100644 +index 0000000..00d7331 +--- /dev/null ++++ b/pkg-config/openhmd.pc.in +@@ -0,0 +1,11 @@ ++prefix=${pcfiledir}/../.. ++libdir=${prefix}/lib ++includedir=${prefix}/include/openhmd ++ ++Name: openhmd ++Description: API and drivers for immersive technology devices such as HMDs ++Version: 0.0.1 ++Requires: @hidapi@ ++Conflicts: ++Libs: -L${libdir} -lopenhmd -l@hidapi@ ++Cflags: -I${includedir} diff --git a/debian/patches/pkg-config-Substitute-the-correct-libdir-includedir.patch b/debian/patches/pkg-config-Substitute-the-correct-libdir-includedir.patch new file mode 100644 index 0000000..a33a439 --- /dev/null +++ b/debian/patches/pkg-config-Substitute-the-correct-libdir-includedir.patch @@ -0,0 +1,27 @@ +From: Simon McVittie <s...@debian.org> +Date: Wed, 17 Oct 2018 17:52:15 +0100 +Subject: pkg-config: Substitute the correct libdir, includedir + +Libraries are not always installed in ${prefix}/lib, and pkg-config +metadata is not always in ${prefix}/lib/pkgconfig. + +Origin: vendor, Debian +--- + pkg-config/openhmd.pc.in | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/pkg-config/openhmd.pc.in b/pkg-config/openhmd.pc.in +index 00d7331..575a061 100644 +--- a/pkg-config/openhmd.pc.in ++++ b/pkg-config/openhmd.pc.in +@@ -1,6 +1,7 @@ +-prefix=${pcfiledir}/../.. +-libdir=${prefix}/lib +-includedir=${prefix}/include/openhmd ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@/openhmd + + Name: openhmd + Description: API and drivers for immersive technology devices such as HMDs diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..8a723b3 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +Autoconf-do-not-hard-code-the-hidapi-dependency-in-the-pk.patch +pkg-config-Substitute-the-correct-libdir-includedir.patch -- 2.19.1