commit:     5654ae0877a025b09fe1e642eb48da392e9b9db6
Author:     Tony Vroon <chainsaw <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 16:42:33 2016 +0000
Commit:     Tony Vroon <chainsaw <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 16:42:33 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5654ae08

app-admin/mongo-tools: Build PIE (Position Independent Executables) to avoid 
text relocations. Patch by "runtarod" closes bug #582854.

Package-Manager: portage-2.3.0

 .../mongo-tools/files/mongo-tools-3.2.10-pie.patch | 12 +++++
 app-admin/mongo-tools/mongo-tools-3.2.10-r1.ebuild | 58 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/app-admin/mongo-tools/files/mongo-tools-3.2.10-pie.patch 
b/app-admin/mongo-tools/files/mongo-tools-3.2.10-pie.patch
new file mode 100644
index 00000000..6a80d75
--- /dev/null
+++ b/app-admin/mongo-tools/files/mongo-tools-3.2.10-pie.patch
@@ -0,0 +1,12 @@
+diff -uNr mongo-tools-r3.2.10.ORIG/build.sh mongo-tools-r3.2.10/build.sh
+--- mongo-tools-r3.2.10.ORIG/build.sh  2016-11-15 16:15:09.487441283 +0000
++++ mongo-tools-r3.2.10/build.sh       2016-11-15 16:15:23.127235064 +0000
+@@ -22,7 +22,7 @@
+ 
+ for i in bsondump mongostat mongofiles mongoexport mongoimport mongorestore 
mongodump mongotop mongooplog; do
+         echo "Building ${i}..."
+-        go build -o "bin/$i" -tags "$tags" "$i/main/$i.go"
++        go build -buildmode=pie -o "bin/$i" -tags "$tags" "$i/main/$i.go"
+         ./bin/$i --version
+ done
+ 

diff --git a/app-admin/mongo-tools/mongo-tools-3.2.10-r1.ebuild 
b/app-admin/mongo-tools/mongo-tools-3.2.10-r1.ebuild
new file mode 100644
index 00000000..0e5c5cc
--- /dev/null
+++ b/app-admin/mongo-tools/mongo-tools-3.2.10-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-r${MY_PV}
+
+DESCRIPTION="A high-performance, open source, schema-free document-oriented 
database"
+HOMEPAGE="http://www.mongodb.org";
+SRC_URI="https://github.com/mongodb/mongo-tools/archive/r${MY_PV}.tar.gz -> 
mongo-tools-${MY_PV}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="sasl ssl"
+
+# Maintainer note:
+# openssl DEPEND constraint, see:
+# https://github.com/mongodb/mongo-tools/issues/11
+
+RDEPEND="!<dev-db/mongodb-3.0.0"
+DEPEND="${RDEPEND}
+       dev-lang/go:=
+       sasl? ( dev-libs/cyrus-sasl )
+       ssl? ( dev-libs/openssl )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+       sed -e 's|go build .*|go build -o "bin/$i" -tags "$tags" 
"$i/main/$i.go"|g' -i build.sh || die
+
+       # ensure we use bash wrt #582906
+       sed -e 's@/bin/sh@/bin/bash@g' -i build.sh || die
+
+       epatch "${FILESDIR}/${P}-pie.patch"
+}
+
+src_compile() {
+       local myconf
+
+       if use sasl; then
+         myconf="${myconf} sasl"
+       fi
+
+       if use ssl; then
+         myconf="${myconf} ssl"
+       fi
+
+       ./build.sh ${myconf} || die "build failed"
+}
+
+src_install() {
+       dobin bin/*
+}

Reply via email to