text_ux 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +51 -0
  7. data/Rakefile +18 -0
  8. data/ext/text_ux/extconf.rb +5 -0
  9. data/ext/text_ux/text_ux.cpp +252 -0
  10. data/lib/text_ux.rb +5 -0
  11. data/lib/text_ux/version.rb +3 -0
  12. data/spec/fixtures/test.ux +0 -0
  13. data/spec/spec_helper.rb +19 -0
  14. data/spec/text_ux_spec.rb +137 -0
  15. data/text_ux.gemspec +26 -0
  16. data/vendor/ux-trie/ux-0.1.9/.lock-waf_darwin_build +8 -0
  17. data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest-all.cc +9118 -0
  18. data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest.h +19537 -0
  19. data/vendor/ux-trie/ux-0.1.9/.unittest-gtest/gtest-1.6.0/fused-src/gtest/gtest_main.cc +39 -0
  20. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.py +733 -0
  21. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Build.pyc +0 -0
  22. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.py +147 -0
  23. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ConfigSet.pyc +0 -0
  24. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.py +314 -0
  25. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Configure.pyc +0 -0
  26. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.py +298 -0
  27. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Context.pyc +0 -0
  28. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.py +37 -0
  29. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Errors.pyc +0 -0
  30. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.py +149 -0
  31. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Logs.pyc +0 -0
  32. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.py +500 -0
  33. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Node.pyc +0 -0
  34. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.py +130 -0
  35. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Options.pyc +0 -0
  36. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.py +191 -0
  37. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Runner.pyc +0 -0
  38. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.py +358 -0
  39. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Scripting.pyc +0 -0
  40. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.py +669 -0
  41. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Task.pyc +0 -0
  42. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.py +341 -0
  43. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/TaskGen.pyc +0 -0
  44. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.py +4 -0
  45. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/__init__.pyc +0 -0
  46. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.py +12 -0
  47. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ar.pyc +0 -0
  48. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/asm.py +25 -0
  49. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/bison.py +29 -0
  50. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c.py +27 -0
  51. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.py +56 -0
  52. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_aliases.pyc +0 -0
  53. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.py +708 -0
  54. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_config.pyc +0 -0
  55. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.py +121 -0
  56. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_osx.pyc +0 -0
  57. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.py +606 -0
  58. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_preproc.pyc +0 -0
  59. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.py +110 -0
  60. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/c_tests.pyc +0 -0
  61. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.py +372 -0
  62. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ccroot.pyc +0 -0
  63. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_c.py +39 -0
  64. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.py +39 -0
  65. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_cxx.pyc +0 -0
  66. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_d.py +30 -0
  67. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/compiler_fc.py +45 -0
  68. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cs.py +98 -0
  69. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.py +27 -0
  70. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/cxx.pyc +0 -0
  71. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d.py +51 -0
  72. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_config.py +47 -0
  73. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/d_scan.py +133 -0
  74. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dbus.py +30 -0
  75. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/dmd.py +43 -0
  76. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/errcheck.py +153 -0
  77. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc.py +123 -0
  78. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_config.py +271 -0
  79. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/fc_scan.py +68 -0
  80. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/flex.py +27 -0
  81. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/g95.py +55 -0
  82. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gas.py +10 -0
  83. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gcc.py +98 -0
  84. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gdc.py +34 -0
  85. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gfortran.py +69 -0
  86. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/glib2.py +174 -0
  87. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gnu_dirs.py +65 -0
  88. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.py +98 -0
  89. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/gxx.pyc +0 -0
  90. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icc.py +31 -0
  91. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/icpc.py +30 -0
  92. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ifort.py +42 -0
  93. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/intltool.py +78 -0
  94. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/irixcc.py +49 -0
  95. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/javaw.py +272 -0
  96. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/kde4.py +49 -0
  97. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/lua.py +19 -0
  98. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/msvc.py +650 -0
  99. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/nasm.py +13 -0
  100. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/perl.py +78 -0
  101. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/python.py +303 -0
  102. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/qt4.py +424 -0
  103. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/ruby.py +104 -0
  104. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncc.py +54 -0
  105. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/suncxx.py +55 -0
  106. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/tex.py +222 -0
  107. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/vala.py +215 -0
  108. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/waf_unit_test.py +79 -0
  109. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/winres.py +34 -0
  110. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlc.py +46 -0
  111. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Tools/xlcxx.py +46 -0
  112. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.py +334 -0
  113. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/Utils.pyc +0 -0
  114. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.py +4 -0
  115. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/__init__.pyc +0 -0
  116. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.py +173 -0
  117. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/ansiterm.pyc +0 -0
  118. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.py +4 -0
  119. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/__init__.pyc +0 -0
  120. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.py +223 -0
  121. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/extras/compat15.pyc +0 -0
  122. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.py +50 -0
  123. data/vendor/ux-trie/ux-0.1.9/.waf-1.6.8-3e3391c5f23fbabad81e6d17c63a1b1e/waflib/fixpy2.pyc +0 -0
  124. data/vendor/ux-trie/ux-0.1.9/src/bitVec.cpp +119 -0
  125. data/vendor/ux-trie/ux-0.1.9/src/bitVec.hpp +64 -0
  126. data/vendor/ux-trie/ux-0.1.9/src/bitVecTest.cpp +143 -0
  127. data/vendor/ux-trie/ux-0.1.9/src/cmdline.h +809 -0
  128. data/vendor/ux-trie/ux-0.1.9/src/rsDic.cpp +121 -0
  129. data/vendor/ux-trie/ux-0.1.9/src/rsDic.hpp +57 -0
  130. data/vendor/ux-trie/ux-0.1.9/src/ux.hpp +26 -0
  131. data/vendor/ux-trie/ux-0.1.9/src/uxMain.cpp +206 -0
  132. data/vendor/ux-trie/ux-0.1.9/src/uxMap.cpp +0 -0
  133. data/vendor/ux-trie/ux-0.1.9/src/uxMap.hpp +248 -0
  134. data/vendor/ux-trie/ux-0.1.9/src/uxMapTest.cpp +139 -0
  135. data/vendor/ux-trie/ux-0.1.9/src/uxTest.cpp +229 -0
  136. data/vendor/ux-trie/ux-0.1.9/src/uxTrie.cpp +529 -0
  137. data/vendor/ux-trie/ux-0.1.9/src/uxTrie.hpp +220 -0
  138. data/vendor/ux-trie/ux-0.1.9/src/uxUtil.cpp +92 -0
  139. data/vendor/ux-trie/ux-0.1.9/src/uxUtil.hpp +35 -0
  140. data/vendor/ux-trie/ux-0.1.9/src/wscript +43 -0
  141. data/vendor/ux-trie/ux-0.1.9/unittest_gtest.py +0 -0
  142. data/vendor/ux-trie/ux-0.1.9/unittest_gtest.pyc +0 -0
  143. data/vendor/ux-trie/ux-0.1.9/unittestt.py +166 -0
  144. data/vendor/ux-trie/ux-0.1.9/ux.pc.in +10 -0
  145. data/vendor/ux-trie/ux-0.1.9/waf +0 -0
  146. data/vendor/ux-trie/ux-0.1.9/wscript +32 -0
  147. metadata +249 -0
