diff options
-rwxr-xr-x | configure | 5 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | pow/Makefile.in | 29 | ||||
-rw-r--r-- | pow/README | 50 | ||||
-rw-r--r-- | pow/build.py | 53 | ||||
-rw-r--r-- | rpkid/Makefile.in | 18 | ||||
-rw-r--r-- | rpkid/ext/POW.c (renamed from pow/POW.c) | 0 | ||||
-rw-r--r-- | rpkid/setup.py | 46 |
8 files changed, 66 insertions, 139 deletions
@@ -4084,7 +4084,7 @@ fi test $build_openssl = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS openssl" TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS rcynic utils" test $build_pywrap = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS pywrap" -test $build_python = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS pow rpkid" +test $build_python = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS rpkid" @@ -4147,7 +4147,7 @@ fi if test $build_python = yes then - ac_config_files="$ac_config_files pow/Makefile rpkid/Makefile rpkid/tests/Makefile" + ac_config_files="$ac_config_files rpkid/Makefile rpkid/tests/Makefile" # These are plain Python scripts, do not require pywrap @@ -4905,7 +4905,6 @@ do "utils/uri/Makefile") CONFIG_FILES="$CONFIG_FILES utils/uri/Makefile" ;; "openssl/Makefile") CONFIG_FILES="$CONFIG_FILES openssl/Makefile" ;; "pywrap/Makefile") CONFIG_FILES="$CONFIG_FILES pywrap/Makefile" ;; - "pow/Makefile") CONFIG_FILES="$CONFIG_FILES pow/Makefile" ;; "rpkid/Makefile") CONFIG_FILES="$CONFIG_FILES rpkid/Makefile" ;; "rpkid/tests/Makefile") CONFIG_FILES="$CONFIG_FILES rpkid/tests/Makefile" ;; "rpkid/backup-sql") CONFIG_FILES="$CONFIG_FILES rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py" ;; diff --git a/configure.ac b/configure.ac index bdc7c564..05a2c43f 100644 --- a/configure.ac +++ b/configure.ac @@ -217,7 +217,7 @@ fi test $build_openssl = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS openssl" TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS rcynic utils" test $build_pywrap = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS pywrap" -test $build_python = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS pow rpkid" +test $build_python = yes && TOP_LEVEL_SUBDIRS="$TOP_LEVEL_SUBDIRS rpkid" AC_SUBST(TOP_LEVEL_SUBDIRS) @@ -282,7 +282,7 @@ AC_SUBST(OPENSSL_SHARED_LIBRARY_DIR) if test $build_python = yes then - AC_CONFIG_FILES([pow/Makefile rpkid/Makefile rpkid/tests/Makefile]) + AC_CONFIG_FILES([rpkid/Makefile rpkid/tests/Makefile]) # These are plain Python scripts, do not require pywrap AC_CONFIG_FILES([rpkid/backup-sql:buildtools/python-header:rpkid/backup-sql.py], [chmod +x rpkid/backup-sql]) diff --git a/pow/Makefile.in b/pow/Makefile.in deleted file mode 100644 index d120b037..00000000 --- a/pow/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -# $Id$ - -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -PYTHON = @PYTHON@ - -abs_top_srcdir = @abs_top_srcdir@ -abs_top_builddir = @abs_top_builddir@ - -TARGET = ../rpkid/rpki/POW/_POW.so - -all: ${TARGET} - -${TARGET}: POW.c - AC_CFLAGS='${CFLAGS}' AC_LDFLAGS='${LDFLAGS}' AC_LIBS='${LIBS}' ${PYTHON} build.py - rm -f *.o - -clean: - rm -f *.o ${TARGET} - -install: - @echo Not attempting to install modified POW, if you want that, do it yourself - -test: - @true - -distclean: clean - rm -f Makefile diff --git a/pow/README b/pow/README deleted file mode 100644 index f234489e..00000000 --- a/pow/README +++ /dev/null @@ -1,50 +0,0 @@ -$Id$ - -This is a hacked version of the Python OpenSSL Wrappers (POW) package. -At some point I'll package up the changes and send them to the package -maintainer (if I can find him), but I want my changes under version -control while I'm hacking. - -POW is a nice package, although it appears not to have gotten much -attention recently. It's really two separate packages, one of which -uses a few facilities from the other: - -- POW itself is a Python extension module linked against OpenSSL. - This (or some equivilent package like M2Crypto) is necessary if one - wants to use the various crypto algorithms. - -- POW.pkix is a pure-Python module that builds on the base POW module - to support X509v3 extensions. This, to me, is the most interesting - thing about POW: it's the only X.509 package for Python I've seen - that has a reasonably complete mapping of X.509v3 into native Python - datatypes (M2Crypto, by comparision, only supports the text - representations provided by the extension drivers in the OpenSSL - libraries -- POW supports those too, but they're not as useful). - -=== - -At present the POW extension module does not build cleanly on 64-bit -Intel-based systems using the GNU tool chain (eg, Linux on 64-bit -hardware) due to a problem in the compilation tool chain. The details -are obscure and nasty, but the short version is that the 32-bit tool -chain supports building a .so file with static (.a) library as one of -the inputs, while the 64-bit tool chain does not; this problem is -compounded by a combination of the baroque OpenSSL build system and -the highly automated Python extension module build system. - -The (vile, temporary) workaround is to build everything with shared -libraries instead of static libraries and install a 3779-enabled set -of OpenSSL shared libraries in the system library directory so that -the Python extension module can find them. This is (sort of) ok if -you don't mind having the 3779-enabled OpenSSL libraries installed, -but as this code was intended to be self-contained without whacky -dependencies like this, it's not what I would wish. - -There is probably some set of kludges we can insert into the build -process (eg, a "ld -r" hack) to work around this, but we haven't taken -the time to figure out what it is yet. - -The test for whether your system has this problem is simple: try -running "make" in the top-level directory. If it blows up trying to -build the POW extension module, you have this problem; if nothing -obviously bad happens, you're (probably) ok. diff --git a/pow/build.py b/pow/build.py deleted file mode 100644 index 87f99db9..00000000 --- a/pow/build.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Hack to build our Python extension module. - -In a sane world, we'd just use the excellent distutils package, which -would do all the work for us. But we have this little problem of -sometimes needing to use a private copy of the OpenSSL libraries to -kludge around obsolete system libraries, and a further problem that -GNU ld has bizzare issues with linking static libraries into shared -objects on 64-bit platforms. - -In the long term, this problem will go away, when everybody updates to -a reasonable version of OpenSSL with CMS and RFC 3779 support enabled. -When that happens, this whackiness should be replaced by a normal -setup.py using distutils. - -In the meantime, we pull config information from distutils, but do the -build ourselves. - -This is a minimal hack to get the job done, and probably a bit -fragile. Much of the code is taken from python-config and the -distutils.sysconfig.customize_compiler. If there's any real -documentation on how to do this sort of thing, I have not found it -yet. YMMV. Beware Of Dog. - -$Id$ -""" - -import os, subprocess, sys - -from distutils.sysconfig import (get_config_var as getvar, - get_python_inc as getinc) - -cmd = getvar("CC").split() -cmd.extend(("-c", "-o", "POW.o", "POW.c")) -cmd.extend(os.environ["AC_CFLAGS"].split()) -cmd.append("-I%s" % getinc(plat_specific = False)) -cmd.append("-I%s" % getinc(plat_specific = True)) -cmd.extend(getvar("CFLAGS").split()) -cmd.extend(getvar("CCSHARED").split()) -print " ".join(cmd) -r = subprocess.call(cmd) -if r: - sys.exit(r) - -cmd = getvar("LDSHARED").split() -cmd.extend(("-o", "../rpkid/rpki/POW/_POW.so", "POW.o")) -cmd.extend(os.environ["AC_LDFLAGS"].split()) -cmd.extend(getvar("LDFLAGS").split()) -cmd.extend(os.environ["AC_LIBS"].split()) -print " ".join(cmd) -r = subprocess.call(cmd) -if r: - sys.exit(r) diff --git a/rpkid/Makefile.in b/rpkid/Makefile.in index 674cf49c..6a087ba5 100644 --- a/rpkid/Makefile.in +++ b/rpkid/Makefile.in @@ -2,9 +2,23 @@ PYTHON = @PYTHON@ PYWRAP_CMD = @PYWRAP_CMD@ + +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ + +abs_top_srcdir = @abs_top_srcdir@ abs_top_builddir = @abs_top_builddir@ -all: rpki/relaxng.py myrpki.rng +SETUP_PY = AC_CFLAGS='${CFLAGS}' AC_LDFLAGS='${LDFLAGS}' AC_LIBS='${LIBS}' ${PYTHON} setup.py + +all: rpki/pow/_POW.so rpki/relaxng.py myrpki.rng + +rpki/pow/_POW.so: ext/POW.c setup.py + ${SETUP_PY} build_ext --inplace + +clean:: + rm -f rpki/pow/_POW.so rpki/relaxng.py: ../scripts/make-relaxng.py left-right-schema.rng up-down-schema.rng publication-schema.rng ${PYTHON} ../scripts/make-relaxng.py >$@.tmp @@ -22,7 +36,7 @@ publication-schema.rng: publication-schema.rnc myrpki.rng: myrpki.rnc trang myrpki.rnc myrpki.rng -clean: +clean:: find . -type f -name '*.pyc' -delete cd tests; $(MAKE) $@ diff --git a/pow/POW.c b/rpkid/ext/POW.c index 666a8919..666a8919 100644 --- a/pow/POW.c +++ b/rpkid/ext/POW.c diff --git a/rpkid/setup.py b/rpkid/setup.py new file mode 100644 index 00000000..7bf53be8 --- /dev/null +++ b/rpkid/setup.py @@ -0,0 +1,46 @@ +# $Id$ +# +# Copyright (C) 2011 Internet Systems Consortium ("ISC") +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +from distutils.core import setup, Extension +import os + +# We can't build POW without these settings, but allow them to be null +# so that things like "python setup.py --help" will work. + +ac_cflags = os.getenv("AC_CFLAGS", "").split() +ac_ldflags = os.getenv("AC_LDFLAGS", "").split() +ac_libs = os.getenv("AC_LIBS", "").split() + +# Non-standard extension build specification: we need to force +# whatever build options our top-level ./configure selected, and we +# have to specify our libraries as extra_link_args because they may be +# complete pathnames to .a files elsewhere in the build tree. Most of +# this insanity is to kludge around pre-existing OpenSSL libraries +# that would screw up our build without these gymnastics. + +pow = Extension("rpki.POW._POW", ["ext/POW.c"], + extra_compile_args = ac_cflags, + extra_link_args = ac_ldflags + ac_libs) + +setup(name = "rpkitoolkit", + version = "1.0", + description = "RPKI Toolkit", + license = "BSD", + url = "http://www.rpki.net/", + packages = ["rpki"], + ext_modules = [pow]) + +# Probably add other stuff here: scripts, data files, and so forth. |