From 7c58e02a277db899041948b60853c8b18e0368d5 Mon Sep 17 00:00:00 2001 From: Fredrik Roubert Date: Tue, 3 Jun 2014 08:24:40 +0000 Subject: [PATCH] Modernize debian/ and add multiarch support and hardening flags. R=daniel@pocock.pro BUG= Review URL: https://codereview.appspot.com/103800043 --- debian/compat | 2 +- debian/control | 16 +++++++++------- debian/libphonenumber-dev.install | 4 ++-- debian/libphonenumber6.install | 2 +- debian/rules | 12 ++++++++++++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/debian/compat b/debian/compat index 7f8f011eb..ec635144f 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index f6b0c7be8..306b5b752 100644 --- a/debian/control +++ b/debian/control @@ -2,10 +2,12 @@ Source: libphonenumber Priority: optional Maintainer: Fredrik Roubert Build-Depends: ant, + ant-optional, cmake, - debhelper (>= 7.0.50~), + debhelper (>= 9), default-jdk | java-sdk, javahelper (>= 0.34), + junit, libboost-dev (>= 1.40), libboost-system-dev (>= 1.40), libboost-thread-dev (>= 1.40), @@ -14,7 +16,7 @@ Build-Depends: ant, libprotobuf-dev (>= 2.4), libre2-dev, protobuf-compiler -Standards-Version: 3.9.1 +Standards-Version: 3.9.5 Section: libs Homepage: http://code.google.com/p/libphonenumber/ Vcs-Browser: http://code.google.com/p/libphonenumber/source/browse/ @@ -24,21 +26,21 @@ Package: libphonenumber-dev Section: libdevel Architecture: any Depends: libphonenumber6 (=${binary:Version}), ${misc:Depends} -Description: parsing/formatting/validating phone numbers - development +Description: parsing/formatting/validating phone numbers - development files Google's common C++ and Java library for parsing, formatting, storing and validating international phone numbers. . This package contains the static libraries and include files. Package: libphonenumber6 -Section: libs Architecture: any +Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} -Description: parsing/formatting/validating phone numbers - runtime +Description: parsing/formatting/validating phone numbers Google's common C++ and Java library for parsing, formatting, storing and validating international phone numbers. . - This package contains the runtime libraries. + This package contains the runtime libraries for C++ users. Package: libphonenumber-java Section: java @@ -48,4 +50,4 @@ Description: parsing/formatting/validating phone numbers - java Google's common C++ and Java library for parsing, formatting, storing and validating international phone numbers. . - This package contains the JAR files. + This package contains the runtime library JARs for Java users. diff --git a/debian/libphonenumber-dev.install b/debian/libphonenumber-dev.install index d1bffed05..a3c8f6cab 100644 --- a/debian/libphonenumber-dev.install +++ b/debian/libphonenumber-dev.install @@ -1,3 +1,3 @@ usr/include/* -usr/lib/lib*.a -usr/lib/lib*.so +usr/lib/*/lib*.a +usr/lib/*/lib*.so diff --git a/debian/libphonenumber6.install b/debian/libphonenumber6.install index d0dbfd18a..3ddde5841 100644 --- a/debian/libphonenumber6.install +++ b/debian/libphonenumber6.install @@ -1 +1 @@ -usr/lib/lib*.so.* +usr/lib/*/lib*.so.* diff --git a/debian/rules b/debian/rules index b067e8ed1..8beed531c 100755 --- a/debian/rules +++ b/debian/rules @@ -26,6 +26,12 @@ CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/usr CPP_BUILD := cpp/build JAVA_BUILD := java/build +# CMake doesn't read CPPFLAGS and dh_auto commands are not used in this rules +# file so we have to manually set the flags here to ensure that hardening flags +# are used: +CFLAGS += $(CPPFLAGS) +CXXFLAGS += $(CPPFLAGS) + ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else @@ -55,8 +61,14 @@ ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) $(ANT) -f $(JAVA_BUILD).xml junit endif +# Hack for multiarch: CMake doesn't really support libdir so we just manually +# move /usr/lib/* to a proper multiarch location. override_dh_auto_install: dh_auto_install --builddirectory=$(CPP_BUILD) + mkdir -p debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH) + mv debian/tmp/usr/lib/* debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH) + mv debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH) \ + debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) override_dh_auto_clean: -test -d $(CPP_BUILD) && $(MAKE) -C $(CPP_BUILD) clean