SConstruct for libjpeg

libjpeg is created by the Independent JPEG Group. Get the library itself here. This is setup to use MinGW by default. If you want to use another compiler or OS you may need to play with it a bit, but not much.

Code

   1 import os
   2 
   3 env = Environment(ENV=os.environ)
   4 Tool('mingw')(env)
   5 env.Replace(CCFLAGS="-O2 -march=i686")
   6 
   7 opts = Variables('jpeg.conf')
   8 opts.Add(PathVariable('PREFIX', 'Directory to install under', 'c:/mingw'))
   9 opts.Update(env)
  10 opts.Save('jpeg.conf', env)
  11 
  12 Help(opts.GenerateHelpText(env))
  13 
  14 idir_prefix = '$PREFIX'
  15 idir_lib    = '$PREFIX/lib'
  16 idir_bin    = '$PREFIX/bin'
  17 idir_inc    = '$PREFIX/include'
  18 idir_data   = '$PREFIX/share'
  19 Export('env idir_prefix idir_lib idir_bin idir_inc idir_data')
  20 
  21 VariantDir('bin', 'obj', duplicate=0)
  22 VariantDir('lib', 'obj', duplicate=0)
  23 VariantDir('obj', '.', duplicate=0)
  24 
  25 Execute(Copy("jconfig.h", "jconfig.vc"))
  26 
  27 api = [
  28     "obj/jcapimin.c", # Application program interface: core routines for compression.
  29     "obj/jcapistd.c", # Application program interface: standard compression.
  30     "obj/jdapimin.c", # Application program interface: core routines for decompression.
  31     "obj/jdapistd.c", # Application program interface: standard decompression.
  32     "obj/jcomapi.c", # Application program interface routines common to compression and decompression.
  33     "obj/jcparam.c", # Compression parameter setting helper routines.
  34     "obj/jctrans.c", # API and library routines for transcoding compression.
  35     "obj/jdtrans.c", # API and library routines for transcoding decompression.
  36 ]
  37 
  38 compression = [
  39     "obj/jcinit.c", # Initialization: determines which other modules to use.
  40     "obj/jcmaster.c", # Master control: setup and inter-pass sequencing logic.
  41     "obj/jcmainct.c", # Main buffer controller (preprocessor => JPEG compressor).
  42     "obj/jcprepct.c", # Preprocessor buffer controller.
  43     "obj/jccoefct.c", # Buffer controller for DCT coefficient buffer.
  44     "obj/jccolor.c", # Color space conversion.
  45     "obj/jcsample.c", # Downsampling.
  46     "obj/jcdctmgr.c", # DCT manager (DCT implementation selection & control).
  47     "obj/jfdctint.c", # Forward DCT using slow-but-accurate integer method.
  48     "obj/jfdctfst.c", # Forward DCT using faster, less accurate integer method.
  49     "obj/jfdctflt.c", # Forward DCT using floating-point arithmetic.
  50     "obj/jchuff.c", # Huffman entropy coding for sequential JPEG.
  51     "obj/jcphuff.c", # Huffman entropy coding for progressive JPEG.
  52     "obj/jcmarker.c", # JPEG marker writing.
  53     "obj/jdatadst.c", # Data destination manager for stdio output.
  54 ]
  55 
  56 decompression = [
  57     "obj/jdmaster.c", # Master control: determines which other modules to use.
  58     "obj/jdinput.c", # Input controller: controls input processing modules.
  59     "obj/jdmainct.c", # Main buffer controller (JPEG decompressor => postprocessor).
  60     "obj/jdcoefct.c", # Buffer controller for DCT coefficient buffer.
  61     "obj/jdpostct.c", # Postprocessor buffer controller.
  62     "obj/jdmarker.c", # JPEG marker reading.
  63     "obj/jdhuff.c", # Huffman entropy decoding for sequential JPEG.
  64     "obj/jdphuff.c", # Huffman entropy decoding for progressive JPEG.
  65     "obj/jddctmgr.c", # IDCT manager (IDCT implementation selection & control).
  66     "obj/jidctint.c", # Inverse DCT using slow-but-accurate integer method.
  67     "obj/jidctfst.c", # Inverse DCT using faster, less accurate integer method.
  68     "obj/jidctflt.c", # Inverse DCT using floating-point arithmetic.
  69     "obj/jidctred.c", # Inverse DCTs with reduced-size outputs.
  70     "obj/jdsample.c", # Upsampling.
  71     "obj/jdcolor.c", # Color space conversion.
  72     "obj/jdmerge.c", # Merged upsampling/color conversion (faster, lower quality).
  73     "obj/jquant1.c", # One-pass color quantization using a fixed-spacing colormap.
  74     "obj/jquant2.c", # Two-pass color quantization using a custom-generated colormap. Also handles one-pass quantization to an externally given map.
  75     "obj/jdatasrc.c", # Data source manager for stdio input.
  76 ]
  77 
  78 support = [
  79     "obj/jerror.c", # Standard error handling routines (application replaceable).
  80     "obj/jmemmgr.c", # System-independent (more or less) memory management code.
  81     "obj/jutils.c", # Miscellaneous utility routines.
  82     "obj/jmemnobs.c", # "No backing store": assumes adequate virtual memory exists.
  83 ]
  84 
  85 libjpeg = env.StaticLibrary(target='lib/jpeg', source=api+compression+decompression+support)
  86 Default(libjpeg)
  87 
  88 cdjpeg = env.Object('obj/cdjpeg.c', LIBS=['jpeg'])
  89 rdswitch = env.Object('obj/rdswitch.c', LIBS=['jpeg'])
  90 
  91 cjpeg = env.Program(target='bin/cjpeg', 
  92                     source=['obj/cjpeg.c', cdjpeg, rdswitch, 
  93                             'obj/rdbmp.c', 'obj/rdgif.c', 'obj/rdppm.c', 'obj/rdrle.c', 'obj/rdtarga.c'],
  94                     LIBS=['jpeg'])
  95 
  96 djpeg = env.Program(target='bin/djpeg',
  97                     source=['obj/djpeg.c', cdjpeg, 'obj/rdcolmap.c',
  98                             'obj/wrbmp.c', 'obj/wrgif.c', 'obj/wrppm.c', 'obj/wrrle.c', 'obj/wrtarga.c'],
  99                     LIBS=['jpeg'])
 100 
 101 jpegtran = env.Program(target='bin/jpegtran',
 102                        source=['obj/jpegtran.c', cdjpeg, rdswitch, 'obj/transupp.c'],
 103                        LIBS=['jpeg'])
 104 
 105 rdjpgcom = env.Program('bin/rdjpgcom', ['obj/rdjpgcom.c'])
 106 wrjpgcom = env.Program('bin/wrjpgcom', ['obj/wrjpgcom.c'])
 107 
 108 env.Alias('install-lib', env.Install(idir_lib, libjpeg))
 109 env.Alias('install-inc', env.Install(idir_inc, ['jpeglib.h', 'jconfig.h', 'jmorecfg.h', 'jerror.h']))
 110 env.Alias('install-bin', env.Install(idir_bin, [cjpeg, djpeg, jpegtran, rdjpgcom, wrjpgcom]))
 111 env.Alias('install', ['install-lib', 'install-inc', 'install-bin'])

Discussion

KenBull/libjpeg (last edited 2008-12-24 07:19:15 by d38-58-133)