From ea95df791e3cb320cd0b2a3f0f3c64e3617b4c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 8 Jul 2015 16:53:41 +0200 Subject: work on hardening & make fit for gcc-5 --- debian/changelog | 9 ++++++++- debian/control | 8 ++++---- debian/copyright | 6 ++---- debian/patches/0100-gcc5.patch | 26 ++++++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 23 ++++++++++++++++++++++- debian/source/options | 1 - 7 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 debian/patches/0100-gcc5.patch create mode 100644 debian/patches/series delete mode 100644 debian/source/options diff --git a/debian/changelog b/debian/changelog index 3364d99..0ebb448 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,13 +9,20 @@ libmongo-client (0.1.8-2) unstable; urgency=medium - Add missing license for tests/tools/*. - Add myself to the list of authors for debian/*. - Change upstream email address to algernon@madhouse-project.org. + - Change source to github. * debian/rules: - Remove useless override_dh_builddeb: xz is now standard. - Remove oldstyle debhelper parts. + - Add override_dh_makeshlibs to build symbols on every build. + - Add missing LDFLAGS. * debian/watch: - Change source to github. + * Remove debian/source/options because xz is now standard. + * New debian/patches/0100-gcc5.patch: + - Cheery-picked upstream commit 7ccdf08e81aa51a1b54eb4c574e6e4fc5f2e2d54 + to make the library fit for gcc-5 (Closes: #777959). - -- Jörg Frings-Fürst Thu, 04 Dec 2014 18:14:03 +0100 + -- Jörg Frings-Fürst Wed, 08 Jul 2015 14:42:01 +0200 libmongo-client (0.1.8-1) unstable; urgency=medium diff --git a/debian/control b/debian/control index e922a67..77d2f9f 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,7 @@ Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: - ${shlibs:Depends}, + ${shlibs:Depends}, ${misc:Depends} Description: Alternate C driver for the MongoDB document-oriented datastore MongoDB is a high-performance, open source, schema-free @@ -43,8 +43,8 @@ Section: libdevel Architecture: any Depends: libmongo-client0 (= ${binary:Version}), - pkg-config, - libglib2.0-dev, + pkg-config, + libglib2.0-dev, ${misc:Depends} Description: Development files for the alternate C driver for MongoDB libmongo-client is an alternative C language driver to the MongoDB @@ -59,7 +59,7 @@ Section: debug Architecture: any Multi-Arch: same Depends: - libmongo-client0 (= ${binary:Version}), + libmongo-client0 (= ${binary:Version}), ${misc:Depends} Description: Alternate C driver for MongoDB (debugging symbols) libmongo-client is an alternative C language driver to the MongoDB diff --git a/debian/copyright b/debian/copyright index d6bc264..1858a45 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: libmongo-client Upstream-Contact: Gergely Nagy -Source: git://git.madhouse-project.org/projects/libmongo-client.git -Copyright: Copyright (C) 2011-2014 Gergely Nagy -License: Apache-2.0 +Source: https://github.com/algernon/libmongo-client.git Files: * Copyright: 2011-2014 Gergely Nagy @@ -15,7 +13,7 @@ License: GPL-2+ Files: debian/* Copyright: 2011-2014 Gergely Nagy - 2014 Jörg Frings-Fürst + 2014-2015 Jörg Frings-Fürst License: Apache-2.0 License: Apache-2.0 diff --git a/debian/patches/0100-gcc5.patch b/debian/patches/0100-gcc5.patch new file mode 100644 index 0000000..c2797db --- /dev/null +++ b/debian/patches/0100-gcc5.patch @@ -0,0 +1,26 @@ +Description: Make fit for gcc-5 + Cheery-picked from upstream commit 7ccdf08e81aa51a1b54eb4c574e6e4fc5f2e2d54 +Author: Gergely Nagy +Bug: https://github.com/algernon/libmongo-client/issues/37 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777959 +Forwarded: no +Last-Update: 2015-07-08 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: trunk/src/bson.c +=================================================================== +--- trunk.orig/src/bson.c ++++ trunk/src/bson.c +@@ -892,9 +892,10 @@ bson_cursor_next (bson_cursor *c) + + static inline gboolean + _bson_cursor_find (const bson *b, const gchar *name, size_t start_pos, +- gint32 end_pos, gboolean wrap_over, bson_cursor *dest_c) ++ guint32 end_pos, gboolean wrap_over, bson_cursor *dest_c) + { +- gint32 pos = start_pos, bs; ++ size_t pos = start_pos; ++ gint32 bs; + const guint8 *d; + gint32 name_len; + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..8587bd5 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0100-gcc5.patch diff --git a/debian/rules b/debian/rules index c4ddaa7..4e4155a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,27 @@ #!/usr/bin/make -f # -*- makefile -*- -export DH_OPTIONS += -O-Bbuild-tree +# hardening +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +export DH_OPTIONS += -O-Bbuild-tree UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -n '/\(Version:\)/{s/^Version:[[:space:]]\+\([0-9]\+:\)\?\(.*\)/\2/p}' | rev | cut -d- -f 2- | rev) +LDFLAGS += -fPIE -pie -Wl,-z,relro -Wl,-z,now -fPIC +CPPFLAGS += -D_FORTIFY_SOURCE=2 -fPIE -pie -Wl,-z,relro -Wl,-z,now +CFLAGS += -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIE -pie -Wl,-z,relro -Wl,-z,now +export CPPFLAGS +export CFLAGS +export LDFLAGS + +# +# Test for gcc-5 support +# +#export CC=gcc-5 +#export CXX=g++-5 + + %: dh $@ --with autoreconf @@ -47,3 +64,7 @@ override_dh_compress: override_dh_strip: dh_strip --dbg-package=libmongo-client0-dbg + +override_dh_makeshlibs: + dh_makeshlibs + dpkg-gensymbols -v$(UPSTREAM_VERSION) -plibmongo-client0 diff --git a/debian/source/options b/debian/source/options deleted file mode 100644 index b7bc1f2..0000000 --- a/debian/source/options +++ /dev/null @@ -1 +0,0 @@ -compression = "xz" -- cgit v1.2.3