| 2 | 
  | 
 | 
| 3 | 
  | 
Import('env') # inherit from parent | 
| 4 | 
  | 
 | 
| 5 | 
< | 
mlib = env['RAD_MLIB'] | 
| 5 | 
> | 
mlib = ['$RAD_MLIB'] | 
| 6 | 
> | 
progs = [] | 
| 7 | 
  | 
 | 
| 8 | 
  | 
# compose paths | 
| 9 | 
< | 
def radbin(name): return os.path.join(env['RAD_BUILDBIN'], name) | 
| 10 | 
< | 
def radlib(name): return os.path.join(env['RAD_BUILDLIB'], name) | 
| 9 | 
> | 
def radbin(name): return os.path.join('$RAD_BUILDBIN', name) | 
| 10 | 
> | 
def radlib(name): return os.path.join('$RAD_BUILDLIB', name) | 
| 11 | 
  | 
 | 
| 12 | 
  | 
warp3d = env.Object(source="warp3d.c") | 
| 13 | 
  | 
clrtab = env.Object(source="clrtab.c") | 
| 14 | 
  | 
neuclrtab = env.Object(source="neuclrtab.c") | 
| 14 | 
– | 
ciq = env.Object(source="ciq.c") | 
| 15 | 
– | 
cut = env.Object(source="cut.c") | 
| 16 | 
– | 
closest = env.Object(source="closest.c") | 
| 15 | 
  | 
 | 
| 16 | 
  | 
# standard targets | 
| 17 | 
  | 
PROGS = ( | 
| 18 | 
< | 
# name          files            libs | 
| 18 | 
> | 
# name       files            libs | 
| 19 | 
  | 
('macbethcal', Split('macbethcal.c pmapgen.c mx3.c')+[warp3d], | 
| 20 | 
< | 
        ['rtpic','rtproc','rtpath','rtio','rtargs','rtcont','rtmem','rterror']), | 
| 20 | 
> | 
        ['rtpic','rtproc','rtpath','rtargs','rtio','rtcont','rtmem','rterror']), | 
| 21 | 
  | 
('pcond',    Split('pcond.c pcond2.c pcond3.c pcond4.c')+[warp3d], | 
| 22 | 
< | 
        ['rtpic','rtproc','rtpath','rtio','rtargs','rtmath','rtcont','rtmem','rterror']), | 
| 22 | 
> | 
        ['rtpic','rtproc','rtpath','rtargs','rtio','rtmath','rtcont','rtmem','rterror']), | 
| 23 | 
  | 
('pfilt',    Split('pfilt.c pf2.c pf3.c'), | 
| 24 | 
< | 
        ['rtlamps','rtpic','rtio','rtpath','rtargs','rtmath']), | 
| 25 | 
< | 
('pcwarp',   ['pcwarp.c', warp3d], | 
| 24 | 
> | 
        ['rtlamps','rtpic','rtpath','rtargs','rtio','rtmath']), | 
| 25 | 
> | 
('pcwarp',   ['pcwarp.c', warp3d],        | 
| 26 | 
  | 
        ['rtpic','rtio','rtcont','rtmem','rterror']), | 
| 27 | 
< | 
('pvalue',   ['pvalue.c'],    ['rtpic','rtio','rtargs','rtmath']), | 
| 27 | 
> | 
('pvalue',   ['pvalue.c'],    ['rtpic','rtargs','rtio','rtmath']), | 
| 28 | 
  | 
('pcompos',  ['pcompos.c'],   ['rtpic','rtproc','rtpath','rtio','rterror']), | 
| 29 | 
  | 
('psign',    ['psign.c'], | 
| 30 | 
< | 
        ['rtpic','rtscene','rtio','rtpath','rtargs','rtcont','rtmem','rterror']), | 
| 30 | 
> | 
        ['rtpic','rtscene','rtpath','rtargs','rtio','rtcont','rtmem','rterror']), | 
| 31 | 
  | 
('protate',  ['protate.c'],   ['rtpic','rtio']), | 
| 32 | 
  | 
('pextrem',  ['pextrem.c'],   ['rtpic','rtio']), | 
| 33 | 
  | 
('pflip',    ['pflip.c'],     ['rtpic','rtio']), | 
| 34 | 
  | 
