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.
|
|
|
|
|
2009-06-09 00:02:43 +00:00
|
|
|
import os
|
2013-10-24 03:45:02 +00:00
|
|
|
import sys
|
|
|
|
import Utils
|
2009-06-09 00:02:43 +00:00
|
|
|
|
2009-01-23 20:36:04 +00:00
|
|
|
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':
|
2010-04-24 22:11:57 +00:00
|
|
|
source += ' ' + test + os.sep + fila
|
2009-01-23 20:36:04 +00:00
|
|
|
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]
|
2009-01-23 20:36:04 +00:00
|
|
|
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
|
2009-01-23 20:36:04 +00:00
|
|
|
|
|
|
|
obj = bld.new_task_gen ('cc', 'program')
|
|
|
|
obj.target = 'test-' + target
|
2009-02-15 21:01:27 +00:00
|
|
|
obj.includes = '.. ../midori ../panels'
|
2009-01-23 20:36:04 +00:00
|
|
|
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'
|
2009-01-23 20:36:04 +00:00
|
|
|
obj.unit_test = 1
|