distutils being invoked from scons; ld is failing with 'libhammer.a: archive has no index, run ranlib to add one'

This commit is contained in:
Meredith L. Patterson 2013-11-26 19:09:27 -08:00
parent 1e0f3744f8
commit 53bc886e2f
2 changed files with 27 additions and 17 deletions

View file

@ -4,18 +4,20 @@ Import('env libhammer_shared testruns')
pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0) pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
pythonenv.Append(CPPPATH = ['../../']) #pythonenv.Append(CPPPATH = ['../../'])
pythonenv.Append(CCFLAGS = ['-fpic', '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error']) #pythonenv.Append(CCFLAGS = ['-fpic', '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error'])
pythonenv.ParseConfig("pkg-config --cflags python") #pythonenv.ParseConfig("pkg-config --cflags python")
pythonenv.Append(LIBS = ['hammer']) #pythonenv.Append(LIBS = ['hammer'])
pythonenv.Append(LIBPATH = ['../../']) #pythonenv.Append(LIBPATH = ['../../'])
pythonenv.Append(SWIGFLAGS = ['-DHAMMER_INTERNAL__NO_STDARG_H', '-Isrc/', '-python']) #pythonenv.Append(SWIGFLAGS = ['-DHAMMER_INTERNAL__NO_STDARG_H', '-Isrc/', '-python'])
pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE"))
swig = ['hammer.i']
libhammer_python = pythonenv.SharedLibrary('hammer', swig, SHLIBPREFIX='_') swig = pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE"))
setup = ['setup.py']
pydir = os.path.join(env['BUILD_BASE'], 'src/bindings/python')
#libhammer_python = pythonenv.SharedLibrary('hammer', swig, SHLIBPREFIX='_')
libhammer_python = pythonenv.Command(None, [swig, setup], 'python ' + os.path.join(pydir, 'setup.py') + ' build_ext --swig-opts="-outdir ' + pydir + ' -DHAMMER_INTERNAL__NO_STDARG_H -Isrc"')
Default(libhammer_python) Default(libhammer_python)
pytestenv = pythonenv.Clone() pytestenv = pythonenv.Clone()

View file

@ -3,20 +3,28 @@
""" """
setup.py for Hammer bindings setup.py for Hammer bindings
""" """
import os.path, sys
from distutils.core import setup, Extension from distutils.core import setup, Extension
setup(name="hammer", setup(name="hammer",
version="0.9.0", version="0.9.0",
author="Upstanding Hackers, LLC", author="Upstanding Hackers, LLC",
author_email="hammer@upstandinghackers.com",
url="https://github.com/UpstandingHackers/hammer",
description="""The Hammer parser combinator library""", description="""The Hammer parser combinator library""",
ext_modules=[Extension('_hammer', ['hammer.i'], ext_modules=[Extension('_hammer', [os.path.join(os.path.dirname(sys.argv[0]),
swig_opts=['-DHAMMER_INTERNAL__NO_STDARG_H', '-I../../'], 'hammer.i')],
# swig_opts is set by SConscript
define_macros=[('SWIG', None)], define_macros=[('SWIG', None)],
depends=['allocator.h',
'glue.h',
'hammer.h',
'internal.h',],
extra_compile_args=['-fPIC', extra_compile_args=['-fPIC',
'-std=gnu99',], '-std=gnu99',],
include_dirs=['../../'], include_dirs=['src'],
library_dirs=['../../'], library_dirs=['src'],
libraries=['hammer'],)], libraries=['hammer'],)],
py_modules=['hammer'], py_modules=['hammer'],
) )