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
@@ -0,0 +1,104 @@
|
|
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
|
6
|
+
from waflib import Task,Options,Utils
|
7
|
+
from waflib.TaskGen import before_method,feature,after_method,Task,extension
|
8
|
+
from waflib.Configure import conf
|
9
|
+
def init_rubyext(self):
|
10
|
+
self.install_path='${ARCHDIR_RUBY}'
|
11
|
+
self.uselib=self.to_list(getattr(self,'uselib',''))
|
12
|
+
if not'RUBY'in self.uselib:
|
13
|
+
self.uselib.append('RUBY')
|
14
|
+
if not'RUBYEXT'in self.uselib:
|
15
|
+
self.uselib.append('RUBYEXT')
|
16
|
+
def apply_ruby_so_name(self):
|
17
|
+
self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['rubyext_PATTERN']
|
18
|
+
def check_ruby_version(self,minver=()):
|
19
|
+
if Options.options.rubybinary:
|
20
|
+
self.env.RUBY=Options.options.rubybinary
|
21
|
+
else:
|
22
|
+
self.find_program('ruby',var='RUBY')
|
23
|
+
ruby=self.env.RUBY
|
24
|
+
try:
|
25
|
+
version=self.cmd_and_log([ruby,'-e','puts defined?(VERSION) ? VERSION : RUBY_VERSION']).strip()
|
26
|
+
except:
|
27
|
+
self.fatal('could not determine ruby version')
|
28
|
+
self.env.RUBY_VERSION=version
|
29
|
+
try:
|
30
|
+
ver=tuple(map(int,version.split(".")))
|
31
|
+
except:
|
32
|
+
self.fatal('unsupported ruby version %r'%version)
|
33
|
+
cver=''
|
34
|
+
if minver:
|
35
|
+
if ver<minver:
|
36
|
+
self.fatal('ruby is too old %r'%ver)
|
37
|
+
cver='.'.join([str(x)for x in minver])
|
38
|
+
else:
|
39
|
+
cver=ver
|
40
|
+
self.msg('Checking for ruby version %s'%str(minver or''),cver)
|
41
|
+
def check_ruby_ext_devel(self):
|
42
|
+
if not self.env.RUBY:
|
43
|
+
self.fatal('ruby detection is required first')
|
44
|
+
if not self.env.CC_NAME and not self.env.CXX_NAME:
|
45
|
+
self.fatal('load a c/c++ compiler first')
|
46
|
+
version=tuple(map(int,self.env.RUBY_VERSION.split(".")))
|
47
|
+
def read_out(cmd):
|
48
|
+
return Utils.to_list(self.cmd_and_log([self.env.RUBY,'-rrbconfig','-e',cmd]))
|
49
|
+
def read_config(key):
|
50
|
+
return read_out('puts Config::CONFIG[%r]'%key)
|
51
|
+
ruby=self.env['RUBY']
|
52
|
+
archdir=read_config('archdir')
|
53
|
+
cpppath=archdir
|
54
|
+
if version>=(1,9,0):
|
55
|
+
ruby_hdrdir=read_config('rubyhdrdir')
|
56
|
+
cpppath+=ruby_hdrdir
|
57
|
+
cpppath+=[os.path.join(ruby_hdrdir[0],read_config('arch')[0])]
|
58
|
+
self.check(header_name='ruby.h',includes=cpppath,errmsg='could not find ruby header file')
|
59
|
+
self.env.LIBPATH_RUBYEXT=read_config('libdir')
|
60
|
+
self.env.LIBPATH_RUBYEXT+=archdir
|
61
|
+
self.env.INCLUDES_RUBYEXT=cpppath
|
62
|
+
self.env.CFLAGS_RUBYEXT=read_config('CCDLFLAGS')
|
63
|
+
self.env.rubyext_PATTERN='%s.'+read_config('DLEXT')[0]
|
64
|
+
flags=read_config('LDSHARED')
|
65
|
+
while flags and flags[0][0]!='-':
|
66
|
+
flags=flags[1:]
|
67
|
+
if len(flags)>1 and flags[1]=="ppc":
|
68
|
+
flags=flags[2:]
|
69
|
+
self.env.LINKFLAGS_RUBYEXT=flags
|
70
|
+
self.env.LINKFLAGS_RUBYEXT+=read_config('LIBS')
|
71
|
+
self.env.LINKFLAGS_RUBYEXT+=read_config('LIBRUBYARG_SHARED')
|
72
|
+
if Options.options.rubyarchdir:
|
73
|
+
self.env.ARCHDIR_RUBY=Options.options.rubyarchdir
|
74
|
+
else:
|
75
|
+
self.env.ARCHDIR_RUBY=read_config('sitearchdir')[0]
|
76
|
+
if Options.options.rubylibdir:
|
77
|
+
self.env.LIBDIR_RUBY=Options.options.rubylibdir
|
78
|
+
else:
|
79
|
+
self.env.LIBDIR_RUBY=read_config('sitelibdir')[0]
|
80
|
+
def check_ruby_module(self,module_name):
|
81
|
+
self.start_msg('Ruby module %s'%module_name)
|
82
|
+
try:
|
83
|
+
self.cmd_and_log([self.env['RUBY'],'-e','require \'%s\';puts 1'%module_name])
|
84
|
+
except:
|
85
|
+
self.end_msg(False)
|
86
|
+
self.fatal('Could not find the ruby module %r'%module_name)
|
87
|
+
self.end_msg(True)
|
88
|
+
def process(self,node):
|
89
|
+
tsk=self.create_task('run_ruby',node)
|
90
|
+
class run_ruby(Task.Task):
|
91
|
+
run_str='${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'
|
92
|
+
def options(opt):
|
93
|
+
opt.add_option('--with-ruby-archdir',type='string',dest='rubyarchdir',help='Specify directory where to install arch specific files')
|
94
|
+
opt.add_option('--with-ruby-libdir',type='string',dest='rubylibdir',help='Specify alternate ruby library path')
|
95
|
+
opt.add_option('--with-ruby-binary',type='string',dest='rubybinary',help='Specify alternate ruby binary')
|
96
|
+
|
97
|
+
feature('rubyext')(init_rubyext)
|
98
|
+
before_method('apply_incpaths','apply_lib_vars','apply_bundle','apply_link')(init_rubyext)
|
99
|
+
feature('rubyext')(apply_ruby_so_name)
|
100
|
+
before_method('apply_link','propagate_uselib')(apply_ruby_so_name)
|
101
|
+
conf(check_ruby_version)
|
102
|
+
conf(check_ruby_ext_devel)
|
103
|
+
conf(check_ruby_module)
|
104
|
+
extension('.rb')(process)
|
data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncc.py
ADDED
@@ -0,0 +1,54 @@
|
|
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
|
6
|
+
from waflib import Utils
|
7
|
+
from waflib.Tools import ccroot,ar
|
8
|
+
from waflib.Configure import conf
|
9
|
+
def find_scc(conf):
|
10
|
+
v=conf.env
|
11
|
+
cc=None
|
12
|
+
if v['CC']:cc=v['CC']
|
13
|
+
elif'CC'in conf.environ:cc=conf.environ['CC']
|
14
|
+
if not cc:cc=conf.find_program('cc',var='CC')
|
15
|
+
if not cc:conf.fatal('Could not find a Sun C compiler')
|
16
|
+
cc=conf.cmd_to_list(cc)
|
17
|
+
try:
|
18
|
+
conf.cmd_and_log(cc+['-flags'])
|
19
|
+
except:
|
20
|
+
conf.fatal('%r is not a Sun compiler'%cc)
|
21
|
+
v['CC']=cc
|
22
|
+
v['CC_NAME']='sun'
|
23
|
+
def scc_common_flags(conf):
|
24
|
+
v=conf.env
|
25
|
+
v['CC_SRC_F']=[]
|
26
|
+
v['CC_TGT_F']=['-c','-o']
|
27
|
+
if not v['LINK_CC']:v['LINK_CC']=v['CC']
|
28
|
+
v['CCLNK_SRC_F']=''
|
29
|
+
v['CCLNK_TGT_F']=['-o']
|
30
|
+
v['CPPPATH_ST']='-I%s'
|
31
|
+
v['DEFINES_ST']='-D%s'
|
32
|
+
v['LIB_ST']='-l%s'
|
33
|
+
v['LIBPATH_ST']='-L%s'
|
34
|
+
v['STLIB_ST']='-l%s'
|
35
|
+
v['STLIBPATH_ST']='-L%s'
|
36
|
+
v['SONAME_ST']='-Wl,-h,%s'
|
37
|
+
v['SHLIB_MARKER']='-Bdynamic'
|
38
|
+
v['STLIB_MARKER']='-Bstatic'
|
39
|
+
v['cprogram_PATTERN']='%s'
|
40
|
+
v['CFLAGS_cshlib']=['-Kpic','-DPIC']
|
41
|
+
v['LINKFLAGS_cshlib']=['-G']
|
42
|
+
v['cshlib_PATTERN']='lib%s.so'
|
43
|
+
v['LINKFLAGS_cstlib']=['-Bstatic']
|
44
|
+
v['cstlib_PATTERN']='lib%s.a'
|
45
|
+
def configure(conf):
|
46
|
+
conf.find_scc()
|
47
|
+
conf.find_ar()
|
48
|
+
conf.scc_common_flags()
|
49
|
+
conf.cc_load_tools()
|
50
|
+
conf.cc_add_flags()
|
51
|
+
conf.link_add_flags()
|
52
|
+
|
53
|
+
conf(find_scc)
|
54
|
+
conf(scc_common_flags)
|
data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncxx.py
ADDED
@@ -0,0 +1,55 @@
|
|
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
|
6
|
+
from waflib import Utils
|
7
|
+
from waflib.Tools import ccroot,ar
|
8
|
+
from waflib.Configure import conf
|
9
|
+
def find_sxx(conf):
|
10
|
+
v=conf.env
|
11
|
+
cc=None
|
12
|
+
if v['CXX']:cc=v['CXX']
|
13
|
+
elif'CXX'in conf.environ:cc=conf.environ['CXX']
|
14
|
+
if not cc:cc=conf.find_program('CC',var='CXX')
|
15
|
+
if not cc:cc=conf.find_program('c++',var='CXX')
|
16
|
+
if not cc:conf.fatal('Could not find a Sun C++ compiler')
|
17
|
+
cc=conf.cmd_to_list(cc)
|
18
|
+
try:
|
19
|
+
conf.cmd_and_log(cc+['-flags'])
|
20
|
+
except:
|
21
|
+
conf.fatal('%r is not a Sun compiler'%cc)
|
22
|
+
v['CXX']=cc
|
23
|
+
v['CXX_NAME']='sun'
|
24
|
+
def sxx_common_flags(conf):
|
25
|
+
v=conf.env
|
26
|
+
v['CXX_SRC_F']=[]
|
27
|
+
v['CXX_TGT_F']=['-c','-o']
|
28
|
+
if not v['LINK_CXX']:v['LINK_CXX']=v['CXX']
|
29
|
+
v['CXXLNK_SRC_F']=[]
|
30
|
+
v['CXXLNK_TGT_F']=['-o']
|
31
|
+
v['CPPPATH_ST']='-I%s'
|
32
|
+
v['DEFINES_ST']='-D%s'
|
33
|
+
v['LIB_ST']='-l%s'
|
34
|
+
v['LIBPATH_ST']='-L%s'
|
35
|
+
v['STLIB_ST']='-l%s'
|
36
|
+
v['STLIBPATH_ST']='-L%s'
|
37
|
+
v['SONAME_ST']='-Wl,-h,%s'
|
38
|
+
v['SHLIB_MARKER']='-Bdynamic'
|
39
|
+
v['STLIB_MARKER']='-Bstatic'
|
40
|
+
v['cxxprogram_PATTERN']='%s'
|
41
|
+
v['CXXFLAGS_cxxshlib']=['-Kpic','-DPIC']
|
42
|
+
v['LINKFLAGS_cxxshlib']=['-G']
|
43
|
+
v['cxxshlib_PATTERN']='lib%s.so'
|
44
|
+
v['LINKFLAGS_cxxstlib']=['-Bstatic']
|
45
|
+
v['cxxstlib_PATTERN']='lib%s.a'
|
46
|
+
def configure(conf):
|
47
|
+
conf.find_sxx()
|
48
|
+
conf.find_ar()
|
49
|
+
conf.sxx_common_flags()
|
50
|
+
conf.cxx_load_tools()
|
51
|
+
conf.cxx_add_flags()
|
52
|
+
conf.link_add_flags()
|
53
|
+
|
54
|
+
conf(find_sxx)
|
55
|
+
conf(sxx_common_flags)
|
@@ -0,0 +1,222 @@
|
|
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,re
|
6
|
+
from waflib import Utils,Task,Runner,Build,Errors
|
7
|
+
from waflib.TaskGen import feature,before_method
|
8
|
+
from waflib.Logs import error,warn,debug
|
9
|
+
re_bibunit=re.compile(r'\\(?P<type>putbib)\[(?P<file>[^\[\]]*)\]',re.M)
|
10
|
+
def bibunitscan(self):
|
11
|
+
node=self.inputs[0]
|
12
|
+
env=self.env
|
13
|
+
nodes=[]
|
14
|
+
if not node:return nodes
|
15
|
+
code=Utils.readf(node.abspath())
|
16
|
+
for match in re_bibunit.finditer(code):
|
17
|
+
path=match.group('file')
|
18
|
+
if path:
|
19
|
+
for k in['','.bib']:
|
20
|
+
debug('tex: trying %s%s'%(path,k))
|
21
|
+
fi=node.parent.find_resource(path+k)
|
22
|
+
if fi:
|
23
|
+
nodes.append(fi)
|
24
|
+
else:
|
25
|
+
debug('tex: could not find %s'%path)
|
26
|
+
debug("tex: found the following bibunit files: %s"%nodes)
|
27
|
+
return nodes
|
28
|
+
exts_deps_tex=['','.ltx','.tex','.bib','.pdf','.png','.eps','.ps']
|
29
|
+
re_tex=re.compile(r'\\(?P<type>include|bibliography|putbib|includegraphics|input|import|bringin|lstinputlisting)(\[[^\[\]]*\])?{(?P<file>[^{}]*)}',re.M)
|
30
|
+
g_bibtex_re=re.compile('bibdata',re.M)
|
31
|
+
class tex(Task.Task):
|
32
|
+
bibtex_fun,_=Task.compile_fun('${BIBTEX} ${BIBTEXFLAGS} ${SRCFILE}',shell=False)
|
33
|
+
bibtex_fun.__doc__="""
|
34
|
+
Execute the program **bibtex**
|
35
|
+
"""
|
36
|
+
makeindex_fun,_=Task.compile_fun('${MAKEINDEX} ${MAKEINDEXFLAGS} ${SRCFILE}',shell=False)
|
37
|
+
makeindex_fun.__doc__="""
|
38
|
+
Execute the program **makeindex**
|
39
|
+
"""
|
40
|
+
def scan(self):
|
41
|
+
node=self.inputs[0]
|
42
|
+
env=self.env
|
43
|
+
nodes=[]
|
44
|
+
names=[]
|
45
|
+
seen=[]
|
46
|
+
if not node:return(nodes,names)
|
47
|
+
def parse_node(node):
|
48
|
+
if node in seen:
|
49
|
+
return
|
50
|
+
seen.append(node)
|
51
|
+
code=node.read()
|
52
|
+
global re_tex
|
53
|
+
for match in re_tex.finditer(code):
|
54
|
+
for path in match.group('file').split(','):
|
55
|
+
if path:
|
56
|
+
add_name=True
|
57
|
+
found=None
|
58
|
+
for k in exts_deps_tex:
|
59
|
+
debug('tex: trying %s%s'%(path,k))
|
60
|
+
found=node.parent.find_resource(path+k)
|
61
|
+
if found and not found in self.outputs:
|
62
|
+
nodes.append(found)
|
63
|
+
add_name=False
|
64
|
+
if found.name.endswith('.tex')or found.name.endswith('.ltx'):
|
65
|
+
parse_node(found)
|
66
|
+
if add_name:
|
67
|
+
names.append(path)
|
68
|
+
parse_node(node)
|
69
|
+
for x in nodes:
|
70
|
+
x.parent.get_bld().mkdir()
|
71
|
+
debug("tex: found the following : %s and names %s"%(nodes,names))
|
72
|
+
return(nodes,names)
|
73
|
+
def check_status(self,msg,retcode):
|
74
|
+
if retcode!=0:
|
75
|
+
raise Errors.WafError("%r command exit status %r"%(msg,retcode))
|
76
|
+
def bibfile(self):
|
77
|
+
try:
|
78
|
+
ct=self.aux_node.read()
|
79
|
+
except(OSError,IOError):
|
80
|
+
error('error bibtex scan')
|
81
|
+
else:
|
82
|
+
fo=g_bibtex_re.findall(ct)
|
83
|
+
if fo:
|
84
|
+
warn('calling bibtex')
|
85
|
+
self.env.env={}
|
86
|
+
self.env.env.update(os.environ)
|
87
|
+
self.env.env.update({'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS})
|
88
|
+
self.env.SRCFILE=self.aux_node.name[:-4]
|
89
|
+
self.check_status('error when calling bibtex',self.bibtex_fun())
|
90
|
+
def bibunits(self):
|
91
|
+
try:
|
92
|
+
bibunits=bibunitscan(self)
|
93
|
+
except FSError:
|
94
|
+
error('error bibunitscan')
|
95
|
+
else:
|
96
|
+
if bibunits:
|
97
|
+
fn=['bu'+str(i)for i in xrange(1,len(bibunits)+1)]
|
98
|
+
if fn:
|
99
|
+
warn('calling bibtex on bibunits')
|
100
|
+
for f in fn:
|
101
|
+
self.env.env={'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS}
|
102
|
+
self.env.SRCFILE=f
|
103
|
+
self.check_status('error when calling bibtex',self.bibtex_fun())
|
104
|
+
def makeindex(self):
|
105
|
+
try:
|
106
|
+
idx_path=self.idx_node.abspath()
|
107
|
+
os.stat(idx_path)
|
108
|
+
except OSError:
|
109
|
+
warn('index file %s absent, not calling makeindex'%idx_path)
|
110
|
+
else:
|
111
|
+
warn('calling makeindex')
|
112
|
+
self.env.SRCFILE=self.idx_node.name
|
113
|
+
self.env.env={}
|
114
|
+
self.check_status('error when calling makeindex %s'%idx_path,self.makeindex_fun())
|
115
|
+
def run(self):
|
116
|
+
env=self.env
|
117
|
+
bld=self.generator.bld
|
118
|
+
if not env['PROMPT_LATEX']:
|
119
|
+
env.append_value('LATEXFLAGS','-interaction=batchmode')
|
120
|
+
env.append_value('PDFLATEXFLAGS','-interaction=batchmode')
|
121
|
+
env.append_value('XELATEXFLAGS','-interaction=batchmode')
|
122
|
+
fun=self.texfun
|
123
|
+
node=self.inputs[0]
|
124
|
+
srcfile=node.abspath()
|
125
|
+
texinputs=self.env.TEXINPUTS or''
|
126
|
+
self.TEXINPUTS=node.parent.get_bld().abspath()+os.pathsep+node.parent.get_src().abspath()+os.pathsep+texinputs+os.pathsep
|
127
|
+
self.aux_node=node.change_ext('.aux')
|
128
|
+
self.idx_node=node.change_ext('.idx')
|
129
|
+
self.cwd=self.inputs[0].parent.get_bld().abspath()
|
130
|
+
warn('first pass on %s'%self.__class__.__name__)
|
131
|
+
self.env.env={}
|
132
|
+
self.env.env.update(os.environ)
|
133
|
+
self.env.env.update({'TEXINPUTS':self.TEXINPUTS})
|
134
|
+
self.env.SRCFILE=srcfile
|
135
|
+
self.check_status('error when calling latex',fun())
|
136
|
+
self.bibfile()
|
137
|
+
self.bibunits()
|
138
|
+
self.makeindex()
|
139
|
+
hash=''
|
140
|
+
for i in range(10):
|
141
|
+
prev_hash=hash
|
142
|
+
try:
|
143
|
+
hash=Utils.h_file(self.aux_node.abspath())
|
144
|
+
except(OSError,IOError):
|
145
|
+
error('could not read aux.h -> %s'%self.aux_node.abspath())
|
146
|
+
pass
|
147
|
+
if hash and hash==prev_hash:
|
148
|
+
break
|
149
|
+
warn('calling %s'%self.__class__.__name__)
|
150
|
+
self.env.env={}
|
151
|
+
self.env.env.update(os.environ)
|
152
|
+
self.env.env.update({'TEXINPUTS':self.TEXINPUTS})
|
153
|
+
self.env.SRCFILE=srcfile
|
154
|
+
self.check_status('error when calling %s'%self.__class__.__name__,fun())
|
155
|
+
class latex(tex):
|
156
|
+
texfun,vars=Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}',shell=False)
|
157
|
+
class pdflatex(tex):
|
158
|
+
texfun,vars=Task.compile_fun('${PDFLATEX} ${PDFLATEXFLAGS} ${SRCFILE}',shell=False)
|
159
|
+
class xelatex(tex):
|
160
|
+
texfun,vars=Task.compile_fun('${XELATEX} ${XELATEXFLAGS} ${SRCFILE}',shell=False)
|
161
|
+
class dvips(Task.Task):
|
162
|
+
run_str='${DVIPS} ${DVIPSFLAGS} ${SRC} -o ${TGT}'
|
163
|
+
color='BLUE'
|
164
|
+
after=['latex','pdflatex','xelatex']
|
165
|
+
class dvipdf(Task.Task):
|
166
|
+
run_str='${DVIPDF} ${DVIPDFFLAGS} ${SRC} ${TGT}'
|
167
|
+
color='BLUE'
|
168
|
+
after=['latex','pdflatex','xelatex']
|
169
|
+
class pdf2ps(Task.Task):
|
170
|
+
run_str='${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}'
|
171
|
+
color='BLUE'
|
172
|
+
after=['latex','pdflatex','xelatex']
|
173
|
+
def apply_tex(self):
|
174
|
+
if not getattr(self,'type',None)in['latex','pdflatex','xelatex']:
|
175
|
+
self.type='pdflatex'
|
176
|
+
tree=self.bld
|
177
|
+
outs=Utils.to_list(getattr(self,'outs',[]))
|
178
|
+
self.env['PROMPT_LATEX']=getattr(self,'prompt',1)
|
179
|
+
deps_lst=[]
|
180
|
+
if getattr(self,'deps',None):
|
181
|
+
deps=self.to_list(self.deps)
|
182
|
+
for filename in deps:
|
183
|
+
n=self.path.find_resource(filename)
|
184
|
+
if not n in deps_lst:deps_lst.append(n)
|
185
|
+
for node in self.to_nodes(self.source):
|
186
|
+
if self.type=='latex':
|
187
|
+
task=self.create_task('latex',node,node.change_ext('.dvi'))
|
188
|
+
elif self.type=='pdflatex':
|
189
|
+
task=self.create_task('pdflatex',node,node.change_ext('.pdf'))
|
190
|
+
elif self.type=='xelatex':
|
191
|
+
task=self.create_task('xelatex',node,node.change_ext('.pdf'))
|
192
|
+
task.env=self.env
|
193
|
+
if deps_lst:
|
194
|
+
try:
|
195
|
+
lst=tree.node_deps[task.uid()]
|
196
|
+
for n in deps_lst:
|
197
|
+
if not n in lst:
|
198
|
+
lst.append(n)
|
199
|
+
except KeyError:
|
200
|
+
tree.node_deps[task.uid()]=deps_lst
|
201
|
+
if self.type=='latex':
|
202
|
+
if'ps'in outs:
|
203
|
+
tsk=self.create_task('dvips',task.outputs,node.change_ext('.ps'))
|
204
|
+
tsk.env.env={'TEXINPUTS':node.parent.abspath()+os.pathsep+self.path.abspath()+os.pathsep+self.path.get_bld().abspath()}
|
205
|
+
if'pdf'in outs:
|
206
|
+
tsk=self.create_task('dvipdf',task.outputs,node.change_ext('.pdf'))
|
207
|
+
tsk.env.env={'TEXINPUTS':node.parent.abspath()+os.pathsep+self.path.abspath()+os.pathsep+self.path.get_bld().abspath()}
|
208
|
+
elif self.type=='pdflatex':
|
209
|
+
if'ps'in outs:
|
210
|
+
self.create_task('pdf2ps',task.outputs,node.change_ext('.ps'))
|
211
|
+
self.source=[]
|
212
|
+
def configure(self):
|
213
|
+
v=self.env
|
214
|
+
for p in'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split():
|
215
|
+
try:
|
216
|
+
self.find_program(p,var=p.upper())
|
217
|
+
except self.errors.ConfigurationError:
|
218
|
+
pass
|
219
|
+
v['DVIPSFLAGS']='-Ppdf'
|
220
|
+
|
221
|
+
feature('tex')(apply_tex)
|
222
|
+
before_method('process_source')(apply_tex)
|
@@ -0,0 +1,215 @@
|
|
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.path,shutil,re
|
6
|
+
from waflib import Context,Task,Utils,Logs,Options,Errors
|
7
|
+
from waflib.TaskGen import extension
|
8
|
+
from waflib.Configure import conf
|
9
|
+
class valac(Task.Task):
|
10
|
+
vars=["VALAC","VALAC_VERSION","VALAFLAGS"]
|
11
|
+
ext_out=['.h']
|
12
|
+
def run(self):
|
13
|
+
env=self.env
|
14
|
+
cmd=[env['VALAC'],'-C','--quiet']
|
15
|
+
cmd.extend(Utils.to_list(env['VALAFLAGS']))
|
16
|
+
if self.threading:
|
17
|
+
cmd.append('--thread')
|
18
|
+
if self.profile:
|
19
|
+
cmd.append('--profile=%s'%self.profile)
|
20
|
+
if self.target_glib:
|
21
|
+
cmd.append('--target-glib=%s'%self.target_glib)
|
22
|
+
if self.is_lib:
|
23
|
+
cmd.append('--library='+self.target)
|
24
|
+
for x in self.outputs:
|
25
|
+
if x.name.endswith('.h'):
|
26
|
+
cmd.append('--header='+x.name)
|
27
|
+
if self.gir:
|
28
|
+
cmd.append('--gir=%s.gir'%self.gir)
|
29
|
+
for vapi_dir in self.vapi_dirs:
|
30
|
+
cmd.append('--vapidir=%s'%vapi_dir)
|
31
|
+
for package in self.packages:
|
32
|
+
cmd.append('--pkg=%s'%package)
|
33
|
+
for package in self.packages_private:
|
34
|
+
cmd.append('--pkg=%s'%package)
|
35
|
+
for define in self.vala_defines:
|
36
|
+
cmd.append('--define=%s'%define)
|
37
|
+
cmd.extend([a.abspath()for a in self.inputs])
|
38
|
+
ret=self.exec_command(cmd,cwd=self.outputs[0].parent.abspath())
|
39
|
+
if ret:
|
40
|
+
return ret
|
41
|
+
for x in self.outputs:
|
42
|
+
if id(x.parent)!=id(self.outputs[0].parent):
|
43
|
+
shutil.move(self.outputs[0].parent.abspath()+os.sep+x.name,x.abspath())
|
44
|
+
if self.packages and getattr(self,'deps_node',None):
|
45
|
+
self.deps_node.write('\n'.join(self.packages))
|
46
|
+
return ret
|
47
|
+
def vala_file(self,node):
|
48
|
+
valatask=getattr(self,"valatask",None)
|
49
|
+
if not valatask:
|
50
|
+
def _get_api_version():
|
51
|
+
api_version='1.0'
|
52
|
+
if hasattr(Context.g_module,'API_VERSION'):
|
53
|
+
version=Context.g_module.API_VERSION.split(".")
|
54
|
+
if version[0]=="0":
|
55
|
+
api_version="0."+version[1]
|
56
|
+
else:
|
57
|
+
api_version=version[0]+".0"
|
58
|
+
return api_version
|
59
|
+
valatask=self.create_task('valac')
|
60
|
+
self.valatask=valatask
|
61
|
+
self.includes=Utils.to_list(getattr(self,'includes',[]))
|
62
|
+
self.uselib=self.to_list(getattr(self,'uselib',[]))
|
63
|
+
valatask.packages=[]
|
64
|
+
valatask.packages_private=Utils.to_list(getattr(self,'packages_private',[]))
|
65
|
+
valatask.vapi_dirs=[]
|
66
|
+
valatask.target=self.target
|
67
|
+
valatask.threading=False
|
68
|
+
valatask.install_path=getattr(self,'install_path','')
|
69
|
+
valatask.profile=getattr(self,'profile','gobject')
|
70
|
+
valatask.vala_defines=getattr(self,'vala_defines',[])
|
71
|
+
valatask.target_glib=None
|
72
|
+
valatask.gir=getattr(self,'gir',None)
|
73
|
+
valatask.gir_path=getattr(self,'gir_path','${DATAROOTDIR}/gir-1.0')
|
74
|
+
valatask.vapi_path=getattr(self,'vapi_path','${DATAROOTDIR}/vala/vapi')
|
75
|
+
valatask.pkg_name=getattr(self,'pkg_name',self.env['PACKAGE'])
|
76
|
+
valatask.header_path=getattr(self,'header_path','${INCLUDEDIR}/%s-%s'%(valatask.pkg_name,_get_api_version()))
|
77
|
+
valatask.is_lib=False
|
78
|
+
if not'cprogram'in self.features:
|
79
|
+
valatask.is_lib=True
|
80
|
+
packages=Utils.to_list(getattr(self,'packages',[]))
|
81
|
+
vapi_dirs=Utils.to_list(getattr(self,'vapi_dirs',[]))
|
82
|
+
includes=[]
|
83
|
+
if hasattr(self,'use'):
|
84
|
+
local_packages=Utils.to_list(self.use)[:]
|
85
|
+
seen=[]
|
86
|
+
while len(local_packages)>0:
|
87
|
+
package=local_packages.pop()
|
88
|
+
if package in seen:
|
89
|
+
continue
|
90
|
+
seen.append(package)
|
91
|
+
try:
|
92
|
+
package_obj=self.bld.get_tgen_by_name(package)
|
93
|
+
except Errors.WafError:
|
94
|
+
continue
|
95
|
+
package_name=package_obj.target
|
96
|
+
package_node=package_obj.path
|
97
|
+
package_dir=package_node.path_from(self.path)
|
98
|
+
for task in package_obj.tasks:
|
99
|
+
for output in task.outputs:
|
100
|
+
if output.name==package_name+".vapi":
|
101
|
+
valatask.set_run_after(task)
|
102
|
+
if package_name not in packages:
|
103
|
+
packages.append(package_name)
|
104
|
+
if package_dir not in vapi_dirs:
|
105
|
+
vapi_dirs.append(package_dir)
|
106
|
+
if package_dir not in includes:
|
107
|
+
includes.append(package_dir)
|
108
|
+
if hasattr(package_obj,'use'):
|
109
|
+
lst=self.to_list(package_obj.use)
|
110
|
+
lst.reverse()
|
111
|
+
local_packages=[pkg for pkg in lst if pkg not in seen]+local_packages
|
112
|
+
valatask.packages=packages
|
113
|
+
for vapi_dir in vapi_dirs:
|
114
|
+
try:
|
115
|
+
valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath())
|
116
|
+
valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).get_bld().abspath())
|
117
|
+
except AttributeError:
|
118
|
+
Logs.warn("Unable to locate Vala API directory: '%s'"%vapi_dir)
|
119
|
+
self.includes.append(self.bld.srcnode.abspath())
|
120
|
+
self.includes.append(self.bld.bldnode.abspath())
|
121
|
+
for include in includes:
|
122
|
+
try:
|
123
|
+
self.includes.append(self.path.find_dir(include).abspath())
|
124
|
+
self.includes.append(self.path.find_dir(include).get_bld().abspath())
|
125
|
+
except AttributeError:
|
126
|
+
Logs.warn("Unable to locate include directory: '%s'"%include)
|
127
|
+
if valatask.profile=='gobject':
|
128
|
+
if hasattr(self,'target_glib'):
|
129
|
+
Logs.warn('target_glib on vala tasks is not supported --vala-target-glib=MAJOR.MINOR from the vala tool options')
|
130
|
+
if getattr(Options.options,'vala_target_glib',None):
|
131
|
+
valatask.target_glib=Options.options.vala_target_glib
|
132
|
+
if not'GOBJECT'in self.uselib:
|
133
|
+
self.uselib.append('GOBJECT')
|
134
|
+
if hasattr(self,'threading'):
|
135
|
+
if valatask.profile=='gobject':
|
136
|
+
valatask.threading=self.threading
|
137
|
+
if not'GTHREAD'in self.uselib:
|
138
|
+
self.uselib.append('GTHREAD')
|
139
|
+
else:
|
140
|
+
Logs.warn("Profile %s does not have threading support"%valatask.profile)
|
141
|
+
if valatask.is_lib:
|
142
|
+
valatask.outputs.append(self.path.find_or_declare('%s.h'%self.target))
|
143
|
+
valatask.outputs.append(self.path.find_or_declare('%s.vapi'%self.target))
|
144
|
+
if valatask.gir:
|
145
|
+
valatask.outputs.append(self.path.find_or_declare('%s.gir'%self.gir))
|
146
|
+
if valatask.packages:
|
147
|
+
d=self.path.find_or_declare('%s.deps'%self.target)
|
148
|
+
valatask.outputs.append(d)
|
149
|
+
valatask.deps_node=d
|
150
|
+
valatask.inputs.append(node)
|
151
|
+
c_node=node.change_ext('.c')
|
152
|
+
valatask.outputs.append(c_node)
|
153
|
+
self.source.append(c_node)
|
154
|
+
if valatask.is_lib:
|
155
|
+
headers_list=[o for o in valatask.outputs if o.suffix()==".h"]
|
156
|
+
try:
|
157
|
+
self.install_vheader.source=headers_list
|
158
|
+
except AttributeError:
|
159
|
+
self.install_vheader=self.bld.install_files(valatask.header_path,headers_list,self.env)
|
160
|
+
vapi_list=[o for o in valatask.outputs if(o.suffix()in(".vapi",".deps"))]
|
161
|
+
try:
|
162
|
+
self.install_vapi.source=vapi_list
|
163
|
+
except AttributeError:
|
164
|
+
self.install_vapi=self.bld.install_files(valatask.vapi_path,vapi_list,self.env)
|
165
|
+
gir_list=[o for o in valatask.outputs if o.suffix()==".gir"]
|
166
|
+
try:
|
167
|
+
self.install_gir.source=gir_list
|
168
|
+
except AttributeError:
|
169
|
+
self.install_gir=self.bld.install_files(valatask.gir_path,gir_list,self.env)
|
170
|
+
valac=Task.update_outputs(valac)
|
171
|
+
def find_valac(self,valac_name,min_version):
|
172
|
+
valac=self.find_program(valac_name,var='VALAC')
|
173
|
+
try:
|
174
|
+
output=self.cmd_and_log(valac+' --version')
|
175
|
+
except Exception:
|
176
|
+
valac_version=None
|
177
|
+
else:
|
178
|
+
ver=re.search(r'\d+.\d+.\d+',output).group(0).split('.')
|
179
|
+
valac_version=tuple([int(x)for x in ver])
|
180
|
+
self.msg('Checking for %s version >= %r'%(valac_name,min_version),valac_version,valac_version and valac_version>=min_version)
|
181
|
+
if valac and valac_version<min_version:
|
182
|
+
self.fatal("%s version %r is too old, need >= %r"%(valac_name,valac_version,min_version))
|
183
|
+
self.env['VALAC_VERSION']=valac_version
|
184
|
+
return valac
|
185
|
+
def check_vala(self,min_version=(0,8,0),branch=None):
|
186
|
+
if not branch:
|
187
|
+
branch=min_version[:2]
|
188
|
+
try:
|
189
|
+
find_valac(self,'valac-%d.%d'%(branch[0],branch[1]),min_version)
|
190
|
+
except self.errors.ConfigurationError:
|
191
|
+
find_valac(self,'valac',min_version)
|
192
|
+
def check_vala_deps(self):
|
193
|
+
if not self.env['HAVE_GOBJECT']:
|
194
|
+
pkg_args={'package':'gobject-2.0','uselib_store':'GOBJECT','args':'--cflags --libs'}
|
195
|
+
if getattr(Options.options,'vala_target_glib',None):
|
196
|
+
pkg_args['atleast_version']=Options.options.vala_target_glib
|
197
|
+
self.check_cfg(**pkg_args)
|
198
|
+
if not self.env['HAVE_GTHREAD']:
|
199
|
+
pkg_args={'package':'gthread-2.0','uselib_store':'GTHREAD','args':'--cflags --libs'}
|
200
|
+
if getattr(Options.options,'vala_target_glib',None):
|
201
|
+
pkg_args['atleast_version']=Options.options.vala_target_glib
|
202
|
+
self.check_cfg(**pkg_args)
|
203
|
+
def configure(self):
|
204
|
+
self.load('gnu_dirs')
|
205
|
+
self.check_vala_deps()
|
206
|
+
self.check_vala()
|
207
|
+
def options(opt):
|
208
|
+
opt.load('gnu_dirs')
|
209
|
+
valaopts=opt.add_option_group('Vala Compiler Options')
|
210
|
+
valaopts.add_option('--vala-target-glib',default=None,dest='vala_target_glib',metavar='MAJOR.MINOR',help='Target version of glib for Vala GObject code generation')
|
211
|
+
|
212
|
+
extension('.vala','.gs')(vala_file)
|
213
|
+
conf(find_valac)
|
214
|
+
conf(check_vala)
|
215
|
+
conf(check_vala_deps)
|