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,49 @@
|
|
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 Options,TaskGen,Task,Utils
|
7
|
+
from waflib.TaskGen import feature,after_method
|
8
|
+
def apply_msgfmt(self):
|
9
|
+
for lang in self.to_list(self.langs):
|
10
|
+
node=self.path.find_resource(lang+'.po')
|
11
|
+
task=self.create_task('msgfmt',node,node.change_ext('.mo'))
|
12
|
+
langname=lang.split('/')
|
13
|
+
langname=langname[-1]
|
14
|
+
inst=getattr(self,'install_path','${KDE4_LOCALE_INSTALL_DIR}')
|
15
|
+
self.bld.install_as(inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+getattr(self,'appname','set_your_appname')+'.mo',task.outputs[0],chmod=getattr(self,'chmod',Utils.O644))
|
16
|
+
class msgfmt(Task.Task):
|
17
|
+
color='BLUE'
|
18
|
+
run_str='${MSGFMT} ${SRC} -o ${TGT}'
|
19
|
+
def configure(self):
|
20
|
+
kdeconfig=self.find_program('kde4-config')
|
21
|
+
prefix=self.cmd_and_log('%s --prefix'%kdeconfig).strip()
|
22
|
+
fname='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix
|
23
|
+
try:os.stat(fname)
|
24
|
+
except OSError:
|
25
|
+
fname='%s/share/kde4/apps/cmake/modules/KDELibsDependencies.cmake'%prefix
|
26
|
+
try:os.stat(fname)
|
27
|
+
except OSError:self.fatal('could not open %s'%fname)
|
28
|
+
try:
|
29
|
+
txt=Utils.readf(fname)
|
30
|
+
except(OSError,IOError):
|
31
|
+
self.fatal('could not read %s'%fname)
|
32
|
+
txt=txt.replace('\\\n','\n')
|
33
|
+
fu=re.compile('#(.*)\n')
|
34
|
+
txt=fu.sub('',txt)
|
35
|
+
setregexp=re.compile('([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)')
|
36
|
+
found=setregexp.findall(txt)
|
37
|
+
for(_,key,val)in found:
|
38
|
+
self.env[key]=val
|
39
|
+
self.env['LIB_KDECORE']=['kdecore']
|
40
|
+
self.env['LIB_KDEUI']=['kdeui']
|
41
|
+
self.env['LIB_KIO']=['kio']
|
42
|
+
self.env['LIB_KHTML']=['khtml']
|
43
|
+
self.env['LIB_KPARTS']=['kparts']
|
44
|
+
self.env['LIBPATH_KDECORE']=[self.env['KDE4_LIB_INSTALL_DIR']]
|
45
|
+
self.env['INCLUDES_KDECORE']=[self.env['KDE4_INCLUDE_INSTALL_DIR']]
|
46
|
+
self.env.append_value('INCLUDES_KDECORE',[self.env['KDE4_INCLUDE_INSTALL_DIR']+os.sep+'KDE'])
|
47
|
+
self.find_program('msgfmt',var='MSGFMT')
|
48
|
+
|
49
|
+
feature('msgfmt')(apply_msgfmt)
|
@@ -0,0 +1,19 @@
|
|
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
|
+
from waflib.TaskGen import extension
|
6
|
+
from waflib import Task,Utils
|
7
|
+
def add_lua(self,node):
|
8
|
+
tsk=self.create_task('luac',node,node.change_ext('.luac'))
|
9
|
+
inst_to=getattr(self,'install_path',self.env.LUADIR and'${LUADIR}'or None)
|
10
|
+
if inst_to:
|
11
|
+
self.bld.install_files(inst_to,tsk.outputs)
|
12
|
+
return tsk
|
13
|
+
class luac(Task.Task):
|
14
|
+
run_str='${LUAC} -s -o ${TGT} ${SRC}'
|
15
|
+
color='PINK'
|
16
|
+
def configure(conf):
|
17
|
+
conf.find_program('luac',var='LUAC')
|
18
|
+
|
19
|
+
extension('.lua')(add_lua)
|
@@ -0,0 +1,650 @@
|
|
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,tempfile
|
6
|
+
try:
|
7
|
+
import _winreg
|
8
|
+
except:
|
9
|
+
try:
|
10
|
+
import winreg as _winreg
|
11
|
+
except:
|
12
|
+
_winreg=None
|
13
|
+
from waflib import Utils,TaskGen,Runner,Configure,Task,Options
|
14
|
+
from waflib.Logs import debug,info,warn,error
|
15
|
+
from waflib.TaskGen import after_method,before_method,feature
|
16
|
+
from waflib.Configure import conf
|
17
|
+
from waflib.Tools import ccroot,c,cxx,ar,winres
|
18
|
+
g_msvc_systemlibs='''
|
19
|
+
aclui activeds ad1 adptif adsiid advapi32 asycfilt authz bhsupp bits bufferoverflowu cabinet
|
20
|
+
cap certadm certidl ciuuid clusapi comctl32 comdlg32 comsupp comsuppd comsuppw comsuppwd comsvcs
|
21
|
+
credui crypt32 cryptnet cryptui d3d8thk daouuid dbgeng dbghelp dciman32 ddao35 ddao35d
|
22
|
+
ddao35u ddao35ud delayimp dhcpcsvc dhcpsapi dlcapi dnsapi dsprop dsuiext dtchelp
|
23
|
+
faultrep fcachdll fci fdi framedyd framedyn gdi32 gdiplus glauxglu32 gpedit gpmuuid
|
24
|
+
gtrts32w gtrtst32hlink htmlhelp httpapi icm32 icmui imagehlp imm32 iphlpapi iprop
|
25
|
+
kernel32 ksguid ksproxy ksuser libcmt libcmtd libcpmt libcpmtd loadperf lz32 mapi
|
26
|
+
mapi32 mgmtapi minidump mmc mobsync mpr mprapi mqoa mqrt msacm32 mscms mscoree
|
27
|
+
msdasc msimg32 msrating mstask msvcmrt msvcurt msvcurtd mswsock msxml2 mtx mtxdm
|
28
|
+
netapi32 nmapinmsupp npptools ntdsapi ntdsbcli ntmsapi ntquery odbc32 odbcbcp
|
29
|
+
odbccp32 oldnames ole32 oleacc oleaut32 oledb oledlgolepro32 opends60 opengl32
|
30
|
+
osptk parser pdh penter pgobootrun pgort powrprof psapi ptrustm ptrustmd ptrustu
|
31
|
+
ptrustud qosname rasapi32 rasdlg rassapi resutils riched20 rpcndr rpcns4 rpcrt4 rtm
|
32
|
+
rtutils runtmchk scarddlg scrnsave scrnsavw secur32 sensapi setupapi sfc shell32
|
33
|
+
shfolder shlwapi sisbkup snmpapi sporder srclient sti strsafe svcguid tapi32 thunk32
|
34
|
+
traffic unicows url urlmon user32 userenv usp10 uuid uxtheme vcomp vcompd vdmdbg
|
35
|
+
version vfw32 wbemuuid webpost wiaguid wininet winmm winscard winspool winstrm
|
36
|
+
wintrust wldap32 wmiutils wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 xaswitch xolehlp
|
37
|
+
'''.split()
|
38
|
+
all_msvc_platforms=[('x64','amd64'),('x86','x86'),('ia64','ia64'),('x86_amd64','amd64'),('x86_ia64','ia64')]
|
39
|
+
all_wince_platforms=[('armv4','arm'),('armv4i','arm'),('mipsii','mips'),('mipsii_fp','mips'),('mipsiv','mips'),('mipsiv_fp','mips'),('sh4','sh'),('x86','cex86')]
|
40
|
+
all_icl_platforms=[('intel64','amd64'),('em64t','amd64'),('ia32','x86'),('Itanium','ia64')]
|
41
|
+
def options(opt):
|
42
|
+
opt.add_option('--msvc_version',type='string',help='msvc version, eg: "msvc 10.0,msvc 9.0"',default='')
|
43
|
+
opt.add_option('--msvc_targets',type='string',help='msvc targets, eg: "x64,arm"',default='')
|
44
|
+
def setup_msvc(conf,versions):
|
45
|
+
platforms=getattr(Options.options,'msvc_targets','').split(',')
|
46
|
+
if platforms==['']:
|
47
|
+
platforms=Utils.to_list(conf.env['MSVC_TARGETS'])or[i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms]
|
48
|
+
desired_versions=getattr(Options.options,'msvc_version','').split(',')
|
49
|
+
if desired_versions==['']:
|
50
|
+
desired_versions=conf.env['MSVC_VERSIONS']or[v for v,_ in versions][::-1]
|
51
|
+
versiondict=dict(versions)
|
52
|
+
for version in desired_versions:
|
53
|
+
try:
|
54
|
+
targets=dict(versiondict[version])
|
55
|
+
for target in platforms:
|
56
|
+
try:
|
57
|
+
arch,(p1,p2,p3)=targets[target]
|
58
|
+
compiler,revision=version.split()
|
59
|
+
return compiler,revision,p1,p2,p3
|
60
|
+
except KeyError:continue
|
61
|
+
except KeyError:continue
|
62
|
+
conf.fatal('msvc: Impossible to find a valid architecture for building (in setup_msvc)')
|
63
|
+
def get_msvc_version(conf,compiler,version,target,vcvars):
|
64
|
+
debug('msvc: get_msvc_version: %r %r %r',compiler,version,target)
|
65
|
+
batfile=conf.bldnode.make_node('waf-print-msvc.bat')
|
66
|
+
batfile.write("""@echo off
|
67
|
+
set INCLUDE=
|
68
|
+
set LIB=
|
69
|
+
call "%s" %s
|
70
|
+
echo PATH=%%PATH%%
|
71
|
+
echo INCLUDE=%%INCLUDE%%
|
72
|
+
echo LIB=%%LIB%%
|
73
|
+
"""%(vcvars,target))
|
74
|
+
sout=conf.cmd_and_log(['cmd','/E:on','/V:on','/C',batfile.abspath()])
|
75
|
+
lines=sout.splitlines()
|
76
|
+
if not lines[0]:lines=lines[1:]
|
77
|
+
for x in('Setting environment','Setting SDK environment','Intel(R) C++ Compiler','Intel Parallel Studio'):
|
78
|
+
if lines[0].find(x)!=-1:
|
79
|
+
break
|
80
|
+
else:
|
81
|
+
debug('msvc: get_msvc_version: %r %r %r -> not found',compiler,version,target)
|
82
|
+
conf.fatal('msvc: Impossible to find a valid architecture for building (in get_msvc_version)')
|
83
|
+
for line in lines[1:]:
|
84
|
+
if line.startswith('PATH='):
|
85
|
+
path=line[5:]
|
86
|
+
MSVC_PATH=path.split(';')
|
87
|
+
elif line.startswith('INCLUDE='):
|
88
|
+
MSVC_INCDIR=[i for i in line[8:].split(';')if i]
|
89
|
+
elif line.startswith('LIB='):
|
90
|
+
MSVC_LIBDIR=[i for i in line[4:].split(';')if i]
|
91
|
+
env={}
|
92
|
+
env.update(os.environ)
|
93
|
+
env.update(PATH=path)
|
94
|
+
compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
|
95
|
+
cxx=conf.find_program(compiler_name,path_list=MSVC_PATH)
|
96
|
+
cxx=conf.cmd_to_list(cxx)
|
97
|
+
if'CL'in env:
|
98
|
+
del(env['CL'])
|
99
|
+
try:
|
100
|
+
try:
|
101
|
+
conf.cmd_and_log(cxx+['/help'],env=env)
|
102
|
+
except Exception ,e:
|
103
|
+
debug('msvc: get_msvc_version: %r %r %r -> failure'%(compiler,version,target))
|
104
|
+
debug(str(e))
|
105
|
+
conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
|
106
|
+
else:
|
107
|
+
debug('msvc: get_msvc_version: %r %r %r -> OK',compiler,version,target)
|
108
|
+
finally:
|
109
|
+
conf.env[compiler_name]=''
|
110
|
+
return(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR)
|
111
|
+
def gather_wsdk_versions(conf,versions):
|
112
|
+
version_pattern=re.compile('^v..?.?\...?.?')
|
113
|
+
try:
|
114
|
+
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows')
|
115
|
+
except WindowsError:
|
116
|
+
try:
|
117
|
+
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows')
|
118
|
+
except WindowsError:
|
119
|
+
return
|
120
|
+
index=0
|
121
|
+
while 1:
|
122
|
+
try:
|
123
|
+
version=_winreg.EnumKey(all_versions,index)
|
124
|
+
except WindowsError:
|
125
|
+
break
|
126
|
+
index=index+1
|
127
|
+
if not version_pattern.match(version):
|
128
|
+
continue
|
129
|
+
try:
|
130
|
+
msvc_version=_winreg.OpenKey(all_versions,version)
|
131
|
+
path,type=_winreg.QueryValueEx(msvc_version,'InstallationFolder')
|
132
|
+
except WindowsError:
|
133
|
+
continue
|
134
|
+
if os.path.isfile(os.path.join(path,'bin','SetEnv.cmd')):
|
135
|
+
targets=[]
|
136
|
+
for target,arch in all_msvc_platforms:
|
137
|
+
try:
|
138
|
+
targets.append((target,(arch,conf.get_msvc_version('wsdk',version,'/'+target,os.path.join(path,'bin','SetEnv.cmd')))))
|
139
|
+
except conf.errors.ConfigurationError:
|
140
|
+
pass
|
141
|
+
versions.append(('wsdk '+version[1:],targets))
|
142
|
+
def gather_wince_supported_platforms():
|
143
|
+
supported_wince_platforms=[]
|
144
|
+
try:
|
145
|
+
ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs')
|
146
|
+
except WindowsError:
|
147
|
+
try:
|
148
|
+
ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs')
|
149
|
+
except WindowsError:
|
150
|
+
ce_sdk=''
|
151
|
+
if not ce_sdk:
|
152
|
+
return supported_wince_platforms
|
153
|
+
ce_index=0
|
154
|
+
while 1:
|
155
|
+
try:
|
156
|
+
sdk_device=_winreg.EnumKey(ce_sdk,ce_index)
|
157
|
+
except WindowsError:
|
158
|
+
break
|
159
|
+
ce_index=ce_index+1
|
160
|
+
sdk=_winreg.OpenKey(ce_sdk,sdk_device)
|
161
|
+
try:
|
162
|
+
path,type=_winreg.QueryValueEx(sdk,'SDKRootDir')
|
163
|
+
except WindowsError:
|
164
|
+
continue
|
165
|
+
path=str(path)
|
166
|
+
path,device=os.path.split(path)
|
167
|
+
if not device:
|
168
|
+
path,device=os.path.split(path)
|
169
|
+
for arch,compiler in all_wince_platforms:
|
170
|
+
platforms=[]
|
171
|
+
if os.path.isdir(os.path.join(path,device,'Lib',arch)):
|
172
|
+
platforms.append((arch,compiler,os.path.join(path,device,'Include',arch),os.path.join(path,device,'Lib',arch)))
|
173
|
+
if platforms:
|
174
|
+
supported_wince_platforms.append((device,platforms))
|
175
|
+
return supported_wince_platforms
|
176
|
+
def gather_msvc_detected_versions():
|
177
|
+
version_pattern=re.compile('^(\d\d?\.\d\d?)(Exp)?$')
|
178
|
+
detected_versions=[]
|
179
|
+
for vcver,vcvar in[('VCExpress','Exp'),('VisualStudio','')]:
|
180
|
+
try:
|
181
|
+
prefix='SOFTWARE\\Wow6432node\\Microsoft\\'+vcver
|
182
|
+
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,prefix)
|
183
|
+
except WindowsError:
|
184
|
+
try:
|
185
|
+
prefix='SOFTWARE\\Microsoft\\'+vcver
|
186
|
+
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,prefix)
|
187
|
+
except WindowsError:
|
188
|
+
continue
|
189
|
+
index=0
|
190
|
+
while 1:
|
191
|
+
try:
|
192
|
+
version=_winreg.EnumKey(all_versions,index)
|
193
|
+
except WindowsError:
|
194
|
+
break
|
195
|
+
index=index+1
|
196
|
+
match=version_pattern.match(version)
|
197
|
+
if not match:
|
198
|
+
continue
|
199
|
+
else:
|
200
|
+
versionnumber=float(match.group(1))
|
201
|
+
detected_versions.append((versionnumber,version+vcvar,prefix+"\\"+version))
|
202
|
+
def fun(tup):
|
203
|
+
return tup[0]
|
204
|
+
try:
|
205
|
+
detected_versions.sort(key=fun)
|
206
|
+
except:
|
207
|
+
detected_versions.sort(lambda x,y:cmp(x[0],y[0]))
|
208
|
+
return detected_versions
|
209
|
+
def gather_msvc_targets(conf,versions,version,vc_path):
|
210
|
+
targets=[]
|
211
|
+
if os.path.isfile(os.path.join(vc_path,'vcvarsall.bat')):
|
212
|
+
for target,realtarget in all_msvc_platforms[::-1]:
|
213
|
+
try:
|
214
|
+
targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(vc_path,'vcvarsall.bat')))))
|
215
|
+
except conf.errors.ConfigurationError:
|
216
|
+
pass
|
217
|
+
elif os.path.isfile(os.path.join(vc_path,'Common7','Tools','vsvars32.bat')):
|
218
|
+
try:
|
219
|
+
targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'x86',os.path.join(vc_path,'Common7','Tools','vsvars32.bat')))))
|
220
|
+
except conf.errors.ConfigurationError:
|
221
|
+
pass
|
222
|
+
elif os.path.isfile(os.path.join(vc_path,'Bin','vcvars32.bat')):
|
223
|
+
try:
|
224
|
+
targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'',os.path.join(vc_path,'Bin','vcvars32.bat')))))
|
225
|
+
except conf.errors.ConfigurationError:
|
226
|
+
pass
|
227
|
+
versions.append(('msvc '+version,targets))
|
228
|
+
def gather_wince_targets(conf,versions,version,vc_path,vsvars,supported_platforms):
|
229
|
+
for device,platforms in supported_platforms:
|
230
|
+
cetargets=[]
|
231
|
+
for platform,compiler,include,lib in platforms:
|
232
|
+
winCEpath=os.path.join(vc_path,'ce')
|
233
|
+
if not os.path.isdir(winCEpath):
|
234
|
+
continue
|
235
|
+
try:
|
236
|
+
common_bindirs,_1,_2=conf.get_msvc_version('msvc',version,'x86',vsvars)
|
237
|
+
except conf.errors.ConfigurationError:
|
238
|
+
continue
|
239
|
+
if os.path.isdir(os.path.join(winCEpath,'lib',platform)):
|
240
|
+
bindirs=[os.path.join(winCEpath,'bin',compiler),os.path.join(winCEpath,'bin','x86_'+compiler)]+common_bindirs
|
241
|
+
incdirs=[include,os.path.join(winCEpath,'include'),os.path.join(winCEpath,'atlmfc','include')]
|
242
|
+
libdirs=[lib,os.path.join(winCEpath,'lib',platform),os.path.join(winCEpath,'atlmfc','lib',platform)]
|
243
|
+
cetargets.append((platform,(platform,(bindirs,incdirs,libdirs))))
|
244
|
+
if cetargets:
|
245
|
+
versions.append((device+' '+version,cetargets))
|
246
|
+
def gather_msvc_versions(conf,versions):
|
247
|
+
vc_paths=[]
|
248
|
+
for(v,version,reg)in gather_msvc_detected_versions():
|
249
|
+
try:
|
250
|
+
try:
|
251
|
+
msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\VC")
|
252
|
+
except WindowsError:
|
253
|
+
msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\Microsoft Visual C++")
|
254
|
+
path,type=_winreg.QueryValueEx(msvc_version,'ProductDir')
|
255
|
+
vc_paths.append((version,os.path.abspath(str(path))))
|
256
|
+
except WindowsError:
|
257
|
+
continue
|
258
|
+
wince_supported_platforms=gather_wince_supported_platforms()
|
259
|
+
for version,vc_path in vc_paths:
|
260
|
+
vs_path=os.path.dirname(vc_path)
|
261
|
+
vsvars=os.path.join(vs_path,'Common7','Tools','vsvars32.bat')
|
262
|
+
if wince_supported_platforms and os.path.isfile(vsvars):
|
263
|
+
conf.gather_wince_targets(versions,version,vc_path,vsvars,wince_supported_platforms)
|
264
|
+
for version,vc_path in vc_paths:
|
265
|
+
vs_path=os.path.dirname(vc_path)
|
266
|
+
conf.gather_msvc_targets(versions,version,vc_path)
|
267
|
+
def gather_icl_versions(conf,versions):
|
268
|
+
version_pattern=re.compile('^...?.?\....?.?')
|
269
|
+
try:
|
270
|
+
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++')
|
271
|
+
except WindowsError:
|
272
|
+
try:
|
273
|
+
all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Intel\\Compilers\\C++')
|
274
|
+
except WindowsError:
|
275
|
+
return
|
276
|
+
index=0
|
277
|
+
while 1:
|
278
|
+
try:
|
279
|
+
version=_winreg.EnumKey(all_versions,index)
|
280
|
+
except WindowsError:
|
281
|
+
break
|
282
|
+
index=index+1
|
283
|
+
if not version_pattern.match(version):
|
284
|
+
continue
|
285
|
+
targets=[]
|
286
|
+
for target,arch in all_icl_platforms:
|
287
|
+
try:
|
288
|
+
if target=='intel64':targetDir='EM64T_NATIVE'
|
289
|
+
else:targetDir=target
|
290
|
+
_winreg.OpenKey(all_versions,version+'\\'+targetDir)
|
291
|
+
icl_version=_winreg.OpenKey(all_versions,version)
|
292
|
+
path,type=_winreg.QueryValueEx(icl_version,'ProductDir')
|
293
|
+
if os.path.isfile(os.path.join(path,'bin','iclvars.bat')):
|
294
|
+
try:
|
295
|
+
targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat')))))
|
296
|
+
except conf.errors.ConfigurationError:
|
297
|
+
pass
|
298
|
+
except WindowsError:
|
299
|
+
pass
|
300
|
+
for target,arch in all_icl_platforms:
|
301
|
+
try:
|
302
|
+
icl_version=_winreg.OpenKey(all_versions,version+'\\'+target)
|
303
|
+
path,type=_winreg.QueryValueEx(icl_version,'ProductDir')
|
304
|
+
if os.path.isfile(os.path.join(path,'bin','iclvars.bat')):
|
305
|
+
try:
|
306
|
+
targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat')))))
|
307
|
+
except conf.errors.ConfigurationError:
|
308
|
+
pass
|
309
|
+
except WindowsError:
|
310
|
+
continue
|
311
|
+
major=version[0:2]
|
312
|
+
versions.append(('intel '+major,targets))
|
313
|
+
def get_msvc_versions(conf):
|
314
|
+
if not conf.env['MSVC_INSTALLED_VERSIONS']:
|
315
|
+
lst=[]
|
316
|
+
conf.gather_icl_versions(lst)
|
317
|
+
conf.gather_wsdk_versions(lst)
|
318
|
+
conf.gather_msvc_versions(lst)
|
319
|
+
conf.env['MSVC_INSTALLED_VERSIONS']=lst
|
320
|
+
return conf.env['MSVC_INSTALLED_VERSIONS']
|
321
|
+
def print_all_msvc_detected(conf):
|
322
|
+
for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']:
|
323
|
+
info(version)
|
324
|
+
for target,l in targets:
|
325
|
+
info("\t"+target)
|
326
|
+
def detect_msvc(conf):
|
327
|
+
versions=get_msvc_versions(conf)
|
328
|
+
return setup_msvc(conf,versions)
|
329
|
+
def find_lt_names_msvc(self,libname,is_static=False):
|
330
|
+
lt_names=['lib%s.la'%libname,'%s.la'%libname,]
|
331
|
+
for path in self.env['LIBPATH']:
|
332
|
+
for la in lt_names:
|
333
|
+
laf=os.path.join(path,la)
|
334
|
+
dll=None
|
335
|
+
if os.path.exists(laf):
|
336
|
+
ltdict=Utils.read_la_file(laf)
|
337
|
+
lt_libdir=None
|
338
|
+
if ltdict.get('libdir',''):
|
339
|
+
lt_libdir=ltdict['libdir']
|
340
|
+
if not is_static and ltdict.get('library_names',''):
|
341
|
+
dllnames=ltdict['library_names'].split()
|
342
|
+
dll=dllnames[0].lower()
|
343
|
+
dll=re.sub('\.dll$','',dll)
|
344
|
+
return(lt_libdir,dll,False)
|
345
|
+
elif ltdict.get('old_library',''):
|
346
|
+
olib=ltdict['old_library']
|
347
|
+
if os.path.exists(os.path.join(path,olib)):
|
348
|
+
return(path,olib,True)
|
349
|
+
elif lt_libdir!=''and os.path.exists(os.path.join(lt_libdir,olib)):
|
350
|
+
return(lt_libdir,olib,True)
|
351
|
+
else:
|
352
|
+
return(None,olib,True)
|
353
|
+
else:
|
354
|
+
raise self.errors.WafError('invalid libtool object file: %s'%laf)
|
355
|
+
return(None,None,None)
|
356
|
+
def libname_msvc(self,libname,is_static=False):
|
357
|
+
lib=libname.lower()
|
358
|
+
lib=re.sub('\.lib$','',lib)
|
359
|
+
if lib in g_msvc_systemlibs:
|
360
|
+
return lib
|
361
|
+
lib=re.sub('^lib','',lib)
|
362
|
+
if lib=='m':
|
363
|
+
return None
|
364
|
+
(lt_path,lt_libname,lt_static)=self.find_lt_names_msvc(lib,is_static)
|
365
|
+
if lt_path!=None and lt_libname!=None:
|
366
|
+
if lt_static==True:
|
367
|
+
return os.path.join(lt_path,lt_libname)
|
368
|
+
if lt_path!=None:
|
369
|
+
_libpaths=[lt_path]+self.env['LIBPATH']
|
370
|
+
else:
|
371
|
+
_libpaths=self.env['LIBPATH']
|
372
|
+
static_libs=['lib%ss.lib'%lib,'lib%s.lib'%lib,'%ss.lib'%lib,'%s.lib'%lib,]
|
373
|
+
dynamic_libs=['lib%s.dll.lib'%lib,'lib%s.dll.a'%lib,'%s.dll.lib'%lib,'%s.dll.a'%lib,'lib%s_d.lib'%lib,'%s_d.lib'%lib,'%s.lib'%lib,]
|
374
|
+
libnames=static_libs
|
375
|
+
if not is_static:
|
376
|
+
libnames=dynamic_libs+static_libs
|
377
|
+
for path in _libpaths:
|
378
|
+
for libn in libnames:
|
379
|
+
if os.path.exists(os.path.join(path,libn)):
|
380
|
+
debug('msvc: lib found: %s'%os.path.join(path,libn))
|
381
|
+
return re.sub('\.lib$','',libn)
|
382
|
+
self.fatal("The library %r could not be found"%libname)
|
383
|
+
return re.sub('\.lib$','',libname)
|
384
|
+
def check_lib_msvc(self,libname,is_static=False,uselib_store=None):
|
385
|
+
libn=self.libname_msvc(libname,is_static)
|
386
|
+
if not uselib_store:
|
387
|
+
uselib_store=libname.upper()
|
388
|
+
if False and is_static:
|
389
|
+
self.env['STLIB_'+uselib_store]=[libn]
|
390
|
+
else:
|
391
|
+
self.env['LIB_'+uselib_store]=[libn]
|
392
|
+
def check_libs_msvc(self,libnames,is_static=False):
|
393
|
+
for libname in Utils.to_list(libnames):
|
394
|
+
self.check_lib_msvc(libname,is_static)
|
395
|
+
def configure(conf):
|
396
|
+
conf.autodetect()
|
397
|
+
conf.find_msvc()
|
398
|
+
conf.msvc_common_flags()
|
399
|
+
conf.cc_load_tools()
|
400
|
+
conf.cxx_load_tools()
|
401
|
+
conf.cc_add_flags()
|
402
|
+
conf.cxx_add_flags()
|
403
|
+
conf.link_add_flags()
|
404
|
+
conf.visual_studio_add_flags()
|
405
|
+
def no_autodetect(conf):
|
406
|
+
conf.env.NO_MSVC_DETECT=1
|
407
|
+
configure(conf)
|
408
|
+
def autodetect(conf):
|
409
|
+
v=conf.env
|
410
|
+
if v.NO_MSVC_DETECT:
|
411
|
+
return
|
412
|
+
compiler,version,path,includes,libdirs=conf.detect_msvc()
|
413
|
+
v['PATH']=path
|
414
|
+
v['INCLUDES']=includes
|
415
|
+
v['LIBPATH']=libdirs
|
416
|
+
v['MSVC_COMPILER']=compiler
|
417
|
+
try:
|
418
|
+
v['MSVC_VERSION']=float(version)
|
419
|
+
except:
|
420
|
+
v['MSVC_VERSION']=float(version[:-3])
|
421
|
+
def _get_prog_names(conf,compiler):
|
422
|
+
if compiler=='intel':
|
423
|
+
compiler_name='ICL'
|
424
|
+
linker_name='XILINK'
|
425
|
+
lib_name='XILIB'
|
426
|
+
else:
|
427
|
+
compiler_name='CL'
|
428
|
+
linker_name='LINK'
|
429
|
+
lib_name='LIB'
|
430
|
+
return compiler_name,linker_name,lib_name
|
431
|
+
def find_msvc(conf):
|
432
|
+
if sys.platform=='cygwin':
|
433
|
+
conf.fatal('MSVC module does not work under cygwin Python!')
|
434
|
+
v=conf.env
|
435
|
+
path=v['PATH']
|
436
|
+
compiler=v['MSVC_COMPILER']
|
437
|
+
version=v['MSVC_VERSION']
|
438
|
+
compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
|
439
|
+
v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11)
|
440
|
+
cxx=None
|
441
|
+
if v['CXX']:cxx=v['CXX']
|
442
|
+
elif'CXX'in conf.environ:cxx=conf.environ['CXX']
|
443
|
+
cxx=conf.find_program(compiler_name,var='CXX',path_list=path)
|
444
|
+
cxx=conf.cmd_to_list(cxx)
|
445
|
+
env=dict(conf.environ)
|
446
|
+
if path:env.update(PATH=';'.join(path))
|
447
|
+
if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env):
|
448
|
+
conf.fatal('the msvc compiler could not be identified')
|
449
|
+
v['CC']=v['CXX']=cxx
|
450
|
+
v['CC_NAME']=v['CXX_NAME']='msvc'
|
451
|
+
if not v['LINK_CXX']:
|
452
|
+
link=conf.find_program(linker_name,path_list=path)
|
453
|
+
if link:v['LINK_CXX']=link
|
454
|
+
else:conf.fatal('%s was not found (linker)'%linker_name)
|
455
|
+
v['LINK']=link
|
456
|
+
if not v['LINK_CC']:
|
457
|
+
v['LINK_CC']=v['LINK_CXX']
|
458
|
+
if not v['AR']:
|
459
|
+
stliblink=conf.find_program(lib_name,path_list=path,var='AR')
|
460
|
+
if not stliblink:return
|
461
|
+
v['ARFLAGS']=['/NOLOGO']
|
462
|
+
if v.MSVC_MANIFEST:
|
463
|
+
mt=conf.find_program('MT',path_list=path,var='MT')
|
464
|
+
v['MTFLAGS']=['/NOLOGO']
|
465
|
+
conf.load('winres')
|
466
|
+
if not conf.env['WINRC']:
|
467
|
+
warn('Resource compiler not found. Compiling resource file is disabled')
|
468
|
+
def visual_studio_add_flags(self):
|
469
|
+
v=self.env
|
470
|
+
try:v.prepend_value('INCLUDES',self.environ['INCLUDE'].split(';'))
|
471
|
+
except:pass
|
472
|
+
try:v.prepend_value('LIBPATH',self.environ['LIB'].split(';'))
|
473
|
+
except:pass
|
474
|
+
def msvc_common_flags(conf):
|
475
|
+
v=conf.env
|
476
|
+
v['DEST_BINFMT']='pe'
|
477
|
+
v.append_value('CFLAGS',['/nologo'])
|
478
|
+
v.append_value('CXXFLAGS',['/nologo'])
|
479
|
+
v['DEFINES_ST']='/D%s'
|
480
|
+
v['CC_SRC_F']=''
|
481
|
+
v['CC_TGT_F']=['/c','/Fo']
|
482
|
+
if v['MSVC_VERSION']>=8:
|
483
|
+
v['CC_TGT_F']=['/FC']+v['CC_TGT_F']
|
484
|
+
v['CXX_SRC_F']=''
|
485
|
+
v['CXX_TGT_F']=['/c','/Fo']
|
486
|
+
if v['MSVC_VERSION']>=8:
|
487
|
+
v['CXX_TGT_F']=['/FC']+v['CXX_TGT_F']
|
488
|
+
v['CPPPATH_ST']='/I%s'
|
489
|
+
v['AR_TGT_F']=v['CCLNK_TGT_F']=v['CXXLNK_TGT_F']='/OUT:'
|
490
|
+
v['CFLAGS_CONSOLE']=v['CXXFLAGS_CONSOLE']=['/SUBSYSTEM:CONSOLE']
|
491
|
+
v['CFLAGS_NATIVE']=v['CXXFLAGS_NATIVE']=['/SUBSYSTEM:NATIVE']
|
492
|
+
v['CFLAGS_POSIX']=v['CXXFLAGS_POSIX']=['/SUBSYSTEM:POSIX']
|
493
|
+
v['CFLAGS_WINDOWS']=v['CXXFLAGS_WINDOWS']=['/SUBSYSTEM:WINDOWS']
|
494
|
+
v['CFLAGS_WINDOWSCE']=v['CXXFLAGS_WINDOWSCE']=['/SUBSYSTEM:WINDOWSCE']
|
495
|
+
v['CFLAGS_CRT_MULTITHREADED']=v['CXXFLAGS_CRT_MULTITHREADED']=['/MT']
|
496
|
+
v['CFLAGS_CRT_MULTITHREADED_DLL']=v['CXXFLAGS_CRT_MULTITHREADED_DLL']=['/MD']
|
497
|
+
v['CFLAGS_CRT_MULTITHREADED_DBG']=v['CXXFLAGS_CRT_MULTITHREADED_DBG']=['/MTd']
|
498
|
+
v['CFLAGS_CRT_MULTITHREADED_DLL_DBG']=v['CXXFLAGS_CRT_MULTITHREADED_DLL_DBG']=['/MDd']
|
499
|
+
v['LIB_ST']='%s.lib'
|
500
|
+
v['LIBPATH_ST']='/LIBPATH:%s'
|
501
|
+
v['STLIB_ST']='lib%s.lib'
|
502
|
+
v['STLIBPATH_ST']='/LIBPATH:%s'
|
503
|
+
v.append_value('LINKFLAGS',['/NOLOGO'])
|
504
|
+
if v['MSVC_MANIFEST']:
|
505
|
+
v.append_value('LINKFLAGS',['/MANIFEST'])
|
506
|
+
v['CFLAGS_cshlib']=[]
|
507
|
+
v['CXXFLAGS_cxxshlib']=[]
|
508
|
+
v['LINKFLAGS_cshlib']=v['LINKFLAGS_cxxshlib']=['/DLL']
|
509
|
+
v['cshlib_PATTERN']=v['cxxshlib_PATTERN']='%s.dll'
|
510
|
+
v['implib_PATTERN']='%s.lib'
|
511
|
+
v['IMPLIB_ST']='/IMPLIB:%s'
|
512
|
+
v['LINKFLAGS_cstlib']=[]
|
513
|
+
v['cstlib_PATTERN']=v['cxxstlib_PATTERN']='lib%s.lib'
|
514
|
+
v['cprogram_PATTERN']=v['cxxprogram_PATTERN']='%s.exe'
|
515
|
+
def apply_flags_msvc(self):
|
516
|
+
if self.env.CC_NAME!='msvc'or not getattr(self,'link_task',None):
|
517
|
+
return
|
518
|
+
is_static=isinstance(self.link_task,ccroot.stlink_task)
|
519
|
+
subsystem=getattr(self,'subsystem','')
|
520
|
+
if subsystem:
|
521
|
+
subsystem='/subsystem:%s'%subsystem
|
522
|
+
flags=is_static and'ARFLAGS'or'LINKFLAGS'
|
523
|
+
self.env.append_value(flags,subsystem)
|
524
|
+
if not is_static:
|
525
|
+
for f in self.env.LINKFLAGS:
|
526
|
+
d=f.lower()
|
527
|
+
if d[1:]=='debug':
|
528
|
+
pdbnode=self.link_task.outputs[0].change_ext('.pdb')
|
529
|
+
self.link_task.outputs.append(pdbnode)
|
530
|
+
try:
|
531
|
+
self.install_task.source.append(pdbnode)
|
532
|
+
except AttributeError:
|
533
|
+
pass
|
534
|
+
break
|
535
|
+
def apply_manifest(self):
|
536
|
+
if self.env.CC_NAME=='msvc'and self.env.MSVC_MANIFEST and getattr(self,'link_task',None):
|
537
|
+
out_node=self.link_task.outputs[0]
|
538
|
+
man_node=out_node.parent.find_or_declare(out_node.name+'.manifest')
|
539
|
+
self.link_task.outputs.append(man_node)
|
540
|
+
self.link_task.do_manifest=True
|
541
|
+
def exec_mf(self):
|
542
|
+
env=self.env
|
543
|
+
mtool=env['MT']
|
544
|
+
if not mtool:
|
545
|
+
return 0
|
546
|
+
self.do_manifest=False
|
547
|
+
outfile=self.outputs[0].abspath()
|
548
|
+
manifest=None
|
549
|
+
for out_node in self.outputs:
|
550
|
+
if out_node.name.endswith('.manifest'):
|
551
|
+
manifest=out_node.abspath()
|
552
|
+
break
|
553
|
+
if manifest is None:
|
554
|
+
return 0
|
555
|
+
mode=''
|
556
|
+
if'cprogram'in self.generator.features or'cxxprogram'in self.generator.features:
|
557
|
+
mode='1'
|
558
|
+
elif'cshlib'in self.generator.features or'cxxshlib'in self.generator.features:
|
559
|
+
mode='2'
|
560
|
+
debug('msvc: embedding manifest in mode %r'%mode)
|
561
|
+
lst=[]
|
562
|
+
lst.append(env['MT'])
|
563
|
+
lst.extend(Utils.to_list(env['MTFLAGS']))
|
564
|
+
lst.extend(['-manifest',manifest])
|
565
|
+
lst.append('-outputresource:%s;%s'%(outfile,mode))
|
566
|
+
lst=[lst]
|
567
|
+
return self.exec_command(*lst)
|
568
|
+
def quote_response_command(self,flag):
|
569
|
+
if flag.find(' ')>-1:
|
570
|
+
for x in('/LIBPATH:','/IMPLIB:','/OUT:','/I'):
|
571
|
+
if flag.startswith(x):
|
572
|
+
flag='%s"%s"'%(x,flag[len(x):])
|
573
|
+
break
|
574
|
+
else:
|
575
|
+
flag='"%s"'%flag
|
576
|
+
return flag
|
577
|
+
def exec_response_command(self,cmd,**kw):
|
578
|
+
try:
|
579
|
+
tmp=None
|
580
|
+
if sys.platform.startswith('win')and isinstance(cmd,list)and len(' '.join(cmd))>=8192:
|
581
|
+
program=cmd[0]
|
582
|
+
cmd=[self.quote_response_command(x)for x in cmd]
|
583
|
+
(fd,tmp)=tempfile.mkstemp()
|
584
|
+
os.write(fd,'\r\n'.join(i.replace('\\','\\\\')for i in cmd[1:]))
|
585
|
+
os.close(fd)
|
586
|
+
cmd=[program,'@'+tmp]
|
587
|
+
ret=self.generator.bld.exec_command(cmd,**kw)
|
588
|
+
finally:
|
589
|
+
if tmp:
|
590
|
+
try:
|
591
|
+
os.remove(tmp)
|
592
|
+
except:
|
593
|
+
pass
|
594
|
+
return ret
|
595
|
+
def exec_command_msvc(self,*k,**kw):
|
596
|
+
if self.env['CC_NAME']=='msvc':
|
597
|
+
if isinstance(k[0],list):
|
598
|
+
lst=[]
|
599
|
+
carry=''
|
600
|
+
for a in k[0]:
|
601
|
+
if a=='/Fo'or a=='/doc'or a[-1]==':':
|
602
|
+
carry=a
|
603
|
+
else:
|
604
|
+
lst.append(carry+a)
|
605
|
+
carry=''
|
606
|
+
k=[lst]
|
607
|
+
if self.env['PATH']:
|
608
|
+
env=dict(os.environ)
|
609
|
+
env.update(PATH=';'.join(self.env['PATH']))
|
610
|
+
kw['env']=env
|
611
|
+
bld=self.generator.bld
|
612
|
+
try:
|
613
|
+
if not kw.get('cwd',None):
|
614
|
+
kw['cwd']=bld.cwd
|
615
|
+
except AttributeError:
|
616
|
+
bld.cwd=kw['cwd']=bld.variant_dir
|
617
|
+
ret=self.exec_response_command(k[0],**kw)
|
618
|
+
if not ret and getattr(self,'do_manifest',None):
|
619
|
+
ret=self.exec_mf()
|
620
|
+
return ret
|
621
|
+
for k in'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split():
|
622
|
+
cls=Task.classes.get(k,None)
|
623
|
+
if cls:
|
624
|
+
cls.exec_command=exec_command_msvc
|
625
|
+
cls.exec_response_command=exec_response_command
|
626
|
+
cls.quote_response_command=quote_response_command
|
627
|
+
cls.exec_mf=exec_mf
|
628
|
+
|
629
|
+
conf(get_msvc_version)
|
630
|
+
conf(gather_wsdk_versions)
|
631
|
+
conf(gather_msvc_targets)
|
632
|
+
conf(gather_wince_targets)
|
633
|
+
conf(gather_msvc_versions)
|
634
|
+
conf(gather_icl_versions)
|
635
|
+
conf(get_msvc_versions)
|
636
|
+
conf(print_all_msvc_detected)
|
637
|
+
conf(detect_msvc)
|
638
|
+
conf(find_lt_names_msvc)
|
639
|
+
conf(libname_msvc)
|
640
|
+
conf(check_lib_msvc)
|
641
|
+
conf(check_libs_msvc)
|
642
|
+
conf(no_autodetect)
|
643
|
+
conf(autodetect)
|
644
|
+
conf(find_msvc)
|
645
|
+
conf(visual_studio_add_flags)
|
646
|
+
conf(msvc_common_flags)
|
647
|
+
after_method('apply_link')(apply_flags_msvc)
|
648
|
+
feature('c','cxx')(apply_flags_msvc)
|
649
|
+
feature('cprogram','cshlib','cxxprogram','cxxshlib')(apply_manifest)
|
650
|
+
after_method('apply_link')(apply_manifest)
|