('pcomb',    ['pcomb.c'], | 
| 35 | 
< | 
        ['rtpic','rtproc','rtpath','rtio','rtfunc','rtargs','rtmath','rtcont','rtmem']), | 
| 35 | 
> | 
        ['rtpic','rtproc','rtpath','rtfunc','rtargs','rtio','rtmath','rtcont','rtmem']), | 
| 36 | 
  | 
('pinterp',  ['pinterp.c'], | 
| 37 | 
< | 
        ['rtproc','rtpic','rtio','rtpath','rtargs','rtmath','rtmem','rterror']), | 
| 37 | 
> | 
        ['rtproc','rtpic','rtpath','rtargs','rtio','rtmath','rtmem','rterror']), | 
| 38 | 
  | 
 | 
| 41 | 
– | 
('oki20c',   ['oki20c.c'],['rtpic','rtproc','rtpath','rtio','rtmem','rterror']), | 
| 42 | 
– | 
('oki20',    ['oki20.c'], ['rtpic','rtproc','rtpath','rtio','rtmem','rterror']), | 
| 43 | 
– | 
 | 
| 39 | 
  | 
('ra_gif',   ['ra_gif.c', clrtab, neuclrtab], ['rtpic','rtio','rtmem']), | 
| 40 | 
< | 
('ra_pr',    Split('ra_pr.c biq.c')+ [ciq, cut, closest], | 
| 46 | 
< | 
        ['rtpic','rtio','rtmem']), | 
| 47 | 
< | 
('ra_pr24',  ['ra_pr24.c'],   ['rtpic','rtio','rtmem']), | 
| 48 | 
< | 
('ra_avs',   ['ra_avs.c'],    ['rtpic','rtio','rtmem']), | 
| 49 | 
< | 
('ra_ps',    ['ra_ps.c'],     ['rtpic','rtio','rtargs','rtmem']), | 
| 40 | 
> | 
('ra_ps',    ['ra_ps.c'],     ['rtpic','rtargs','rtio','rtmem']), | 
| 41 | 
  | 
('ra_ppm',   ['ra_ppm.c'],    ['rtpic','rtio','rtmem']), | 
| 42 | 
+ | 
('ra_bmp',   ['ra_bmp.c'], | 
| 43 | 
+ | 
        ['rtpic','rtproc','rterror','rtpath','rtio','rtmem']), | 
| 44 | 
  | 
('ra_t8',    ['ra_t8.c', clrtab, neuclrtab], ['rtpic','rtio','rtmem']), | 
| 45 | 
  | 
('ra_t16',   ['ra_t16.c'],    ['rtpic','rtio','rtmem']), | 
| 53 | 
– | 
('ra_bn',    ['ra_bn.c'],     ['rtpic','rtio','rtmem']), | 
| 46 | 
  | 
('ra_rgbe', ['ra_rgbe.c'],['rtpic','rtproc','rtpath','rtio','rtmem','rterror']), | 
| 47 | 
  | 
('ra_pict',  ['ra_pict.c'],   ['rtpic','rtio','rtmem']), | 
| 48 | 
  | 
('ra_hexbit',['ra_hexbit.c'], ['rtpic','rtio','rtmem']), | 
| 49 | 
  | 
('ra_xyze',  ['ra_xyze.c'],   ['rtpic','rtio','rtmem']), | 
| 50 | 
+ | 
('pmblur2',  ['pmblur2.c'],   ['rtpic','rtargs','rtio','rtargs','rtmath','rtmem','rtcont','rterror',mlib]), | 
| 51 | 
  | 
 | 
| 52 | 
  | 
('ttyimage', ['ttyimage.c'],  ['rtpic','rtio','rtmem']), | 
| 53 | 
  | 
) | 
| 54 | 
  | 
for p in PROGS: | 
| 55 | 
  | 
    prog = env.Program(target=radbin(p[0]), source=p[1], | 
| 56 | 
< | 
                LIBS=p[2]+mlib) | 
| 57 | 
< | 
    Default(prog) | 
| 65 | 
< | 
    env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], prog)]) | 
| 56 | 
> | 
        LIBS=p[2]+mlib) | 
| 57 | 
> | 
    progs.append(prog) | 
| 58 | 
  | 
 | 
| 59 | 
  | 
 | 
