redsnow 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +34 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +20 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +21 -0
  8. data/README.md +62 -0
  9. data/Rakefile +36 -0
  10. data/Vagrantfile +20 -0
  11. data/ext/snowcrash/Makefile +64 -0
  12. data/ext/snowcrash/Vagrantfile +20 -0
  13. data/ext/snowcrash/bin/snowcrash +0 -0
  14. data/ext/snowcrash/common.gypi +163 -0
  15. data/ext/snowcrash/config.gypi +10 -0
  16. data/ext/snowcrash/config.mk +5 -0
  17. data/ext/snowcrash/configure +213 -0
  18. data/ext/snowcrash/provisioning.sh +15 -0
  19. data/ext/snowcrash/snowcrash.gyp +141 -0
  20. data/ext/snowcrash/src/ActionParser.h +503 -0
  21. data/ext/snowcrash/src/AssetParser.h +215 -0
  22. data/ext/snowcrash/src/BlockUtility.h +186 -0
  23. data/ext/snowcrash/src/Blueprint.h +283 -0
  24. data/ext/snowcrash/src/BlueprintParser.h +347 -0
  25. data/ext/snowcrash/src/BlueprintParserCore.h +190 -0
  26. data/ext/snowcrash/src/BlueprintSection.h +140 -0
  27. data/ext/snowcrash/src/BlueprintUtility.h +126 -0
  28. data/ext/snowcrash/src/CBlueprint.cc +600 -0
  29. data/ext/snowcrash/src/CBlueprint.h +354 -0
  30. data/ext/snowcrash/src/CSourceAnnotation.cc +140 -0
  31. data/ext/snowcrash/src/CSourceAnnotation.h +106 -0
  32. data/ext/snowcrash/src/CodeBlockUtility.h +189 -0
  33. data/ext/snowcrash/src/DescriptionSectionUtility.h +156 -0
  34. data/ext/snowcrash/src/HTTP.cc +46 -0
  35. data/ext/snowcrash/src/HTTP.h +105 -0
  36. data/ext/snowcrash/src/HeaderParser.h +289 -0
  37. data/ext/snowcrash/src/ListBlockUtility.h +273 -0
  38. data/ext/snowcrash/src/ListUtility.h +95 -0
  39. data/ext/snowcrash/src/MarkdownBlock.cc +176 -0
  40. data/ext/snowcrash/src/MarkdownBlock.h +93 -0
  41. data/ext/snowcrash/src/MarkdownParser.cc +266 -0
  42. data/ext/snowcrash/src/MarkdownParser.h +88 -0
  43. data/ext/snowcrash/src/ParameterDefinitonParser.h +570 -0
  44. data/ext/snowcrash/src/ParametersParser.h +252 -0
  45. data/ext/snowcrash/src/Parser.cc +71 -0
  46. data/ext/snowcrash/src/Parser.h +29 -0
  47. data/ext/snowcrash/src/ParserCore.cc +120 -0
  48. data/ext/snowcrash/src/ParserCore.h +82 -0
  49. data/ext/snowcrash/src/PayloadParser.h +672 -0
  50. data/ext/snowcrash/src/Platform.h +54 -0
  51. data/ext/snowcrash/src/RegexMatch.h +32 -0
  52. data/ext/snowcrash/src/ResourceGroupParser.h +195 -0
  53. data/ext/snowcrash/src/ResourceParser.h +584 -0
  54. data/ext/snowcrash/src/SectionUtility.h +142 -0
  55. data/ext/snowcrash/src/Serialize.cc +52 -0
  56. data/ext/snowcrash/src/Serialize.h +69 -0
  57. data/ext/snowcrash/src/SerializeJSON.cc +601 -0
  58. data/ext/snowcrash/src/SerializeJSON.h +21 -0
  59. data/ext/snowcrash/src/SerializeYAML.cc +336 -0
  60. data/ext/snowcrash/src/SerializeYAML.h +21 -0
  61. data/ext/snowcrash/src/SourceAnnotation.h +177 -0
  62. data/ext/snowcrash/src/StringUtility.h +109 -0
  63. data/ext/snowcrash/src/SymbolTable.h +83 -0
  64. data/ext/snowcrash/src/UriTemplateParser.cc +195 -0
  65. data/ext/snowcrash/src/UriTemplateParser.h +243 -0
  66. data/ext/snowcrash/src/Version.h +39 -0
  67. data/ext/snowcrash/src/csnowcrash.cc +23 -0
  68. data/ext/snowcrash/src/csnowcrash.h +38 -0
  69. data/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
  70. data/ext/snowcrash/src/snowcrash.cc +18 -0
  71. data/ext/snowcrash/src/snowcrash.h +41 -0
  72. data/ext/snowcrash/src/snowcrash/snowcrash.cc +170 -0
  73. data/ext/snowcrash/src/win/RegexMatch.cc +78 -0
  74. data/ext/snowcrash/sundown/CONTRIBUTING.md +10 -0
  75. data/ext/snowcrash/sundown/Makefile +83 -0
  76. data/ext/snowcrash/sundown/Makefile.win +33 -0
  77. data/ext/snowcrash/sundown/examples/smartypants.c +72 -0
  78. data/ext/snowcrash/sundown/examples/sundown.c +80 -0
  79. data/ext/snowcrash/sundown/html/houdini.h +37 -0
  80. data/ext/snowcrash/sundown/html/houdini_href_e.c +108 -0
  81. data/ext/snowcrash/sundown/html/houdini_html_e.c +84 -0
  82. data/ext/snowcrash/sundown/html/html.c +647 -0
  83. data/ext/snowcrash/sundown/html/html.h +77 -0
  84. data/ext/snowcrash/sundown/html/html_smartypants.c +389 -0
  85. data/ext/snowcrash/sundown/html_block_names.txt +25 -0
  86. data/ext/snowcrash/sundown/src/autolink.c +297 -0
  87. data/ext/snowcrash/sundown/src/autolink.h +51 -0
  88. data/ext/snowcrash/sundown/src/buffer.c +225 -0
  89. data/ext/snowcrash/sundown/src/buffer.h +96 -0
  90. data/ext/snowcrash/sundown/src/html_blocks.h +206 -0
  91. data/ext/snowcrash/sundown/src/markdown.c +2701 -0
  92. data/ext/snowcrash/sundown/src/markdown.h +147 -0
  93. data/ext/snowcrash/sundown/src/src_map.c +200 -0
  94. data/ext/snowcrash/sundown/src/src_map.h +58 -0
  95. data/ext/snowcrash/sundown/src/stack.c +81 -0
  96. data/ext/snowcrash/sundown/src/stack.h +29 -0
  97. data/ext/snowcrash/sundown/sundown.def +20 -0
  98. data/ext/snowcrash/tools/gyp/AUTHORS +11 -0
  99. data/ext/snowcrash/tools/gyp/DEPS +24 -0
  100. data/ext/snowcrash/tools/gyp/OWNERS +1 -0
  101. data/ext/snowcrash/tools/gyp/PRESUBMIT.py +120 -0
  102. data/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +190 -0
  103. data/ext/snowcrash/tools/gyp/codereview.settings +10 -0
  104. data/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
  105. data/ext/snowcrash/tools/gyp/gyp +8 -0
  106. data/ext/snowcrash/tools/gyp/gyp.bat +5 -0
  107. data/ext/snowcrash/tools/gyp/gyp_main.py +18 -0
  108. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
  109. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
  110. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1063 -0
  111. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
  112. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
  113. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +267 -0
  114. data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +409 -0
  115. data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +537 -0
  116. data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
  117. data/ext/snowcrash/tools/gyp/pylib/gyp/common.py +521 -0
  118. data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  119. data/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
  120. data/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +49 -0
  121. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
  122. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  123. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
  124. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1143 -0
  125. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +81 -0
  126. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +335 -0
  127. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +87 -0
  128. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
  129. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2181 -0
  130. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
  131. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3335 -0
  132. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2156 -0
  133. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1224 -0
  134. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  135. data/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2809 -0
  136. data/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
  137. data/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +510 -0
  138. data/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +972 -0
  139. data/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
  140. data/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
  141. data/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +292 -0
  142. data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1440 -0
  143. data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  144. data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2889 -0
  145. data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  146. data/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
  147. data/ext/snowcrash/tools/gyp/pylintrc +307 -0
  148. data/ext/snowcrash/tools/gyp/samples/samples +81 -0
  149. data/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
  150. data/ext/snowcrash/tools/gyp/setup.py +19 -0
  151. data/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
  152. data/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
  153. data/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +252 -0
  154. data/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
  155. data/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
  156. data/ext/snowcrash/tools/gyp/tools/pretty_sln.py +168 -0
  157. data/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
  158. data/ext/snowcrash/tools/homebrew/snowcrash.rb +11 -0
  159. data/ext/snowcrash/vcbuild.bat +184 -0
  160. data/lib/redsnow.rb +31 -0
  161. data/lib/redsnow/binding.rb +132 -0
  162. data/lib/redsnow/blueprint.rb +365 -0
  163. data/lib/redsnow/object.rb +18 -0
  164. data/lib/redsnow/parseresult.rb +107 -0
  165. data/lib/redsnow/version.rb +4 -0
  166. data/provisioning.sh +20 -0
  167. data/redsnow.gemspec +35 -0
  168. data/test/_helper.rb +15 -0
  169. data/test/fixtures/sample-api-ast.json +97 -0
  170. data/test/fixtures/sample-api.apib +20 -0
  171. data/test/redsnow_binding_test.rb +35 -0
  172. data/test/redsnow_parseresult_test.rb +50 -0
  173. data/test/redsnow_test.rb +285 -0
  174. metadata +358 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27dcef9308792bec5bcc00cd275633bad9012160
