diff --git a/configure.ac b/configure.ac index d699f2c7..5f626dbd 100644 --- a/configure.ac +++ b/configure.ac @@ -322,6 +322,10 @@ fi AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test "x${enable_python_bindings}" = "xyes"]) +# Produce cython conditional, so that we can distribute generated C +# source +AM_CONDITIONAL([HAVE_CYTHON], [test "x${CYTHON}" != "x"]) + # failmalloc tests AM_CONDITIONAL([ENABLE_FAILMALLOC], [ test "x${enable_failmalloc}" = "xyes" ]) @@ -406,6 +410,7 @@ AC_CONFIG_FILES([ src/Makefile examples/Makefile python/Makefile + python/setup.py doc/Makefile doc/conf.py doc/index.rst diff --git a/python/Makefile.am b/python/Makefile.am index 56a1328f..6c32e3c6 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -21,27 +21,30 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -EXTRA_DIST = cnghttp2.pxd setup.py +EXTRA_DIST = cnghttp2.pxd nghttp2.pyx setup.py + +# Generate nghttp2.c only if we have cython installed +if HAVE_CYTHON + +EXTRA_DIST += nghttp2.c + +endif # HAVE_CYTHON if ENABLE_PYTHON_BINDINGS -distclean-local: - -rm -f nghttp2.c +all-local: nghttp2.c + $(PYTHON) setup.py build + +install-exec-local: + $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) + +uninstall-local: + rm -rf $(DESTDIR)$(libdir)/python*/site-packages/*nghttp2* + +clean-local: + $(PYTHON) setup.py clean --all .pyx.c: $(CYTHON) -o $@ $< -pyexec_LTLIBRARIES = nghttp2.la -nghttp2_la_SOURCES = nghttp2.pyx -nghttp2_la_CPPFLAGS = \ - $(PYTHON_CPPFLAGS) \ - -fno-strict-aliasing \ - -I$(top_srcdir)/lib/includes \ - -I$(top_builddir)/lib/includes \ - -I$(top_srcdir)/lib -nghttp2_la_LDFLAGS = \ - $(PYTHON_LDFLAGS) \ - -avoid-version -module -nghttp2_la_LIBADD = $(top_builddir)/lib/libnghttp2.la - endif # ENABLE_PYTHON_BINDINGS diff --git a/python/setup.py b/python/setup.py.in similarity index 85% rename from python/setup.py rename to python/setup.py.in index 8370282e..75b43cd3 100644 --- a/python/setup.py +++ b/python/setup.py.in @@ -32,6 +32,10 @@ setup( keywords = [], ext_modules = [Extension("nghttp2", ["nghttp2.c"], + include_dirs=['@top_srcdir@/lib', + '@top_srcdir@/lib/includes', + '@top_builddir@/lib/includes'], + library_dirs=['@top_builddir@/lib/.libs'], libraries=['nghttp2'])], long_description='TBD' )