diff --git a/.travis.yml b/.travis.yml index 06b93822..6a857799 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,5 @@ compiler: - gcc before_install: - sudo apt-get install libboost-regex1.48-dev -env: - - CXXFLAGS='-D USE_BOOST_REGEX' LDFLAGS='-lboost_regex' -install: script/configure.sh +install: script/configure.sh -D USE_BOOST_REGEX script: script/test.sh diff --git a/script/configure.sh b/script/configure.sh index ab594bfe..fc4c56e0 100755 --- a/script/configure.sh +++ b/script/configure.sh @@ -3,5 +3,17 @@ set -e git submodule update --init -externals/gyp/gyp tree_sitter.gyp --depth . -externals/gyp/gyp tree_sitter.gyp --depth . --format=make +externals/gyp/gyp tree_sitter.gyp --depth . --format=make $@ + +if [ $1 == "-h" ]; then + cat <<-HELP + +Variables: + +-D USE_BOOST_REGEX - Use boost regex library for tests, not the built-in regex + library. This is useful when linking against an older + version of the standard library. libboost_regex must be + installed. + +HELP +fi diff --git a/tree_sitter.gyp b/tree_sitter.gyp index c8a470e9..c033b56e 100644 --- a/tree_sitter.gyp +++ b/tree_sitter.gyp @@ -63,6 +63,15 @@ 'examples', 'spec/runtime', ], + 'variables': { + 'USE_BOOST_REGEX%': 'false', + }, + 'conditions': [ + ['USE_BOOST_REGEX != "false"', { + 'defines': ['USE_BOOST_REGEX'], + 'libraries': ['-lboost_regex'], + }] + ], 'sources': [ '