py: build libnatpmp.a

This commit is contained in:
Dmytro Milinevskyy 2017-07-18 13:03:01 +02:00
parent 16434170ca
commit 14f1225ef6
1 changed files with 14 additions and 7 deletions

View File

@ -2,16 +2,23 @@
# $Id: setup.py,v 1.3 2012/03/05 04:54:01 nanard Exp $
#
# python script to build the libnatpmp module under unix
#
# replace libnatpmp.a by libnatpmp.so for shared library usage
from distutils.core import setup, Extension
from distutils import sysconfig
sysconfig.get_config_vars()["OPT"] = ''
sysconfig.get_config_vars()["CFLAGS"] = ''
from setuptools import setup, Extension
from setuptools.command import build_ext
import subprocess
EXT = ['libnatpmp.a']
class make_then_build_ext(build_ext.build_ext):
def run(self):
subprocess.check_call(['make'] + EXT)
build_ext.build_ext.run(self)
setup(name="libnatpmp", version="1.0",
cmdclass={'build_ext': make_then_build_ext},
ext_modules=[
Extension(name="libnatpmp", sources=["libnatpmpmodule.c"],
extra_objects=["libnatpmp.a"],
extra_objects=EXT,
define_macros=[('ENABLE_STRNATPMPERR', None)]
)]
)