Blame SConstruct

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