summaryrefslogtreecommitdiff
path: root/SConstruct
blob: 86012a01720adf440d16509570a0d6a810c6c349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
# -*- python -*-
# Author: Luo Jinghua
import os

env = Environment(tools = ['default', 'convlib'],
                  ENV = os.environ)
bareenv = env.Clone()
srcs = ['codecs_cn.c', 'codecs_hk.c',  'codecs_iso2022.c',
        'codecs_jp.c', 'codecs_kr.c',  'codecs_tw.c',
        'multibytecodec.c']
srcs += Glob('*-table.c')
srcs += ['singlebytetables.c', 'singlebytecodec.c', 'uniconv.c',
         'charsetalias.c', 'unicode.c', 'converter.c',
         'tableconverter.c', 'utfconverter.c']
env.AppendUnique(CCFLAGS = ['-Wall', '-g'],
                 LINKFLAGS = ['-g'],
		 CPPPATH = ['.'])

uniconv = env.ConvenienceLibrary ('uniconv', srcs)

iconv_env = env.Clone()
iconv_src = ['iconv.c']
if iconv_env['PLATFORM'] == 'win32':
    iconv_def = os.path.join('win32', 'iconv.def')
    if 'gcc' in iconv_env['CC']:
        iconv_src.append(iconv_def)
    else:
        iconv_env.AppendUnique(LINKFLAGS = ['/DEF:' + iconv_def])
    iconv_env.AppendUnique(CPPDEFINES = ['UNICONV_REPLACE_ICONV'])

iconv = iconv_env.SharedLibrary('iconv', iconv_src,
                                LIBS = ['uniconv'],
                                LIBPATH = ['.'],
                                CPPPATH = ['.'])

test = env.Program ('test', 'main.c',
                    LIBS = ['uniconv'],
                    LIBPATH = ['.'],
                    CPPPATH = ['.'])
conv = env.Program ('uconv', 'uconv.c',
                    LIBS = ['uniconv'],
                    LIBPATH = ['.'],
                    CPPPATH = ['.'])

conv2_env = bareenv.Clone()
if env['PLATFORM'] == 'win32':
    conv2_env.AppendUnique(CPPPATH = ['win32'],
                           LIBS = ['iconv'],
                           LIBPATH = ['.'])
conv2 = conv2_env.Program ('uconv2', 'uconv2.c')