~pkgcrosswire/xiphos/main

« back to all changes in this revision

Viewing changes to wscript

  • Committer: Dmitrijs Ledkovs
  • Date: 2010-11-14 00:38:52 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: dmitrij.ledkov@ubuntu.com-20101114003852-sjt227lz4qqi85xj
New upstream release 3.1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
import os, os.path
5
5
import intltool
6
 
 
7
 
 
8
 
# waf imports
 
6
import string
9
7
import Utils
10
8
import Options
11
9
import ccroot
12
 
 
13
 
 
14
 
# custom imports
 
10
import preproc
 
11
preproc.go_absolute=1
 
12
preproc.strict_quotes=0
 
13
 
15
14
import waffles.misc
16
15
import waffles.gnome as gnome
17
16
 
18
 
# the following two variables are used by the target "waf dist"
19
 
VERSION='3.1.3'
 
17
bzrrevno = '$CurRevno$'
 
18
bzrrevid = '$CurRevid$'
 
19
 
 
20
VERSION='3.1.4'
 
21
 
 
22
if VERSION.find('dev') != -1 and len(bzrrevno.split()) > 1:
 
23
        VERSION = '+'.join((VERSION,
 
24
                            'bzr' + bzrrevno.split()[1]))
 
25
        if bzrrevid.split()[1].find('svn') != -1:
 
26
                VERSION = '+'.join((VERSION,
 
27
                                    'svn' + bzrrevid.split()[1].split(':')[-1]))
 
28
 
20
29
APPNAME='xiphos'
21
30
PACKAGE='xiphos'
22
 
 
23
 
 
24
 
 
25
 
# these variables are mandatory ('/' are converted automatically)
26
31
srcdir = '.'
27
32
blddir = 'build'
28
33
 
29
 
# dir where waf will search custom (additional) files
30
34
_tooldir = './waffles/'
31
 
 
32
 
_prefix = '/usr/local'
33
 
 
34
35
ROOTDIR_WIN32 = 'C:\msys'
35
 
 
36
36
_headers = '''
37
37
dlfcn.h
38
38
inttypes.h
49
49
sys/socket.h
50
50
winsock.h
51
51
'''.split()
52
 
 
53
52
def set_options(opt):
54
53
 
55
 
 
56
 
    # options provided by the modules
57
 
    #opt.tool_options('g++ gcc gnome intltool glib2')
58
54
    opt.tool_options('g++ gcc')
59
55
 
