Blame SConstruct

Packit 7838c8
# $Id: SConstruct,v 1.4 2007/02/24 15:03:47 dron Exp $
Packit 7838c8
Packit 7838c8
# Tag Image File Format (TIFF) Software
Packit 7838c8
#
Packit 7838c8
# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
Packit 7838c8
#
Packit 7838c8
# Permission to use, copy, modify, distribute, and sell this software and 
Packit 7838c8
# its documentation for any purpose is hereby granted without fee, provided
Packit 7838c8
# that (i) the above copyright notices and this permission notice appear in
Packit 7838c8
# all copies of the software and related documentation, and (ii) the names of
Packit 7838c8
# Sam Leffler and Silicon Graphics may not be used in any advertising or
Packit 7838c8
# publicity relating to the software without the specific, prior written
Packit 7838c8
# permission of Sam Leffler and Silicon Graphics.
Packit 7838c8
# 
Packit 7838c8
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
Packit 7838c8
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
Packit 7838c8
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
Packit 7838c8
# 
Packit 7838c8
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
Packit 7838c8
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
Packit 7838c8
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit 7838c8
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
Packit 7838c8
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
Packit 7838c8
# OF THIS SOFTWARE.
Packit 7838c8
Packit 7838c8
# This file contains rules to build software with the SCons tool
Packit 7838c8
# (see the http://www.scons.org/ for details on SCons).
Packit 7838c8
Packit 7838c8
import os
Packit 7838c8
Packit 7838c8
env = Environment()
Packit 7838c8
Packit 7838c8
# Read the user supplied options
Packit 7838c8
opts = Options('libtiff.conf')
Packit 7838c8
opts.Add(PathOption('PREFIX', \
Packit 7838c8
    'install architecture-independent files in this directory', \
Packit 7838c8
    '/usr/local', PathOption.PathIsDirCreate))
