From 58494668ef864db0ad6cd35eca62106cbbed0543 Mon Sep 17 00:00:00 2001 From: TC Wan Date: Wed, 22 Dec 2010 17:30:29 +0800 Subject: added libnxt as a dependent library Added libnxt as a dependent library instead of using system provided package. This is mainly due to the difficulty in getting libnxt installed using MacPorts. --- Host/libnxt-0.3/SConstruct | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Host/libnxt-0.3/SConstruct (limited to 'Host/libnxt-0.3/SConstruct') diff --git a/Host/libnxt-0.3/SConstruct b/Host/libnxt-0.3/SConstruct new file mode 100644 index 0000000..115d19e --- /dev/null +++ b/Host/libnxt-0.3/SConstruct @@ -0,0 +1,64 @@ +##### +# Note: For Macports, libusb-legacy need to be used? +# I can't get it to build with libusb-compat +#### + +import os +import os.path +from glob import glob + +############################################################### +# Utility functions. +############################################################### + +# Similar to env.WhereIs, but always searches os.environ. +def find_on_path(filename): + paths = os.environ.get('PATH') + if not paths: + return None + for p in paths.split(':'): + path = os.path.abspath(os.path.join(p, filename)) + if os.path.isfile(path): + return p + return None + +auto_libs = 'libusb-legacy' + +cmdname = 'pkg-config' +pkg_config_path = find_on_path(cmdname) + ('/%s' % cmdname) + +# Detect the system's endianness +from sys import byteorder +if byteorder == 'big': + endian = '_NXT_BIG_ENDIAN' +else: + endian = '_NXT_LITTLE_ENDIAN' + +BuildEnv = Environment(CCFLAGS=['-Wall', '-std=gnu99', + '-g', '-ggdb', '-D' + endian]) +if auto_libs: + cmdstr = '%s --cflags --libs ' % pkg_config_path + BuildEnv.ParseConfig(cmdstr + ' --cflags --libs ' + auto_libs) + +BuildEnv.Command('flash_routine.h', + 'flash_routine.h.base', + './make_flash_header.py') + +BuildEnv.Append(LIBPATH='.') +libnxt = Default(BuildEnv.Library('nxt', + [x for x in glob('*.c') + if not x.startswith('main_')], + LIBS='usb-legacy')) + +fwflash = Default(BuildEnv.Program('fwflash', 'main_fwflash.c', + LIBS=['usb-legacy', 'nxt'])) + +fwexec = Default(BuildEnv.Program('fwexec', 'main_fwexec.c', + LIBS=['usb-legacy', 'nxt'])) + +# the install target +#BuildEnv.Alias("install", BuildEnv.Install(os.path.join(os.environ['DESTDIR'], "lib"), libnxt)) +#BuildEnv.Alias("install", BuildEnv.Install(os.path.join(os.environ['DESTDIR'], "bin"), fwflash, fwexec)) +#BuildEnv.Command("uninstall", None, Delete(FindInstalledFiles())) + + -- cgit v1.2.3