miniupnpc:py: build libminiupnpc.a

This commit is contained in:
Dmytro Milinevskyy 2017-07-18 13:00:28 +02:00
parent d13f840a4a
commit ae0c3489bf
1 changed files with 14 additions and 10 deletions

View File

@ -5,15 +5,18 @@
# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
# #
# python script to build the miniupnpc module under unix # python script to build the miniupnpc module under unix
#
# replace libminiupnpc.a by libminiupnpc.so for shared library usage from setuptools import setup, Extension
try: from setuptools.command import build_ext
from setuptools import setup, Extension import subprocess
except ImportError:
from distutils.core import setup, Extension EXT = ['libminiupnpc.a']
from distutils import sysconfig
sysconfig.get_config_vars()["OPT"] = '' class make_then_build_ext(build_ext.build_ext):
sysconfig.get_config_vars()["CFLAGS"] = '' def run(self):
subprocess.check_call(['make'] + EXT)
build_ext.build_ext.run(self)
setup(name="miniupnpc", setup(name="miniupnpc",
version=open('VERSION').read().strip(), version=open('VERSION').read().strip(),
author='Thomas BERNARD', author='Thomas BERNARD',
@ -21,8 +24,9 @@ setup(name="miniupnpc",
license=open('LICENSE').read(), license=open('LICENSE').read(),
url='http://miniupnp.free.fr/', url='http://miniupnp.free.fr/',
description='miniUPnP client', description='miniUPnP client',
cmdclass={'build_ext': make_then_build_ext},
ext_modules=[ ext_modules=[
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
extra_objects=["libminiupnpc.a"]) extra_objects=EXT)
]) ])