text_ux 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +18 -0
- data/ext/text_ux/extconf.rb +5 -0
- data/ext/text_ux/text_ux.cpp +252 -0
- data/lib/text_ux.rb +5 -0
- data/lib/text_ux/version.rb +3 -0
- data/spec/fixtures/test.ux +0 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/text_ux_spec.rb +137 -0
- data/text_ux.gemspec +26 -0
- data/vendor/ux-trie/ux-0.1.9/.lock-waf_darwin_build +8 -0
- data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest-all.cc +9118 -0
- data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest.h +19537 -0
- data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest_main.cc +39 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.py +733 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.py +147 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.py +314 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.py +298 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.py +37 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.py +149 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.py +500 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.py +130 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.py +191 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.py +358 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.py +669 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.py +341 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.py +4 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.py +12 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/asm.py +25 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/bison.py +29 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c.py +27 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.py +56 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.py +708 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.py +121 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.py +606 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.py +110 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.py +372 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_c.py +39 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.py +39 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_d.py +30 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_fc.py +45 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cs.py +98 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.py +27 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d.py +51 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_config.py +47 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_scan.py +133 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dbus.py +30 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dmd.py +43 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/errcheck.py +153 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc.py +123 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_config.py +271 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_scan.py +68 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/flex.py +27 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/g95.py +55 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gas.py +10 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gcc.py +98 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gdc.py +34 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gfortran.py +69 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/glib2.py +174 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gnu_dirs.py +65 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.py +98 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icc.py +31 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icpc.py +30 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ifort.py +42 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/intltool.py +78 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/irixcc.py +49 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/javaw.py +272 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/kde4.py +49 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/lua.py +19 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/msvc.py +650 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/nasm.py +13 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/perl.py +78 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/python.py +303 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/qt4.py +424 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ruby.py +104 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncc.py +54 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncxx.py +55 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/tex.py +222 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/vala.py +215 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/waf_unit_test.py +79 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/winres.py +34 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlc.py +46 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlcxx.py +46 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.py +334 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.py +4 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.py +173 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.py +4 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.py +223 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.py +50 -0
- data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/src/bitVec.cpp +119 -0
- data/vendor/ux-trie/ux-0.1.9/src/bitVec.hpp +64 -0
- data/vendor/ux-trie/ux-0.1.9/src/bitVecTest.cpp +143 -0
- data/vendor/ux-trie/ux-0.1.9/src/cmdline.h +809 -0
- data/vendor/ux-trie/ux-0.1.9/src/rsDic.cpp +121 -0
- data/vendor/ux-trie/ux-0.1.9/src/rsDic.hpp +57 -0
- data/vendor/ux-trie/ux-0.1.9/src/ux.hpp +26 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMain.cpp +206 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMap.cpp +0 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMap.hpp +248 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxMapTest.cpp +139 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxTest.cpp +229 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxTrie.cpp +529 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxTrie.hpp +220 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxUtil.cpp +92 -0
- data/vendor/ux-trie/ux-0.1.9/src/uxUtil.hpp +35 -0
- data/vendor/ux-trie/ux-0.1.9/src/wscript +43 -0
- data/vendor/ux-trie/ux-0.1.9/unittest_gtest.py +0 -0
- data/vendor/ux-trie/ux-0.1.9/unittest_gtest.pyc +0 -0
- data/vendor/ux-trie/ux-0.1.9/unittestt.py +166 -0
- data/vendor/ux-trie/ux-0.1.9/ux.pc.in +10 -0
- data/vendor/ux-trie/ux-0.1.9/waf +0 -0
- data/vendor/ux-trie/ux-0.1.9/wscript +32 -0
- metadata +249 -0
data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.py
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#! /usr/bin/env python
|
2
|
+
# encoding: utf-8
|
3
|
+
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
|
4
|
+
|
5
|
+
import os,sys,re
|
6
|
+
from waflib import Utils,Build
|
7
|
+
from waflib.Configure import conf
|
8
|
+
def get_extensions(lst):
|
9
|
+
ret=[]
|
10
|
+
for x in Utils.to_list(lst):
|
11
|
+
try:
|
12
|
+
if not isinstance(x,str):
|
13
|
+
x=x.name
|
14
|
+
ret.append(x[x.rfind('.')+1:])
|
15
|
+
except:
|
16
|
+
pass
|
17
|
+
return ret
|
18
|
+
def sniff_features(**kw):
|
19
|
+
exts=get_extensions(kw['source'])
|
20
|
+
type=kw['_type']
|
21
|
+
feats=[]
|
22
|
+
if'cxx'in exts or'cpp'in exts or'c++'in exts or'cc'in exts or'C'in exts:
|
23
|
+
feats.append('cxx')
|
24
|
+
if'c'in exts or'vala'in exts:
|
25
|
+
feats.append('c')
|
26
|
+
if'd'in exts:
|
27
|
+
feats.append('d')
|
28
|
+
if'java'in exts:
|
29
|
+
feats.append('java')
|
30
|
+
if'java'in exts:
|
31
|
+
return'java'
|
32
|
+
if type in['program','shlib','stlib']:
|
33
|
+
for x in feats:
|
34
|
+
if x in['cxx','d','c']:
|
35
|
+
feats.append(x+type)
|
36
|
+
return feats
|
37
|
+
def set_features(kw,_type):
|
38
|
+
kw['_type']=_type
|
39
|
+
kw['features']=Utils.to_list(kw.get('features',[]))+Utils.to_list(sniff_features(**kw))
|
40
|
+
def program(bld,*k,**kw):
|
41
|
+
set_features(kw,'program')
|
42
|
+
return bld(*k,**kw)
|
43
|
+
def shlib(bld,*k,**kw):
|
44
|
+
set_features(kw,'shlib')
|
45
|
+
return bld(*k,**kw)
|
46
|
+
def stlib(bld,*k,**kw):
|
47
|
+
set_features(kw,'stlib')
|
48
|
+
return bld(*k,**kw)
|
49
|
+
def objects(bld,*k,**kw):
|
50
|
+
set_features(kw,'objects')
|
51
|
+
return bld(*k,**kw)
|
52
|
+
|
53
|
+
conf(program)
|
54
|
+
conf(shlib)
|
55
|
+
conf(stlib)
|
56
|
+
conf(objects)
|
data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.pyc
ADDED
Binary file
|
data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.py
ADDED
@@ -0,0 +1,708 @@
|
|
1
|
+
#! /usr/bin/env python
|
2
|
+
# encoding: utf-8
|
3
|
+
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
|
4
|
+
|
5
|
+
import sys
|
6
|
+
if sys.hexversion < 0x020400f0: from sets import Set as set
|
7
|
+
import os,imp,sys,re,shlex,shutil
|
8
|
+
from waflib import Build,Utils,Configure,Task,Options,Logs,TaskGen,Errors,ConfigSet,Runner
|
9
|
+
from waflib.TaskGen import before_method,after_method,feature
|
10
|
+
from waflib.Configure import conf
|
11
|
+
WAF_CONFIG_H='config.h'
|
12
|
+
DEFKEYS='define_key'
|
13
|
+
INCKEYS='include_key'
|
14
|
+
cfg_ver={'atleast-version':'>=','exact-version':'==','max-version':'<=',}
|
15
|
+
SNIP_FUNCTION='''
|
16
|
+
int main() {
|
17
|
+
void *p;
|
18
|
+
p=(void*)(%s);
|
19
|
+
return 0;
|
20
|
+
}
|
21
|
+
'''
|
22
|
+
SNIP_TYPE='''
|
23
|
+
int main() {
|
24
|
+
if ((%(type_name)s *) 0) return 0;
|
25
|
+
if (sizeof (%(type_name)s)) return 0;
|
26
|
+
}
|
27
|
+
'''
|
28
|
+
SNIP_CLASS='''
|
29
|
+
int main() {
|
30
|
+
if (
|
31
|
+
}
|
32
|
+
'''
|
33
|
+
SNIP_EMPTY_PROGRAM='''
|
34
|
+
int main() {
|
35
|
+
return 0;
|
36
|
+
}
|
37
|
+
'''
|
38
|
+
SNIP_FIELD='''
|
39
|
+
int main() {
|
40
|
+
char *off;
|
41
|
+
off = (char*) &((%(type_name)s*)0)->%(field_name)s;
|
42
|
+
return (size_t) off < sizeof(%(type_name)s);
|
43
|
+
}
|
44
|
+
'''
|
45
|
+
MACRO_TO_DESTOS={'__linux__':'linux','__GNU__':'gnu','__FreeBSD__':'freebsd','__NetBSD__':'netbsd','__OpenBSD__':'openbsd','__sun':'sunos','__hpux':'hpux','__sgi':'irix','_AIX':'aix','__CYGWIN__':'cygwin','__MSYS__':'msys','_UWIN':'uwin','_WIN64':'win32','_WIN32':'win32','__POWERPC__':'powerpc','__QNX__':'qnx'}
|
46
|
+
MACRO_TO_DEST_CPU={'__x86_64__':'x86_64','__i386__':'x86','__ia64__':'ia','__mips__':'mips','__sparc__':'sparc','__alpha__':'alpha','__arm__':'arm','__hppa__':'hppa','__powerpc__':'powerpc',}
|
47
|
+
def parse_flags(self,line,uselib,env=None):
|
48
|
+
assert(isinstance(line,str))
|
49
|
+
env=env or self.env
|
50
|
+
app=env.append_value
|
51
|
+
appu=env.append_unique
|
52
|
+
lex=shlex.shlex(line,posix=False)
|
53
|
+
lex.whitespace_split=True
|
54
|
+
lex.commenters=''
|
55
|
+
lst=list(lex)
|
56
|
+
while lst:
|
57
|
+
x=lst.pop(0)
|
58
|
+
st=x[:2]
|
59
|
+
ot=x[2:]
|
60
|
+
if st=='-I'or st=='/I':
|
61
|
+
if not ot:ot=lst.pop(0)
|
62
|
+
appu('INCLUDES_'+uselib,[ot])
|
63
|
+
elif st=='-include':
|
64
|
+
tmp=[x,lst.pop(0)]
|
65
|
+
app('CFLAGS',tmp)
|
66
|
+
app('CXXFLAGS',tmp)
|
67
|
+
elif st=='-D'or(self.env.CXX_NAME=='msvc'and st=='/D'):
|
68
|
+
if not ot:ot=lst.pop(0)
|
69
|
+
app('DEFINES_'+uselib,[ot])
|
70
|
+
elif st=='-l':
|
71
|
+
if not ot:ot=lst.pop(0)
|
72
|
+
appu('LIB_'+uselib,[ot])
|
73
|
+
elif st=='-L':
|
74
|
+
if not ot:ot=lst.pop(0)
|
75
|
+
appu('LIBPATH_'+uselib,[ot])
|
76
|
+
elif x=='-pthread'or x.startswith('+')or x.startswith('-std'):
|
77
|
+
app('CFLAGS_'+uselib,[x])
|
78
|
+
app('CXXFLAGS_'+uselib,[x])
|
79
|
+
app('LINKFLAGS_'+uselib,[x])
|
80
|
+
elif x=='-framework':
|
81
|
+
appu('FRAMEWORK_'+uselib,[lst.pop(0)])
|
82
|
+
elif x.startswith('-F'):
|
83
|
+
appu('FRAMEWORKPATH_'+uselib,[x[2:]])
|
84
|
+
elif x.startswith('-Wl'):
|
85
|
+
app('LINKFLAGS_'+uselib,[x])
|
86
|
+
elif x.startswith('-m')or x.startswith('-f')or x.startswith('-dynamic'):
|
87
|
+
app('CFLAGS_'+uselib,[x])
|
88
|
+
app('CXXFLAGS_'+uselib,[x])
|
89
|
+
elif x.startswith('-bundle'):
|
90
|
+
app('LINKFLAGS_'+uselib,[x])
|
91
|
+
elif x.startswith('-undefined'):
|
92
|
+
arg=lst.pop(0)
|
93
|
+
app('LINKFLAGS_'+uselib,[x,arg])
|
94
|
+
elif x.startswith('-arch')or x.startswith('-isysroot'):
|
95
|
+
tmp=[x,lst.pop(0)]
|
96
|
+
app('CFLAGS_'+uselib,tmp)
|
97
|
+
app('CXXFLAGS_'+uselib,tmp)
|
98
|
+
app('LINKFLAGS_'+uselib,tmp)
|
99
|
+
elif x.endswith('.a')or x.endswith('.so')or x.endswith('.dylib'):
|
100
|
+
appu('LINKFLAGS_'+uselib,[x])
|
101
|
+
def ret_msg(self,f,kw):
|
102
|
+
if isinstance(f,str):
|
103
|
+
return f
|
104
|
+
return f(kw)
|
105
|
+
def validate_cfg(self,kw):
|
106
|
+
if not'path'in kw:
|
107
|
+
if not self.env.PKGCONFIG:
|
108
|
+
self.find_program('pkg-config',var='PKGCONFIG')
|
109
|
+
kw['path']=self.env.PKGCONFIG
|
110
|
+
if'atleast_pkgconfig_version'in kw:
|
111
|
+
if not'msg'in kw:
|
112
|
+
kw['msg']='Checking for pkg-config version >= %r'%kw['atleast_pkgconfig_version']
|
113
|
+
return
|
114
|
+
if not'okmsg'in kw:
|
115
|
+
kw['okmsg']='yes'
|
116
|
+
if not'errmsg'in kw:
|
117
|
+
kw['errmsg']='not found'
|
118
|
+
if'modversion'in kw:
|
119
|
+
if not'msg'in kw:
|
120
|
+
kw['msg']='Checking for %r version'%kw['modversion']
|
121
|
+
return
|
122
|
+
for x in cfg_ver.keys():
|
123
|
+
y=x.replace('-','_')
|
124
|
+
if y in kw:
|
125
|
+
if not'package'in kw:
|
126
|
+
raise ValueError('%s requires a package'%x)
|
127
|
+
if not'msg'in kw:
|
128
|
+
kw['msg']='Checking for %r %s %s'%(kw['package'],cfg_ver[x],kw[y])
|
129
|
+
return
|
130
|
+
if not'msg'in kw:
|
131
|
+
kw['msg']='Checking for %r'%(kw['package']or kw['path'])
|
132
|
+
def exec_cfg(self,kw):
|
133
|
+
if'atleast_pkgconfig_version'in kw:
|
134
|
+
cmd=[kw['path'],'--atleast-pkgconfig-version=%s'%kw['atleast_pkgconfig_version']]
|
135
|
+
self.cmd_and_log(cmd)
|
136
|
+
if not'okmsg'in kw:
|
137
|
+
kw['okmsg']='yes'
|
138
|
+
return
|
139
|
+
for x in cfg_ver:
|
140
|
+
y=x.replace('-','_')
|
141
|
+
if y in kw:
|
142
|
+
self.cmd_and_log([kw['path'],'--%s=%s'%(x,kw[y]),kw['package']])
|
143
|
+
if not'okmsg'in kw:
|
144
|
+
kw['okmsg']='yes'
|
145
|
+
self.define(self.have_define(kw.get('uselib_store',kw['package'])),1,0)
|
146
|
+
break
|
147
|
+
if'modversion'in kw:
|
148
|
+
version=self.cmd_and_log([kw['path'],'--modversion',kw['modversion']]).strip()
|
149
|
+
self.define('%s_VERSION'%Utils.quote_define_name(kw.get('uselib_store',kw['modversion'])),version)
|
150
|
+
return version
|
151
|
+
lst=[kw['path']]
|
152
|
+
defi=kw.get('define_variable',None)
|
153
|
+
if not defi:
|
154
|
+
defi=self.env.PKG_CONFIG_DEFINES or{}
|
155
|
+
for key,val in defi.items():
|
156
|
+
lst.append('--define-variable=%s=%s'%(key,val))
|
157
|
+
if kw['package']:
|
158
|
+
lst.extend(Utils.to_list(kw['package']))
|
159
|
+
if'variables'in kw:
|
160
|
+
env=kw.get('env',self.env)
|
161
|
+
uselib=kw.get('uselib_store',kw['package'].upper())
|
162
|
+
vars=Utils.to_list(kw['variables'])
|
163
|
+
for v in vars:
|
164
|
+
val=self.cmd_and_log(lst+['--variable='+v]).strip()
|
165
|
+
var='%s_%s'%(uselib,v)
|
166
|
+
env[var]=val
|
167
|
+
if not'okmsg'in kw:
|
168
|
+
kw['okmsg']='yes'
|
169
|
+
return
|
170
|
+
if'args'in kw:
|
171
|
+
lst+=Utils.to_list(kw['args'])
|
172
|
+
ret=self.cmd_and_log(lst)
|
173
|
+
if not'okmsg'in kw:
|
174
|
+
kw['okmsg']='yes'
|
175
|
+
self.define(self.have_define(kw.get('uselib_store',kw['package'])),1,0)
|
176
|
+
self.parse_flags(ret,kw.get('uselib_store',kw['package'].upper()),kw.get('env',self.env))
|
177
|
+
return ret
|
178
|
+
def check_cfg(self,*k,**kw):
|
179
|
+
if k:
|
180
|
+
lst=k[0].split()
|
181
|
+
kw['package']=lst[0]
|
182
|
+
kw['args']=' '.join(lst[1:])
|
183
|
+
self.validate_cfg(kw)
|
184
|
+
if'msg'in kw:
|
185
|
+
self.start_msg(kw['msg'])
|
186
|
+
ret=None
|
187
|
+
try:
|
188
|
+
ret=self.exec_cfg(kw)
|
189
|
+
except self.errors.WafError ,e:
|
190
|
+
if'errmsg'in kw:
|
191
|
+
self.end_msg(kw['errmsg'],'YELLOW')
|
192
|
+
if Logs.verbose>1:
|
193
|
+
raise
|
194
|
+
else:
|
195
|
+
self.fatal('The configuration failed')
|
196
|
+
else:
|
197
|
+
kw['success']=ret
|
198
|
+
if'okmsg'in kw:
|
199
|
+
self.end_msg(self.ret_msg(kw['okmsg'],kw))
|
200
|
+
return ret
|
201
|
+
def validate_c(self,kw):
|
202
|
+
if not'env'in kw:
|
203
|
+
kw['env']=self.env.derive()
|
204
|
+
env=kw['env']
|
205
|
+
if not'compiler'in kw and not'features'in kw:
|
206
|
+
kw['compiler']='c'
|
207
|
+
if env['CXX_NAME']and Task.classes.get('cxx',None):
|
208
|
+
kw['compiler']='cxx'
|
209
|
+
if not self.env['CXX']:
|
210
|
+
self.fatal('a c++ compiler is required')
|
211
|
+
else:
|
212
|
+
if not self.env['CC']:
|
213
|
+
self.fatal('a c compiler is required')
|
214
|
+
if not'compile_mode'in kw:
|
215
|
+
kw['compile_mode']='c'
|
216
|
+
if'cxx'in Utils.to_list(kw.get('features',[]))or kw.get('compiler','')=='cxx':
|
217
|
+
kw['compile_mode']='cxx'
|
218
|
+
if not'type'in kw:
|
219
|
+
kw['type']='cprogram'
|
220
|
+
if not'features'in kw:
|
221
|
+
kw['features']=[kw['compile_mode'],kw['type']]
|
222
|
+
else:
|
223
|
+
kw['features']=Utils.to_list(kw['features'])
|
224
|
+
if not'compile_filename'in kw:
|
225
|
+
kw['compile_filename']='test.c'+((kw['compile_mode']=='cxx')and'pp'or'')
|
226
|
+
def to_header(dct):
|
227
|
+
if'header_name'in dct:
|
228
|
+
dct=Utils.to_list(dct['header_name'])
|
229
|
+
return''.join(['#include <%s>\n'%x for x in dct])
|
230
|
+
return''
|
231
|
+
if'framework_name'in kw:
|
232
|
+
fwkname=kw['framework_name']
|
233
|
+
if not'uselib_store'in kw:
|
234
|
+
kw['uselib_store']=fwkname.upper()
|
235
|
+
if not kw.get('no_header',False):
|
236
|
+
if not'header_name'in kw:
|
237
|
+
kw['header_name']=[]
|
238
|
+
fwk='%s/%s.h'%(fwkname,fwkname)
|
239
|
+
if kw.get('remove_dot_h',None):
|
240
|
+
fwk=fwk[:-2]
|
241
|
+
kw['header_name']=Utils.to_list(kw['header_name'])+[fwk]
|
242
|
+
kw['msg']='Checking for framework %s'%fwkname
|
243
|
+
kw['framework']=fwkname
|
244
|
+
if'function_name'in kw:
|
245
|
+
fu=kw['function_name']
|
246
|
+
if not'msg'in kw:
|
247
|
+
kw['msg']='Checking for function %s'%fu
|
248
|
+
kw['code']=to_header(kw)+SNIP_FUNCTION%fu
|
249
|
+
if not'uselib_store'in kw:
|
250
|
+
kw['uselib_store']=fu.upper()
|
251
|
+
if not'define_name'in kw:
|
252
|
+
kw['define_name']=self.have_define(fu)
|
253
|
+
elif'type_name'in kw:
|
254
|
+
tu=kw['type_name']
|
255
|
+
if not'header_name'in kw:
|
256
|
+
kw['header_name']='stdint.h'
|
257
|
+
if'field_name'in kw:
|
258
|
+
field=kw['field_name']
|
259
|
+
kw['code']=to_header(kw)+SNIP_FIELD%{'type_name':tu,'field_name':field}
|
260
|
+
if not'msg'in kw:
|
261
|
+
kw['msg']='Checking for field %s in %s'%(field,tu)
|
262
|
+
if not'define_name'in kw:
|
263
|
+
kw['define_name']=self.have_define((tu+'_'+field).upper())
|
264
|
+
else:
|
265
|
+
kw['code']=to_header(kw)+SNIP_TYPE%{'type_name':tu}
|
266
|
+
if not'msg'in kw:
|
267
|
+
kw['msg']='Checking for type %s'%tu
|
268
|
+
if not'define_name'in kw:
|
269
|
+
kw['define_name']=self.have_define(tu.upper())
|
270
|
+
elif'header_name'in kw:
|
271
|
+
if not'msg'in kw:
|
272
|
+
kw['msg']='Checking for header %s'%kw['header_name']
|
273
|
+
l=Utils.to_list(kw['header_name'])
|
274
|
+
assert len(l)>0,'list of headers in header_name is empty'
|
275
|
+
kw['code']=to_header(kw)+SNIP_EMPTY_PROGRAM
|
276
|
+
if not'uselib_store'in kw:
|
277
|
+
kw['uselib_store']=l[0].upper()
|
278
|
+
if not'define_name'in kw:
|
279
|
+
kw['define_name']=self.have_define(l[0])
|
280
|
+
if'lib'in kw:
|
281
|
+
if not'msg'in kw:
|
282
|
+
kw['msg']='Checking for library %s'%kw['lib']
|
283
|
+
if not'uselib_store'in kw:
|
284
|
+
kw['uselib_store']=kw['lib'].upper()
|
285
|
+
if'stlib'in kw:
|
286
|
+
if not'msg'in kw:
|
287
|
+
kw['msg']='Checking for static library %s'%kw['stlib']
|
288
|
+
if not'uselib_store'in kw:
|
289
|
+
kw['uselib_store']=kw['stlib'].upper()
|
290
|
+
if'fragment'in kw:
|
291
|
+
kw['code']=kw['fragment']
|
292
|
+
if not'msg'in kw:
|
293
|
+
kw['msg']='Checking for code snippet'
|
294
|
+
if not'errmsg'in kw:
|
295
|
+
kw['errmsg']='no'
|
296
|
+
for(flagsname,flagstype)in[('cxxflags','compiler'),('cflags','compiler'),('linkflags','linker')]:
|
297
|
+
if flagsname in kw:
|
298
|
+
if not'msg'in kw:
|
299
|
+
kw['msg']='Checking for %s flags %s'%(flagstype,kw[flagsname])
|
300
|
+
if not'errmsg'in kw:
|
301
|
+
kw['errmsg']='no'
|
302
|
+
if not'execute'in kw:
|
303
|
+
kw['execute']=False
|
304
|
+
if kw['execute']:
|
305
|
+
kw['features'].append('test_exec')
|
306
|
+
if not'errmsg'in kw:
|
307
|
+
kw['errmsg']='not found'
|
308
|
+
if not'okmsg'in kw:
|
309
|
+
kw['okmsg']='yes'
|
310
|
+
if not'code'in kw:
|
311
|
+
kw['code']=SNIP_EMPTY_PROGRAM
|
312
|
+
if self.env[INCKEYS]:
|
313
|
+
kw['code']='\n'.join(['#include <%s>'%x for x in self.env[INCKEYS]])+'\n'+kw['code']
|
314
|
+
if not kw.get('success'):kw['success']=None
|
315
|
+
if'define_name'in kw:
|
316
|
+
self.undefine(kw['define_name'])
|
317
|
+
assert'msg'in kw,'invalid parameters, read http://freehackers.org/~tnagy/wafbook/single.html#config_helpers_c'
|
318
|
+
def post_check(self,*k,**kw):
|
319
|
+
is_success=0
|
320
|
+
if kw['execute']:
|
321
|
+
if kw['success']is not None:
|
322
|
+
if kw.get('define_ret',False):
|
323
|
+
is_success=kw['success']
|
324
|
+
else:
|
325
|
+
is_success=(kw['success']==0)
|
326
|
+
else:
|
327
|
+
is_success=(kw['success']==0)
|
328
|
+
if'define_name'in kw:
|
329
|
+
if'header_name'in kw or'function_name'in kw or'type_name'in kw or'fragment'in kw:
|
330
|
+
nm=kw['define_name']
|
331
|
+
if kw['execute']and kw.get('define_ret',None)and isinstance(is_success,str):
|
332
|
+
self.define(kw['define_name'],is_success,quote=kw.get('quote',1))
|
333
|
+
else:
|
334
|
+
self.define_cond(kw['define_name'],is_success)
|
335
|
+
else:
|
336
|
+
self.define_cond(kw['define_name'],is_success)
|
337
|
+
if'header_name'in kw:
|
338
|
+
if kw.get('auto_add_header_name',False):
|
339
|
+
self.env.append_value(INCKEYS,Utils.to_list(kw['header_name']))
|
340
|
+
if is_success and'uselib_store'in kw:
|
341
|
+
from waflib.Tools import ccroot
|
342
|
+
_vars=set([])
|
343
|
+
for x in kw['features']:
|
344
|
+
if x in ccroot.USELIB_VARS:
|
345
|
+
_vars|=ccroot.USELIB_VARS[x]
|
346
|
+
for k in _vars:
|
347
|
+
lk=k.lower()
|
348
|
+
if k=='INCLUDES':lk='includes'
|
349
|
+
if k=='DEFINES':lk='defines'
|
350
|
+
if lk in kw:
|
351
|
+
val=kw[lk]
|
352
|
+
if isinstance(val,str):
|
353
|
+
val=val.rstrip(os.path.sep)
|
354
|
+
self.env.append_unique(k+'_'+kw['uselib_store'],val)
|
355
|
+
return is_success
|
356
|
+
def check(self,*k,**kw):
|
357
|
+
self.validate_c(kw)
|
358
|
+
self.start_msg(kw['msg'])
|
359
|
+
ret=None
|
360
|
+
try:
|
361
|
+
ret=self.run_c_code(*k,**kw)
|
362
|
+
except self.errors.ConfigurationError ,e:
|
363
|
+
self.end_msg(kw['errmsg'],'YELLOW')
|
364
|
+
if Logs.verbose>1:
|
365
|
+
raise
|
366
|
+
else:
|
367
|
+
self.fatal('The configuration failed')
|
368
|
+
else:
|
369
|
+
kw['success']=ret
|
370
|
+
self.end_msg(self.ret_msg(kw['okmsg'],kw))
|
371
|
+
ret=self.post_check(*k,**kw)
|
372
|
+
if not ret:
|
373
|
+
self.fatal('The configuration failed %r'%ret)
|
374
|
+
return ret
|
375
|
+
class test_exec(Task.Task):
|
376
|
+
color='PINK'
|
377
|
+
def run(self):
|
378
|
+
if getattr(self.generator,'rpath',None):
|
379
|
+
if getattr(self.generator,'define_ret',False):
|
380
|
+
self.generator.bld.retval=self.generator.bld.cmd_and_log([self.inputs[0].abspath()])
|
381
|
+
else:
|
382
|
+
self.generator.bld.retval=self.generator.bld.exec_command([self.inputs[0].abspath()])
|
383
|
+
else:
|
384
|
+
env=self.env.env or{}
|
385
|
+
env.update(dict(os.environ))
|
386
|
+
for var in('LD_LIBRARY_PATH','DYLD_LIBRARY_PATH','PATH'):
|
387
|
+
env[var]=self.inputs[0].parent.abspath()+os.path.pathsep+env.get(var,'')
|
388
|
+
if getattr(self.generator,'define_ret',False):
|
389
|
+
self.generator.bld.retval=self.generator.bld.cmd_and_log([self.inputs[0].abspath()],env=env)
|
390
|
+
else:
|
391
|
+
self.generator.bld.retval=self.generator.bld.exec_command([self.inputs[0].abspath()],env=env)
|
392
|
+
def test_exec_fun(self):
|
393
|
+
self.create_task('test_exec',self.link_task.outputs[0])
|
394
|
+
CACHE_RESULTS=1
|
395
|
+
COMPILE_ERRORS=2
|
396
|
+
def run_c_code(self,*k,**kw):
|
397
|
+
lst=[str(v)for(p,v)in kw.items()if p!='env']
|
398
|
+
h=Utils.h_list(lst)
|
399
|
+
dir=self.bldnode.abspath()+os.sep+(not Utils.is_win32 and'.'or'')+'conf_check_'+Utils.to_hex(h)
|
400
|
+
try:
|
401
|
+
os.makedirs(dir)
|
402
|
+
except:
|
403
|
+
pass
|
404
|
+
try:
|
405
|
+
os.stat(dir)
|
406
|
+
except:
|
407
|
+
self.fatal('cannot use the configuration test folder %r'%dir)
|
408
|
+
cachemode=getattr(Options.options,'confcache',None)
|
409
|
+
if cachemode==CACHE_RESULTS:
|
410
|
+
try:
|
411
|
+
proj=ConfigSet.ConfigSet(os.path.join(dir,'cache_run_c_code'))
|
412
|
+
ret=proj['cache_run_c_code']
|
413
|
+
except:
|
414
|
+
pass
|
415
|
+
else:
|
416
|
+
if isinstance(ret,str)and ret.startswith('Test does not build'):
|
417
|
+
self.fatal(ret)
|
418
|
+
return ret
|
419
|
+
bdir=os.path.join(dir,'testbuild')
|
420
|
+
if not os.path.exists(bdir):
|
421
|
+
os.makedirs(bdir)
|
422
|
+
self.test_bld=bld=Build.BuildContext(top_dir=dir,out_dir=bdir)
|
423
|
+
bld.init_dirs()
|
424
|
+
bld.progress_bar=0
|
425
|
+
bld.targets='*'
|
426
|
+
if kw['compile_filename']:
|
427
|
+
node=bld.srcnode.make_node(kw['compile_filename'])
|
428
|
+
node.write(kw['code'])
|
429
|
+
bld.logger=self.logger
|
430
|
+
bld.all_envs.update(self.all_envs)
|
431
|
+
bld.env=kw['env']
|
432
|
+
o=bld(features=kw['features'],source=kw['compile_filename'],target='testprog')
|
433
|
+
for k,v in kw.items():
|
434
|
+
setattr(o,k,v)
|
435
|
+
self.to_log("==>\n%s\n<=="%kw['code'])
|
436
|
+
bld.targets='*'
|
437
|
+
ret=-1
|
438
|
+
try:
|
439
|
+
try:
|
440
|
+
bld.compile()
|
441
|
+
except Errors.WafError:
|
442
|
+
ret='Test does not build: %s'%Utils.ex_stack()
|
443
|
+
self.fatal(ret)
|
444
|
+
else:
|
445
|
+
ret=getattr(bld,'retval',0)
|
446
|
+
finally:
|
447
|
+
proj=ConfigSet.ConfigSet()
|
448
|
+
proj['cache_run_c_code']=ret
|
449
|
+
proj.store(os.path.join(dir,'cache_run_c_code'))
|
450
|
+
return ret
|
451
|
+
def check_cxx(self,*k,**kw):
|
452
|
+
kw['compiler']='cxx'
|
453
|
+
return self.check(*k,**kw)
|
454
|
+
def check_cc(self,*k,**kw):
|
455
|
+
kw['compiler']='c'
|
456
|
+
return self.check(*k,**kw)
|
457
|
+
def define(self,key,val,quote=True):
|
458
|
+
assert key and isinstance(key,str)
|
459
|
+
if isinstance(val,int)or isinstance(val,float):
|
460
|
+
s='%s=%s'
|
461
|
+
else:
|
462
|
+
s=quote and'%s="%s"'or'%s=%s'
|
463
|
+
app=s%(key,str(val))
|
464
|
+
ban=key+'='
|
465
|
+
lst=self.env['DEFINES']
|
466
|
+
for x in lst:
|
467
|
+
if x.startswith(ban):
|
468
|
+
lst[lst.index(x)]=app
|
469
|
+
break
|
470
|
+
else:
|
471
|
+
self.env.append_value('DEFINES',app)
|
472
|
+
self.env.append_unique(DEFKEYS,key)
|
473
|
+
def undefine(self,key):
|
474
|
+
assert key and isinstance(key,str)
|
475
|
+
ban=key+'='
|
476
|
+
lst=[x for x in self.env['DEFINES']if not x.startswith(ban)]
|
477
|
+
self.env['DEFINES']=lst
|
478
|
+
self.env.append_unique(DEFKEYS,key)
|
479
|
+
def define_cond(self,key,val):
|
480
|
+
assert key and isinstance(key,str)
|
481
|
+
if val:
|
482
|
+
self.define(key,1)
|
483
|
+
else:
|
484
|
+
self.undefine(key)
|
485
|
+
def is_defined(self,key):
|
486
|
+
assert key and isinstance(key,str)
|
487
|
+
ban=key+'='
|
488
|
+
for x in self.env['DEFINES']:
|
489
|
+
if x.startswith(ban):
|
490
|
+
return True
|
491
|
+
return False
|
492
|
+
def get_define(self,key):
|
493
|
+
assert key and isinstance(key,str)
|
494
|
+
ban=key+'='
|
495
|
+
for x in self.env['DEFINES']:
|
496
|
+
if x.startswith(ban):
|
497
|
+
return x[len(ban):]
|
498
|
+
return None
|
499
|
+
def have_define(self,key):
|
500
|
+
return self.__dict__.get('HAVE_PAT','HAVE_%s')%Utils.quote_define_name(key)
|
501
|
+
def write_config_header(self,configfile='',guard='',top=False,env=None,defines=True,headers=False,remove=True):
|
502
|
+
if not configfile:configfile=WAF_CONFIG_H
|
503
|
+
waf_guard=guard or'_%s_WAF'%Utils.quote_define_name(configfile)
|
504
|
+
node=top and self.bldnode or self.path.get_bld()
|
505
|
+
node=node.make_node(configfile)
|
506
|
+
node.parent.mkdir()
|
507
|
+
lst=['/* WARNING! All changes made to this file will be lost! */\n']
|
508
|
+
lst.append('#ifndef %s\n#define %s\n'%(waf_guard,waf_guard))
|
509
|
+
lst.append(self.get_config_header(defines,headers))
|
510
|
+
lst.append('\n#endif /* %s */\n'%waf_guard)
|
511
|
+
node.write('\n'.join(lst))
|
512
|
+
env=env or self.env
|
513
|
+
env.append_unique(Build.CFG_FILES,[node.abspath()])
|
514
|
+
if remove:
|
515
|
+
for key in self.env[DEFKEYS]:
|
516
|
+
self.undefine(key)
|
517
|
+
self.env[DEFKEYS]=[]
|
518
|
+
def get_config_header(self,defines=True,headers=False):
|
519
|
+
lst=[]
|
520
|
+
if headers:
|
521
|
+
for x in self.env[INCKEYS]:
|
522
|
+
lst.append('#include <%s>'%x)
|
523
|
+
if defines:
|
524
|
+
for x in self.env[DEFKEYS]:
|
525
|
+
if self.is_defined(x):
|
526
|
+
val=self.get_define(x)
|
527
|
+
lst.append('#define %s %s'%(x,val))
|
528
|
+
else:
|
529
|
+
lst.append('/* #undef %s */'%x)
|
530
|
+
return"\n".join(lst)
|
531
|
+
def cc_add_flags(conf):
|
532
|
+
conf.add_os_flags('CPPFLAGS','CFLAGS')
|
533
|
+
conf.add_os_flags('CFLAGS')
|
534
|
+
def cxx_add_flags(conf):
|
535
|
+
conf.add_os_flags('CPPFLAGS','CXXFLAGS')
|
536
|
+
conf.add_os_flags('CXXFLAGS')
|
537
|
+
def link_add_flags(conf):
|
538
|
+
conf.add_os_flags('LINKFLAGS')
|
539
|
+
conf.add_os_flags('LDFLAGS','LINKFLAGS')
|
540
|
+
def cc_load_tools(conf):
|
541
|
+
if not conf.env.DEST_OS:
|
542
|
+
conf.env.DEST_OS=Utils.unversioned_sys_platform()
|
543
|
+
conf.load('c')
|
544
|
+
def cxx_load_tools(conf):
|
545
|
+
if not conf.env.DEST_OS:
|
546
|
+
conf.env.DEST_OS=Utils.unversioned_sys_platform()
|
547
|
+
conf.load('cxx')
|
548
|
+
def get_cc_version(conf,cc,gcc=False,icc=False):
|
549
|
+
cmd=cc+['-dM','-E','-']
|
550
|
+
try:
|
551
|
+
p=Utils.subprocess.Popen(cmd,stdin=Utils.subprocess.PIPE,stdout=Utils.subprocess.PIPE,stderr=Utils.subprocess.PIPE)
|
552
|
+
p.stdin.write('\n')
|
553
|
+
out=p.communicate()[0]
|
554
|
+
except:
|
555
|
+
conf.fatal('could not determine the compiler version %r'%cmd)
|
556
|
+
if not isinstance(out,str):
|
557
|
+
out=out.decode(sys.stdout.encoding)
|
558
|
+
if gcc:
|
559
|
+
if out.find('__INTEL_COMPILER')>=0:
|
560
|
+
conf.fatal('The intel compiler pretends to be gcc')
|
561
|
+
if out.find('__GNUC__')<0:
|
562
|
+
conf.fatal('Could not determine the compiler type')
|
563
|
+
if icc and out.find('__INTEL_COMPILER')<0:
|
564
|
+
conf.fatal('Not icc/icpc')
|
565
|
+
k={}
|
566
|
+
if icc or gcc:
|
567
|
+
out=out.split('\n')
|
568
|
+
import shlex
|
569
|
+
for line in out:
|
570
|
+
lst=shlex.split(line)
|
571
|
+
if len(lst)>2:
|
572
|
+
key=lst[1]
|
573
|
+
val=lst[2]
|
574
|
+
k[key]=val
|
575
|
+
def isD(var):
|
576
|
+
return var in k
|
577
|
+
def isT(var):
|
578
|
+
return var in k and k[var]!='0'
|
579
|
+
if not conf.env.DEST_OS:
|
580
|
+
conf.env.DEST_OS=''
|
581
|
+
for i in MACRO_TO_DESTOS:
|
582
|
+
if isD(i):
|
583
|
+
conf.env.DEST_OS=MACRO_TO_DESTOS[i]
|
584
|
+
break
|
585
|
+
else:
|
586
|
+
if isD('__APPLE__')and isD('__MACH__'):
|
587
|
+
conf.env.DEST_OS='darwin'
|
588
|
+
elif isD('__unix__'):
|
589
|
+
conf.env.DEST_OS='generic'
|
590
|
+
if isD('__ELF__'):
|
591
|
+
conf.env.DEST_BINFMT='elf'
|
592
|
+
elif isD('__WINNT__')or isD('__CYGWIN__'):
|
593
|
+
conf.env.DEST_BINFMT='pe'
|
594
|
+
conf.env.LIBDIR=conf.env['PREFIX']+'/bin'
|
595
|
+
elif isD('__APPLE__'):
|
596
|
+
conf.env.DEST_BINFMT='mac-o'
|
597
|
+
if not conf.env.DEST_BINFMT:
|
598
|
+
conf.env.DEST_BINFMT=Utils.destos_to_binfmt(conf.env.DEST_OS)
|
599
|
+
for i in MACRO_TO_DEST_CPU:
|
600
|
+
if isD(i):
|
601
|
+
conf.env.DEST_CPU=MACRO_TO_DEST_CPU[i]
|
602
|
+
break
|
603
|
+
Logs.debug('ccroot: dest platform: '+' '.join([conf.env[x]or'?'for x in('DEST_OS','DEST_BINFMT','DEST_CPU')]))
|
604
|
+
if icc:
|
605
|
+
ver=k['__INTEL_COMPILER']
|
606
|
+
conf.env['CC_VERSION']=(ver[:-2],ver[-2],ver[-1])
|
607
|
+
else:
|
608
|
+
conf.env['CC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__'])
|
609
|
+
return k
|
610
|
+
def get_xlc_version(conf,cc):
|
611
|
+
version_re=re.compile(r"IBM XL C/C\+\+.*, V(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
|
612
|
+
cmd=cc+['-qversion']
|
613
|
+
try:
|
614
|
+
out,err=conf.cmd_and_log(cmd,output=0)
|
615
|
+
except Errors.WafError:
|
616
|
+
conf.fatal('Could not find xlc %r'%cmd)
|
617
|
+
if out:match=version_re(out)
|
618
|
+
else:match=version_re(err)
|
619
|
+
if not match:
|
620
|
+
conf.fatal('Could not determine the XLC version.')
|
621
|
+
k=match.groupdict()
|
622
|
+
conf.env['CC_VERSION']=(k['major'],k['minor'])
|
623
|
+
def add_as_needed(self):
|
624
|
+
if self.env.DEST_BINFMT=='elf'and'gcc'in(self.env.CXX_NAME,self.env.CC_NAME):
|
625
|
+
self.env.append_unique('LINKFLAGS','--as-needed')
|
626
|
+
class cfgtask(Task.TaskBase):
|
627
|
+
def display(self):
|
628
|
+
return''
|
629
|
+
def runnable_status(self):
|
630
|
+
return Task.RUN_ME
|
631
|
+
def run(self):
|
632
|
+
conf=self.conf
|
633
|
+
bld=Build.BuildContext(top_dir=conf.srcnode.abspath(),out_dir=conf.bldnode.abspath())
|
634
|
+
bld.env=conf.env
|
635
|
+
bld.init_dirs()
|
636
|
+
bld.in_msg=1
|
637
|
+
bld.logger=self.logger
|
638
|
+
try:
|
639
|
+
bld.check(**self.args)
|
640
|
+
except:
|
641
|
+
return 1
|
642
|
+
def multicheck(self,*k,**kw):
|
643
|
+
self.start_msg(kw.get('msg','Executing %d configuration tests'%len(k)))
|
644
|
+
class par(object):
|
645
|
+
def __init__(self):
|
646
|
+
self.keep=False
|
647
|
+
self.cache_global=Options.cache_global
|
648
|
+
self.nocache=Options.options.nocache
|
649
|
+
self.returned_tasks=[]
|
650
|
+
def total(self):
|
651
|
+
return len(tasks)
|
652
|
+
def to_log(self,*k,**kw):
|
653
|
+
return
|
654
|
+
bld=par()
|
655
|
+
tasks=[]
|
656
|
+
for dct in k:
|
657
|
+
x=cfgtask(bld=bld)
|
658
|
+
tasks.append(x)
|
659
|
+
x.args=dct
|
660
|
+
x.bld=bld
|
661
|
+
x.conf=self
|
662
|
+
x.args=dct
|
663
|
+
x.logger=Logs.make_mem_logger(str(id(x)),self.logger)
|
664
|
+
def it():
|
665
|
+
yield tasks
|
666
|
+
while 1:
|
667
|
+
yield[]
|
668
|
+
p=Runner.Parallel(bld,Options.options.jobs)
|
669
|
+
p.biter=it()
|
670
|
+
p.start()
|
671
|
+
for x in tasks:
|
672
|
+
x.logger.memhandler.flush()
|
673
|
+
for x in tasks:
|
674
|
+
if x.hasrun!=Task.SUCCESS:
|
675
|
+
self.end_msg(kw.get('errmsg','no'),color='YELLOW')
|
676
|
+
self.fatal(kw.get('fatalmsg',None)or'One of the tests has failed, see the config.log for more information')
|
677
|
+
self.end_msg('ok')
|
678
|
+
|
679
|
+
conf(parse_flags)
|
680
|
+
conf(ret_msg)
|
681
|
+
conf(validate_cfg)
|
682
|
+
conf(exec_cfg)
|
683
|
+
conf(check_cfg)
|
684
|
+
conf(validate_c)
|
685
|
+
conf(post_check)
|
686
|
+
conf(check)
|
687
|
+
feature('test_exec')(test_exec_fun)
|
688
|
+
after_method('apply_link')(test_exec_fun)
|
689
|
+
conf(run_c_code)
|
690
|
+
conf(check_cxx)
|
691
|
+
conf(check_cc)
|
692
|
+
conf(define)
|
693
|
+
conf(undefine)
|
694
|
+
conf(define_cond)
|
695
|
+
conf(is_defined)
|
696
|
+
conf(get_define)
|
697
|
+
conf(have_define)
|
698
|
+
conf(write_config_header)
|
699
|
+
conf(get_config_header)
|
700
|
+
conf(cc_add_flags)
|
701
|
+
conf(cxx_add_flags)
|
702
|
+
conf(link_add_flags)
|
703
|
+
conf(cc_load_tools)
|
704
|
+
conf(cxx_load_tools)
|
705
|
+
conf(get_cc_version)
|
706
|
+
conf(get_xlc_version)
|
707
|
+
conf(add_as_needed)
|
708
|
+
conf(multicheck)
|