summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-12-23 00:43:07 +0200
committerVicent Marti <tanoku@gmail.com>2010-12-23 00:43:07 +0200
commite7379f338474fad9318faffe5d0b6000ff3e1b30 (patch)
treed7f51a82728ae3953f8f0ecd592ab802a3078bf4 /wscript
parent9f54fe482dd369ebbae67b0b33f7efde206ba249 (diff)
downloadlibgit2-e7379f338474fad9318faffe5d0b6000ff3e1b30.tar.gz
Link tests with the raw objects
Fix the test building issues once for all; each test is linked with the raw objects of the library, not with any compiled version. That way we make sure the tests always run, and are always linked with the latest and most up-to-date version of the code. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'wscript')
-rw-r--r--wscript42
1 files changed, 15 insertions, 27 deletions
diff --git a/wscript b/wscript
index 41d3d30ec..6f898047c 100644
--- a/wscript
+++ b/wscript
@@ -74,15 +74,15 @@ def build(bld):
# command '[build|clean|install|uninstall]-static'
if bld.variant == 'static':
- build_library(bld, 'cstlib')
+ build_library(bld, 'static')
# command '[build|clean|install|uninstall]-shared'
elif bld.variant == 'shared':
- build_library(bld, 'cshlib')
+ build_library(bld, 'shared')
# command '[build|clean]-tests'
elif bld.variant == 'tests':
- build_library(bld, 'cshlib')
+ build_library(bld, 'objects')
build_tests(bld)
# command 'build|clean|install|uninstall': by default, run
@@ -91,9 +91,15 @@ def build(bld):
from waflib import Options
Options.commands = [bld.cmd + '-shared', bld.cmd + '-static'] + Options.commands
-def build_library(bld, lib_str):
- directory = bld.path
+def build_library(bld, build_type):
+
+ BUILD = {
+ 'shared' : bld.shlib,
+ 'static' : bld.stlib,
+ 'objects' : bld.objects
+ }
+ directory = bld.path
sources = directory.ant_glob('src/*.c')
# Compile platform-dependant code
@@ -106,15 +112,12 @@ def build_library(bld, lib_str):
sources.append('src/ppc/sha1.c')
else:
sources.append('src/block-sha1/sha1.c')
-
- features = ['c', lib_str]
-
#------------------------------
# Build the main library
#------------------------------
# either as static or shared;
- bld(features=features,
+ BUILD[build_type](
source=sources,
target='git2',
includes='src',
@@ -123,7 +126,7 @@ def build_library(bld, lib_str):
)
# On Unix systems, build the Pkg-config entry file
- if bld.env.PLATFORM == 'unix':
+ if bld.env.PLATFORM == 'unix' and bld.is_install:
bld(rule="""sed -e 's#@prefix@#$(prefix)#' -e 's#@libdir@#$(libdir)#' < ${SRC} > ${TGT}""",
source='libgit2.pc.in',
target='libgit2.pc',
@@ -167,7 +170,6 @@ def build_tests(bld):
includes=['src', 'tests'],
defines=['TEST_TOC="%s.toc"' % test_name, 'TEST_RESOURCES="%s"' % resources_path],
install_path=None,
- shlibpath=[directory.find_node('build/tests/').abspath()],
use=['test_helper', 'git2'] + ALL_LIBS # link with all the libs we know
# libraries which are not enabled won't link
)
@@ -200,28 +202,14 @@ class _run_tests(Context):
fun = 'run_tests'
def run_tests(ctx):
- import shutil, tempfile, sys, os
+ import shutil, tempfile
failed = False
test_folder = tempfile.mkdtemp()
- build_folder = ctx.path.find_node('build/tests/')
test_glob = 'build/tests/t????-*'
- environ = os.environ.copy()
- environ_tail = ""
-
- if sys.platform == 'win32':
- test_glob += '.exe'
- environ_var, environ_separator = 'PATH', ';'
- else:
- environ_var, environ_separator = 'LD_LIBRARY_PATH', ':'
-
- if environ_var in environ:
- environ_tail = environ_separator + environ[environ_var]
-
- environ[environ_var] = build_folder.abspath() + environ_tail
for test in ctx.path.ant_glob(test_glob):
- if ctx.exec_command(test.abspath(), cwd=test_folder, env=environ) != 0:
+ if ctx.exec_command(test.abspath(), cwd=test_folder) != 0:
failed = True
break