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,13 @@
|
|
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 waflib.Tools.asm
|
6
|
+
from waflib.TaskGen import feature
|
7
|
+
def apply_nasm_vars(self):
|
8
|
+
self.env.append_value('ASFLAGS',self.to_list(getattr(self,'nasm_flags',[])))
|
9
|
+
def configure(conf):
|
10
|
+
nasm=conf.find_program(['nasm','yasm'],var='AS')
|
11
|
+
conf.env.AS_TGT_F='-o'
|
12
|
+
|
13
|
+
feature('asm')(apply_nasm_vars)
|
@@ -0,0 +1,78 @@
|
|
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.Configure import conf
|
8
|
+
from waflib.TaskGen import extension,feature,before_method
|
9
|
+
def init_perlext(self):
|
10
|
+
self.uselib=self.to_list(getattr(self,'uselib',[]))
|
11
|
+
if not'PERLEXT'in self.uselib:self.uselib.append('PERLEXT')
|
12
|
+
self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['perlext_PATTERN']
|
13
|
+
def xsubpp_file(self,node):
|
14
|
+
outnode=node.change_ext('.c')
|
15
|
+
self.create_task('xsubpp',node,outnode)
|
16
|
+
self.source.append(outnode)
|
17
|
+
class xsubpp(Task.Task):
|
18
|
+
run_str='${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}'
|
19
|
+
color='BLUE'
|
20
|
+
ext_out=['.h']
|
21
|
+
def check_perl_version(self,minver=None):
|
22
|
+
res=True
|
23
|
+
cver=""if minver is None else".".join(map(str,minver))
|
24
|
+
self.start_msg('Checking for minimum perl version %s'%cver)
|
25
|
+
perl=getattr(Options.options,'perlbinary',None)
|
26
|
+
if not perl:
|
27
|
+
perl=self.find_program('perl',var='PERL')
|
28
|
+
if not perl:
|
29
|
+
self.end_msg("Perl not found",color="YELLOW")
|
30
|
+
return False
|
31
|
+
self.env['PERL']=perl
|
32
|
+
version=self.cmd_and_log([perl,"-e",'printf \"%vd\", $^V'])
|
33
|
+
if not version:
|
34
|
+
res=False
|
35
|
+
version="Unknown"
|
36
|
+
elif not minver is None:
|
37
|
+
ver=tuple(map(int,version.split(".")))
|
38
|
+
if ver<minver:
|
39
|
+
res=False
|
40
|
+
self.end_msg(version,color="GREEN"if res else"YELLOW")
|
41
|
+
return res
|
42
|
+
def check_perl_module(self,module):
|
43
|
+
cmd=[self.env['PERL'],'-e','use %s'%module]
|
44
|
+
self.start_msg('perl module %s'%module)
|
45
|
+
try:
|
46
|
+
r=self.cmd_and_log(cmd)
|
47
|
+
except:
|
48
|
+
self.end_msg(False)
|
49
|
+
return None
|
50
|
+
self.end_msg(r or True)
|
51
|
+
return r
|
52
|
+
def check_perl_ext_devel(self):
|
53
|
+
env=self.env
|
54
|
+
perl=env.PERL
|
55
|
+
if not perl:
|
56
|
+
self.fatal('find perl first')
|
57
|
+
def read_out(cmd):
|
58
|
+
return Utils.to_list(self.cmd_and_log(perl+cmd))
|
59
|
+
env['LINKFLAGS_PERLEXT']=read_out(" -MConfig -e'print $Config{lddlflags}'")
|
60
|
+
env['INCLUDES_PERLEXT']=read_out(" -MConfig -e'print \"$Config{archlib}/CORE\"'")
|
61
|
+
env['CFLAGS_PERLEXT']=read_out(" -MConfig -e'print \"$Config{ccflags} $Config{cccdlflags}\"'")
|
62
|
+
env['XSUBPP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}\"'")
|
63
|
+
env['EXTUTILS_TYPEMAP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/typemap\"'")
|
64
|
+
if not getattr(Options.options,'perlarchdir',None):
|
65
|
+
env['ARCHDIR_PERL']=self.cmd_and_log(perl+" -MConfig -e'print $Config{sitearch}'")
|
66
|
+
else:
|
67
|
+
env['ARCHDIR_PERL']=getattr(Options.options,'perlarchdir')
|
68
|
+
env['perlext_PATTERN']='%s.'+self.cmd_and_log(perl+" -MConfig -e'print $Config{dlext}'")
|
69
|
+
def options(opt):
|
70
|
+
opt.add_option('--with-perl-binary',type='string',dest='perlbinary',help='Specify alternate perl binary',default=None)
|
71
|
+
opt.add_option('--with-perl-archdir',type='string',dest='perlarchdir',help='Specify directory where to install arch specific files',default=None)
|
72
|
+
|
73
|
+
before_method('apply_incpaths','apply_link','propagate_uselib_vars')(init_perlext)
|
74
|
+
feature('perlext')(init_perlext)
|
75
|
+
extension('.xs')(xsubpp_file)
|
76
|
+
conf(check_perl_version)
|
77
|
+
conf(check_perl_module)
|
78
|
+
conf(check_perl_ext_devel)
|
data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/python.py
ADDED
@@ -0,0 +1,303 @@
|
|
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
|
6
|
+
from waflib import Utils,Options,Errors
|
7
|
+
from waflib.Logs import debug,warn,info,error
|
8
|
+
from waflib.TaskGen import extension,before_method,after_method,feature
|
9
|
+
from waflib.Configure import conf
|
10
|
+
FRAG='''
|
11
|
+
#include <Python.h>
|
12
|
+
#ifdef __cplusplus
|
13
|
+
extern "C" {
|
14
|
+
#endif
|
15
|
+
void Py_Initialize(void);
|
16
|
+
void Py_Finalize(void);
|
17
|
+
#ifdef __cplusplus
|
18
|
+
}
|
19
|
+
#endif
|
20
|
+
int main()
|
21
|
+
{
|
22
|
+
Py_Initialize();
|
23
|
+
Py_Finalize();
|
24
|
+
return 0;
|
25
|
+
}
|
26
|
+
'''
|
27
|
+
INST='''
|
28
|
+
import sys, py_compile
|
29
|
+
py_compile.compile(sys.argv[1], sys.argv[2], sys.argv[3])
|
30
|
+
'''
|
31
|
+
def process_py(self,node):
|
32
|
+
try:
|
33
|
+
if not self.bld.is_install:
|
34
|
+
return
|
35
|
+
except:
|
36
|
+
return
|
37
|
+
try:
|
38
|
+
if not self.install_path:
|
39
|
+
return
|
40
|
+
except AttributeError:
|
41
|
+
self.install_path='${PYTHONDIR}'
|
42
|
+
def inst_py(ctx):
|
43
|
+
install_from=getattr(self,'install_from',None)
|
44
|
+
if install_from:
|
45
|
+
install_from=self.path.find_dir(install_from)
|
46
|
+
install_pyfile(self,node,install_from)
|
47
|
+
self.bld.add_post_fun(inst_py)
|
48
|
+
def install_pyfile(self,node,install_from=None):
|
49
|
+
from_node=install_from or node.parent
|
50
|
+
tsk=self.bld.install_as(self.install_path+'/'+node.path_from(from_node),node,postpone=False)
|
51
|
+
path=tsk.get_install_path()
|
52
|
+
if self.bld.is_install<0:
|
53
|
+
info("+ removing byte compiled python files")
|
54
|
+
for x in'co':
|
55
|
+
try:
|
56
|
+
os.remove(path+x)
|
57
|
+
except OSError:
|
58
|
+
pass
|
59
|
+
if self.bld.is_install>0:
|
60
|
+
try:
|
61
|
+
st1=os.stat(path)
|
62
|
+
except:
|
63
|
+
error('The python file is missing, this should not happen')
|
64
|
+
for x in['c','o']:
|
65
|
+
do_inst=self.env['PY'+x.upper()]
|
66
|
+
try:
|
67
|
+
st2=os.stat(path+x)
|
68
|
+
except OSError:
|
69
|
+
pass
|
70
|
+
else:
|
71
|
+
if st1.st_mtime<=st2.st_mtime:
|
72
|
+
do_inst=False
|
73
|
+
if do_inst:
|
74
|
+
lst=(x=='o')and[self.env['PYFLAGS_OPT']]or[]
|
75
|
+
(a,b,c)=(path,path+x,tsk.get_install_path(destdir=False)+x)
|
76
|
+
argv=self.env['PYTHON']+lst+['-c',INST,a,b,c]
|
77
|
+
info('+ byte compiling %r'%(path+x))
|
78
|
+
ret=Utils.subprocess.Popen(argv).wait()
|
79
|
+
if ret:
|
80
|
+
raise Errors.WafError('py%s compilation failed %r'%(x,path))
|
81
|
+
def feature_py(self):
|
82
|
+
pass
|
83
|
+
def init_pyext(self):
|
84
|
+
try:
|
85
|
+
if not self.install_path:
|
86
|
+
return
|
87
|
+
except AttributeError:
|
88
|
+
self.install_path='${PYTHONARCHDIR}'
|
89
|
+
self.uselib=self.to_list(getattr(self,'uselib',[]))
|
90
|
+
if not'PYEXT'in self.uselib:
|
91
|
+
self.uselib.append('PYEXT')
|
92
|
+
self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['macbundle_PATTERN']=self.env['pyext_PATTERN']
|
93
|
+
def set_bundle(self):
|
94
|
+
if sys.platform.startswith('darwin'):
|
95
|
+
self.mac_bundle=True
|
96
|
+
def init_pyembed(self):
|
97
|
+
self.uselib=self.to_list(getattr(self,'uselib',[]))
|
98
|
+
if not'PYEMBED'in self.uselib:
|
99
|
+
self.uselib.append('PYEMBED')
|
100
|
+
def get_python_variables(conf,variables,imports=['import sys']):
|
101
|
+
program=list(imports)
|
102
|
+
program.append('')
|
103
|
+
for v in variables:
|
104
|
+
program.append("print(repr(%s))"%v)
|
105
|
+
os_env=dict(os.environ)
|
106
|
+
try:
|
107
|
+
del os_env['MACOSX_DEPLOYMENT_TARGET']
|
108
|
+
except KeyError:
|
109
|
+
pass
|
110
|
+
try:
|
111
|
+
out=conf.cmd_and_log(conf.env.PYTHON+['-c','\n'.join(program)],env=os_env)
|
112
|
+
except Errors.WafError:
|
113
|
+
conf.fatal('The distutils module is unusable: install "python-devel"?')
|
114
|
+
return_values=[]
|
115
|
+
for s in out.split('\n'):
|
116
|
+
s=s.strip()
|
117
|
+
if not s:
|
118
|
+
continue
|
119
|
+
if s=='None':
|
120
|
+
return_values.append(None)
|
121
|
+
elif s[0]=="'"and s[-1]=="'":
|
122
|
+
return_values.append(s[1:-1])
|
123
|
+
elif s[0].isdigit():
|
124
|
+
return_values.append(int(s))
|
125
|
+
else:break
|
126
|
+
return return_values
|
127
|
+
def check_python_headers(conf):
|
128
|
+
if not conf.env['CC_NAME']and not conf.env['CXX_NAME']:
|
129
|
+
conf.fatal('load a compiler first (gcc, g++, ..)')
|
130
|
+
if not conf.env['PYTHON_VERSION']:
|
131
|
+
conf.check_python_version()
|
132
|
+
env=conf.env
|
133
|
+
pybin=conf.env.PYTHON
|
134
|
+
if not pybin:
|
135
|
+
conf.fatal('could not find the python executable')
|
136
|
+
v='prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS'.split()
|
137
|
+
try:
|
138
|
+
lst=conf.get_python_variables(["get_config_var('%s') or ''"%x for x in v],['from distutils.sysconfig import get_config_var'])
|
139
|
+
except RuntimeError:
|
140
|
+
conf.fatal("Python development headers not found (-v for details).")
|
141
|
+
vals=['%s = %r'%(x,y)for(x,y)in zip(v,lst)]
|
142
|
+
conf.to_log("Configuration returned from %r:\n%r\n"%(pybin,'\n'.join(vals)))
|
143
|
+
dct=dict(zip(v,lst))
|
144
|
+
x='MACOSX_DEPLOYMENT_TARGET'
|
145
|
+
if dct[x]:
|
146
|
+
conf.env[x]=conf.environ[x]=dct[x]
|
147
|
+
env['pyext_PATTERN']='%s'+dct['SO']
|
148
|
+
all_flags=dct['LDFLAGS']+' '+dct['CFLAGS']
|
149
|
+
conf.parse_flags(all_flags,'PYEMBED')
|
150
|
+
all_flags=dct['LDFLAGS']+' '+dct['LDSHARED']+' '+dct['CFLAGS']
|
151
|
+
conf.parse_flags(all_flags,'PYEXT')
|
152
|
+
result=None
|
153
|
+
for name in('python'+env['PYTHON_VERSION'],'python'+env['PYTHON_VERSION'].replace('.','')):
|
154
|
+
if not result and env['LIBPATH_PYEMBED']:
|
155
|
+
path=env['LIBPATH_PYEMBED']
|
156
|
+
conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n"%path)
|
157
|
+
result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False,msg='Checking for library %s in LIBPATH_PYEMBED'%name)
|
158
|
+
if not result and dct['LIBDIR']:
|
159
|
+
path=[dct['LIBDIR']]
|
160
|
+
conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n"%path)
|
161
|
+
result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False,msg='Checking for library %s in LIBDIR'%name)
|
162
|
+
if not result and dct['LIBPL']:
|
163
|
+
path=[dct['LIBPL']]
|
164
|
+
conf.to_log("\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n")
|
165
|
+
result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False,msg='Checking for library %s in python_LIBPL'%name)
|
166
|
+
if not result:
|
167
|
+
path=[os.path.join(dct['prefix'],"libs")]
|
168
|
+
conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n")
|
169
|
+
result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False,msg='Checking for library %s in $prefix/libs'%name)
|
170
|
+
if result:
|
171
|
+
break
|
172
|
+
if result:
|
173
|
+
env['LIBPATH_PYEMBED']=path
|
174
|
+
env.append_value('LIB_PYEMBED',[name])
|
175
|
+
else:
|
176
|
+
conf.to_log("\n\n### LIB NOT FOUND\n")
|
177
|
+
if(Utils.is_win32 or sys.platform.startswith('os2')or dct['Py_ENABLE_SHARED']):
|
178
|
+
env['LIBPATH_PYEXT']=env['LIBPATH_PYEMBED']
|
179
|
+
env['LIB_PYEXT']=env['LIB_PYEMBED']
|
180
|
+
num='.'.join(env['PYTHON_VERSION'].split('.')[:2])
|
181
|
+
conf.find_program(['python%s-config'%num,'python-config-%s'%num,'python%sm-config'%num],var='PYTHON_CONFIG',mandatory=False)
|
182
|
+
includes=[]
|
183
|
+
if conf.env.PYTHON_CONFIG:
|
184
|
+
for incstr in conf.cmd_and_log([conf.env.PYTHON_CONFIG,'--includes']).strip().split():
|
185
|
+
if(incstr.startswith('-I')or incstr.startswith('/I')):
|
186
|
+
incstr=incstr[2:]
|
187
|
+
if incstr not in includes:
|
188
|
+
includes.append(incstr)
|
189
|
+
conf.to_log("Include path for Python extensions (found via python-config --includes): %r\n"%(includes,))
|
190
|
+
env['INCLUDES_PYEXT']=includes
|
191
|
+
env['INCLUDES_PYEMBED']=includes
|
192
|
+
else:
|
193
|
+
conf.to_log("Include path for Python extensions ""(found via distutils module): %r\n"%(dct['INCLUDEPY'],))
|
194
|
+
env['INCLUDES_PYEXT']=[dct['INCLUDEPY']]
|
195
|
+
env['INCLUDES_PYEMBED']=[dct['INCLUDEPY']]
|
196
|
+
if env['CC_NAME']=='gcc':
|
197
|
+
env.append_value('CFLAGS_PYEMBED',['-fno-strict-aliasing'])
|
198
|
+
env.append_value('CFLAGS_PYEXT',['-fno-strict-aliasing'])
|
199
|
+
if env['CXX_NAME']=='gcc':
|
200
|
+
env.append_value('CXXFLAGS_PYEMBED',['-fno-strict-aliasing'])
|
201
|
+
env.append_value('CXXFLAGS_PYEXT',['-fno-strict-aliasing'])
|
202
|
+
if env.CC_NAME=="msvc":
|
203
|
+
from distutils.msvccompiler import MSVCCompiler
|
204
|
+
dist_compiler=MSVCCompiler()
|
205
|
+
dist_compiler.initialize()
|
206
|
+
env.append_value('CFLAGS_PYEXT',dist_compiler.compile_options)
|
207
|
+
env.append_value('CXXFLAGS_PYEXT',dist_compiler.compile_options)
|
208
|
+
env.append_value('LINKFLAGS_PYEXT',dist_compiler.ldflags_shared)
|
209
|
+
try:
|
210
|
+
conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',uselib='PYEMBED',fragment=FRAG,errmsg='Could not find the python development headers')
|
211
|
+
except conf.errors.ConfigurationError:
|
212
|
+
conf.check_cfg(path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEMBED',args=['--cflags','--libs'])
|
213
|
+
conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',msg='Getting the python flags from python-config',uselib='PYEMBED',fragment=FRAG,errmsg='Could not find the python development headers elsewhere')
|
214
|
+
def check_python_version(conf,minver=None):
|
215
|
+
assert minver is None or isinstance(minver,tuple)
|
216
|
+
pybin=conf.env['PYTHON']
|
217
|
+
if not pybin:
|
218
|
+
conf.fatal('could not find the python executable')
|
219
|
+
cmd=pybin+['-c','import sys\nfor x in sys.version_info: print(str(x))']
|
220
|
+
debug('python: Running python command %r'%cmd)
|
221
|
+
lines=conf.cmd_and_log(cmd).split()
|
222
|
+
assert len(lines)==5,"found %i lines, expected 5: %r"%(len(lines),lines)
|
223
|
+
pyver_tuple=(int(lines[0]),int(lines[1]),int(lines[2]),lines[3],int(lines[4]))
|
224
|
+
result=(minver is None)or(pyver_tuple>=minver)
|
225
|
+
if result:
|
226
|
+
pyver='.'.join([str(x)for x in pyver_tuple[:2]])
|
227
|
+
conf.env['PYTHON_VERSION']=pyver
|
228
|
+
if'PYTHONDIR'in conf.environ:
|
229
|
+
pydir=conf.environ['PYTHONDIR']
|
230
|
+
else:
|
231
|
+
if Utils.is_win32:
|
232
|
+
(python_LIBDEST,pydir)=conf.get_python_variables(["get_config_var('LIBDEST') or ''","get_python_lib(standard_lib=0, prefix=%r) or ''"%conf.env['PREFIX']],['from distutils.sysconfig import get_config_var, get_python_lib'])
|
233
|
+
else:
|
234
|
+
python_LIBDEST=None
|
235
|
+
(pydir,)=conf.get_python_variables(["get_python_lib(standard_lib=0, prefix=%r) or ''"%conf.env['PREFIX']],['from distutils.sysconfig import get_python_lib'])
|
236
|
+
if python_LIBDEST is None:
|
237
|
+
if conf.env['LIBDIR']:
|
238
|
+
python_LIBDEST=os.path.join(conf.env['LIBDIR'],"python"+pyver)
|
239
|
+
else:
|
240
|
+
python_LIBDEST=os.path.join(conf.env['PREFIX'],"lib","python"+pyver)
|
241
|
+
if'PYTHONARCHDIR'in conf.environ:
|
242
|
+
pyarchdir=conf.environ['PYTHONARCHDIR']
|
243
|
+
else:
|
244
|
+
(pyarchdir,)=conf.get_python_variables(["get_python_lib(plat_specific=1, standard_lib=0, prefix=%r) or ''"%conf.env['PREFIX']],['from distutils.sysconfig import get_python_lib'])
|
245
|
+
if not pyarchdir:
|
246
|
+
pyarchdir=pydir
|
247
|
+
if hasattr(conf,'define'):
|
248
|
+
conf.define('PYTHONDIR',pydir)
|
249
|
+
conf.define('PYTHONARCHDIR',pyarchdir)
|
250
|
+
conf.env['PYTHONDIR']=pydir
|
251
|
+
conf.env['PYTHONARCHDIR']=pyarchdir
|
252
|
+
pyver_full='.'.join(map(str,pyver_tuple[:3]))
|
253
|
+
if minver is None:
|
254
|
+
conf.msg('Checking for python version',pyver_full)
|
255
|
+
else:
|
256
|
+
minver_str='.'.join(map(str,minver))
|
257
|
+
conf.msg('Checking for python version',pyver_tuple,">= %s"%(minver_str,)and'GREEN'or'YELLOW')
|
258
|
+
if not result:
|
259
|
+
conf.fatal('The python version is too old, expecting %r'%(minver,))
|
260
|
+
PYTHON_MODULE_TEMPLATE='''
|
261
|
+
import %s
|
262
|
+
print(1)
|
263
|
+
'''
|
264
|
+
def check_python_module(conf,module_name):
|
265
|
+
conf.start_msg('Python module %s'%module_name)
|
266
|
+
try:
|
267
|
+
conf.cmd_and_log(conf.env['PYTHON']+['-c',PYTHON_MODULE_TEMPLATE%module_name])
|
268
|
+
except:
|
269
|
+
conf.end_msg(False)
|
270
|
+
conf.fatal('Could not find the python module %r'%module_name)
|
271
|
+
conf.end_msg(True)
|
272
|
+
def configure(conf):
|
273
|
+
try:
|
274
|
+
conf.find_program('python',var='PYTHON')
|
275
|
+
except conf.errors.ConfigurationError:
|
276
|
+
warn("could not find a python executable, setting to sys.executable '%s'"%sys.executable)
|
277
|
+
conf.env.PYTHON=sys.executable
|
278
|
+
if conf.env.PYTHON!=sys.executable:
|
279
|
+
warn("python executable '%s' different from sys.executable '%s'"%(conf.env.PYTHON,sys.executable))
|
280
|
+
conf.env.PYTHON=conf.cmd_to_list(conf.env.PYTHON)
|
281
|
+
v=conf.env
|
282
|
+
v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"'
|
283
|
+
v['PYFLAGS']=''
|
284
|
+
v['PYFLAGS_OPT']='-O'
|
285
|
+
v['PYC']=getattr(Options.options,'pyc',1)
|
286
|
+
v['PYO']=getattr(Options.options,'pyo',1)
|
287
|
+
def options(opt):
|
288
|
+
opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc')
|
289
|
+
opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo')
|
290
|
+
|
291
|
+
extension('.py')(process_py)
|
292
|
+
feature('py')(feature_py)
|
293
|
+
feature('pyext')(init_pyext)
|
294
|
+
before_method('propagate_uselib_vars','apply_link')(init_pyext)
|
295
|
+
after_method('apply_bundle')(init_pyext)
|
296
|
+
feature('pyext')(set_bundle)
|
297
|
+
before_method('apply_link','apply_bundle')(set_bundle)
|
298
|
+
before_method('propagate_uselib_vars')(init_pyembed)
|
299
|
+
feature('pyembed')(init_pyembed)
|
300
|
+
conf(get_python_variables)
|
301
|
+
conf(check_python_headers)
|
302
|
+
conf(check_python_version)
|
303
|
+
conf(check_python_module)
|
@@ -0,0 +1,424 @@
|
|
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
|
+
try:
|
8
|
+
from xml.sax import make_parser
|
9
|
+
from xml.sax.handler import ContentHandler
|
10
|
+
except ImportError:
|
11
|
+
has_xml=False
|
12
|
+
ContentHandler=object
|
13
|
+
else:
|
14
|
+
has_xml=True
|
15
|
+
import os,sys
|
16
|
+
from waflib.Tools import c_preproc,cxx
|
17
|
+
from waflib import Task,Utils,Options,Errors
|
18
|
+
from waflib.TaskGen import feature,after_method,extension
|
19
|
+
from waflib.Configure import conf
|
20
|
+
from waflib.Logs import error
|
21
|
+
MOC_H=['.h','.hpp','.hxx','.hh']
|
22
|
+
EXT_RCC=['.qrc']
|
23
|
+
EXT_UI=['.ui']
|
24
|
+
EXT_QT4=['.cpp','.cc','.cxx','.C']
|
25
|
+
QT4_LIBS="QtCore QtGui QtUiTools QtNetwork QtOpenGL QtSql QtSvg QtTest QtXml QtXmlPatterns QtWebKit Qt3Support QtHelp QtScript QtDeclarative"
|
26
|
+
class qxx(cxx.cxx):
|
27
|
+
def __init__(self,*k,**kw):
|
28
|
+
Task.Task.__init__(self,*k,**kw)
|
29
|
+
self.moc_done=0
|
30
|
+
def scan(self):
|
31
|
+
(nodes,names)=c_preproc.scan(self)
|
32
|
+
for x in nodes:
|
33
|
+
if x.name.endswith('.moc'):
|
34
|
+
nodes.remove(x)
|
35
|
+
names.append(x.path_from(self.inputs[0].parent.get_bld()))
|
36
|
+
return(nodes,names)
|
37
|
+
def runnable_status(self):
|
38
|
+
if self.moc_done:
|
39
|
+
return Task.Task.runnable_status(self)
|
40
|
+
else:
|
41
|
+
for t in self.run_after:
|
42
|
+
if not t.hasrun:
|
43
|
+
return Task.ASK_LATER
|
44
|
+
self.add_moc_tasks()
|
45
|
+
return Task.Task.runnable_status(self)
|
46
|
+
def add_moc_tasks(self):
|
47
|
+
node=self.inputs[0]
|
48
|
+
bld=self.generator.bld
|
49
|
+
try:
|
50
|
+
self.signature()
|
51
|
+
except KeyError:
|
52
|
+
pass
|
53
|
+
else:
|
54
|
+
delattr(self,'cache_sig')
|
55
|
+
moctasks=[]
|
56
|
+
mocfiles=[]
|
57
|
+
try:
|
58
|
+
tmp_lst=bld.raw_deps[self.uid()]
|
59
|
+
bld.raw_deps[self.uid()]=[]
|
60
|
+
except KeyError:
|
61
|
+
tmp_lst=[]
|
62
|
+
for d in tmp_lst:
|
63
|
+
if not d.endswith('.moc'):
|
64
|
+
continue
|
65
|
+
if d in mocfiles:
|
66
|
+
error("paranoia owns")
|
67
|
+
continue
|
68
|
+
mocfiles.append(d)
|
69
|
+
h_node=None
|
70
|
+
try:ext=Options.options.qt_header_ext.split()
|
71
|
+
except AttributeError:pass
|
72
|
+
if not ext:ext=MOC_H
|
73
|
+
base2=d[:-4]
|
74
|
+
for x in[node.parent]+self.generator.includes_nodes:
|
75
|
+
for e in ext:
|
76
|
+
h_node=x.find_node(base2+e)
|
77
|
+
if h_node:
|
78
|
+
break
|
79
|
+
else:
|
80
|
+
continue
|
81
|
+
break
|
82
|
+
else:
|
83
|
+
raise Errors.WafError('no header found for %r which is a moc file'%d)
|
84
|
+
m_node=h_node.change_ext('.moc')
|
85
|
+
bld.node_deps[(self.inputs[0].parent.abspath(),m_node.name)]=h_node
|
86
|
+
task=Task.classes['moc'](env=self.env,generator=self.generator)
|
87
|
+
task.set_inputs(h_node)
|
88
|
+
task.set_outputs(m_node)
|
89
|
+
gen=bld.producer
|
90
|
+
gen.outstanding.insert(0,task)
|
91
|
+
gen.total+=1
|
92
|
+
moctasks.append(task)
|
93
|
+
tmp_lst=bld.raw_deps[self.uid()]=mocfiles
|
94
|
+
lst=bld.node_deps.get(self.uid(),())
|
95
|
+
for d in lst:
|
96
|
+
name=d.name
|
97
|
+
if name.endswith('.moc'):
|
98
|
+
task=Task.classes['moc'](env=self.env,generator=self.generator)
|
99
|
+
task.set_inputs(bld.node_deps[(self.inputs[0].parent.abspath(),name)])
|
100
|
+
task.set_outputs(d)
|
101
|
+
gen=bld.producer
|
102
|
+
gen.outstanding.insert(0,task)
|
103
|
+
gen.total+=1
|
104
|
+
moctasks.append(task)
|
105
|
+
self.run_after.update(set(moctasks))
|
106
|
+
self.moc_done=1
|
107
|
+
run=Task.classes['cxx'].__dict__['run']
|
108
|
+
class trans_update(Task.Task):
|
109
|
+
run_str='${QT_LUPDATE} ${SRC} -ts ${TGT}'
|
110
|
+
color='BLUE'
|
111
|
+
Task.update_outputs(trans_update)
|
112
|
+
class XMLHandler(ContentHandler):
|
113
|
+
def __init__(self):
|
114
|
+
self.buf=[]
|
115
|
+
self.files=[]
|
116
|
+
def startElement(self,name,attrs):
|
117
|
+
if name=='file':
|
118
|
+
self.buf=[]
|
119
|
+
def endElement(self,name):
|
120
|
+
if name=='file':
|
121
|
+
self.files.append(str(''.join(self.buf)))
|
122
|
+
def characters(self,cars):
|
123
|
+
self.buf.append(cars)
|
124
|
+
def create_rcc_task(self,node):
|
125
|
+
rcnode=node.change_ext('_rc.cpp')
|
126
|
+
rcctask=self.create_task('rcc',node,rcnode)
|
127
|
+
cpptask=self.create_task('cxx',rcnode,rcnode.change_ext('.o'))
|
128
|
+
try:
|
129
|
+
self.compiled_tasks.append(cpptask)
|
130
|
+
except AttributeError:
|
131
|
+
self.compiled_tasks=[cpptask]
|
132
|
+
return cpptask
|
133
|
+
def create_uic_task(self,node):
|
134
|
+
uictask=self.create_task('ui4',node)
|
135
|
+
uictask.outputs=[self.path.find_or_declare(self.env['ui_PATTERN']%node.name[:-3])]
|
136
|
+
def add_lang(self,node):
|
137
|
+
self.lang=self.to_list(getattr(self,'lang',[]))+[node]
|
138
|
+
def apply_qt4(self):
|
139
|
+
if getattr(self,'lang',None):
|
140
|
+
qmtasks=[]
|
141
|
+
for x in self.to_list(self.lang):
|
142
|
+
if isinstance(x,str):
|
143
|
+
x=self.path.find_resource(x+'.ts')
|
144
|
+
qmtasks.append(self.create_task('ts2qm',x,x.change_ext('.qm')))
|
145
|
+
if getattr(self,'update',None)and Options.options.trans_qt4:
|
146
|
+
cxxnodes=[a.inputs[0]for a in self.compiled_tasks]+[a.inputs[0]for a in self.tasks if getattr(a,'inputs',None)and a.inputs[0].name.endswith('.ui')]
|
147
|
+
for x in qmtasks:
|
148
|
+
self.create_task('trans_update',cxxnodes,x.inputs)
|
149
|
+
if getattr(self,'langname',None):
|
150
|
+
qmnodes=[x.outputs[0]for x in qmtasks]
|
151
|
+
rcnode=self.langname
|
152
|
+
if isinstance(rcnode,str):
|
153
|
+
rcnode=self.path.find_or_declare(rcnode+'.qrc')
|
154
|
+
t=self.create_task('qm2rcc',qmnodes,rcnode)
|
155
|
+
k=create_rcc_task(self,t.outputs[0])
|
156
|
+
self.link_task.inputs.append(k.outputs[0])
|
157
|
+
lst=[]
|
158
|
+
for flag in self.to_list(self.env['CXXFLAGS']):
|
159
|
+
if len(flag)<2:continue
|
160
|
+
f=flag[0:2]
|
161
|
+
if f in['-D','-I','/D','/I']:
|
162
|
+
if(f[0]=='/'):
|
163
|
+
lst.append('-'+flag[1:])
|
164
|
+
else:
|
165
|
+
lst.append(flag)
|
166
|
+
self.env['MOC_FLAGS']=lst
|
167
|
+
def cxx_hook(self,node):
|
168
|
+
return self.create_compiled_task('qxx',node)
|
169
|
+
class rcc(Task.Task):
|
170
|
+
color='BLUE'
|
171
|
+
run_str='${QT_RCC} -name ${SRC[0].name} ${SRC[0].abspath()} ${RCC_ST} -o ${TGT}'
|
172
|
+
ext_out=['.h']
|
173
|
+
def scan(self):
|
174
|
+
node=self.inputs[0]
|
175
|
+
parser=make_parser()
|
176
|
+
curHandler=XMLHandler()
|
177
|
+
parser.setContentHandler(curHandler)
|
178
|
+
fi=open(self.inputs[0].abspath())
|
179
|
+
parser.parse(fi)
|
180
|
+
fi.close()
|
181
|
+
nodes=[]
|
182
|
+
names=[]
|
183
|
+
root=self.inputs[0].parent
|
184
|
+
for x in curHandler.files:
|
185
|
+
nd=root.find_resource(x)
|
186
|
+
if nd:nodes.append(nd)
|
187
|
+
else:names.append(x)
|
188
|
+
return(nodes,names)
|
189
|
+
class moc(Task.Task):
|
190
|
+
color='BLUE'
|
191
|
+
run_str='${QT_MOC} ${MOC_FLAGS} ${MOCCPPPATH_ST:INCPATHS} ${MOCDEFINES_ST:DEFINES} ${SRC} ${MOC_ST} ${TGT}'
|
192
|
+
class ui4(Task.Task):
|
193
|
+
color='BLUE'
|
194
|
+
run_str='${QT_UIC} ${SRC} -o ${TGT}'
|
195
|
+
ext_out=['.h']
|
196
|
+
class ts2qm(Task.Task):
|
197
|
+
color='BLUE'
|
198
|
+
run_str='${QT_LRELEASE} ${QT_LRELEASE_FLAGS} ${SRC} -qm ${TGT}'
|
199
|
+
class qm2rcc(Task.Task):
|
200
|
+
color='BLUE'
|
201
|
+
after='ts2qm'
|
202
|
+
def run(self):
|
203
|
+
txt='\n'.join(['<file>%s</file>'%k.path_from(self.outputs[0].parent)for k in self.inputs])
|
204
|
+
code='<!DOCTYPE RCC><RCC version="1.0">\n<qresource>\n%s\n</qresource>\n</RCC>'%txt
|
205
|
+
self.outputs[0].write(code)
|
206
|
+
def configure(self):
|
207
|
+
self.find_qt4_binaries()
|
208
|
+
self.set_qt4_libs_to_check()
|
209
|
+
self.find_qt4_libraries()
|
210
|
+
self.add_qt4_rpath()
|
211
|
+
self.simplify_qt4_libs()
|
212
|
+
def find_qt4_binaries(self):
|
213
|
+
env=self.env
|
214
|
+
opt=Options.options
|
215
|
+
qtdir=getattr(opt,'qtdir','')
|
216
|
+
qtbin=getattr(opt,'qtbin','')
|
217
|
+
paths=[]
|
218
|
+
if qtdir:
|
219
|
+
qtbin=os.path.join(qtdir,'bin')
|
220
|
+
if not qtdir:
|
221
|
+
qtdir=self.environ.get('QT4_ROOT','')
|
222
|
+
qtbin=os.path.join(qtdir,'bin')
|
223
|
+
if qtbin:
|
224
|
+
paths=[qtbin]
|
225
|
+
if not qtdir:
|
226
|
+
paths=os.environ.get('PATH','').split(os.pathsep)
|
227
|
+
paths.append('/usr/share/qt4/bin/')
|
228
|
+
try:
|
229
|
+
lst=Utils.listdir('/usr/local/Trolltech/')
|
230
|
+
except OSError:
|
231
|
+
pass
|
232
|
+
else:
|
233
|
+
if lst:
|
234
|
+
lst.sort()
|
235
|
+
lst.reverse()
|
236
|
+
qtdir='/usr/local/Trolltech/%s/'%lst[0]
|
237
|
+
qtbin=os.path.join(qtdir,'bin')
|
238
|
+
paths.append(qtbin)
|
239
|
+
cand=None
|
240
|
+
prev_ver=['4','0','0']
|
241
|
+
for qmk in['qmake-qt4','qmake4','qmake']:
|
242
|
+
try:
|
243
|
+
qmake=self.find_program(qmk,path_list=paths)
|
244
|
+
except self.errors.ConfigurationError:
|
245
|
+
pass
|
246
|
+
else:
|
247
|
+
try:
|
248
|
+
version=self.cmd_and_log([qmake,'-query','QT_VERSION']).strip()
|
249
|
+
except self.errors.ConfigurationError:
|
250
|
+
pass
|
251
|
+
else:
|
252
|
+
if version:
|
253
|
+
new_ver=version.split('.')
|
254
|
+
if new_ver>prev_ver:
|
255
|
+
cand=qmake
|
256
|
+
prev_ver=new_ver
|
257
|
+
if cand:
|
258
|
+
self.env.QMAKE=cand
|
259
|
+
else:
|
260
|
+
self.fatal('Could not find qmake for qt4')
|
261
|
+
qtbin=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_BINS']).strip()+os.sep
|
262
|
+
def find_bin(lst,var):
|
263
|
+
for f in lst:
|
264
|
+
try:
|
265
|
+
ret=self.find_program(f,path_list=paths)
|
266
|
+
except self.errors.ConfigurationError:
|
267
|
+
pass
|
268
|
+
else:
|
269
|
+
env[var]=ret
|
270
|
+
break
|
271
|
+
find_bin(['uic-qt3','uic3'],'QT_UIC3')
|
272
|
+
find_bin(['uic-qt4','uic'],'QT_UIC')
|
273
|
+
if not env['QT_UIC']:
|
274
|
+
self.fatal('cannot find the uic compiler for qt4')
|
275
|
+
try:
|
276
|
+
uicver=self.cmd_and_log(env['QT_UIC']+" -version 2>&1").strip()
|
277
|
+
except self.errors.ConfigurationError:
|
278
|
+
self.fatal('this uic compiler is for qt3, add uic for qt4 to your path')
|
279
|
+
uicver=uicver.replace('Qt User Interface Compiler ','').replace('User Interface Compiler for Qt','')
|
280
|
+
self.msg('Checking for uic version','%s'%uicver)
|
281
|
+
if uicver.find(' 3.')!=-1:
|
282
|
+
self.fatal('this uic compiler is for qt3, add uic for qt4 to your path')
|
283
|
+
find_bin(['moc-qt4','moc'],'QT_MOC')
|
284
|
+
find_bin(['rcc'],'QT_RCC')
|
285
|
+
find_bin(['lrelease-qt4','lrelease'],'QT_LRELEASE')
|
286
|
+
find_bin(['lupdate-qt4','lupdate'],'QT_LUPDATE')
|
287
|
+
env['UIC3_ST']='%s -o %s'
|
288
|
+
env['UIC_ST']='%s -o %s'
|
289
|
+
env['MOC_ST']='-o'
|
290
|
+
env['ui_PATTERN']='ui_%s.h'
|
291
|
+
env['QT_LRELEASE_FLAGS']=['-silent']
|
292
|
+
env.MOCCPPPATH_ST='-I%s'
|
293
|
+
env.MOCDEFINES_ST='-D%s'
|
294
|
+
def find_qt4_libraries(self):
|
295
|
+
qtlibs=getattr(Options.options,'qtlibs','')
|
296
|
+
if not qtlibs:
|
297
|
+
try:
|
298
|
+
qtlibs=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_LIBS']).strip()
|
299
|
+
except Errors.WafError:
|
300
|
+
qtdir=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_PREFIX']).strip()+os.sep
|
301
|
+
qtlibs=os.path.join(qtdir,'lib')
|
302
|
+
self.msg('Found the Qt4 libraries in',qtlibs)
|
303
|
+
qtincludes=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_HEADERS']).strip()
|
304
|
+
env=self.env
|
305
|
+
if not'PKG_CONFIG_PATH'in os.environ:
|
306
|
+
os.environ['PKG_CONFIG_PATH']='%s:%s/pkgconfig:/usr/lib/qt4/lib/pkgconfig:/opt/qt4/lib/pkgconfig:/usr/lib/qt4/lib:/opt/qt4/lib'%(qtlibs,qtlibs)
|
307
|
+
try:
|
308
|
+
self.check_cfg(atleast_pkgconfig_version='0.1')
|
309
|
+
except self.errors.ConfigurationError:
|
310
|
+
for i in self.qt4_vars:
|
311
|
+
uselib=i.upper()
|
312
|
+
if sys.platform=="darwin":
|
313
|
+
frameworkName=i+".framework"
|
314
|
+
qtDynamicLib=os.path.join(qtlibs,frameworkName,i)
|
315
|
+
if os.path.exists(qtDynamicLib):
|
316
|
+
env.append_unique('FRAMEWORK_'+uselib,i)
|
317
|
+
self.msg('Checking for %s'%i,qtDynamicLib,'GREEN')
|
318
|
+
else:
|
319
|
+
self.msg('Checking for %s'%i,False,'YELLOW')
|
320
|
+
env.append_unique('INCLUDES_'+uselib,os.path.join(qtlibs,frameworkName,'Headers'))
|
321
|
+
elif sys.platform!="win32":
|
322
|
+
qtDynamicLib=os.path.join(qtlibs,"lib"+i+".so")
|
323
|
+
qtStaticLib=os.path.join(qtlibs,"lib"+i+".a")
|
324
|
+
if os.path.exists(qtDynamicLib):
|
325
|
+
env.append_unique('LIB_'+uselib,i)
|
326
|
+
self.msg('Checking for %s'%i,qtDynamicLib,'GREEN')
|
327
|
+
elif os.path.exists(qtStaticLib):
|
328
|
+
env.append_unique('LIB_'+uselib,i)
|
329
|
+
self.msg('Checking for %s'%i,qtStaticLib,'GREEN')
|
330
|
+
else:
|
331
|
+
self.msg('Checking for %s'%i,False,'YELLOW')
|
332
|
+
env.append_unique('LIBPATH_'+uselib,qtlibs)
|
333
|
+
env.append_unique('INCLUDES_'+uselib,qtincludes)
|
334
|
+
env.append_unique('INCLUDES_'+uselib,os.path.join(qtincludes,i))
|
335
|
+
else:
|
336
|
+
for k in("lib%s.a","lib%s4.a","%s.lib","%s4.lib"):
|
337
|
+
lib=os.path.join(qtlibs,k%i)
|
338
|
+
if os.path.exists(lib):
|
339
|
+
env.append_unique('LIB_'+uselib,i+k[k.find("%s")+2:k.find('.')])
|
340
|
+
self.msg('Checking for %s'%i,lib,'GREEN')
|
341
|
+
break
|
342
|
+
else:
|
343
|
+
self.msg('Checking for %s'%i,False,'YELLOW')
|
344
|
+
env.append_unique('LIBPATH_'+uselib,qtlibs)
|
345
|
+
env.append_unique('INCLUDES_'+uselib,qtincludes)
|
346
|
+
env.append_unique('INCLUDES_'+uselib,os.path.join(qtincludes,i))
|
347
|
+
uselib=i.upper()+"_debug"
|
348
|
+
for k in("lib%sd.a","lib%sd4.a","%sd.lib","%sd4.lib"):
|
349
|
+
lib=os.path.join(qtlibs,k%i)
|
350
|
+
if os.path.exists(lib):
|
351
|
+
env.append_unique('LIB_'+uselib,i+k[k.find("%s")+2:k.find('.')])
|
352
|
+
self.msg('Checking for %s'%i,lib,'GREEN')
|
353
|
+
break
|
354
|
+
else:
|
355
|
+
self.msg('Checking for %s'%i,False,'YELLOW')
|
356
|
+
env.append_unique('LIBPATH_'+uselib,qtlibs)
|
357
|
+
env.append_unique('INCLUDES_'+uselib,qtincludes)
|
358
|
+
env.append_unique('INCLUDES_'+uselib,os.path.join(qtincludes,i))
|
359
|
+
else:
|
360
|
+
for i in self.qt4_vars_debug+self.qt4_vars:
|
361
|
+
self.check_cfg(package=i,args='--cflags --libs',mandatory=False)
|
362
|
+
def simplify_qt4_libs(self):
|
363
|
+
env=self.env
|
364
|
+
def process_lib(vars_,coreval):
|
365
|
+
for d in vars_:
|
366
|
+
var=d.upper()
|
367
|
+
if var=='QTCORE':
|
368
|
+
continue
|
369
|
+
value=env['LIBPATH_'+var]
|
370
|
+
if value:
|
371
|
+
core=env[coreval]
|
372
|
+
accu=[]
|
373
|
+
for lib in value:
|
374
|
+
if lib in core:
|
375
|
+
continue
|
376
|
+
accu.append(lib)
|
377
|
+
env['LIBPATH_'+var]=accu
|
378
|
+
process_lib(self.qt4_vars,'LIBPATH_QTCORE')
|
379
|
+
process_lib(self.qt4_vars_debug,'LIBPATH_QTCORE_DEBUG')
|
380
|
+
def add_qt4_rpath(self):
|
381
|
+
env=self.env
|
382
|
+
if Options.options.want_rpath:
|
383
|
+
def process_rpath(vars_,coreval):
|
384
|
+
for d in vars_:
|
385
|
+
var=d.upper()
|
386
|
+
value=env['LIBPATH_'+var]
|
387
|
+
if value:
|
388
|
+
core=env[coreval]
|
389
|
+
accu=[]
|
390
|
+
for lib in value:
|
391
|
+
if var!='QTCORE':
|
392
|
+
if lib in core:
|
393
|
+
continue
|
394
|
+
accu.append('-Wl,--rpath='+lib)
|
395
|
+
env['RPATH_'+var]=accu
|
396
|
+
process_rpath(self.qt4_vars,'LIBPATH_QTCORE')
|
397
|
+
process_rpath(self.qt4_vars_debug,'LIBPATH_QTCORE_DEBUG')
|
398
|
+
def set_qt4_libs_to_check(self):
|
399
|
+
if not hasattr(self,'qt4_vars'):
|
400
|
+
self.qt4_vars=QT4_LIBS
|
401
|
+
self.qt4_vars=Utils.to_list(self.qt4_vars)
|
402
|
+
if not hasattr(self,'qt4_vars_debug'):
|
403
|
+
self.qt4_vars_debug=[a+'_debug'for a in self.qt4_vars]
|
404
|
+
self.qt4_vars_debug=Utils.to_list(self.qt4_vars_debug)
|
405
|
+
def options(opt):
|
406
|
+
opt.add_option('--want-rpath',action='store_true',default=False,dest='want_rpath',help='enable the rpath for qt libraries')
|
407
|
+
opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext')
|
408
|
+
for i in'qtdir qtbin qtlibs'.split():
|
409
|
+
opt.add_option('--'+i,type='string',default='',dest=i)
|
410
|
+
if sys.platform=="darwin":
|
411
|
+
opt.add_option('--no-qt4-framework',action="store_false",help='do not use the framework version of Qt4 in OS X',dest='use_qt4_osxframework',default=True)
|
412
|
+
opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False)
|
413
|
+
|
414
|
+
extension(*EXT_RCC)(create_rcc_task)
|
415
|
+
extension(*EXT_UI)(create_uic_task)
|
416
|
+
extension('.ts')(add_lang)
|
417
|
+
feature('qt4')(apply_qt4)
|
418
|
+
after_method('apply_link')(apply_qt4)
|
419
|
+
extension(*EXT_QT4)(cxx_hook)
|
420
|
+
conf(find_qt4_binaries)
|
421
|
+
conf(find_qt4_libraries)
|
422
|
+
conf(simplify_qt4_libs)
|
423
|
+
conf(add_qt4_rpath)
|
424
|
+
conf(set_qt4_libs_to_check)
|