pylibfdt: Simpler CFLAGS handling
At the moment we have some fiddly code to either pass in make's CPPFLAGS to setup.py, or have setup.py extract them from the Makefile. But really the only thing we need from here is the include paths. We already know what include paths we need (libfdt/) so we can just set that directly in setup.py. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Simon Glass <sjg@chromium.org>main
parent
47cafbeeb9
commit
855b9963de
|
@ -5,7 +5,7 @@ PYLIBFDT_srcs = $(PYLIBFDT_srcdir)/libfdt.i
|
||||||
PYMODULE = $(PYLIBFDT_objdir)/_libfdt.so
|
PYMODULE = $(PYLIBFDT_objdir)/_libfdt.so
|
||||||
|
|
||||||
define run_setup
|
define run_setup
|
||||||
CPPFLAGS="$(CPPFLAGS)" VERSION="$(dtc_version)"
|
VERSION="$(dtc_version)"
|
||||||
$(PYLIBFDT_objdir)/setup.py --quiet $(1)
|
$(PYLIBFDT_objdir)/setup.py --quiet $(1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ setup.py file for SWIG libfdt
|
||||||
Copyright (C) 2017 Google, Inc.
|
Copyright (C) 2017 Google, Inc.
|
||||||
Written by Simon Glass <sjg@chromium.org>
|
Written by Simon Glass <sjg@chromium.org>
|
||||||
|
|
||||||
C flags to use are provided in CPPFLAGS
|
|
||||||
Version is provided in VERSION
|
Version is provided in VERSION
|
||||||
|
|
||||||
If these variables are not given they are parsed from the Makefiles. This
|
If these variables are not given they are parsed from the Makefiles. This
|
||||||
|
@ -75,26 +74,24 @@ def GetEnvFromMakefiles():
|
||||||
makevars = ParseMakefile(os.path.join(basedir, 'Makefile'))
|
makevars = ParseMakefile(os.path.join(basedir, 'Makefile'))
|
||||||
version = '%s.%s.%s' % (makevars['VERSION'], makevars['PATCHLEVEL'],
|
version = '%s.%s.%s' % (makevars['VERSION'], makevars['PATCHLEVEL'],
|
||||||
makevars['SUBLEVEL'])
|
makevars['SUBLEVEL'])
|
||||||
cflags = ['-I%s/libfdt' % basedir]
|
return version
|
||||||
return version, cflags
|
|
||||||
|
|
||||||
|
|
||||||
progname = sys.argv[0]
|
progname = sys.argv[0]
|
||||||
cflags = os.environ.get('CPPFLAGS', '').split()
|
|
||||||
version = os.environ.get('VERSION')
|
version = os.environ.get('VERSION')
|
||||||
|
|
||||||
# If we were called directly rather than through our Makefile (which is often
|
# If we were called directly rather than through our Makefile (which is often
|
||||||
# the case with Python module installation), read the settings from the
|
# the case with Python module installation), read the settings from the
|
||||||
# Makefile.
|
# Makefile.
|
||||||
if not all((version, cflags)):
|
if not version:
|
||||||
version, cflags= GetEnvFromMakefiles()
|
version = GetEnvFromMakefiles()
|
||||||
|
|
||||||
libfdt_module = Extension(
|
libfdt_module = Extension(
|
||||||
'_libfdt',
|
'_libfdt',
|
||||||
sources = ['pylibfdt/libfdt.i'],
|
sources = ['pylibfdt/libfdt.i'],
|
||||||
|
include_dirs = ['libfdt'],
|
||||||
libraries = ['fdt'],
|
libraries = ['fdt'],
|
||||||
library_dirs = ['libfdt'],
|
library_dirs = ['libfdt'],
|
||||||
extra_compile_args = cflags,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
Loading…
Reference in New Issue