Package: bear
Version: 2.2.1-1
Severity: normal
Tags: patch

Dear Maintainer,

bear is preloading the libear.so library with an absolute path,
this requires that the architecture (32/64 bit) is matched
and known in advance.

This leads to several issues:

1.  the package is not multiarch capable, thus
    there cant be libear.so for multiple archs installed
2.  the default path is fixed for one architecture
3.  starting a build under bear, using both 32 and 64 bit
    tools will need someting different that a fixed path

I am attaching a path to fix these issue, by splitting the library
in its own package, and using a variable in the default path

Kind Regards,
Norbert Lange

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (200, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf, arm64

Kernel: Linux 4.9.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bear depends on:
ii  bear-lib     2.2.1-1
pn  python3:any  <none>

bear recommends no packages.

bear suggests no packages.

-- no debconf information
diff -burN debian.orig/bear.install debian/bear.install
--- debian.orig/bear.install    1970-01-01 01:00:00.000000000 +0100
+++ debian/bear.install 2017-02-28 00:01:36.000000000 +0100
@@ -0,0 +1,2 @@
+/usr/bin
+/usr/share/man
diff -burN debian.orig/bear-lib.install debian/bear-lib.install
--- debian.orig/bear-lib.install        1970-01-01 01:00:00.000000000 +0100
+++ debian/bear-lib.install     2017-02-27 23:59:12.000000000 +0100
@@ -0,0 +1 @@
+/usr/lib
diff -burN debian.orig/changelog debian/changelog
--- debian.orig/changelog       2016-10-19 19:01:50.000000000 +0200
+++ debian/changelog    2017-02-28 00:40:58.000000000 +0100
@@ -1,3 +1,11 @@
+bear (2.2.1-1~nmu) unstable; urgency=medium
+
+  * split library from main python script
+  * make default libear.so path configurable in the CMake files
+  * adjust the default libear.so path to use the ${LIB} Variable
+
+ -- Norbert Lange <nolang...@gmail.com>  Tue, 28 Feb 2017 00:40:58 +0100
+
 bear (2.2.1-1) unstable; urgency=medium
 
   * New upstream release.
diff -burN debian.orig/control debian/control
--- debian.orig/control 2016-10-19 18:58:44.000000000 +0200
+++ debian/control      2017-02-28 00:36:05.000000000 +0100
@@ -5,8 +5,8 @@
 Build-Depends:
  debhelper (>= 10),
  cmake,
- python,
- python3,
+ python:any,
+ python3:any,
  scons,
  libqt4-dev,
  dh-python
@@ -16,9 +16,9 @@
 Vcs-Git: https://anonscm.debian.org/git/collab-maint/bear.git
 
 Package: bear
-Architecture: any
+Architecture: all
 Depends:
- ${shlibs:Depends},
+ bear-lib (>= ${source:Version}), bear-lib (<< ${source:Upstream-Version}.0~)
  ${misc:Depends},
  ${python3:Depends}
 Description: generate compilation database for Clang tooling
@@ -29,3 +29,19 @@
  cmake supports the generation of JSON compilation databases out of the box.
  For any other build system that does not support this, Bear can be used
  instead to intercept the invocation of the compiler.
+
+Package: bear-lib
+Architecture: any
+Multi-Arch: same
+Depends:
+ ${shlibs:Depends}
+Description: generate compilation database for Clang tooling
+ Bear records the flags passed to the compiler for each translation unit and
+ stores them in a JSON file. This file can be used by Clang's tooling interface
+ and programs like clang-check to process a translation unit.
+ .
+ cmake supports the generation of JSON compilation databases out of the box.
+ For any other build system that does not support this, Bear can be used
+ instead to intercept the invocation of the compiler.
+ .
+ This is the required library for wrapping system calls
diff -burN debian.orig/patches/make_default_preload_configurable.diff 
debian/patches/make_default_preload_configurable.diff
--- debian.orig/patches/make_default_preload_configurable.diff  1970-01-01 
01:00:00.000000000 +0100
+++ debian/patches/make_default_preload_configurable.diff       2017-02-28 
00:19:16.000000000 +0100
@@ -0,0 +1,15 @@
+Description: Allow configuring the default preload library path
+ Add the responsible variable to CMake's  cache
+ .
+
+--- bear-2.2.1.orig/CMakeLists.txt
++++ bear-2.2.1/CMakeLists.txt
+@@ -39,7 +39,7 @@ if (NOT CMAKE_BUILD_TYPE)
+ endif()
+ 
+ set(EAR_LIB_FILE 
${CMAKE_SHARED_LIBRARY_PREFIX}ear${CMAKE_SHARED_LIBRARY_SUFFIX})
+-set(DEFAULT_PRELOAD_FILE ${CMAKE_INSTALL_FULL_LIBDIR}/${EAR_LIB_FILE})
++set(DEFAULT_PRELOAD_FILE ${CMAKE_INSTALL_FULL_LIBDIR}/${EAR_LIB_FILE} CACHE 
STRING "Default preload library path")
+ 
+ add_subdirectory(libear)
+ add_subdirectory(bear)
diff -burN debian.orig/patches/series debian/patches/series
--- debian.orig/patches/series  2015-08-08 17:13:48.000000000 +0200
+++ debian/patches/series       2017-02-28 00:17:16.000000000 +0100
@@ -1,2 +1,3 @@
 use-python3.patch
 remove-rpath.patch
+make_default_preload_configurable.diff
diff -burN debian.orig/rules debian/rules
--- debian.orig/rules   2016-10-19 18:58:44.000000000 +0200
+++ debian/rules        2017-02-28 00:35:21.000000000 +0100
@@ -7,7 +7,8 @@
 
 override_dh_auto_configure:
        dh_auto_configure -- \
-               -DCMAKE_INSTALL_LIBDIR="lib/${DEB_HOST_MULTIARCH}/bear"
+               -DCMAKE_INSTALL_LIBDIR="lib/${DEB_HOST_MULTIARCH}/bear" \
+               -DDEFAULT_PRELOAD_FILE="/usr/\$${LIB}/bear/libear.so"
 
 override_dh_auto_test:
        # The tests fail if /usr/lib/ccache is in PATH so we remove it here. 
The tests
@@ -17,10 +18,5 @@
                        -e 's;^/usr/lib/ccache/\?;;') \
                dh_auto_test
 
-override_dh_auto_install:
-       dh_auto_install
-       # Remove unwanted files.
-       rm -rf debian/bear/usr/share/doc/bear
-
 override_dh_installchangelogs:
        dh_installchangelogs ChangeLog.md

Reply via email to