~ubuntu-branches/ubuntu/raring/sunpinyin/raring

« back to all changes in this revision

Viewing changes to SConstruct

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.3) (1.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120330153155-qgls77sogzgtg9zp
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import os
3
3
import sys
4
4
 
5
 
version="2.0.3"
 
5
version="2.0.4"
6
6
abi_major = 3
7
7
abi_minor = 0
8
8
 
9
 
cflags='-O2 -g -pipe '
 
9
cflags='-g -Wall'
10
10
 
11
11
slmsource=['src/slm/ids2ngram/ids2ngram.cpp',
12
12
           'src/slm/ids2ngram/idngram_merge.cpp',
57
57
           'src/ime-core/imi_funcobjs.cpp',
58
58
           'src/ime-core/imi_options.cpp',
59
59
           'src/ime-core/imi_option_event.cpp',
60
 
           'src/ime-core/userdict.cpp']
 
60
           'src/ime-core/userdict.cpp',
 
61
           'src/ime-core/imi_plugin.cpp']
61
62
 
62
63
headers=['src/slm/ids2ngram/idngram.h',
63
64
         'src/slm/ids2ngram/idngram_merge.h',
83
84
         'src/ime-core/imi_funcobjs.h',
84
85
         'src/ime-core/imi_context.h',
85
86
         'src/ime-core/imi_winHandler.h',
 
87
         'src/ime-core/imi_glibHandler.h',
86
88
         'src/ime-core/userdict.h',
87
89
         'src/ime-core/imi_option_event.h',
88
90
         'src/ime-core/imi_data.h',
92
94
         'src/ime-core/imi_options.h',
93
95
         'src/ime-core/imi_defines.h',
94
96
         'src/ime-core/imi_view.h',
 
97
         'src/ime-core/imi_plugin.h',
95
98
         'src/portability.h',
96
99
         'src/pinyin/segmentor.h',
97
100
         'src/pinyin/shuangpin_seg.h',
158
161
    for (x, y) in envvar:
159
162
        if x in os.environ:
160
163
            print 'Warning: you\'ve set %s in the environmental variable!' % x
161
 
            if y == 'LINKFLAGS':
162
 
                env[y] = os.environ[x].split()
163
 
            else:
164
 
                env[y] = os.environ[x]
 
164
            env[y] = os.environ[x]
165
165
    
166
166
env = CreateEnvironment()
167
167
opts.Update(env)
195
195
PassVariables(envvar, env)
196
196
 
197
197
# append critical cflags
198
 
extra_cflags=' -DHAVE_CONFIG_H -DSUNPINYIN_DATA_DIR=\'"%s"\'' % libdatadir
 
198
extra_cflags=' -pipe -DHAVE_CONFIG_H -DSUNPINYIN_DATA_DIR=\'"%s"\'' % libdatadir
199
199
env.Append(CFLAGS=extra_cflags)
200
200
env.Append(CXXFLAGS=extra_cflags)
201
201
 
202
202
if GetOS() != 'Darwin':
203
 
    env.Append(LINKFLAGS=['-Wl,-soname=libsunpinyin.so.%d' % abi_major])
 
203
    env.Append(LINKFLAGS=' -Wl,-soname=libsunpinyin.so.%d' % abi_major)
204
204
 
205
205
if GetOption('rpath') is not None and GetOS() != 'Darwin':
206
 
    env.Append(LINKFLAGS=['-Wl,-R', '-Wl,%s' % GetOption('rpath')])
 
206
    env.Append(LINKFLAGS=' -Wl,-R -Wl,%s' % GetOption('rpath'))
207
207
 
208
208
#
209
209
#==============================configure================================
220
220
    context.Result(ret)
221
221
    return ret
222
222
 
 
223
def CheckPython(context):
 
224
    context.Message('Checking for Python library...')
 
225
    ret = context.TryAction('python-config --prefix')[0]
 
226
    context.Result(ret)
 
227
    if ret:
 
228
        context.env.MergeFlags(['!python-config --includes',
 
229
                                '!python-config --libs'])
 
230
    return ret
 
231
 
223
232
def AppendEndianCheck(conf):
224
233
    conf.config_h_text += r'''
225
234
 
233
242
  || defined(_POWER)   || defined(__powerpc__) \
234
243
  || defined(__ppc__)  || defined(__hpux) || defined(__hppa) \
235
244
  || defined(_MIPSEB)  || defined(_POWER) \
236
 
  || defined(__s390__) || (defined(__sh__) && defined(__BIG_ENDIAN__)) 
 
245
  || defined(__s390__) || (defined(__sh__) && defined(__BIG_ENDIAN__))
237
246
# define WORDS_BIGENDIAN 1
238
247
 
239
248
#elif defined(__i386__) || defined(__i386) \
244
253
  || defined(__x86_64)  || defined(__x86_64__) \
245
254
  || defined(_M_X64)    || defined(__bfin__) \
246
255
  || defined(__alpha__) || defined(__ARMEL__) \
247
 
  || defined(_MIPSEL)   || (defined(__sh__) && defined(__LITTLE_ENDIAN__)) 
 
256
  || defined(_MIPSEL)   || (defined(__sh__) && defined(__LITTLE_ENDIAN__))
248
257
# undef WORDS_BIGENDIAN
249
258
 
250
259
#else
254
263
 
255
264
conf = env.Configure(clean=False, help=False, config_h='config.h',
256
265
                     custom_tests={'CheckPKGConfig' : CheckPKGConfig,
257
 
                                   'CheckPKG' : CheckPKG})
 
266
                                   'CheckPKG' : CheckPKG,
 
267
                                   'CheckPython': CheckPython})
258
268
 
259
269
def DoConfigure():
260
270
    if GetOption('clean'):
271
281
        if not conf.CheckPKG('sqlite3'):
272
282
            Exit(1)
273
283
 
 
284
    if not conf.CheckPython():
 
285
        Exit(1)
 
286
 
274
287
    conf.Define('ENABLE_NLS', 1)
275
288
    conf.Define('GETTEXT_PACKAGE', '"sunpinyin2"')
276
289
    conf.CheckCHeader('assert.h')