4
+ data.tar.gz: 78544e79fddb7c1d3ba08e4c17c6f95b7e74d7e5
5
+ SHA512:
6
+ metadata.gz: b43a113c6ffd35e6eca1371838c3cb62ca3a8f851f6159bbe34f73cb49178443a57781eed1fa41e6d17f9665650526cbf82eb047efc48702934ba9fe624b93a1
7
+ data.tar.gz: e29214475daf2192389a9869610ab5c851c2146cecc09356d2e0e6999e8c641ceca3e8dbf7ea79eb404391e79e5012cb1557fca0fd9824c029f549737266756a
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ Gemfile.lock
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
@@ -0,0 +1,3 @@
1
+ [submodule "ext/snowcrash"]
2
+ path = ext/snowcrash
3
+ url = https://github.com/apiaryio/snowcrash.git
@@ -0,0 +1,20 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.1.0
5
+ script:
6
+ - rake test
7
+ - rake install
8
+ before_install:
9
+ - git submodule update --init --recursive
10
+ - gem update bundler
11
+ - bundle
12
+ notifications:
13
+ email:
14
+ recipients:
15
+ - ladislav@apiary.io
16
+ on_success: change
17
+ on_failure: always
18
+ hipchat:
19
+ rooms:
20
+ secure: d1RJSY+QU7y01wmqvxpgYsAyRzNzbAK2r1Ut9X87s5UOFB+5yxUgRocs4sKpGSpm0UVtD0u/G3H1wqbmWpxnYpmQYilTw9Qa04GDwJJ2/IraHU1fpGG+gZCsOMid7NjNl6jErbY8cfoUmCQdrUiYBgLowtxh5i8HbPT//Cb7mhU=
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+ - 0.0.8 - Add support for [Parse Result](https://github.com/apiaryio/api-blueprint-ast/blob/master/Parse%20Result.md)
3
+ - 0.0.7 - Fixed dependency, first public version
4
+ - 0.0.1 - 0.0.6 Developement versions
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in red_snow.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Apiary
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # RedSnow
2
+
3
+ Ruby binding for the Snow Crash library, also a thermonuclear weapon.
4
+
5
+
6
+ ## Install
7
+ The best way to install RedSnow is by using its [GEM package](https://rubygems.org/gems/redsnow).
8
+
9
+ gem install redsnow
10
+
11
+ ## Documentation
12
+
13
+ - [Documentation at rubydoc](http://rubydoc.info/gems/redsnow/)
14
+
15
+ ## Getting started
16
+
17
+ ```ruby
18
+ require 'redsnow'
19
+
20
+ result = RedSnow::parse('# My API')
21
+ puts result.ast.name
22
+ ```
23
+
24
+ ## Hacking Redsnow
25
+ You are welcome to contribute. Use following steps to build & test Redsnow.
26
+
27
+ ### Build
28
+
29
+
30
+ 1. If needed, install bundler:
31
+
32
+ ```sh
33
+ $ gem install bundler
34
+ ```
35
+
36
+ 2. Clone the repo + fetch the submodules:
37
+
38
+ ```sh
39
+ $ git clone git://github.com/apiaryio/redsnow.git
40
+ $ cd redsnow
41
+ $ git submodule update --init --recursive
42
+ ```
43
+
44
+ 3. Build:
45
+
46
+ ```sh
47
+ $ rake
48
+ ```
49
+
50
+ ### Test
51
+ Inside the redsnow repository run:
52
+
53
+ ```sh
54
+ $ bundle install
55
+ $ rake test
56
+ ```
57
+
58
+ ### Contribute
59
+ Fork & Pull Request.
60
+
61
+ ## License
62
+ MIT License. See the [LICENSE](https://github.com/apiaryio/protagonist/blob/master/LICENSE) file.
@@ -0,0 +1,36 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+ require 'ffi'
4
+
5
+ task :default => :compile
6
+
7
+ desc "Compile extension"
8
+ task :compile do
9
+ prefix = "lib.target/"
10
+ if FFI::Platform.mac?
11
+ prefix = ""
12
+ end
13
+ path = File.expand_path("ext/snowcrash/build/out/Release/#{prefix}libsnowcrash.#{FFI::Platform::LIBSUFFIX}", File.dirname(__FILE__))
14
+ puts path
15
+ if !File.exists?(path) || ENV['RECOMPILE']
16
+ puts "Compiling extension..."
17
+ `cd #{File.expand_path("ext/snowcrash/")} && ./configure --shared && make`
18
+ else
19
+ puts "Extension already compiled. To recompile set env variable RECOMPILE=true."
20
+ end
21
+ end
22
+
23
+ Rake::TestTask.new(:test) do |test|
24
+ Rake::Task["compile"].invoke
25
+
26
+ test.libs << 'lib' << 'test'
27
+ test.test_files = FileList['test/*_test.rb']
28
+ test.verbose = true
29
+ end
30
+
31
+ # ----- Documentation tasks ---------------------------------------------------
32
+
33
+ require 'yard'
34
+ YARD::Rake::YardocTask.new(:doc) do |t|
35
+ t.options = %w| --embed-mixins --markup=markdown |
36
+ end
@@ -0,0 +1,20 @@
1
+ Vagrant.configure("2") do |config|
2
+ config.vm.box = "precise64"
3
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
4
+
5
+ # VirtualBox
6
+ config.vm.provider :virtualbox do |vb|
7
+ vb.customize ["modifyvm", :id, "--memory", "2048"]
8
+ vb.customize ["modifyvm", :id, "--cpus", "1"]
9
+ end
10
+
11
+ # VMWare Fusion
12
+ config.vm.provider :vmware_fusion do |vb|
13
+ vb.vmx["memsize"] = "4096"
14
+ vb.vmx["numvcpus"] = "1"
15
+ end
16
+
17
+ config.vm.network :private_network, ip: "10.3.3.3"
18
+ config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", type: "nfs"
19
+ config.vm.provision :shell, :path => "./provisioning.sh"
20
+ end
@@ -0,0 +1,64 @@
1
+ -include config.mk
2
+
3
+ BUILDTYPE ?= Release
4
+ BUILD_DIR ?= ./build
5
+ PYTHON ?= python
6
+ GYP ?= ./tools/gyp/gyp
7
+ DESTDIR ?= /usr/local/bin
8
+
9
+ # Default to verbose builds
10
+ V ?= 1
11
+
12
+ # Targets
13
+ all: libsnowcrash test-libsnowcrash snowcrash
14
+
15
+ .PHONY: libsnowcrash test-libsnowcrash snowcrash
16
+
17
+ libsnowcrash: config.gypi $(BUILD_DIR)/Makefile
18
+ $(MAKE) -C $(BUILD_DIR) V=$(V) libsnowcrash
19
+
20
+ test-libsnowcrash: config.gypi $(BUILD_DIR)/Makefile
21
+ $(MAKE) -C $(BUILD_DIR) V=$(V) test-libsnowcrash
22
+ mkdir -p ./bin
23
+ cp -f $(BUILD_DIR)/out/$(BUILDTYPE)/test-libsnowcrash ./bin/test-libsnowcrash
24
+
25
+ perf-libsnowcrash: config.gypi $(BUILD_DIR)/Makefile
26
+ $(MAKE) -C $(BUILD_DIR) V=$(V) perf-libsnowcrash
27
+ mkdir -p ./bin
28
+ cp -f $(BUILD_DIR)/out/$(BUILDTYPE)/perf-libsnowcrash ./bin/perf-libsnowcrash
29
+
30
+ snowcrash: config.gypi $(BUILD_DIR)/Makefile
31
+ $(MAKE) -C $(BUILD_DIR) V=$(V) snowcrash
32
+ mkdir -p ./bin
33
+ cp -f $(BUILD_DIR)/out/$(BUILDTYPE)/snowcrash ./bin/snowcrash
34
+
35
+ config.gypi: configure
36
+ $(PYTHON) ./configure
37
+
38
+ $(BUILD_DIR)/Makefile:
39
+ $(GYP) -f make --generator-output $(BUILD_DIR) --depth=.
40
+
41
+ clean:
42
+ rm -rf $(BUILD_DIR)/out
43
+ rm -rf ./bin
44
+
45
+ distclean:
46
+ rm -rf ./build
47
+ rm -f ./config.mk
48
+ rm -f ./config.gypi
49
+ rm -rf ./bin
50
+
51
+ test: test-libsnowcrash snowcrash
52
+ $(BUILD_DIR)/out/$(BUILDTYPE)/test-libsnowcrash
53
+
54
+ ifdef INTEGRATION_TESTS
55
+ bundle exec cucumber
56
+ endif
57
+
58
+ perf: perf-libsnowcrash
59
+ $(BUILD_DIR)/out/$(BUILDTYPE)/perf-libsnowcrash ./test/performance/fixtures/fixture-1.md
60
+
61
+ install: snowcrash
62
+ cp -f $(BUILD_DIR)/out/$(BUILDTYPE)/snowcrash $(DESTDIR)/snowcrash
63
+
64
+ .PHONY: libsnowcrash test-libsnowcrash perf-libsnowcrash snowcrash clean distclean test
@@ -0,0 +1,20 @@
1
+ Vagrant.configure("2") do |config|
2
+ config.vm.box = "precise64"
3
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
4
+
5
+ # VirtualBox
6
+ config.vm.provider :virtualbox do |vb|
7
+ vb.customize ["modifyvm", :id, "--memory", "2048"]
8
+ vb.customize ["modifyvm", :id, "--cpus", "1"]
9
+ end
10
+
11
+ # VMWare Fusion
12
+ config.vm.provider :vmware_fusion do |vb|
13
+ vb.vmx["memsize"] = "4096"
14
+ vb.vmx["numvcpus"] = "1"
15
+ end
16
+
17
+ config.vm.network :private_network, ip: "10.3.3.3"
18
+ config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", type: "nfs"
19
+ config.vm.provision :shell, :path => "./provisioning.sh"
20
+ end
@@ -0,0 +1,163 @@
1
+ #
2
+ # Common build configuration
3
+ # ==========================
4
+ #
5
+ # GYP include file with common configuration settings.
6
+ #
7
+ # Attribution Notice:
8
+ # This work might use parts of Node.js `common.gypi` (https://github.com/joyent/node).
9
+ #
10
+ {
11
+ 'variables': {
12
+ 'target_arch%': 'ia32',
13
+ 'libsnowcrash_type%': 'static_library'
14
+ },
15
+ 'target_defaults': {
16
+ 'defines': [
17
+ 'BUILDING_SNOWCRASH=1'
18
+ ],
19
+ 'configurations': {
20
+ 'Debug': {
21
+ 'defines': [ 'DEBUG', '_DEBUG' ],
22
+ 'cflags': [ '-g', '-O0' ],
23
+ 'conditions': [
24
+ ['target_arch=="x64"', {
25
+ 'msvs_configuration_platform': 'x64',
26
+ }],
27
+ ],
28
+ 'msvs_settings': {
29
+ 'VCCLCompilerTool': {
30
+ 'PreprocessorDefinitions': ['_SECURE_SCL=0', '_HAS_ITERATOR_DEBUGGING=0' ], # https://github.com/xbmc/xbmc/pull/1009
31
+ 'RuntimeLibrary': 3, # dll debug
32
+ 'Optimization': 0, # /Od, no optimization
33
+ 'MinimalRebuild': 'false',
34
+ 'OmitFramePointers': 'false',
35
+ 'BasicRuntimeChecks': 3, # /RTC1
36
+ 'RuntimeTypeInfo': 'true', # /GR, determine object type at runtime
37
+ 'DebugInformationFormat': 3, # /Zi, use program database as debugging information
38
+ 'ExceptionHandling': 1
39
+ },
40
+ 'VCLinkerTool': {
41
+ 'LinkIncremental': 2, # enable incremental linking
42
+ 'GenerateDebugInformation': 'true', # /DEBUG enable line by line debugging
43
+ 'SubSystem': 1 # /SUBSYSTEM:CONSOLE use console as native environment
44
+ },
45
+ },
46
+ 'xcode_settings': {
47
+ 'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
48
+ }
49
+ },
50
+ 'Release': {
51
+ 'conditions': [
52
+ ['target_arch=="x64"', {
53
+ 'msvs_configuration_platform': 'x64',
54
+ }],
55
+ ],
56
+ 'msvs_settings': {
57
+ 'VCCLCompilerTool': {
58
+ 'RuntimeLibrary': 2, # dll release
59
+ 'Optimization': 0, # /Od, no optimizations
60
+ 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
61
+ 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
62
+ 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
63
+ 'OmitFramePointers': 'true',
64
+ 'EnableFunctionLevelLinking': 'true',
65
+ 'EnableIntrinsicFunctions': 'true',
66
+ 'RuntimeTypeInfo': 'true', # /GR, determine object type at runtime
67
+ 'ExceptionHandling': 1,
68
+ 'AdditionalOptions': [
69
+ '/MP', # compile across multiple CPUs
70
+ ]
71
+ },
72
+ 'VCLibrarianTool': {
73
+ 'AdditionalOptions': [
74
+ '/LTCG', # link time code generation
75
+ ],
76
+ },
77
+ 'VCLinkerTool': {
78
+ 'LinkTimeCodeGeneration': 1, # link-time code generation
79
+ 'OptimizeReferences': 2, # /OPT:REF
80
+ 'EnableCOMDATFolding': 2, # /OPT:ICF
81
+ 'LinkIncremental': 1, # disable incremental linking
82
+ 'SubSystem': 1 # /SUBSYSTEM:CONSOLE use console as native environment
83
+ }
84
+ }
85
+ }
86
+ },
87
+ 'conditions': [
88
+ ['OS == "win"', {
89
+ 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
90
+ 'defines': [
91
+ 'WIN32',
92
+ # we don't really want VC++ warning us about
93
+ # how dangerous C functions are...
94
+ '_CRT_SECURE_NO_DEPRECATE',
95
+ # ... or that C implementations shouldn't use
96
+ # POSIX names
97
+ '_CRT_NONSTDC_NO_DEPRECATE'
98
+ ],
99
+ }],
100
+ [ 'OS in "linux freebsd openbsd solaris"', {
101
+ 'cflags': [ '-pthread', '-fPIC' ],
102
+ 'ldflags': [ '-pthread' ],
103
+ }],
104
+ [ 'OS in "linux freebsd openbsd solaris android"', {
105
+ 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
106
+ 'cflags_cc!': [ '-fno-rtti', '-fno-exceptions' ],
107
+ 'ldflags': [ '-rdynamic' ],
108
+ 'target_conditions': [
109
+ ['_type=="static_library"', {
110
+ 'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
111
+ }],
112
+ ],
113
+ 'conditions': [
114
+ [ 'target_arch=="ia32"', {
115
+ 'cflags': [ '-m32' ],
116
+ 'ldflags': [ '-m32' ],
117
+ }],
118
+ [ 'target_arch=="x64"', {
119
+ 'cflags': [ '-m64' ],
120
+ 'ldflags': [ '-m64' ],
121
+ }]
122
+ ]
123
+ }],
124
+ ['OS=="mac"', {
125
+ 'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
126
+ 'xcode_settings': {
127
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
128
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
129
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic (Equivalent to -fPIC)
130
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', # !-fno-exceptions
131
+ 'GCC_ENABLE_CPP_RTTI': 'YES', # !-fno-rtti
132
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
133
+ 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
134
+ 'PREBINDING': 'NO', # No -Wl,-prebind
135
+ 'MACOSX_DEPLOYMENT_TARGET': '10.5', # -mmacosx-version-min=10.5
136
+ 'USE_HEADERMAP': 'NO',
137
+ 'OTHER_CFLAGS': [
138
+ '-fno-strict-aliasing',
139
+ ],
140
+ 'WARNING_CFLAGS': [
141
+ '-Wall',
142
+ '-Wendif-labels',
143
+ '-W',
144
+ '-Wno-unused-parameter',
145
+ ],
146
+ },
147
+ 'target_conditions': [
148
+ ['_type!="static_library"', {
149
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
150
+ }],
151
+ ],
152
+ 'conditions': [
153
+ ['target_arch=="ia32"', {
154
+ 'xcode_settings': {'ARCHS': ['i386']},
155
+ }],
156
+ ['target_arch=="x64"', {
157
+ 'xcode_settings': {'ARCHS': ['x86_64']},
158
+ }],
159
+ ],
160
+ }]
161
+ ],
162
+ }
163
+ }