summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-libs/libntru/ChangeLog10
-rw-r--r--dev-libs/libntru/files/libntru-0.3-Allow-building-and-installing-static-lib.patch78
-rw-r--r--dev-libs/libntru/files/libntru-0.3-Make-the-lib-target-depend-on-the-libntru.so-target.patch33
-rw-r--r--dev-libs/libntru/files/libntru-0.3-Update-VERSION-in-Makefiles.patch53
-rw-r--r--dev-libs/libntru/libntru-0.3.ebuild57
5 files changed, 230 insertions, 1 deletions
diff --git a/dev-libs/libntru/ChangeLog b/dev-libs/libntru/ChangeLog
index e7ffd4bdf4af..5d2f85177e09 100644
--- a/dev-libs/libntru/ChangeLog
+++ b/dev-libs/libntru/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for dev-libs/libntru
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libntru/ChangeLog,v 1.1 2014/04/16 22:48:09 hasufell Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libntru/ChangeLog,v 1.2 2014/11/17 22:32:35 hasufell Exp $
+
+*libntru-0.3 (17 Nov 2014)
+
+ 17 Nov 2014; Julian Ospald <hasufell@gentoo.org> +libntru-0.3.ebuild,
+ +files/libntru-0.3-Allow-building-and-installing-static-lib.patch,
+ +files/libntru-0.3-Make-the-lib-target-depend-on-the-libntru.so-target.patch,
+ +files/libntru-0.3-Update-VERSION-in-Makefiles.patch:
+ version bump
*libntru-0.2 (16 Apr 2014)
diff --git a/dev-libs/libntru/files/libntru-0.3-Allow-building-and-installing-static-lib.patch b/dev-libs/libntru/files/libntru-0.3-Allow-building-and-installing-static-lib.patch
new file mode 100644
index 000000000000..36c4f693dcc6
--- /dev/null
+++ b/dev-libs/libntru/files/libntru-0.3-Allow-building-and-installing-static-lib.patch
@@ -0,0 +1,78 @@
+From 5cb48a5a1bf43c5d4811295aa3fb25744c4c254d Mon Sep 17 00:00:00 2001
+From: Julian Ospald <hasufell@hasufell.de>
+Date: Mon, 17 Nov 2014 23:25:31 +0100
+Subject: [PATCH 3/6] Allow building and installing static lib
+
+Refactored the install rules a bit, so that installing the static
+lib optionally becomes a bit more convenient.
+---
+ Makefile.linux | 36 ++++++++++++++++++++++++++++++------
+ 1 file changed, 30 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile.linux b/Makefile.linux
+index dbc4957..218162c 100644
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -1,4 +1,5 @@
+ CC?=gcc
++AR?=ar
+ CFLAGS?=-g -O2
+ CFLAGS+=-Wall -Wextra -Wno-unused-parameter
+ LIBS+=-lrt
+@@ -24,24 +25,47 @@ all: lib
+
+ lib: libntru.so
+
++static-lib: libntru.a
++
+ libntru.so: $(LIB_OBJS_PATHS)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS) $(LIBS)
+
+-install: lib
+- test -d "$(DESTDIR)$(INST_PFX)" || mkdir -p "$(DESTDIR)$(INST_PFX)"
+- test -d "$(DESTDIR)$(INST_LIBDIR)" || mkdir "$(DESTDIR)$(INST_LIBDIR)"
+- test -d "$(DESTDIR)$(INST_INCLUDE)" || mkdir -p "$(DESTDIR)$(INST_INCLUDE)"
+- test -d "$(DESTDIR)$(INST_DOCDIR)" || mkdir -p "$(DESTDIR)$(INST_DOCDIR)"
++libntru.a: $(LIB_OBJS_PATHS)
++ $(AR) cru libntru.a $(LIB_OBJS_PATHS)
++
++install: install-lib install-doc install-headers
++
++install-lib: lib
++ test -d "$(DESTDIR)$(INST_LIBDIR)" || mkdir -p "$(DESTDIR)$(INST_LIBDIR)"
+ install -m 0755 libntru.so "$(DESTDIR)$(INST_LIBDIR)/libntru.so"
++
++install-static-lib: static-lib
++ test -d "$(DESTDIR)$(INST_LIBDIR)" || mkdir -p "$(DESTDIR)$(INST_LIBDIR)"
++ install -m 0755 libntru.a "$(DESTDIR)$(INST_LIBDIR)/libntru.a"
++
++install-doc:
++ test -d "$(DESTDIR)$(INST_DOCDIR)" || mkdir -p "$(DESTDIR)$(INST_DOCDIR)"
+ install -m 0644 README.md "$(DESTDIR)$(INST_DOCDIR)/README.md"
++
++install-headers:
++ test -d "$(DESTDIR)$(INST_INCLUDE)" || mkdir -p "$(DESTDIR)$(INST_INCLUDE)"
+ for header in $(INST_HEADERS) ; do \
+ install -m 0644 "$(SRCDIR)/$$header" "$(DESTDIR)$(INST_INCLUDE)/" ; \
+ done
+
+-uninstall:
++uninstall: uninstall-lib uninstall-doc uninstall-headers
++
++uninstall-lib:
+ rm -f "$(DESTDIR)$(INST_LIBDIR)/libntru.so"
++
++uninstall-static-lib:
++ rm -f "$(DESTDIR)$(INST_LIBDIR)/libntru.a"
++
++uninstall-doc:
+ rm -f "$(DESTDIR)$(INST_DOCDIR)/README.md"
+ rmdir "$(DESTDIR)$(INST_DOCDIR)/"
++
++uninstall-headers:
+ for header in $(INST_HEADERS) ; do \
+ rm "$(DESTDIR)$(INST_INCLUDE)/$$header" ; \
+ done
+--
+2.1.3
+
diff --git a/dev-libs/libntru/files/libntru-0.3-Make-the-lib-target-depend-on-the-libntru.so-target.patch b/dev-libs/libntru/files/libntru-0.3-Make-the-lib-target-depend-on-the-libntru.so-target.patch
new file mode 100644
index 000000000000..101d0472faac
--- /dev/null
+++ b/dev-libs/libntru/files/libntru-0.3-Make-the-lib-target-depend-on-the-libntru.so-target.patch
@@ -0,0 +1,33 @@
+From 38e454b12c707a0d6870fb5541fad64ece17f78d Mon Sep 17 00:00:00 2001
+From: Julian Ospald <hasufell@hasufell.de>
+Date: Mon, 17 Nov 2014 22:27:39 +0100
+Subject: [PATCH 1/4] Make the "lib" target depend on the "libntru.so" target
+
+Depending on the old "lib" target caused a rebuild of libntru.so on any
+such target (e.g. installation), because "lib" is in .PHONY
+and not an expected file name.
+
+Fixing this helps with distro policies which require to not do
+compilation processes during installation phase.
+---
+ Makefile.linux | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.linux b/Makefile.linux
+index b699998..dbc4957 100644
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -22,7 +22,9 @@ MAKEFILENAME=$(lastword $(MAKEFILE_LIST))
+
+ all: lib
+
+-lib: $(LIB_OBJS_PATHS)
++lib: libntru.so
++
++libntru.so: $(LIB_OBJS_PATHS)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS) $(LIBS)
+
+ install: lib
+--
+2.1.3
+
diff --git a/dev-libs/libntru/files/libntru-0.3-Update-VERSION-in-Makefiles.patch b/dev-libs/libntru/files/libntru-0.3-Update-VERSION-in-Makefiles.patch
new file mode 100644
index 000000000000..0c46be1c3552
--- /dev/null
+++ b/dev-libs/libntru/files/libntru-0.3-Update-VERSION-in-Makefiles.patch
@@ -0,0 +1,53 @@
+From e434656449d0797a2f6e14e33b6a0114371d0e16 Mon Sep 17 00:00:00 2001
+From: Julian Ospald <hasufell@hasufell.de>
+Date: Mon, 17 Nov 2014 22:58:29 +0100
+Subject: [PATCH 3/4] Update VERSION in Makefiles
+
+---
+ Makefile.linux | 2 +-
+ Makefile.osx | 2 +-
+ Makefile.win | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.linux b/Makefile.linux
+index fabf8d5..3248ba8 100644
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -7,7 +7,7 @@ SRCDIR=src
+ TESTDIR=tests
+ LIB_OBJS=bitstring.o encparams.o hash.o idxgen.o key.o mgf.o ntru.o poly.o rand.o sha1.o sha2.o
+ TEST_OBJS=test_bitstring.o test_hash.o test_idxgen.o test_key.o test_ntru.o test.o test_poly.o test_util.o
+-VERSION=0.2
++VERSION=0.3
+ INST_PFX=/usr
+ INST_LIBDIR=$(INST_PFX)/lib
+ INST_INCLUDE=$(INST_PFX)/include/libntru
+diff --git a/Makefile.osx b/Makefile.osx
+index ccbdf3e..a0f67d3 100644
+--- a/Makefile.osx
++++ b/Makefile.osx
+@@ -4,7 +4,7 @@ SRCDIR=src
+ TESTDIR=tests
+ LIB_OBJS=bitstring.o encparams.o hash.o idxgen.o key.o mgf.o ntru.o poly.o rand.o sha1.o sha2.o
+ TEST_OBJS=test_bitstring.o test_hash.o test_idxgen.o test_key.o test_ntru.o test.o test_poly.o test_util.o
+-VERSION=0.2
++VERSION=0.3
+ INST_PFX=/usr
+ INST_LIBDIR=$(INST_PFX)/lib
+ INST_INCLUDE=$(INST_PFX)/include/libntru
+diff --git a/Makefile.win b/Makefile.win
+index 7a93144..ffa7225 100644
+--- a/Makefile.win
++++ b/Makefile.win
+@@ -6,7 +6,7 @@ SRCDIR=src
+ TESTDIR=tests
+ LIB_OBJS=bitstring.o encparams.o hash.o idxgen.o key.o mgf.o ntru.o poly.o rand.o sha1.o sha2.o
+ TEST_OBJS=test_bitstring.o test_hash.o test_idxgen.o test_key.o test_ntru.o test.o test_poly.o test_util.o
+-VERSION=0.2
++VERSION=0.3
+ INST_PFX=%PROGRAMFILES%
+ INST_LIBDIR=$(INST_PFX)\libntru
+ INST_INCLUDE=$(INST_PFX)\libntru\include
+--
+2.1.3
+
diff --git a/dev-libs/libntru/libntru-0.3.ebuild b/dev-libs/libntru/libntru-0.3.ebuild
new file mode 100644
index 000000000000..6f68d0e8fcf2
--- /dev/null
+++ b/dev-libs/libntru/libntru-0.3.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libntru/libntru-0.3.ebuild,v 1.1 2014/11/17 22:32:35 hasufell Exp $
+
+EAPI=5
+
+inherit eutils toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="C Implementation of NTRUEncrypt"
+HOMEPAGE="https://github.com/tbuktu/libntru"
+SRC_URI="https://github.com/tbuktu/libntru/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples static-libs"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-Make-the-lib-target-depend-on-the-libntru.so-target.patch \
+ "${FILESDIR}"/${P}-Allow-building-and-installing-static-lib.patch \
+ "${FILESDIR}"/${P}-Update-VERSION-in-Makefiles.patch
+
+ multilib_copy_sources
+
+ _copy_test_dir() {
+ cp -pr "${BUILD_DIR}" "${BUILD_DIR}-test" || die
+ }
+ multilib_foreach_abi _copy_test_dir
+}
+
+multilib_src_compile() {
+ CFLAGS="${CFLAGS}" emake CC="$(tc-getCC)" $(usex static-libs "libntru.a" "")
+}
+
+src_test() {
+ _test() {
+ CFLAGS="${CFLAGS}" emake CC="$(tc-getCC)" test -j1 -C "${BUILD_DIR}-test"
+ }
+
+ multilib_foreach_abi _test
+}
+
+multilib_src_install() {
+ emake \
+ DESTDIR="${ED}" \
+ INST_LIBDIR="/usr/$(get_libdir)" \
+ INST_DOCDIR="/usr/share/doc/${PF}" \
+ install $(usex static-libs install-static-lib "")
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ if use examples ; then
+ docinto examples
+ dodoc src/hybrid.c
+ fi
+}