60
56
    opt.add_option('--enable-gtkhtml', action='store_true', default=False,
165
161
        env['IS_LINUX'] = True
166
162
 
167
163
    ## temporary HACKS for win32
168
 
    if env['IS_WIN32']:
169
 
        env['PREFIX'] = conf.escpath(os.path.abspath('win32/binaries/Xiphos'))
170
 
    ##
 
164
    #if env['IS_WIN32']:
 
165
    #    env['PREFIX'] = conf.escpath(os.path.abspath('win32/binaries/Xiphos'))
171
166
 
172
167
    if env['IS_WIN32']:
173
168
        env['ROOTDIR'] = ROOTDIR_WIN32
174
 
    
 
169
 
 
170
    conf.check_tool('nothreads', tooldir=_tooldir)
175
171
    conf.check_tool('g++ gcc')
176
172
    # cross compiler
177
173
    if env['IS_CROSS_WIN32']:
178
174
        conf.check_tool('cross_linux_win32', tooldir=_tooldir)
179
 
 
 
175
  
180
176
    conf.check_tool('gnu_dirs misc')
181
 
    conf.check_tool('intltool') # check for locale.h included
 
177
    conf.check_tool('intltool')
182
178
 
183
179
    opt = Options.options
184
180
    env['DISABLE_HELP'] = opt.disable_help
243
239
    env = conf.env
244
240
 
245
241
 
246
 
    if env['IS_CROSS_WIN32']:
 
242
    #if env['IS_CROSS_WIN32']:
247
243
        # allows to use linux pkg-config for cross-compilation
248
 
        os.environ['PKG_CONFIG_LIBDIR'] = opt.pkg_conf_libdir
249
 
        env['PKG_CONFIG_PREFIX'] = opt.pkg_conf_prefix
 
244
        #os.environ['PKG_CONFIG_LIBDIR'] = opt.pkg_conf_libdir
 
245
        #env['PKG_CONFIG_PREFIX'] = opt.pkg_conf_prefix
250
246
 
251
247
    # mozilla distdir mandatory for win32 for using libxul
252
248
    if env['IS_WIN32']:
255
251
        else:
256
252
            env['MOZILLA_DISTDIR'] = '%s/../..' % env['PKG_CONFIG_LIBDIR']
257
253
 
258
 
    # appropriate cflags
259
 
    env.append_value('CXXFLAGS', env['CXXFLAGS_%s' % opt.debug_level.upper()])
260
 
    env.append_value('CCFLAGS', env['CCFLAGS_%s' % opt.debug_level.upper()])
261
 
 
262
254
    if env['IS_WIN32']:
263
255
        dfn('WIN32', 1)
264
256
 
265
 
    if opt.delint:
266
 
        env.append_value('CXXFLAGS', env['CXXFLAGS_DELINT'])
267
 
        env.append_value('CCFLAGS', env['CCFLAGS_DELINT'])
268
 
 
269
257
    # gtkhtml
270
258
    if opt.gtkhtml:
271
259
        env['ENABLE_GTKHTML'] = True
278
266
 
279
267
    # strip xiphos binary
280
268
    if env['IS_CROSS_WIN32']:
281
 
        env['STRIP'] = conf.find_program('i686-mingw32-strip', mandatory=True)
 
269
        env['STRIP'] = conf.find_program('i686-pc-mingw32-strip', mandatory=True)
282
270
    else:
283
271
        env['STRIP'] = conf.find_program('strip', mandatory=True)
284
272
 
293
281
        conf.check_tool('dbus', tooldir=_tooldir)
294
282
        conf.check_tool('glib2')
295
283
 
296
 
 
297
284
    ### App info, paths
298
285
    define = conf.define
299
286
    sub = Utils.subst_vars
322
309
    define('PACKAGE_PIXMAPS_DIR', conf.escpath(sub('${DATAROOTDIR}/pixmaps/${PACKAGE}', env)))
323
310
    define('PACKAGE_SOURCE_DIR', conf.escpath(os.path.abspath(srcdir))) # foder where was wscript executed
324
311
 
325
 
    # pkg-config
 
312
 
 
313
    if conf.check_cfg(modversion='gtkhtml-editor-3.14',
 
314
                      msg='Is post GNOME3 gtkhtml-editor available?',
 
315
                      okmsg='Deffinatly',
 
316
                      errmsg='Probably, not'
 
317
                      ):
 
318
            editor='"gtkhtml-editor-3.14"'
 
319
    else:
 
320
            editor='"gtkhtml-editor"'
 
321
 
 
322
    common_libs = string.join(
 
323
    [editor] + '''
 
324
    "gtk+-2.0 >= 2.14"
 
325
    "libglade-2.0"
 
326
    "gmodule-2.0"
 
327
    "glib-2.0"
 
328
    "libgsf-1 >= 1.14"
 
329
    "libxml-2.0"
 
330
    "libgtkhtml-3.14 >= 3.23"
 
331
    --cflags --libs'''
 
332
    .split()," ")
 
333
 
326
334
    conf.check_cfg(atleast_pkgconfig_version='0.9.0')
327
 
 
328
 
    # GTK+
329
 
    #check_pkg(conf, 'gtk+-x11-2.0', '2.0.0', var='LIBGTK_X11_2_0')
330
 
    #if not env['HAVE_LIBGTK_X11_2_0']:
331
 
    #    check_pkg(conf, 'gtk+-x11-2.0', '2.0.0', True, var='LIBGTK_WIN32_2_0')
332
 
    conf.check_pkg('gtk+-2.0', '2.14', True, var='GTK')
333
 
    # glade
334
 
    conf.check_pkg('libglade-2.0', '2.0.0', var='GLADE')
335
 
        
336
 
    conf.check_pkg('gmodule-2.0', '2.0.0', True, var='GMODULEEXP')
337
 
    conf.check_pkg('glib-2.0', '2.0.0', True, 'GLIB')
338
 
 
339
 
    ## gfs
340
 
    conf.check_pkg('libgsf-1', '1.14', True, var='GFS')
341
 
 
342
 
    #check_pkg(conf, 'libgnomeprintui-2.2', '2.2', True, var='GNOMEPRINTUI')
343
 
    #check_pkg(conf, 'libgnomeprint-2.2', '2.2', True, var='GNOMEPRINT')
344
 
 
345
 
    ## Other
346
 
    conf.check_pkg('libxml-2.0', '2.0.0', True, var='XML')
347
 
 
348
 
    conf.check_pkg('gtk+-unix-print-2.0', '2.0.0', var='UPRINT')
349
 
    if env['HAVE_UPRINT']:
350
 
        dfn('USE_GTKUPRINT', 1)
351
 
 
352
 
    ## Sword
353
 
    conf.check_pkg('sword', '1.5.11', True, var='SWORD')
354
 
 
355
 
    conf.check_pkgver_msg('sword', '1.5.11.99', var='MULTIVERSE',
356
 
            msg='Checking for sword multiverse')
357
 
    if env['HAVE_MULTIVERSE']:
358
 
        dfn('SWORD_MULTIVERSE', 1)
359
 
 
360
 
 
361
 
    #here gtkhtml
362
 
    conf.check_pkg('libgtkhtml-3.14', version='3.23', mandatory=True, var='GTKHTML')
363
 
 
364
 
    if conf.env['HAVE_GTKHTML']:
365
 
        conf.define('USE_GTKHTML3_14', 1)
366
 
 
367
 
    conf.check_pkg('gtkhtml-editor', mandatory=True)
 
335
    conf.check_cfg(msg="Checking for GNOME related libs",
 
336
                   package='',
 
337
                   args=common_libs,
 
338
                   uselib_store='GNOME',
 
339
                   mandatory=True)
 
340
 
 
341
    env.append_value('ALL_LIBS', 'GNOME')
 
342
 
 
343
    conf.check_cfg(package="gtk+-unix-print-2.0",
 
344
                   uselib_stor='GTKUPRINT')
 
345
 
 
346
    env.append_value('ALL_LIBS', 'GTKUPRINT')
 
347
 
 
348
    conf.check_cfg(package='sword',
 
349
                   args='"sword >= 1.6.1" --cflags --libs',
 
350
                   uselib_store='SWORD',
 
351
                   mandatory=True)
 
352
    env.append_value('ALL_LIBS', 'SWORD')
 
353
 
 
354
    conf.check_cfg(package="gtk+-2.0",
 
355
                   atleast_version = "2.16",
 
356
                   uselib_store="GTK_216")
 
357
    conf.check_cfg(package="gtk+-2.0",
 
358
                   atleast_version = "2.18",
 
359
                   uselib_store="GTK_218")
 
360
    conf.check_cfg(package="gtk+-2.0",
 
361
                   atleast_version = "2.20",
 
362
                   uselib_store="GTK_220")
368
363
 
369
364
    ######################
370
365
    ### gecko (xulrunner) for html rendering
372
367
    if not env['ENABLE_GTKHTML']:
373
368
        if not env["IS_WIN32"]:
374
369
 
375
 
            conf.check_cfg (package='libxul-embedding',
 
370
            conf.check_cfg (package='nspr', uselib_store='NSPR')    
 
371
            conf.check_cfg (package='',
376
372
                            uselib_store='GECKO',
377
 
                            args='--define-variable=includetype=unstable --cflags --libs',
378
 
                            atleast_version='1.9.0')
379
 
            conf.define('GECKO_HOME', conf.get_pkgvar('libxul-embedding', 'sdkdir'))
 
373
                            args='"libxul-embedding >= 1.9.0" --define-variable=includetype=unstable "nspr" --cflags --libs',
 
374
                            msg='checking for libxul-embedding')
 
375
 
 
376
            conf.define('GECKO_HOME', conf.check_cfg(package='libxul-embedding',
 
377
                                                     args='--variable=sdkdir',
 
378
                                                     okmsg=waffles.misc.myokmsg,
 
379
                                                     msg="Checking for libxul sdkdir").strip())
380
380
        else:
381
381
                    d = env['MOZILLA_DISTDIR']
382
382
                    conf.define['CPPPATH_GECKO'] = ['%s/sdk/include' % d,
390
390
                    conf.define['LIBPATH_GECKO'] = ['%s/sdk/lib' % d]
391
391
                    conf.define['LIB_GECKO'] = ['xpcomglue_s', 'xpcom', 'xul', 'nspr4']
392
392
 
 
393
        env.append_value('ALL_LIBS', 'NSPR')
393
394
        env.append_value('ALL_LIBS', 'GECKO')
394
395
        conf.define('USE_GTKMOZEMBED', 1)
395
396
 
396
397
 
397
 
    ######################
398
 
 
399
 
 
400
 
    # TODO: maybe the following checks should be in a more generic module.
401
 
 
402
 
    #always defined to indicate that i18n is enabled */
 
398
 
403
399
    dfn('ENABLE_NLS', 1)
404
 
 
405
 
    # TODO
406
 
    #Define to 1 if you have the `bind_textdomain_codeset' function.
407
400
    dfn('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
408
 
 
409
 
 
410
 
    # TODO
411
 
    #Define if the GNU gettext() function is already present or preinstalled.
412
401
    dfn('HAVE_GETTEXT', 1)
413
 
    #Define to 1 if you have the `dcgettext' function.
414
402
    dfn('HAVE_DCGETTEXT', 1)
415
403
 
416
404
 
433
421
    # Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
434
422
    dfn('TIME_WITH_SYS_TIME', 1)
435
423
 
436
 
 
437
 
            # TODO: how to detect these values? is it possible to detect them?
438
 
 
439
 
    # TODO: not necessary SELECT* defines?
440
 
    # Define to the type of arg 1 for `select'. */
441
 
    #dfn('SELECT_TYPE_ARG1', 'int', quote=0) # dont add quotes around 'int'
442
 
    # Define to the type of args 2, 3 and 4 for `select'. */
443
 
    #dfn('SELECT_TYPE_ARG234', '(fd_set *)', quote=0)
444
 
    # Define to the type of arg 5 for `select'. */
445
 
    #dfn('SELECT_TYPE_ARG5', '(struct timeval *)', quote=0)
446
 
 
447
 
 
448
 
    #dfn('__cplusplus', 1)
449
 
 
450
 
    # let compiler know that we have 'config.h'
451
 
    
 
424
    # appropriate cflags
 
425
    env.append_value('CXXFLAGS', env['CXXFLAGS_%s' % opt.debug_level.upper()])
 
426
    env.append_value('CCFLAGS', env['CCFLAGS_%s' % opt.debug_level.upper()])
 
427
 
 
428
    if opt.delint:
 
429
        env.append_value('CXXFLAGS', env['CXXFLAGS_DELINT'])
 
430
        env.append_value('CCFLAGS', env['CCFLAGS_DELINT'])
 
431
 
452
432
    # portable adding define, should work gcc and msvc
453
433
    env.append_value('CXXFLAGS', env['CXXDEFINES_ST'] % 'HAVE_CONFIG_H')
454
434
    env.append_value('CCFLAGS', env['CCDEFINES_ST'] % 'HAVE_CONFIG_H')
459
439
    env.append_value('CXXFLAGS', env['CXXFLAGS_SAFE'])
460
440
 
461
441
def build(bld):
 
442
    from waffles.hashing import GetHashofDirs
 
443
 
 
444
    bld.env.CXXDEPS_SWORD = GetHashofDirs(bld.env.CPPPATH_SWORD)
462
445
 
463
446
    env = bld.env
464
447
    opt = Options.options
478
461
        else:
479
462
            bld.add_subdirs('src/gecko')
480
463
 
 
464
    if env['HAVE_DBUS']:
 
465
        import shutil
 
466
        bld.add_subdirs('src/examples')
 
467
        # this seems bad, but I don't know how to do it otherwise
 
468
        shutil.copy('src/gnome2/ipc-interface.xml', 'src/examples')
 
469
        shutil.copy('src/gnome2/marshal.list', 'src/examples')
 
470
 
 
471
 
481
472
    bld.install_files('${PACKAGE_DOC_DIR}', """
482
473
        README
483
474
        RELEASE-NOTES
524
515
    if bld.env['INTLTOOL']:
525
516
        bld.add_subdirs('po')
526
517
 
527
 
    #if env['HAVE_GTKSHARP'] and env['MCS']:
528
 
        #bld.add_subdirs('sharp')
529
 
 
530
 
    #if env['SGML2MAN']:
531
 
    #   bld.add_subdirs('man')
532
 
 
533
518
    def post(ctx):
534
519
        if bld.env['POST_INSTALL']:
535
520
            gnome.postinstall_scrollkeeper('xiphos') # Installing the user docs