| 60 | 
< | 
# special targets not normally built | 
| 61 | 
< | 
SPECIAL = ( | 
| 62 | 
< | 
# name          files             libs | 
| 63 | 
< | 
('psum',       ['psum.c'],       ['rtpic','rtio']), | 
| 64 | 
< | 
#('panim',      ['panim.c'],      ['client','rpcsvc']),# missing externals | 
| 60 | 
> | 
# tiff library (building it is unix-specific for the moment) | 
| 61 | 
> | 
#  If we haven't found one supporting LogLuv installed, build our own. | 
| 62 | 
> | 
libtiff_fn = radlib(env['LIBPREFIX'] + 'tiff' + env['LIBSUFFIX']) | 
| 63 | 
> | 
if os.name == 'posix' and not env.get('TIFFLIB_INSTALLED'): | 
| 64 | 
> | 
        cwd = os.getcwd() | 
| 65 | 
> | 
        upperdir = os.path.split(cwd)[0] | 
| 66 | 
> | 
        libtiff = env.Command(libtiff_fn, None, | 
| 67 | 
> | 
        [('cd "%(tiffdir)s"; ' | 
| 68 | 
> | 
                'env CC="$CC" ' | 
| 69 | 
> | 
                './configure -C ' | 
| 70 | 
> | 
                '"libdir=%(upperdir)s/lib" ' | 
| 71 | 
> | 
                '--enable-static --disable-shared --disable-cxx ' | 
| 72 | 
> | 
                '--enable-logluv --disable-jpeg --disable-zlib --disable-pixarlog; ' | 
| 73 | 
> | 
                'cd %(portdir)s; make all;' | 
| 74 | 
> | 
                'cd %(libtiffdir)s; make install-exec;' # don't install headers | 
| 75 | 
> | 
         ) % { | 
| 76 | 
> | 
        'upperdir':upperdir, | 
| 77 | 
> | 
        'tiffdir':os.path.join(cwd, 'tiff'), | 
| 78 | 
> | 
        'portdir':os.path.join(cwd, 'tiff', 'port'), | 
| 79 | 
> | 
        'libtiffdir':os.path.join(cwd, 'tiff', 'libtiff') | 
| 80 | 
> | 
        } | 
| 81 | 
> | 
        ]) | 
| 82 | 
  | 
 | 
| 83 | 
< | 
('ra_im',      ['ra_im.c'],      ['rtproc','rtpath','rtio','rterror']), | 
| 83 | 
> | 
        env['TIFFLIB_INSTALLED'] = 1 | 
| 84 | 
  | 
 | 
| 85 | 
< | 
#('aedimage',   Split('aedimage.c')+[ciq, cut, closest],[]),# missing externals | 
| 86 | 
< | 
('t4027',      ['t4027.c'],      ['rtpic']), | 
| 78 | 
< | 
('paintjet',   ['paintjet.c'],   ['rtpic','rtio','rtmem']), | 
| 79 | 
< | 
('mt160r',     ['mt160r.c'],     ['rtpic','rtio','rtmem']), | 
| 80 | 
< | 
('greyscale',  ['greyscale.c'],  ['rtpic']), | 
| 81 | 
< | 
('colorscale', ['colorscale.c'], ['rtpic']), | 
| 82 | 
< | 
('d48c',       ['d48c.c'],       ['rtpic']), | 
| 83 | 
< | 
) | 
| 84 | 
< | 
specprogs = [] | 
| 85 | 
< | 
specinst = [] | 
| 86 | 
< | 
for p in SPECIAL: | 
| 87 | 
< | 
        prog = env.Program(target=radbin(p[0]), source=p[1], LIBS=p[2]+mlib) | 
| 88 | 
< | 
        specprogs.append(prog) | 
| 89 | 
< | 
        specinst.append(env.Install(env['RAD_BINDIR'], prog)) | 
| 90 | 
< | 
env.Alias('px_special', specprogs) | 
| 91 | 
< | 
env.Alias('px_special_install', specinst) | 
| 85 | 
> | 
if os.name == 'posix': # cleanup action for a previously built tifflib | 
| 86 | 
> | 
        Clean(libtiff_fn, [libtiff_fn, radlib(env['LIBPREFIX'] + 'tiff.la')]) | 
