OSDN Git Service

Call exit instead of abort on unhandled errors
[android-x86/external-exfat.git] / SConstruct
index 97cbebb..e40a340 100644 (file)
@@ -2,7 +2,7 @@
 #      SConstruct (10.09.09)
 #      SConscript for all components.
 #
-#      Copyright (C) 2010-2012  Andrew Nayenko
+#      Copyright (C) 2010-2013  Andrew Nayenko
 #
 #      This program is free software: you can redistribute it and/or modify
 #      it under the terms of the GNU General Public License as published by
@@ -23,15 +23,21 @@ import platform
 import SCons
 
 env = Environment(**ARGUMENTS)
+for var in ['PATH', 'SYSROOT']:
+       if var in os.environ:
+               env['ENV'][var] = os.environ[var]
 
 destdir = env.get('DESTDIR', '/sbin');
-targets = []
 libs = ['exfat']
 libfuse = 'fuse'
 
 if not env.GetOption('clean'):
        conf = Configure(env)
 
+       if 'AR' in os.environ:
+               conf.env.Replace(AR = os.environ['AR'])
+       if 'RANLIB' in os.environ:
+               conf.env.Replace(RANLIB = os.environ['RANLIB'])
        if 'CC' in os.environ:
                conf.env.Replace(CC = os.environ['CC'])
        if 'CCFLAGS' in os.environ:
@@ -74,6 +80,19 @@ if not env.GetOption('clean'):
                conf.env.Append(CPPPATH = ['/usr/local/include'])
                conf.env.Append(LIBPATH = ['/usr/local/lib'])
 
+       if not conf.CheckCC():
+               print '''
+       A working C compiler is needed very much.
+'''
+               Exit(1)
+
+       if not conf.CheckTypeSize('off_t', '#include <sys/types.h>', 'C', 8):
+               print '''
+       The size of off_t type must be 64 bits. File systems larger than
+       2 GB will be corrupted with 32-bit off_t.
+'''
+               Exit(1)
+
        env = conf.Finish()
 
 
@@ -103,7 +122,6 @@ def program(pattern, output, alias, libs):
                                destdir + '/' + alias)
        else:
                Alias('install', Install(destdir, target))
-       targets.append(target)
 
 env.Library('libexfat/exfat', Glob('libexfat/*.c'))
 
@@ -112,5 +130,3 @@ program('dump/*.c', 'dump/dumpexfat', None, libs)
 program('fsck/*.c', 'fsck/exfatfsck', 'fsck.exfat', libs)
 program('mkfs/*.c', 'mkfs/mkexfatfs', 'mkfs.exfat', libs)
 program('label/*.c', 'label/exfatlabel', None, libs)
-
-Default(targets)