summaryrefslogtreecommitdiff
path: root/extra/crypto++
diff options
context:
space:
mode:
Diffstat (limited to 'extra/crypto++')
-rw-r--r--extra/crypto++/GNUmakefile.parabola94
-rw-r--r--extra/crypto++/PKGBUILD11
2 files changed, 101 insertions, 4 deletions
diff --git a/extra/crypto++/GNUmakefile.parabola b/extra/crypto++/GNUmakefile.parabola
new file mode 100644
index 000000000..22a724961
--- /dev/null
+++ b/extra/crypto++/GNUmakefile.parabola
@@ -0,0 +1,94 @@
+# -*- makefile -*-
+
+CXXFLAGS += -DNDEBUG -fPIC
+# the following options reduce code size, but breaks link or makes link very slow on some systems
+CXXFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS += -Wl,--gc-sections
+ARFLAGS = -cr # ar needs the dash on OpenBSD
+RANLIB = ranlib
+CP = cp
+MKDIR = mkdir
+EGREP = egrep
+
+# Default prefix for make install
+PREFIX ?= /usr
+
+LDFLAGS += -pthread
+
+SRCS = $(wildcard *.cpp)
+ifeq ($(SRCS),) # workaround wildcard function bug in GNU Make 3.77
+SRCS = $(shell echo *.cpp)
+endif
+
+OBJS = $(SRCS:.cpp=.o)
+# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
+TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
+LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
+
+DLLSRCS = algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp cryptlib.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
+DLLOBJS = $(DLLSRCS:.cpp=.export.o)
+LIBIMPORTOBJS = $(LIBOBJS:.o=.import.o)
+TESTIMPORTOBJS = $(TESTOBJS:.o=.import.o)
+DLLTESTOBJS = dlltest.dllonly.o
+
+all: cryptest.exe
+
+test: cryptest.exe
+ ./cryptest.exe v
+
+clean:
+ $(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
+
+install:
+ $(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
+ $(CP) *.h $(PREFIX)/include/cryptopp
+ $(CP) *.a $(PREFIX)/lib
+ $(CP) *.so $(PREFIX)/lib
+ $(CP) *.exe $(PREFIX)/bin
+
+libcryptopp.a: $(LIBOBJS)
+ $(AR) $(ARFLAGS) $@ $(LIBOBJS)
+ $(RANLIB) $@
+
+libcryptopp.so: $(LIBOBJS)
+ $(CXX) -shared -o $@ $(LIBOBJS)
+
+cryptest.exe: libcryptopp.a $(TESTOBJS)
+ $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) -L. -lcryptopp $(LDFLAGS) $(LDLIBS)
+
+nolib: $(OBJS) # makes it faster to test changes
+ $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
+
+dll: cryptest.import.exe dlltest.exe
+
+cryptopp.dll: $(DLLOBJS)
+ $(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
+
+libcryptopp.import.a: $(LIBIMPORTOBJS)
+ $(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
+ $(RANLIB) $@
+
+cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
+ $(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
+
+dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
+ $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
+
+adhoc.cpp: adhoc.cpp.proto
+ifeq ($(wildcard adhoc.cpp),)
+ cp adhoc.cpp.proto adhoc.cpp
+else
+ touch adhoc.cpp
+endif
+
+%.dllonly.o : %.cpp
+ $(CXX) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c $< -o $@
+
+%.import.o : %.cpp
+ $(CXX) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c $< -o $@
+
+%.export.o : %.cpp
+ $(CXX) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c $< -o $@
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) -c $<
diff --git a/extra/crypto++/PKGBUILD b/extra/crypto++/PKGBUILD
index 8cebe45ec..aefbae61b 100644
--- a/extra/crypto++/PKGBUILD
+++ b/extra/crypto++/PKGBUILD
@@ -10,16 +10,18 @@ pkgver=5.6.1
_srcver=561
pkgrel=4
pkgdesc="A free C++ class library of cryptographic schemes"
-arch=('i686' 'x86_64')
+arch=('i686' 'x86_64' 'mips64el')
url="http://www.cryptopp.com/"
license=('custom')
depends=('gcc-libs')
makedepends=('unzip')
source=("http://www.cryptopp.com/cryptopp${_srcver}.zip"
'libcrypto++.pc'
+ 'GNUmakefile.parabola'
'gcc4.7.patch')
md5sums=('96cbeba0907562b077e26bcffb483828'
'2337c6edbc552d9142cae8e0854715e7'
+ 'c95b2134a8c0a35b173ede32001870d2'
'cf26a783d9432e7f9ab7f14d3db3f196')
build() {
@@ -28,9 +30,10 @@ build() {
# Fix gcc 4.7 build
patch -Np1 -i "${srcdir}/gcc4.7.patch"
- sed -i -e 's/^CXXFLAGS/#CXXFLAGS/' GNUmakefile
- export CXXFLAGS="${CXXFLAGS} -DNDEBUG -fPIC"
- make -f GNUmakefile
+ # The upstream build system expects this file to be modified
+ # to e.g. use system CFLAGS or use features of modern linkers.
+ cp "${srcdir}/GNUmakefile.parabola" GNUmakefile
+ make -f GNUmakefile
make libcryptopp.so
}