@@ -0,0 +1,110 @@
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.Configure import conf
6
+ from waflib.TaskGen import feature,before_method
7
+ import sys
8
+ LIB_CODE='''
9
+ #ifdef _MSC_VER
10
+ #define testEXPORT __declspec(dllexport)
11
+ #else
12
+ #define testEXPORT
13
+ #endif
14
+ testEXPORT int lib_func(void) { return 9; }
15
+ '''
16
+ MAIN_CODE='''
17
+ #ifdef _MSC_VER
18
+ #define testEXPORT __declspec(dllimport)
19
+ #else
20
+ #define testEXPORT
21
+ #endif
22
+ testEXPORT int lib_func(void);
23
+ int main(void) {return !(lib_func() == 9);}
24
+ '''
25
+ def link_lib_test_fun(self):
26
+ def write_test_file(task):
27
+ task.outputs[0].write(task.generator.code)
28
+ rpath=[]
29
+ if getattr(self,'add_rpath',False):
30
+ rpath=[self.bld.path.get_bld().abspath()]
31
+ mode=self.mode
32
+ m='%s %s'%(mode,mode)
33
+ bld=self.bld
34
+ bld(rule=write_test_file,target='test.'+mode,code=LIB_CODE)
35
+ bld(rule=write_test_file,target='main.'+mode,code=MAIN_CODE)
36
+ bld(features=m+'shlib',source='test.'+mode,target='test')
37
+ bld(features=m+'program test_exec',source='main.'+mode,target='app',use='test',rpath=rpath)
38
+ def check_library(self,mode=None):
39
+ if not mode:
40
+ mode='c'
41
+ if self.env.CXX:
42
+ mode='cxx'
43
+ self.check(compile_filename=[],features='link_lib_test',msg='Checking for libraries',mode=mode)
44
+ INLINE_CODE='''
45
+ typedef int foo_t;
46
+ static %s foo_t static_foo () {return 0; }
47
+ %s foo_t foo () {
48
+ return 0;
49
+ }
50
+ '''
51
+ INLINE_VALUES=['inline','__inline__','__inline']
52
+ def check_inline(self,**kw):
53
+ self.start_msg('Checking for inline')
54
+ if not'define_name'in kw:
55
+ kw['define_name']='INLINE_MACRO'
56
+ if not'features'in kw:
57
+ if self.env.CXX:
58
+ kw['features']=['cxx']
59
+ else:
60
+ kw['features']=['c']
61
+ for x in INLINE_VALUES:
62
+ kw['fragment']=INLINE_CODE%(x,x)
63
+ try:
64
+ self.check(**kw)
65
+ except self.errors.ConfigurationError:
66
+ continue
67
+ else:
68
+ self.end_msg(x)
69
+ if x!='inline':
70
+ self.define('inline',x,quote=False)
71
+ return x
72
+ self.fatal('could not use inline functions')
73
+ LARGE_FRAGMENT='#include <unistd.h>\nint main() { return !(sizeof(off_t) >= 8); }\n'
74
+ def check_large_file(self,**kw):
75
+ if not'define_name'in kw:
76
+ kw['define_name']='HAVE_LARGEFILE'
77
+ if not'execute'in kw:
78
+ kw['execute']=True
79
+ if not'features'in kw:
80
+ if self.env.CXX:
81
+ kw['features']=['cxx','cxxprogram']
82
+ else:
83
+ kw['features']=['c','cprogram']
84
+ kw['fragment']=LARGE_FRAGMENT
85
+ kw['msg']='Checking for large file support'
86
+ ret=True
87
+ try:
88
+ if self.env.DEST_BINFMT!='pe':
89
+ ret=self.check(**kw)
90
+ except self.errors.ConfigurationError:
91
+ pass
92
+ else:
93
+ if ret:
94
+ return True
95
+ kw['msg']='Checking for -D_FILE_OFFSET_BITS=64'
96
+ kw['defines']=['_FILE_OFFSET_BITS=64']
97
+ try:
98
+ ret=self.check(**kw)
99
+ except self.errors.ConfigurationError:
100
+ pass
101
+ else:
102
+ self.define('_FILE_OFFSET_BITS',64)
103
+ return ret
104
+ self.fatal('There is no support for large files')
105
+
106
+ feature('link_lib_test')(link_lib_test_fun)
107
+ before_method('process_source')(link_lib_test_fun)
108
+ conf(check_library)
109
+ conf(check_inline)
110
+ conf(check_large_file)
@@ -0,0 +1,372 @@
1
+ #! /usr/bin/env python
2
+ # encoding: utf-8
3
+ # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
+
5
+ import sys
6
+ if sys.hexversion < 0x020400f0: from sets import Set as set
7
+ import os,sys,re
8
+ from waflib import TaskGen,Task,Utils,Logs,Build,Options,Node,Errors
9
+ from waflib.Logs import error,debug,warn
10
+ from waflib.TaskGen import after_method,before_method,feature,taskgen_method,extension
11
+ from waflib.Tools import c_aliases,c_preproc,c_config,c_osx,c_tests
12
+ from waflib.Configure import conf
13
+ USELIB_VARS=Utils.defaultdict(set)
14
+ USELIB_VARS['c']=set(['INCLUDES','FRAMEWORKPATH','DEFINES','CPPFLAGS','CCDEPS','CFLAGS','ARCH'])
15
+ USELIB_VARS['cxx']=set(['INCLUDES','FRAMEWORKPATH','DEFINES','CPPFLAGS','CXXDEPS','CXXFLAGS','ARCH'])
16
+ USELIB_VARS['d']=set(['INCLUDES','DFLAGS'])
17
+ USELIB_VARS['cprogram']=USELIB_VARS['cxxprogram']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS','FRAMEWORK','FRAMEWORKPATH','ARCH'])
18
+ USELIB_VARS['cshlib']=USELIB_VARS['cxxshlib']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS','FRAMEWORK','FRAMEWORKPATH','ARCH'])
19
+ USELIB_VARS['cstlib']=USELIB_VARS['cxxstlib']=set(['ARFLAGS','LINKDEPS'])
20
+ USELIB_VARS['dprogram']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS'])
21
+ USELIB_VARS['dshlib']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS'])
22
+ USELIB_VARS['dstlib']=set(['ARFLAGS','LINKDEPS'])
23
+ USELIB_VARS['go']=set(['GOCFLAGS'])
24
+ USELIB_VARS['goprogram']=set(['GOLFLAGS'])
25
+ USELIB_VARS['asm']=set(['ASFLAGS'])
26
+ def create_compiled_task(self,name,node):
27
+ out='%s.%d.o'%(node.name,self.idx)
28
+ task=self.create_task(name,node,node.parent.find_or_declare(out))
29
+ try:
30
+ self.compiled_tasks.append(task)
31
+ except AttributeError:
32
+ self.compiled_tasks=[task]
33
+ return task
34
+ def to_incnodes(self,inlst):
35
+ lst=[]
36
+ seen=set([])
37
+ for x in self.to_list(inlst):
38
+ if x in seen or not x:
39
+ continue
40
+ seen.add(x)
41
+ if isinstance(x,Node.Node):
42
+ lst.append(x)
43
+ else:
44
+ if os.path.isabs(x):
45
+ lst.append(self.bld.root.make_node(x)or x)
46
+ else:
47
+ if x[0]=='#':
48
+ p=self.bld.bldnode.make_node(x[1:])
49
+ v=self.bld.srcnode.make_node(x[1:])
50
+ else:
51
+ p=self.path.get_bld().make_node(x)
52
+ v=self.path.make_node(x)
53
+ p.mkdir()
54
+ lst.append(p)
55
+ lst.append(v)
56
+ return lst
57
+ def apply_incpaths(self):
58
+ lst=self.to_incnodes(self.to_list(getattr(self,'includes',[]))+self.env['INCLUDES'])
59
+ self.includes_nodes=lst
60
+ self.env['INCPATHS']=[x.abspath()for x in lst]
61
+ class link_task(Task.Task):
62
+ color='YELLOW'
63
+ inst_to=None
64
+ chmod=Utils.O644
65
+ def add_target(self,target):
66
+ if isinstance(target,str):
67
+ pattern=self.env[self.__class__.__name__+'_PATTERN']
68
+ if not pattern:
69
+ pattern='%s'
70
+ folder,name=os.path.split(target)
71
+ if self.__class__.__name__.find('shlib')>0:
72
+ if self.env.DEST_BINFMT=='pe'and getattr(self.generator,'vnum',None):
73
+ name=name+'-'+self.generator.vnum.split('.')[0]
74
+ tmp=folder+os.sep+pattern%name
75
+ target=self.generator.path.find_or_declare(tmp)
76
+ self.set_outputs(target)
77
+ class stlink_task(link_task):
78
+ run_str='${AR} ${ARFLAGS} ${AR_TGT_F}${TGT} ${AR_SRC_F}${SRC}'
79
+ def rm_tgt(cls):
80
+ old=cls.run
81
+ def wrap(self):
82
+ try:os.remove(self.outputs[0].abspath())
83
+ except OSError:pass
84
+ return old(self)
85
+ setattr(cls,'run',wrap)
86
+ rm_tgt(stlink_task)
87
+ def apply_link(self):
88
+ for x in self.features:
89
+ if x=='cprogram'and'cxx'in self.features:
90
+ x='cxxprogram'
91
+ elif x=='cshlib'and'cxx'in self.features:
92
+ x='cxxshlib'
93
+ if x in Task.classes:
94
+ if issubclass(Task.classes[x],link_task):
95
+ link=x
96
+ break
97
+ else:
98
+ return
99
+ objs=[t.outputs[0]for t in getattr(self,'compiled_tasks',[])]
100
+ self.link_task=self.create_task(link,objs)
101
+ self.link_task.add_target(self.target)
102
+ if getattr(self.bld,'is_install',None):
103
+ try:
104
+ inst_to=self.install_path
105
+ except AttributeError:
106
+ inst_to=self.link_task.__class__.inst_to
107
+ if inst_to:
108
+ self.install_task=self.bld.install_files(inst_to,self.link_task.outputs[:],env=self.env,chmod=self.link_task.chmod)
109
+ def use_rec(self,name,**kw):
110
+ if name in self.tmp_use_not or name in self.tmp_use_seen:
111
+ return
112
+ try:
113
+ y=self.bld.get_tgen_by_name(name)
114
+ except Errors.WafError:
115
+ self.uselib.append(name)
116
+ self.tmp_use_not.add(name)
117
+ return
118
+ self.tmp_use_seen.append(name)
119
+ y.post()
120
+ y.tmp_use_objects=objects=kw.get('objects',True)
121
+ y.tmp_use_stlib=stlib=kw.get('stlib',True)
122
+ try:
123
+ link_task=y.link_task
124
+ except AttributeError:
125
+ y.tmp_use_var=''
126
+ else:
127
+ objects=False
128
+ if not isinstance(y.link_task,stlink_task):
129
+ stlib=False
130
+ y.tmp_use_var='LIB'
131
+ else:
132
+ y.tmp_use_var='STLIB'
133
+ p=self.tmp_use_prec
134
+ for x in self.to_list(getattr(y,'use',[])):
135
+ try:
136
+ p[x].append(name)
137
+ except:
138
+ p[x]=[name]
139
+ self.use_rec(x,objects=objects,stlib=stlib)
140
+ def process_use(self):
141
+ use_not=self.tmp_use_not=set([])
142
+ use_seen=self.tmp_use_seen=[]
143
+ use_prec=self.tmp_use_prec={}
144
+ self.uselib=self.to_list(getattr(self,'uselib',[]))
145
+ self.includes=self.to_list(getattr(self,'includes',[]))
146
+ names=self.to_list(getattr(self,'use',[]))
147
+ for x in names:
148
+ self.use_rec(x)
149
+ for x in use_not:
150
+ if x in use_prec:
151
+ del use_prec[x]
152
+ out=[]
153
+ tmp=[]
154
+ for x in self.tmp_use_seen:
155
+ for k in use_prec.values():
156
+ if x in k:
157
+ break
158
+ else:
159
+ tmp.append(x)
160
+ while tmp:
161
+ e=tmp.pop()
162
+ out.append(e)
163
+ try:
164
+ nlst=use_prec[e]
165
+ except KeyError:
166
+ pass
167
+ else:
168
+ del use_prec[e]
169
+ for x in nlst:
170
+ for y in use_prec:
171
+ if x in use_prec[y]:
172
+ break
173
+ else:
174
+ tmp.append(x)
175
+ if use_prec:
176
+ raise Errors.WafError('Cycle detected in the use processing %r'%use_prec)
177
+ out.reverse()
178
+ link_task=getattr(self,'link_task',None)
179
+ for x in out:
180
+ y=self.bld.get_tgen_by_name(x)
181
+ var=y.tmp_use_var
182
+ if var and link_task:
183
+ if var=='LIB'or y.tmp_use_stlib:
184
+ self.env.append_value(var,[y.target[y.target.rfind(os.sep)+1:]])
185
+ self.link_task.dep_nodes.extend(y.link_task.outputs)
186
+ tmp_path=y.link_task.outputs[0].parent.path_from(self.bld.bldnode)
187
+ self.env.append_value(var+'PATH',[tmp_path])
188
+ else:
189
+ if y.tmp_use_objects:
190
+ self.add_objects_from_tgen(y)
191
+ if getattr(y,'export_includes',None):
192
+ self.includes.extend(y.to_incnodes(y.export_includes))
193
+ for x in names:
194
+ try:
195
+ y=self.bld.get_tgen_by_name(x)
196
+ except:
197
+ if not self.env['STLIB_'+x]and not x in self.uselib:
198
+ self.uselib.append(x)
199
+ else:
200
+ for k in self.to_list(getattr(y,'uselib',[])):
201
+ if not self.env['STLIB_'+k]and not k in self.uselib:
202
+ self.uselib.append(k)
203
+ def add_objects_from_tgen(self,tg):
204
+ try:
205
+ link_task=self.link_task
206
+ except AttributeError:
207
+ pass
208
+ else:
209
+ for tsk in getattr(tg,'compiled_tasks',[]):
210
+ for x in tsk.outputs:
211
+ if x.name.endswith('.o')or x.name.endswith('.obj'):
212
+ link_task.inputs.append(x)
213
+ def get_uselib_vars(self):
214
+ _vars=set([])
215
+ for x in self.features:
216
+ if x in USELIB_VARS:
217
+ _vars|=USELIB_VARS[x]
218
+ return _vars
219
+ def propagate_uselib_vars(self):
220
+ _vars=self.get_uselib_vars()
221
+ env=self.env
222
+ for x in _vars:
223
+ y=x.lower()
224
+ env.append_unique(x,self.to_list(getattr(self,y,[])))
225
+ for x in self.features:
226
+ for var in _vars:
227
+ compvar='%s_%s'%(var,x)
228
+ env.append_value(var,env[compvar])
229
+ for x in self.to_list(getattr(self,'uselib',[])):
230
+ for v in _vars:
231
+ env.append_value(v,env[v+'_'+x])
232
+ def apply_implib(self):
233
+ if not self.env.DEST_BINFMT=='pe':
234
+ return
235
+ dll=self.link_task.outputs[0]
236
+ if isinstance(self.target,Node.Node):
237
+ name=self.target.name
238
+ else:
239
+ name=os.path.split(self.target)[1]
240
+ implib=self.env['implib_PATTERN']%name
241
+ implib=dll.parent.find_or_declare(implib)
242
+ self.env.append_value('LINKFLAGS',self.env['IMPLIB_ST']%implib.bldpath())
243
+ self.link_task.outputs.append(implib)
244
+ if getattr(self,'defs',None)and self.env.DEST_BINFMT=='pe':
245
+ node=self.path.find_resource(self.defs)
246
+ if not node:
247
+ raise Errors.WafError('invalid def file %r'%self.defs)
248
+ if'msvc'in(self.env.CC_NAME,self.env.CXX_NAME):
249
+ self.env.append_value('LINKFLAGS','/def:%s'%node.path_from(self.bld.bldnode))
250
+ self.link_task.dep_nodes.append(node)
251
+ else:
252
+ self.link_task.inputs.append(node)
253
+ try:
254
+ inst_to=self.install_path
255
+ except AttributeError:
256
+ inst_to=self.link_task.__class__.inst_to
257
+ if not inst_to:
258
+ return
259
+ self.implib_install_task=self.bld.install_as('${PREFIX}/lib/%s'%implib.name,implib,self.env)
260
+ def apply_vnum(self):
261
+ if not getattr(self,'vnum','')or os.name!='posix'or self.env.DEST_BINFMT not in('elf','mac-o'):
262
+ return
263
+ link=self.link_task
264
+ nums=self.vnum.split('.')
265
+ node=link.outputs[0]
266
+ libname=node.name
267
+ if libname.endswith('.dylib'):
268
+ name3=libname.replace('.dylib','.%s.dylib'%self.vnum)
269
+ name2=libname.replace('.dylib','.%s.dylib'%nums[0])
270
+ else:
271
+ name3=libname+'.'+self.vnum
272
+ name2=libname+'.'+nums[0]
273
+ if self.env.SONAME_ST:
274
+ v=self.env.SONAME_ST%name2
275
+ self.env.append_value('LINKFLAGS',v.split())
276
+ tsk=self.create_task('vnum',node,[node.parent.find_or_declare(name2),node.parent.find_or_declare(name3)])
277
+ if getattr(self.bld,'is_install',None):
278
+ self.install_task.hasrun=Task.SKIP_ME
279
+ bld=self.bld
280
+ path=self.install_task.dest
281
+ t1=bld.install_as(path+os.sep+name3,node,env=self.env)
282
+ t2=bld.symlink_as(path+os.sep+name2,name3)
283
+ t3=bld.symlink_as(path+os.sep+libname,name3)
284
+ self.vnum_install_task=(t1,t2,t3)
285
+ class vnum(Task.Task):
286
+ color='CYAN'
287
+ quient=True
288
+ ext_in=['.bin']
289
+ def run(self):
290
+ for x in self.outputs:
291
+ path=x.abspath()
292
+ try:
293
+ os.remove(path)
294
+ except OSError:
295
+ pass
296
+ try:
297
+ os.symlink(self.inputs[0].name,path)
298
+ except OSError:
299
+ return 1
300
+ class fake_shlib(link_task):
301
+ def runnable_status(self):
302
+ for t in self.run_after:
303
+ if not t.hasrun:
304
+ return Task.ASK_LATER
305
+ for x in self.outputs:
306
+ x.sig=Utils.h_file(x.abspath())
307
+ return Task.SKIP_ME
308
+ class fake_stlib(stlink_task):
309
+ def runnable_status(self):
310
+ for t in self.run_after:
311
+ if not t.hasrun:
312
+ return Task.ASK_LATER
313
+ for x in self.outputs:
314
+ x.sig=Utils.h_file(x.abspath())
315
+ return Task.SKIP_ME
316
+ def read_shlib(self,name,paths=[]):
317
+ return self(name=name,features='fake_lib',lib_paths=paths,lib_type='shlib')
318
+ def read_stlib(self,name,paths=[]):
319
+ return self(name=name,features='fake_lib',lib_paths=paths,lib_type='stlib')
320
+ lib_patterns={'shlib':['lib%s.so','%s.so','lib%s.dll','%s.dll'],'stlib':['lib%s.a','%s.a','lib%s.dll','%s.dll','lib%s.lib','%s.lib'],}
321
+ def process_lib(self):
322
+ node=None
323
+ names=[x%self.name for x in lib_patterns[self.lib_type]]
324
+ for x in self.lib_paths+[self.path,'/usr/lib64','/usr/lib','/usr/local/lib64','/usr/local/lib']:
325
+ if not isinstance(x,Node.Node):
326
+ x=self.bld.root.find_node(x)or self.path.find_node(x)
327
+ if not x:
328
+ continue
329
+ for y in names:
330
+ node=x.find_node(y)
331
+ if node:
332
+ node.sig=Utils.h_file(node.abspath())
333
+ break
334
+ else:
335
+ continue
336
+ break
337
+ else:
338
+ raise Errors.WafError('could not find library %r'%self.name)
339
+ self.link_task=self.create_task('fake_%s'%self.lib_type,[],[node])
340
+ self.target=self.name
341
+ class fake_o(Task.Task):
342
+ def runnable_status(self):
343
+ return Task.SKIP_ME
344
+ def add_those_o_files(self,node):
345
+ tsk=self.create_task('fake_o',[],node)
346
+ try:
347
+ self.compiled_tasks.append(tsk)
348
+ except AttributeError:
349
+ self.compiled_tasks=[tsk]
350
+
351
+ taskgen_method(create_compiled_task)
352
+ taskgen_method(to_incnodes)
353
+ feature('c','cxx','d','go','asm','fc','includes')(apply_incpaths)
354
+ after_method('propagate_uselib_vars','process_source')(apply_incpaths)
355
+ feature('c','cxx','d','go','fc','asm')(apply_link)
356
+ after_method('process_source')(apply_link)
357
+ taskgen_method(use_rec)
358
+ feature('c','cxx','d','use','fc')(process_use)
359
+ before_method('apply_incpaths','propagate_uselib_vars')(process_use)
360
+ after_method('apply_link','process_source')(process_use)
361
+ taskgen_method(add_objects_from_tgen)
362
+ taskgen_method(get_uselib_vars)
363
+ feature('c','cxx','d','fc','javac','cs','uselib')(propagate_uselib_vars)
364
+ after_method('process_use')(propagate_uselib_vars)
365
+ feature('cshlib','cxxshlib','fcshlib')(apply_implib)
366
+ after_method('apply_link')(apply_implib)
367
+ feature('cshlib','cxxshlib','dshlib','fcshlib','vnum')(apply_vnum)
368
+ after_method('apply_link')(apply_vnum)
369
+ conf(read_shlib)
370
+ conf(read_stlib)
371
+ feature('fake_lib')(process_lib)
372
+ extension('.o','.obj')(add_those_o_files)