knitti <[EMAIL PROTECTED]> wrote:
> perhaps someone can give me a pointer with my
> following problem:
> I try to use the _fastmath (which needs gmp) module
> in py-crypto. I'm able to build it by including the following
> in PCTBuildExt.build_extensions() in setup.py:
>
> Extension("Crypto.PublicKey._fastmath",
> include_dirs=['src/', '/usr/local/include'],
> sources=["src/_fastmath.c"]),
Following diff enables _fastmath module. OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/security/py-crypto/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile 27 Nov 2005 15:20:42 -0000 1.4
+++ Makefile 22 Jan 2006 12:48:48 -0000
@@ -6,7 +6,7 @@
VERSION= 2.0.1
DISTNAME= pycrypto-${VERSION}
-PKGNAME= py-crypto-${VERSION}
+PKGNAME= py-crypto-${VERSION}p0
CATEGORIES= security devel
HOMEPAGE= http://www.amk.ca/python/code/crypto.html
@@ -22,8 +22,12 @@
MASTER_SITES= http://www.amk.ca/files/python/crypto/
MODULES= lang/python
+LIB_DEPENDS= gmp.6::devel/gmp
DOCSDIR= ${PREFIX}/share/doc/py-crypto
+
+pre-build:
+ perl -pi -e 's,!!LOCALBASE!!,${LOCALBASE},g' ${WRKSRC}/setup.py
post-install:
${INSTALL_DATA_DIR} ${DOCSDIR}
Index: patches/patch-setup_py
===================================================================
RCS file: /cvs/ports/security/py-crypto/patches/patch-setup_py,v
retrieving revision 1.1
diff -u -r1.1 patch-setup_py
--- patches/patch-setup_py 28 May 2005 05:39:45 -0000 1.1
+++ patches/patch-setup_py 22 Jan 2006 12:48:48 -0000
@@ -51,6 +51,26 @@
# Stream ciphers
Extension("Crypto.Cipher.ARC4",
+@@ -116,14 +122,12 @@ class PCTBuildExt (build_ext):
+ build_ext.build_extensions(self)
+
+ def detect_modules (self):
+- lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib']
+- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+ exts = []
+- if (self.compiler.find_library_file(lib_dirs, 'gmp')):
+- exts.append(Extension("Crypto.PublicKey._fastmath",
+- include_dirs=['src/'],
+- libraries=['gmp'],
+- sources=["src/_fastmath.c"]))
++ exts.append(Extension("Crypto.PublicKey._fastmath",
++ include_dirs=['src/', '!!LOCALBASE!!/include'],
++ library_dirs=['!!LOCALBASE!!/lib'],
++ libraries=['gmp'],
++ sources=["src/_fastmath.c"]))
+ self.extensions += exts
+
+ kw = {'name':"pycrypto",
@@ -139,9 +142,9 @@ kw = {'name':"pycrypto",
'package_dir' : { "Crypto":"." },
# One module is defined here, because build_ext won't be
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/security/py-crypto/pkg/PLIST,v
retrieving revision 1.4
diff -u -r1.4 PLIST
--- pkg/PLIST 27 Nov 2005 15:20:42 -0000 1.4
+++ pkg/PLIST 22 Jan 2006 12:48:48 -0000
@@ -38,6 +38,7 @@
lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/RSA.pyc
lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/__init__.py
lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/__init__.pyc
+lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/_fastmath.so
lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/pubkey.py
lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/pubkey.pyc
lib/python${MODPY_VERSION}/site-packages/Crypto/PublicKey/qNEW.py