summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-libs/libntru
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-libs/libntru')
-rw-r--r--dev-libs/libntru/Manifest2
-rw-r--r--dev-libs/libntru/files/01-libntru-0.2-fix-build-on-macosx.patch109
-rw-r--r--dev-libs/libntru/files/02-libntru-0.2-add-warnings.patch60
-rw-r--r--dev-libs/libntru/files/03-libntru-0.2-install-rules.patch255
-rw-r--r--dev-libs/libntru/files/04-libntru-0.2-respect-flags.patch92
-rw-r--r--dev-libs/libntru/files/05-libntru-0.2-fix-memory-leak.patch24
-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.2.ebuild38
-rw-r--r--dev-libs/libntru/libntru-0.3.ebuild57
-rw-r--r--dev-libs/libntru/metadata.xml11
12 files changed, 812 insertions, 0 deletions
diff --git a/dev-libs/libntru/Manifest b/dev-libs/libntru/Manifest
new file mode 100644
index 000000000000..84817df976c6
--- /dev/null
+++ b/dev-libs/libntru/Manifest
@@ -0,0 +1,2 @@
+DIST libntru-0.2.tar.gz 49832 SHA256 bc1d10dcd1755f836d4696b734ecc4bc8b047b7ea40d857657c03ecb31ac141f SHA512 4de4cc550fb74d53a26f1b6f94d27d6131756ab7f1b62ce5f1845e6e626581a357004efbd92881d1e180d75f4a92ec97e3c30926dcdf6ea23d87f1da81809f3a WHIRLPOOL 5e96d55f56f608e5ca24506bc8a122d2dff62c61fc0dab847913456d84d36fe13d615c8910b3915c0aa3881a236aaae45725842f9d062183906162df352fd396
+DIST libntru-0.3.tar.gz 53364 SHA256 9ce6b6a20ca304c09d2ff853e3b5762880a8cb85728113b26eb8ca2e915e2a0a SHA512 b99fecf21104f73246a9494dce6caa6742b7a2e5219e9b2a46d639d3181588bb1580c0b03209f150e9294f721d2e1179157be0eab52f25b2664c1451aaae8712 WHIRLPOOL 1545da85003e0466354767388252a67d5ac9cb457e94baf9ed1862b2b2b28bfa6057202509a017765442ca502c888ca50c6724b8c67569b6e6f4fcb8d5b2fd8a
diff --git a/dev-libs/libntru/files/01-libntru-0.2-fix-build-on-macosx.patch b/dev-libs/libntru/files/01-libntru-0.2-fix-build-on-macosx.patch
new file mode 100644
index 000000000000..d7f834da315a
--- /dev/null
+++ b/dev-libs/libntru/files/01-libntru-0.2-fix-build-on-macosx.patch
@@ -0,0 +1,109 @@
+From 286bbe95e479202d8c8c3cc7bf37eaf206e5f88c Mon Sep 17 00:00:00 2001
+From: Tim Buktu <tbuktu@hotmail.com>
+Date: Tue, 15 Apr 2014 00:39:12 +0200
+Subject: [PATCH] Fix build on Mac OS X (see
+ http://sourceforge.net/p/ntru/feature-requests/2/)
+
+---
+ Makefile | 14 ++++----------
+ Makefile.osx | 31 +++++++++++++++++++++++++++++++
+ Makefile.win | 7 +++++--
+ 3 files changed, 40 insertions(+), 12 deletions(-)
+ create mode 100644 Makefile.osx
+
+diff --git a/Makefile b/Makefile
+index a349627..eb22b7a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,3 +1,4 @@
++CC?=gcc
+ CFLAGS=-g -Wall -O2
+ LDFLAGS=-lrt
+ SRCDIR=src
+@@ -8,17 +9,9 @@ TEST_OBJS=test_bitstring.o test_hash.o test_idxgen.o test_key.o test_ntru.o test
+ LIB_OBJS_PATHS=$(patsubst %,$(SRCDIR)/%,$(LIB_OBJS))
+ TEST_OBJS_PATHS=$(patsubst %,$(TESTDIR)/%,$(TEST_OBJS))
+
+-# Use -install_name on Mac OS, -soname everywhere else
+-UNAME := $(shell uname)
+-ifeq ($(UNAME), Darwin)
+- SONAME=-install_name
+-else
+- SONAME=-soname
+-endif
+-
+ .PHONY: lib
+ lib: $(LIB_OBJS_PATHS)
+- $(CC) $(CFLAGS) -shared -Wl,$(SONAME),libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS)
++ $(CC) $(CFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS)
+
+ test: lib $(TEST_OBJS_PATHS)
+ $(CC) $(CFLAGS) -o test $(TEST_OBJS_PATHS) -L. -lntru -lm
+@@ -35,4 +28,5 @@ tests/%.o: tests/%.c
+
+ .PHONY: clean
+ clean:
+- rm -f $(SRCDIR)/*.o $(TESTDIR)/*.o libntru.so libntru.dll test test.exe bench bench.exe
++ @# also clean files generated on other OSes
++ rm -f $(SRCDIR)/*.o $(TESTDIR)/*.o libntru.so libntru.dylib libntru.dll test test.exe bench bench.exe
+diff --git a/Makefile.osx b/Makefile.osx
+new file mode 100644
+index 0000000..ef20d64
+--- /dev/null
++++ b/Makefile.osx
+@@ -0,0 +1,31 @@
++CC?=gcc
++CFLAGS=-g -Wall -O2
++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
++
++LIB_OBJS_PATHS=$(patsubst %,$(SRCDIR)/%,$(LIB_OBJS))
++TEST_OBJS_PATHS=$(patsubst %,$(TESTDIR)/%,$(TEST_OBJS))
++
++.PHONY: lib
++lib: $(LIB_OBJS_PATHS)
++ $(CC) $(CFLAGS) -dylib -dynamiclib -o libntru.dylib $(LIB_OBJS_PATHS) $(LDFLAGS)
++
++test: lib $(TEST_OBJS_PATHS)
++ $(CC) $(CFLAGS) -o test $(TEST_OBJS_PATHS) -L. -lntru -lm
++ DYLD_LIBRARY_PATH=. ./test
++
++bench: lib $(SRCDIR)/bench.o
++ $(CC) $(CFLAGS) -o bench $(SRCDIR)/bench.o -L. -lntru
++
++$(SRCDIR)/%.o: $(SRCDIR)/%.c
++ $(CC) $(CFLAGS) -c -fPIC $< -o $@
++
++tests/%.o: tests/%.c
++ $(CC) $(CFLAGS) -fPIC -I$(SRCDIR) -c $< -o $@
++
++.PHONY: clean
++clean:
++ @# also clean files generated on other OSes
++ rm -f $(SRCDIR)/*.o $(TESTDIR)/*.o libntru.so libntru.dylib libntru.dll test test.exe bench bench.exe
+diff --git a/Makefile.win b/Makefile.win
+index de8619e..8a1c55b 100644
+--- a/Makefile.win
++++ b/Makefile.win
+@@ -1,3 +1,4 @@
++CC?=gcc
+ CFLAGS=-g -Wall -O2
+ SRCDIR=src
+ TESTDIR=tests
+@@ -28,8 +29,10 @@ clean:
+ @if exist $(SRCDIR)\*.o del $(SRCDIR)\*.o
+ @if exist $(TESTDIR)\*.o del $(TESTDIR)\*.o
+ @if exist libntru.dll del libntru.dll
+- @if exist libntru.so del libntru.so
+ @if exist test.exe del test.exe
+- @if exist test del test
+ @if exist bench.exe del bench.exe
++ @rem ***** clean files generated on other OSes *****
++ @if exist libntru.so del libntru.so
++ @if exist libntru.dylib del libntru.dylib
++ @if exist test del test
+ @if exist bench del bench
+--
+1.9.1
diff --git a/dev-libs/libntru/files/02-libntru-0.2-add-warnings.patch b/dev-libs/libntru/files/02-libntru-0.2-add-warnings.patch
new file mode 100644
index 000000000000..454e781646b9
--- /dev/null
+++ b/dev-libs/libntru/files/02-libntru-0.2-add-warnings.patch
@@ -0,0 +1,60 @@
+From 70ee775ae08d9965b3b1a2045703ab232289cb52 Mon Sep 17 00:00:00 2001
+From: Tim Buktu <tbuktu@hotmail.com>
+Date: Tue, 15 Apr 2014 00:56:43 +0200
+Subject: [PATCH] Add -Wextra -Wno-unused-parameter and fix a warning
+
+---
+ Makefile | 2 +-
+ Makefile.osx | 2 +-
+ Makefile.win | 2 +-
+ src/rand.c | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index eb22b7a..ea88bb3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+ CC?=gcc
+-CFLAGS=-g -Wall -O2
++CFLAGS=-g -Wall -Wextra -Wno-unused-parameter -O2
+ LDFLAGS=-lrt
+ SRCDIR=src
+ TESTDIR=tests
+diff --git a/Makefile.osx b/Makefile.osx
+index ef20d64..68877fb 100644
+--- a/Makefile.osx
++++ b/Makefile.osx
+@@ -1,5 +1,5 @@
+ CC?=gcc
+-CFLAGS=-g -Wall -O2
++CFLAGS=-g -Wall -Wextra -Wno-unused-parameter -O2
+ 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
+diff --git a/Makefile.win b/Makefile.win
+index 8a1c55b..0eb18a5 100644
+--- a/Makefile.win
++++ b/Makefile.win
+@@ -1,5 +1,5 @@
+ CC?=gcc
+-CFLAGS=-g -Wall -O2
++CFLAGS=-g -Wall -Wextra -Wno-unused-parameter -O2
+ 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
+diff --git a/src/rand.c b/src/rand.c
+index 187fad2..93bf76b 100644
+--- a/src/rand.c
++++ b/src/rand.c
+@@ -17,7 +17,7 @@ uint8_t ntru_rand_wincrypt(uint8_t rand_data[], uint16_t len, NtruRandContext *r
+ if (hCryptProv == 0) {
+ uint8_t result = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0);
+ if (!result) {
+- if (GetLastError() == NTE_BAD_KEYSET) // see http://support.microsoft.com/kb/238187
++ if (GetLastError() == (DWORD)NTE_BAD_KEYSET) // see http://support.microsoft.com/kb/238187
+ result = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET);
+ if (!result)
+ return 0;
+--
+1.9.1
diff --git a/dev-libs/libntru/files/03-libntru-0.2-install-rules.patch b/dev-libs/libntru/files/03-libntru-0.2-install-rules.patch
new file mode 100644
index 000000000000..dbe440df5419
--- /dev/null
+++ b/dev-libs/libntru/files/03-libntru-0.2-install-rules.patch
@@ -0,0 +1,255 @@
+From 625e8727bbbeb38975e54f1829bcd7a23f81bb11 Mon Sep 17 00:00:00 2001
+From: Tim Buktu <tbuktu@hotmail.com>
+Date: Tue, 15 Apr 2014 20:45:36 +0200
+Subject: [PATCH] Add Makefile targets
+
+New targets: all, install, uninstall, dist, distclean
+This fixes https://github.com/tbuktu/libntru/issues/6
+---
+ Makefile | 48 +++++++++++++++++++++++++++++++++++++++++++++
+ Makefile.osx | 47 ++++++++++++++++++++++++++++++++++++++++++++
+ Makefile.win | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ src/ntru.h | 1 -
+ 4 files changed, 159 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index ea88bb3..e4a6370 100644
+--- a/Makefile
++++ b/Makefile
+@@ -5,14 +5,57 @@ 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
++INST_PFX=/usr
++INST_HEADERS=ntru.h types.h key.h encparams.h hash.h rand.h err.h
+
+ LIB_OBJS_PATHS=$(patsubst %,$(SRCDIR)/%,$(LIB_OBJS))
+ TEST_OBJS_PATHS=$(patsubst %,$(TESTDIR)/%,$(TEST_OBJS))
++DIST_NAME=libntru-$(VERSION)
++
++.PHONY: all
++all: lib
+
+ .PHONY: lib
+ lib: $(LIB_OBJS_PATHS)
+ $(CC) $(CFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS)
+
++.PHONY: install
++install: lib
++ test -d $(INST_PFX) || mkdir -p $(INST_PFX)
++ test -d $(INST_PFX)/lib || mkdir $(INST_PFX)/lib
++ test -d $(INST_PFX)/include/libntru || mkdir -p $(INST_PFX)/include/libntru
++ test -d $(INST_PFX)/share/doc/libntru || mkdir -p $(INST_PFX)/share/doc/libntru
++ install -m 0755 libntru.so $(INST_PFX)/lib/libntru.so
++ install -m 0644 README.md $(INST_PFX)/share/doc/libntru/README.md
++ for header in $(INST_HEADERS); do \
++ install -m 0644 $(SRCDIR)/$$header $(INST_PFX)/include/libntru/; \
++ done
++
++.PHONY: uninstall
++uninstall:
++ rm -f $(INST_PFX)/lib/libntru.so
++ rm -f $(INST_PFX)/share/doc/libntru/README.md
++ rmdir $(INST_PFX)/share/doc/libntru/
++ for header in $(INST_HEADERS); do \
++ rm $(INST_PFX)/include/libntru/$$header; \
++ done
++ rmdir $(INST_PFX)/include/libntru/
++
++.PHONY: dist
++dist:
++ rm -rf $(DIST_NAME)
++ mkdir $(DIST_NAME)
++ mkdir $(DIST_NAME)/$(SRCDIR)
++ mkdir $(DIST_NAME)/$(TESTDIR)
++ cp Makefile Makefile.win Makefile.osx README.md LICENSE PATENTS $(DIST_NAME)
++ cp $(SRCDIR)/*.c $(DIST_NAME)/$(SRCDIR)
++ cp $(SRCDIR)/*.h $(DIST_NAME)/$(SRCDIR)
++ cp $(TESTDIR)/*.c $(DIST_NAME)/$(TESTDIR)
++ cp $(TESTDIR)/*.h $(DIST_NAME)/$(TESTDIR)
++ tar cf $(DIST_NAME).tar.xz $(DIST_NAME) --lzma
++ rm -rf $(DIST_NAME)
++
+ test: lib $(TEST_OBJS_PATHS)
+ $(CC) $(CFLAGS) -o test $(TEST_OBJS_PATHS) -L. -lntru -lm
+ LD_LIBRARY_PATH=. ./test
+@@ -30,3 +73,8 @@ tests/%.o: tests/%.c
+ clean:
+ @# also clean files generated on other OSes
+ rm -f $(SRCDIR)/*.o $(TESTDIR)/*.o libntru.so libntru.dylib libntru.dll test test.exe bench bench.exe
++
++.PHONY: distclean
++distclean: clean
++ rm -rf $(DIST_NAME)
++ rm -f $(DIST_NAME).tar.xz $(DIST_NAME).zip
+diff --git a/Makefile.osx b/Makefile.osx
+index 68877fb..0baef8c 100644
+--- a/Makefile.osx
++++ b/Makefile.osx
+@@ -4,14 +4,56 @@ 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
++INST_HEADERS=ntru.h types.h key.h encparams.h hash.h rand.h err.h
+
+ LIB_OBJS_PATHS=$(patsubst %,$(SRCDIR)/%,$(LIB_OBJS))
+ TEST_OBJS_PATHS=$(patsubst %,$(TESTDIR)/%,$(TEST_OBJS))
++DIST_NAME=libntru-$(VERSION)
++
++.PHONY: all
++all: lib
+
+ .PHONY: lib
+ lib: $(LIB_OBJS_PATHS)
+ $(CC) $(CFLAGS) -dylib -dynamiclib -o libntru.dylib $(LIB_OBJS_PATHS) $(LDFLAGS)
+
++.PHONY: install
++install: lib
++ test -d $(INST_PFX) || mkdir -p $(INST_PFX)
++ test -d $(INST_PFX)/lib || mkdir $(INST_PFX)/lib
++ test -d $(INST_PFX)/include/libntru || mkdir -p $(INST_PFX)/include/libntru
++ test -d $(INST_PFX)/share/doc/libntru || mkdir -p $(INST_PFX)/share/doc/libntru
++ install -m 0755 libntru.so $(INST_PFX)/lib/libntru.so
++ install -m 0644 README.md $(INST_PFX)/share/doc/libntru/README.md
++ for header in $(INST_HEADERS); do \
++ install -m 0644 $(SRCDIR)/$$header $(INST_PFX)/include/libntru/; \
++ done
++
++.PHONY: uninstall
++uninstall:
++ rm -f $(INST_PFX)/lib/libntru.so
++ rm -f $(INST_PFX)/share/doc/libntru/README.md
++ rmdir $(INST_PFX)/share/doc/libntru/
++ for header in $(INST_HEADERS); do \
++ rm $(INST_PFX)/include/libntru/$$header; \
++ done
++ rmdir $(INST_PFX)/include/libntru/
++
++.PHONY: dist
++dist:
++ rm -rf $(DIST_NAME)
++ mkdir $(DIST_NAME)
++ mkdir $(DIST_NAME)/$(SRCDIR)
++ mkdir $(DIST_NAME)/$(TESTDIR)
++ cp Makefile Makefile.win Makefile.osx README.md LICENSE PATENTS $(DIST_NAME)
++ cp $(SRCDIR)/*.c $(DIST_NAME)/$(SRCDIR)
++ cp $(SRCDIR)/*.h $(DIST_NAME)/$(SRCDIR)
++ cp $(TESTDIR)/*.c $(DIST_NAME)/$(TESTDIR)
++ cp $(TESTDIR)/*.h $(DIST_NAME)/$(TESTDIR)
++ tar cf $(DIST_NAME).tar.xz $(DIST_NAME) --lzma
++ rm -rf $(DIST_NAME)
++
+ test: lib $(TEST_OBJS_PATHS)
+ $(CC) $(CFLAGS) -o test $(TEST_OBJS_PATHS) -L. -lntru -lm
+ DYLD_LIBRARY_PATH=. ./test
+@@ -29,3 +71,8 @@ tests/%.o: tests/%.c
+ clean:
+ @# also clean files generated on other OSes
+ rm -f $(SRCDIR)/*.o $(TESTDIR)/*.o libntru.so libntru.dylib libntru.dll test test.exe bench bench.exe
++
++.PHONY: distclean
++distclean: clean
++ rm -rf $(DIST_NAME)
++ rm -f $(DIST_NAME).tar.xz $(DIST_NAME).zip
+diff --git a/Makefile.win b/Makefile.win
+index 0eb18a5..315e08b 100644
+--- a/Makefile.win
++++ b/Makefile.win
+@@ -4,13 +4,64 @@ 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
++INST_PFX=%PROGRAMFILES%
++INST_HEADERS=ntru.h types.h key.h encparams.h hash.h rand.h err.h
+
+ LIB_OBJS_PATHS=$(patsubst %,$(SRCDIR)/%,$(LIB_OBJS))
+ TEST_OBJS_PATHS=$(patsubst %,$(TESTDIR)/%,$(TEST_OBJS))
++DIST_NAME=libntru-$(VERSION)
+
++.PHONY: all
++all: lib
++
++.PHONY: lib
+ lib: $(LIB_OBJS_PATHS)
+ $(CC) $(CFLAGS) -shared -o libntru.dll $(LIB_OBJS_PATHS) -lws2_32 -ladvapi32
+
++.PHONY: install
++install: lib
++ if not exist "%PROGRAMFILES%\libntru" mkdir "%PROGRAMFILES%\libntru"
++ if not exist "%PROGRAMFILES%\libntru\include" mkdir "%PROGRAMFILES%\libntru\include"
++ copy libntru.dll "%PROGRAMFILES%\libntru"
++ copy README.md "%PROGRAMFILES%\libntru"
++ for %%h in ($(INST_HEADERS)) do \
++ copy $(SRCDIR)\%%h "%PROGRAMFILES%\libntru\include"
++
++uninstall:
++ if exist "%PROGRAMFILES%\libntru\libntru.dll" del "%PROGRAMFILES%\libntru\libntru.dll"
++ if exist "%PROGRAMFILES%\libntru\README.md" del "%PROGRAMFILES%\libntru\README.md"
++ for %%h in ($(INST_HEADERS)) do \
++ if exist "%PROGRAMFILES%\libntru\include\%%h" del "%PROGRAMFILES%\libntru\include\%%h"
++ if exist "%PROGRAMFILES%\libntru\include" rmdir "%PROGRAMFILES%\libntru\include"
++ if exist "%PROGRAMFILES%\libntru" rmdir "%PROGRAMFILES%\libntru"
++
++.PHONY: dist
++dist:
++ @if exist $(DIST_NAME)\$(SRCDIR)\*.c del $(DIST_NAME)\$(SRCDIR)\*.c
++ @if exist $(DIST_NAME)\$(SRCDIR)\*.h del $(DIST_NAME)\$(SRCDIR)\*.h
++ @if exist $(DIST_NAME)\$(SRCDIR) rmdir $(DIST_NAME)\$(SRCDIR)
++ @if exist $(DIST_NAME)\$(TESTDIR)\*.c del $(DIST_NAME)\$(TESTDIR)\*.c
++ @if exist $(DIST_NAME)\$(TESTDIR)\*.h del $(DIST_NAME)\$(TESTDIR)\*.h
++ @if exist $(DIST_NAME)\$(TESTDIR) rmdir $(DIST_NAME)\$(TESTDIR)
++ @if exist $(DIST_NAME)\*.* del /q $(DIST_NAME)\*.*
++ @if exist $(DIST_NAME) rmdir $(DIST_NAME)
++ mkdir $(DIST_NAME)
++ mkdir $(DIST_NAME)\$(SRCDIR)
++ mkdir $(DIST_NAME)\$(TESTDIR)
++ copy Makefile $(DIST_NAME)
++ copy Makefile.win $(DIST_NAME)
++ copy Makefile.osx $(DIST_NAME)
++ copy README.md $(DIST_NAME)
++ copy LICENSE $(DIST_NAME)
++ copy PATENTS $(DIST_NAME)
++ copy $(SRCDIR)\*.c $(DIST_NAME)\$(SRCDIR)
++ copy $(SRCDIR)\*.h $(DIST_NAME)\$(SRCDIR)
++ copy $(TESTDIR)\*.c $(DIST_NAME)\$(TESTDIR)
++ copy $(TESTDIR)\*.h $(DIST_NAME)\$(TESTDIR)
++ @rem zip is provided by MinGW
++ zip -rm $(DIST_NAME).zip $(DIST_NAME)
++
+ test: lib $(TEST_OBJS_PATHS)
+ $(CC) $(CFLAGS) -o test.exe $(TEST_OBJS_PATHS) -L. -lntru -lm
+ test.exe
+@@ -36,3 +87,16 @@ clean:
+ @if exist libntru.dylib del libntru.dylib
+ @if exist test del test
+ @if exist bench del bench
++
++.PHONY: distclean
++distclean: clean
++ @if exist $(DIST_NAME)\$(SRCDIR)\*.c del $(DIST_NAME)\$(SRCDIR)\*.c
++ @if exist $(DIST_NAME)\$(SRCDIR)\*.h del $(DIST_NAME)\$(SRCDIR)\*.h
++ @if exist $(DIST_NAME)\$(SRCDIR) rmdir $(DIST_NAME)\$(SRCDIR)
++ @if exist $(DIST_NAME)\$(TESTDIR)\*.c del $(DIST_NAME)\$(TESTDIR)\*.c
++ @if exist $(DIST_NAME)\$(TESTDIR)\*.h del $(DIST_NAME)\$(TESTDIR)\*.h
++ @if exist $(DIST_NAME)\$(TESTDIR) rmdir $(DIST_NAME)\$(TESTDIR)
++ @if exist $(DIST_NAME)\*.* del /q $(DIST_NAME)\*.*
++ @if exist $(DIST_NAME) rmdir $(DIST_NAME)
++ @if exist $(DIST_NAME).zip del $(DIST_NAME).zip
++ @if exist $(DIST_NAME).tar.xz del $(DIST_NAME).tar.xz
+diff --git a/src/ntru.h b/src/ntru.h
+index a8ff338..41f15e3 100644
+--- a/src/ntru.h
++++ b/src/ntru.h
+@@ -3,7 +3,6 @@
+
+ #include "types.h"
+ #include "key.h"
+-#include "poly.h"
+ #include "encparams.h"
+ #include "rand.h"
+ #include "err.h"
+--
+1.9.1
diff --git a/dev-libs/libntru/files/04-libntru-0.2-respect-flags.patch b/dev-libs/libntru/files/04-libntru-0.2-respect-flags.patch
new file mode 100644
index 000000000000..e9274c41c02f
--- /dev/null
+++ b/dev-libs/libntru/files/04-libntru-0.2-respect-flags.patch
@@ -0,0 +1,92 @@
+From: Julian Ospald <hasufell@gentoo.org>
+Date: Wed Apr 16 14:48:00 UTC 2014
+Subject: respect system flags
+
+--- libntru-0.2/Makefile
++++ libntru-0.2/Makefile
+@@ -1,12 +1,16 @@
+ CC?=gcc
+-CFLAGS=-g -Wall -Wextra -Wno-unused-parameter -O2
+-LDFLAGS=-lrt
++CFLAGS?=-g -O2
++CFLAGS+=-Wall -Wextra -Wno-unused-parameter
++LIBS+=-lrt
+ 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
+ INST_PFX=/usr
++INST_LIBDIR=$(INST_PFX)/lib
++INST_INCLUDE=$(INST_PFX)/include/libntru
++INST_DOCDIR=$(INST_PFX)/share/doc/libntru
+ INST_HEADERS=ntru.h types.h key.h encparams.h hash.h rand.h err.h
+
+ LIB_OBJS_PATHS=$(patsubst %,$(SRCDIR)/%,$(LIB_OBJS))
+@@ -18,29 +22,29 @@
+
+ .PHONY: lib
+ lib: $(LIB_OBJS_PATHS)
+- $(CC) $(CFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(CPPFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS) $(LIBS)
+
+ .PHONY: install
+ install: lib
+- test -d $(INST_PFX) || mkdir -p $(INST_PFX)
+- test -d $(INST_PFX)/lib || mkdir $(INST_PFX)/lib
+- test -d $(INST_PFX)/include/libntru || mkdir -p $(INST_PFX)/include/libntru
+- test -d $(INST_PFX)/share/doc/libntru || mkdir -p $(INST_PFX)/share/doc/libntru
+- install -m 0755 libntru.so $(INST_PFX)/lib/libntru.so
+- install -m 0644 README.md $(INST_PFX)/share/doc/libntru/README.md
+- for header in $(INST_HEADERS); do \
+- install -m 0644 $(SRCDIR)/$$header $(INST_PFX)/include/libntru/; \
++ 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)"
++ install -m 0755 libntru.so "$(DESTDIR)$(INST_LIBDIR)/libntru.so"
++ install -m 0644 README.md "$(DESTDIR)$(INST_DOCDIR)/README.md"
++ for header in $(INST_HEADERS) ; do \
++ install -m 0644 "$(SRCDIR)/$$header" "$(DESTDIR)$(INST_INCLUDE)/" ; \
+ done
+
+ .PHONY: uninstall
+ uninstall:
+- rm -f $(INST_PFX)/lib/libntru.so
+- rm -f $(INST_PFX)/share/doc/libntru/README.md
+- rmdir $(INST_PFX)/share/doc/libntru/
+- for header in $(INST_HEADERS); do \
+- rm $(INST_PFX)/include/libntru/$$header; \
++ rm -f "$(DESTDIR)$(INST_LIBDIR)/libntru.so"
++ rm -f "$(DESTDIR)$(INST_DOCDIR)/README.md"
++ rmdir "$(DESTDIR)$(INST_DOCDIR)/"
++ for header in $(INST_HEADERS) ; do \
++ rm "$(DESTDIR)$(INST_INCLUDE)/$$header" ; \
+ done
+- rmdir $(INST_PFX)/include/libntru/
++ rmdir "$(DESTDIR)$(INST_INCLUDE)/"
+
+ .PHONY: dist
+ dist:
+@@ -57,17 +61,17 @@
+ rm -rf $(DIST_NAME)
+
+ test: lib $(TEST_OBJS_PATHS)
+- $(CC) $(CFLAGS) -o test $(TEST_OBJS_PATHS) -L. -lntru -lm
++ $(CC) $(CFLAGS) $(CPPFLAGS) -o test $(TEST_OBJS_PATHS) $(LDFLAGS) -L. -lntru -lm
+ LD_LIBRARY_PATH=. ./test
+
+ bench: lib $(SRCDIR)/bench.o
+- $(CC) $(CFLAGS) -o bench $(SRCDIR)/bench.o -L. -lntru
++ $(CC) $(CFLAGS) $(CPPFLAGS) -o bench $(SRCDIR)/bench.o $(LDFLAGS) -L. -lntru
+
+ $(SRCDIR)/%.o: $(SRCDIR)/%.c
+- $(CC) $(CFLAGS) -c -fPIC $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -fPIC $< -o $@
+
+ tests/%.o: tests/%.c
+- $(CC) $(CFLAGS) -fPIC -I$(SRCDIR) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -I$(SRCDIR) -c $< -o $@
+
+ .PHONY: clean
+ clean:
diff --git a/dev-libs/libntru/files/05-libntru-0.2-fix-memory-leak.patch b/dev-libs/libntru/files/05-libntru-0.2-fix-memory-leak.patch
new file mode 100644
index 000000000000..843c39c779d4
--- /dev/null
+++ b/dev-libs/libntru/files/05-libntru-0.2-fix-memory-leak.patch
@@ -0,0 +1,24 @@
+From eada223e688d0777f852ca827a375121b375def3 Mon Sep 17 00:00:00 2001
+From: gga01 <gga01@users.noreply.github.com>
+Date: Wed, 16 Apr 2014 00:57:01 +0300
+Subject: [PATCH] Fix memory leak (issue #7)
+
+---
+ src/ntru.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/ntru.c b/src/ntru.c
+index b7513cb..73f0449 100644
+--- a/src/ntru.c
++++ b/src/ntru.c
+@@ -360,7 +360,7 @@ uint8_t ntru_encrypt_det(uint8_t *msg, uint16_t msg_len, NtruEncPubKey *pub, Ntr
+ rand_state = NULL;
+ NtruRandContext rand_ctx = {seed, seed_len, &rand_state};
+ uint8_t result = ntru_encrypt_internal(msg, msg_len, pub, params, rng, &rand_ctx, enc);
+- if (rand_state == NULL)
++ if (rand_state != NULL)
+ free(rand_state);
+ return result;
+ }
+--
+1.9.1
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.2.ebuild b/dev-libs/libntru/libntru-0.2.ebuild
new file mode 100644
index 000000000000..0fd96e42da7d
--- /dev/null
+++ b/dev-libs/libntru/libntru-0.2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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=""
+
+src_prepare() {
+ epatch "${FILESDIR}"/01-${P}-fix-build-on-macosx.patch \
+ "${FILESDIR}"/02-${P}-add-warnings.patch \
+ "${FILESDIR}"/03-${P}-install-rules.patch \
+ "${FILESDIR}"/04-${P}-respect-flags.patch \
+ "${FILESDIR}"/05-${P}-fix-memory-leak.patch
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ emake CC="$(tc-getCC)"
+}
+
+multilib_src_install() {
+ emake \
+ DESTDIR="${ED}" \
+ INST_LIBDIR="/usr/$(get_libdir)" \
+ INST_DOCDIR="/usr/share/doc/${PF}" \
+ install
+}
diff --git a/dev-libs/libntru/libntru-0.3.ebuild b/dev-libs/libntru/libntru-0.3.ebuild
new file mode 100644
index 000000000000..2bc30d24219b
--- /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
+# $Id$
+
+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
+}
diff --git a/dev-libs/libntru/metadata.xml b/dev-libs/libntru/metadata.xml
new file mode 100644
index 000000000000..07826665ce19
--- /dev/null
+++ b/dev-libs/libntru/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>hasufell@gentoo.org</email>
+ <name>Julian Ospald</name>
+ </maintainer>
+ <upstream>
+ <remote-id type='github'>tbuktu/libntru</remote-id>
+ </upstream>
+</pkgmetadata>