summaryrefslogtreecommitdiff
path: root/lib/libfdt/setup.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-04 11:58:11 -0600
committerSimon Glass <sjg@chromium.org>2016-07-14 20:40:24 -0600
commit76bce10d2131938fcd5b1bbb0479cdb66daffa29 (patch)
treeedc401884865e52492e540588a87ffaec83489e5 /lib/libfdt/setup.py
parentdbbe2e6401fc8539f456cab7ef1dd38f9495591d (diff)
downloadu-boot-imx-76bce10d2131938fcd5b1bbb0479cdb66daffa29.zip
u-boot-imx-76bce10d2131938fcd5b1bbb0479cdb66daffa29.tar.gz
u-boot-imx-76bce10d2131938fcd5b1bbb0479cdb66daffa29.tar.bz2
dm: Add a more efficient libfdt library
Add a Python version of the libfdt library which contains enough features to support the dtoc tool. This is only a very bare-bones implementation. It requires the 'swig' to build. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/libfdt/setup.py')
-rw-r--r--lib/libfdt/setup.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/libfdt/setup.py b/lib/libfdt/setup.py
new file mode 100644
index 0000000..62e7bcc
--- /dev/null
+++ b/lib/libfdt/setup.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+"""
+setup.py file for SWIG libfdt
+"""
+
+from distutils.core import setup, Extension
+import os
+import sys
+
+# Don't cross-compile - always use the host compiler.
+del os.environ['CROSS_COMPILE']
+del os.environ['CC']
+
+progname = sys.argv[0]
+cflags = sys.argv[1]
+files = sys.argv[2:]
+
+if cflags:
+ cflags = [flag for flag in cflags.split(' ') if flag]
+else:
+ cflags = None
+
+libfdt_module = Extension(
+ '_libfdt',
+ sources = files,
+ extra_compile_args = cflags
+)
+
+sys.argv = [progname, '--quiet', 'build_ext', '--inplace']
+
+setup (name = 'libfdt',
+ version = '0.1',
+ author = "SWIG Docs",
+ description = """Simple swig libfdt from docs""",
+ ext_modules = [libfdt_module],
+ py_modules = ["libfdt"],
+ )