| 87 | 
  | 
 | 
| 88 | 
< | 
 | 
| 94 | 
< | 
# tiff library (unix-specific for the moment) | 
| 95 | 
< | 
if os.name == 'posix': | 
| 96 | 
< | 
        cwd = os.getcwd() | 
| 97 | 
< | 
        libtiff = env.Command(radlib(env['LIBPREFIX'] + 'tiff' + env['LIBSUFFIX']), | 
| 98 | 
< | 
                'tiff/config.local', | 
| 99 | 
< | 
        [('cd "%s"; ' | 
| 100 | 
< | 
        'sh ./configure -quiet -noninteractive ' | 
| 101 | 
< | 
                '-with-CC="$CC" -with-ENVOPTS="$CCFLAGS"; ' | 
| 102 | 
< | 
        'cd libtiff; ' | 
| 103 | 
< | 
        'make install;') % os.path.join(cwd, 'tiff')]) | 
| 104 | 
< | 
 | 
| 88 | 
> | 
if env.get('TIFFLIB_INSTALLED'): | 
| 89 | 
  | 
        # tiff programs | 
| 90 | 
< | 
        ra_tiff = env.Program(target=radbin('ra_tiff'), source=Split('ra_tiff.c'), | 
| 90 | 
> | 
        tiffi = env.get('RAD_TIFFINCLUDE') | 
| 91 | 
> | 
        if tiffi: tiffincl = [tiffi] + env.get('CPPPATH', []) | 
| 92 | 
> | 
        else: tiffincl = env.get('CPPPATH', []) | 
| 93 | 
> | 
        tiffl = env.get('RAD_TIFFLIB') | 
| 94 | 
> | 
        if tiffl: tifflib = [tiffl] + env.get('LIBPATH', []) | 
| 95 | 
> | 
        else: tifflib = env.get('LIBPATH', []) | 
| 96 | 
> | 
 | 
| 97 | 
> | 
        ra_tiff = env.Program(target=radbin('ra_tiff'), source=['ra_tiff.c'], | 
| 98 | 
> | 
                CPPPATH = tiffincl, LIBPATH=tifflib, | 
| 99 | 
  | 
                LIBS=['tiff','rtpic','rtio','rtmem'] + mlib) | 
| 100 | 
< | 
        Default(ra_tiff) | 
| 109 | 
< | 
        env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], ra_tiff)]) | 
| 100 | 
> | 
        progs.append(ra_tiff) | 
| 101 | 
  | 
 | 
| 102 | 
< | 
        normtiff = env.Program(target=radbin('normtiff'), source=Split('normtiff.c'), | 
| 102 | 
> | 
        normtiff = env.Program(target=radbin('normtiff'),source=['normtiff.c'], | 
| 103 | 
> | 
                CPPPATH = tiffincl, LIBPATH=tifflib, | 
| 104 | 
  | 
                LIBS=['tiff','rtpic','rtio','rtmem'] + mlib) | 
| 105 | 
< | 
        Default(normtiff) | 
| 114 | 
< | 
        env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], normtiff)]) | 
| 105 | 
> | 
        progs.append(normtiff) | 
| 106 | 
  | 
 | 
| 107 | 
  | 
 | 
| 117 | 
– | 
# pixar format requires extra lib | 
| 118 | 
– | 
if env.has_key('PIXAR_LIB'): | 
| 119 | 
– | 
    ra_pixar = env.Program(radbin('ra_pixar'), source=['ra_pixar.c'], | 
| 120 | 
– | 
                LIBS=['rtpic', env['PIXAR_LIB']]) | 
| 121 | 
– | 
    Default(ra_pixar) | 
| 122 | 
– | 
    env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], ra_pixar)]) | 
| 123 | 
– | 
 | 
| 124 | 
– | 
 | 
| 108 | 
  | 
# X11 targets | 
| 109 | 
  | 
if env.has_key('X11LIB'): | 
| 110 | 
< | 
    xcppp = env.get('CPPPATH',[]) + [env['X11INCLUDE']] | 
| 111 | 
< | 
    xlibp = env.get('LIBPATH',[]) + [env['X11LIB']] | 
| 112 | 
< | 
    xlibs = ['X11','rtpic','rtio','rtmath','rtargs','rtmem'] | 