Packit 7838c8
opts.Add(BoolOption('ccitt', \
Packit 7838c8
    'enable support for CCITT Group 3 & 4 algorithms', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('packbits', \
Packit 7838c8
    'enable support for Macintosh PackBits algorithm', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('lzw', \
Packit 7838c8
    'enable support for LZW algorithm', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('thunder', \
Packit 7838c8
    'enable support for ThunderScan 4-bit RLE algorithm', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('next', \
Packit 7838c8
    'enable support for NeXT 2-bit RLE algorithm', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('logluv', \
Packit 7838c8
    'enable support for LogLuv high dynamic range encoding', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('strip_chopping', \
Packit 7838c8
    'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('extrasample_as_alpha', \
Packit 7838c8
    'the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don\'t mark the alpha properly', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Add(BoolOption('check_ycbcr_subsampling', \
Packit 7838c8
    'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \
Packit 7838c8
    'yes'))
Packit 7838c8
opts.Update(env)
Packit 7838c8
opts.Save('libtiff.conf', env)
Packit 7838c8
Help(opts.GenerateHelpText(env))
Packit 7838c8
Packit 7838c8
# Here are our installation paths:
Packit 7838c8
idir_prefix = '$PREFIX'
Packit 7838c8
idir_lib = '$PREFIX/lib'
Packit 7838c8
idir_bin = '$PREFIX/bin'
Packit 7838c8
idir_inc = '$PREFIX/include'
Packit 7838c8
idir_doc = '$PREFIX/doc'
Packit 7838c8
Export([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])
Packit 7838c8
Packit 7838c8
# Now proceed to system feature checks
Packit 7838c8
target_cpu, target_vendor, target_kernel, target_os = \
Packit 7838c8
    os.popen("./config/config.guess").readlines()[0].split("-")
Packit 7838c8
Packit 7838c8
def Define(context, key, have):
Packit 7838c8
    import SCons.Conftest
Packit 7838c8
    SCons.Conftest._Have(context, key, have)
Packit 7838c8
Packit 7838c8
def CheckCustomOption(context, name):
Packit 7838c8
    context.Message('Checking is the ' + name + ' option set... ')
Packit 7838c8
    ret = env[name]
Packit 7838c8
    Define(context, name + '_SUPPORT', ret)
Packit 7838c8
    context.Result(ret)
Packit 7838c8
    return ret
Packit 7838c8
Packit 7838c8
def CheckFillorderOption(context):
Packit 7838c8
    context.Message('Checking for the native cpu bit order... ')
Packit 7838c8
    if target_cpu[0] == 'i' and target_cpu[2:] == '86':
Packit 7838c8
	Define(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')
Packit 7838c8
	context.Result('lsb2msb')
Packit 7838c8
    else:
Packit 7838c8
	Define(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')
Packit 7838c8
	context.Result('msb2lsb')
Packit 7838c8
    return 1
Packit 7838c8
Packit 7838c8
def CheckIEEEFPOption(context):
Packit 7838c8
    context.Message('Checking for the IEEE floating point format... ')
Packit 7838c8
    Define(context, 'HAVE_IEEEFP', 1)
Packit 7838c8
    context.Result(1)
Packit 7838c8
    return 1
Packit 7838c8
Packit 7838c8
def CheckOtherOption(context, name):
Packit 7838c8
    context.Message('Checking is the ' + name + ' option set... ')
Packit 7838c8
    ret = env[name]
Packit 7838c8
    Define(context, 'HAVE_' + name, ret)
Packit 7838c8
    context.Result(ret)
Packit 7838c8
    return ret
Packit 7838c8
Packit 7838c8
custom_tests = { \
Packit 7838c8
    'CheckCustomOption' : CheckCustomOption, \
Packit 7838c8
    'CheckFillorderOption' : CheckFillorderOption, \
Packit 7838c8
    'CheckIEEEFPOption' : CheckIEEEFPOption, \
Packit 7838c8
    'CheckOtherOption' : CheckOtherOption \
Packit 7838c8
    }
Packit 7838c8
conf = Configure(env, custom_tests = custom_tests, \
Packit 7838c8
    config_h = 'libtiff/tif_config.h')
Packit 7838c8
Packit 7838c8
# Check for standard library
Packit 7838c8
conf.CheckLib('c')
Packit 7838c8
if target_os != 'cygwin' \
Packit 7838c8
    and target_os != 'mingw32' \
Packit 7838c8
    and target_os != 'beos' \
Packit 7838c8
    and target_os != 'darwin':
Packit 7838c8
    conf.CheckLib('m')
Packit 7838c8
Packit 7838c8
# Check for system headers
Packit 7838c8
conf.CheckCHeader('assert.h')
Packit 7838c8
conf.CheckCHeader('fcntl.h')
Packit 7838c8
conf.CheckCHeader('io.h')
Packit 7838c8
conf.CheckCHeader('limits.h')
Packit 7838c8
conf.CheckCHeader('malloc.h')
Packit 7838c8
conf.CheckCHeader('search.h')
Packit 7838c8
conf.CheckCHeader('sys/time.h')
Packit 7838c8
conf.CheckCHeader('unistd.h')
Packit 7838c8
Packit 7838c8
# Check for standard library functions
Packit 7838c8
conf.CheckFunc('floor')
Packit 7838c8
conf.CheckFunc('isascii')
Packit 7838c8
conf.CheckFunc('memmove')
Packit 7838c8
conf.CheckFunc('memset')
Packit 7838c8
conf.CheckFunc('mmap')
Packit 7838c8
conf.CheckFunc('pow')
Packit 7838c8
conf.CheckFunc('setmode')
Packit 7838c8
conf.CheckFunc('sqrt')
Packit 7838c8
conf.CheckFunc('strchr')
Packit 7838c8
conf.CheckFunc('strrchr')
Packit 7838c8
conf.CheckFunc('strstr')
Packit 7838c8
conf.CheckFunc('strtol')
Packit 7838c8
Packit 7838c8
conf.CheckFillorderOption()
Packit 7838c8
conf.CheckIEEEFPOption()
Packit 7838c8
conf.CheckCustomOption('ccitt')
Packit 7838c8
conf.CheckCustomOption('packbits')
Packit 7838c8
conf.CheckCustomOption('lzw')
Packit 7838c8
conf.CheckCustomOption('thunder')
Packit 7838c8
conf.CheckCustomOption('next')
Packit 7838c8
conf.CheckCustomOption('logluv')
Packit 7838c8
conf.CheckOtherOption('strip_chopping')
Packit 7838c8
conf.CheckOtherOption('extrasample_as_alpha')
Packit 7838c8
conf.CheckOtherOption('check_ycbcr_subsampling')
Packit 7838c8
Packit 7838c8
env = conf.Finish()
Packit 7838c8
Packit 7838c8
# Ok, now go to build files in the subdirectories
Packit 7838c8
SConscript(dirs = [ 'libtiff' ], name = 'SConstruct')