midori/tests/wscript_build

60 lines
2 KiB
Text
Raw Normal View History

2008-11-15 23:03:34 +00:00
#! /usr/bin/env python
# WAF build script for midori
# This file is licensed under the terms of the expat license, see the file EXPAT.
import os
2013-10-24 03:45:02 +00:00
import sys
import Utils
tests = os.listdir ('tests')
for test in tests:
folder = 'tests' + os.sep + test
if os.path.isdir (folder):
files = os.listdir (folder)
target = test
source = ''
for fila in files:
2013-10-24 03:45:02 +00:00
if fila[-2:] == '.c' or fila[-5:] == '.vala':
source += ' ' + test + os.sep + fila
if not source:
Utils.pprint ('RED', folder + ': No source files found')
2013-10-24 03:45:02 +00:00
sys.exit (1)
elif test[-3:] == '.py' or test[-3:] == '.sh':
obj = bld.new_task_gen ('command-output')
obj.no_inputs = obj.no_outputs = obj.command_is_external = True
obj.command = ['python', 'sh'][test[-3:] == '.sh']
os.environ['SRCDIR'] = os.getcwd ()
os.environ['BLDDIR'] = '_build'
obj.argv = [os.path.join (os.getcwd (), folder)]
continue
elif test[-2:] == '.c':
target = test[:-2]
source = test
2013-10-24 03:45:02 +00:00
elif test[-5:] == '.vala':
target = test[:-5]
source = test
else:
Utils.pprint ('YELLOW', folder + ': Skipped')
continue
obj = bld.new_task_gen ('cc', 'program')
obj.target = 'test-' + target
obj.includes = '.. ../midori ../panels'
obj.source = source
2013-10-24 03:45:02 +00:00
if 'vala' in source:
obj.env.append_value ('CCFLAGS', '-w')
obj.vapi_dirs = '../midori ../katze'
obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 sqlite3 katze midori midori-core'
if bld.env['HAVE_GTK3']:
obj.packages += ' gtk+-3.0'
else:
obj.packages += ' gtk+-2.0'
if bld.env['HAVE_WEBKIT2']:
obj.packages += ' webkit2gtk-3.0'
else:
obj.packages += ' webkitgtk-3.0'
obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML GRANITE ZEITGEIST'
obj.uselib_local = 'midori-c'
obj.unit_test = 1