| 110 | 
> | 
        xincl = env.get('CPPPATH', []) + ['$X11INCLUDE'] | 
| 111 | 
> | 
        xlibp = env.get('LIBPATH', []) + ['$X11LIB'] | 
| 112 | 
> | 
        xlibs = ['X11','rtpic','rtargs','rtio','rtmath','rtmem'] | 
| 113 | 
> | 
        env.x11findwind = env.Object(source='../common/x11findwind.c', # XXX remote magic | 
| 114 | 
> | 
                CPPPATH=xincl) | 
| 115 | 
  | 
 | 
| 116 | 
< | 
    ximage = env.Program(target=radbin('ximage'), | 
| 117 | 
< | 
        source=Split('x11image.c x11raster.c')+[clrtab], | 
| 118 | 
< | 
        CPPPATH=xcppp, LIBPATH=xlibp, LIBS=xlibs + mlib) | 
| 119 | 
< | 
    Default(ximage) | 
| 135 | 
< | 
    env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], ximage)]) | 
| 116 | 
> | 
        ximage = env.Program(target=radbin('ximage'), | 
| 117 | 
> | 
                source=Split('x11image.c x11raster.c')+[clrtab], | 
| 118 | 
> | 
                CPPPATH=xincl, LIBPATH=xlibp, LIBS=xlibs + mlib) | 
| 119 | 
> | 
        progs.append(ximage) | 
| 120 | 
  | 
 | 
| 121 | 
< | 
    xshowtrace = env.Program(target=radbin('xshowtrace'), | 
| 122 | 
< | 
        source=Split('xshowtrace.c x11findwind.c'), | 
| 123 | 
< | 
        CPPPATH=xcppp, LIBPATH=xlibp, LIBS=xlibs + mlib) | 
| 124 | 
< | 
    Default(xshowtrace) | 
| 141 | 
< | 
    env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], xshowtrace)]) | 
| 121 | 
> | 
        xshowtrace = env.Program(target=radbin('xshowtrace'), | 
| 122 | 
> | 
                source=Split('xshowtrace.c') + [env.x11findwind], # XXX remote magic | 
| 123 | 
> | 
                CPPPATH=xincl, LIBPATH=xlibp, LIBS=xlibs + mlib) | 
| 124 | 
> | 
        progs.append(xshowtrace) | 
| 125 | 
  | 
 | 
| 126 | 
< | 
# NeWS ?!? | 
| 127 | 
< | 
#    if env.has_key('OGL'): | 
| 128 | 
< | 
#        glimage = env.Program(target=radbin('glimage'), | 
| 129 | 
< | 
#            CPPFLAGS=env.get('CPPFLAGS', []) + [env['RAD_STEREO']], | 
| 130 | 
< | 
#            source=Split('glimage.c'), | 
| 131 | 
< | 
#            LIBS=['gl_s']+env['LIBS'],) | 
| 132 | 
< | 
#        Default(glimage) | 
| 133 | 
< | 
#        env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], glimage)]) | 
| 126 | 
> | 
if os.name == 'posix': # XXX ignoring trad.wsh | 
| 127 | 
> | 
        for s in Split('''normpat pdfblur pmblur pmdblur | 
| 128 | 
> | 
                        xyzimage phisto pdelta pgblur ra_pfm ran2tiff pbilat'''): | 
| 129 | 
> | 
                Default(env.InstallScript(radbin(s), s + '.csh')) | 
| 130 | 
> | 
        for s in Split('''falsecolor'''): | 
| 131 | 
> | 
                Default(env.InstallScript(radbin(s), s + '.pl')) | 
| 132 | 
> | 
# XXX probably needs fixing | 
| 133 | 
> | 
#else: | 
| 134 | 
> | 
#       for s in Split('''falsecolor'''): | 
| 135 | 
> | 
#               Default(env.InstallScript(radbin(s), s + '.pl')) | 
| 136 | 
> | 
# ignored by Rmakefile: pacuity phisteq psquish pveil vlpic | 
| 137 | 
  | 
 | 
| 138 | 
+ | 
Default('#src/px') | 
| 139 | 
+ | 
env.Install('$RAD_BINDIR', progs) | 
| 140 | 
  | 
 | 
| 141 | 
+ | 
# vim: set syntax=python: |