redsnow 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/.gitmodules +3 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +62 -0
- data/Rakefile +36 -0
- data/Vagrantfile +20 -0
- data/ext/snowcrash/Makefile +64 -0
- data/ext/snowcrash/Vagrantfile +20 -0
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/common.gypi +163 -0
- data/ext/snowcrash/config.gypi +10 -0
- data/ext/snowcrash/config.mk +5 -0
- data/ext/snowcrash/configure +213 -0
- data/ext/snowcrash/provisioning.sh +15 -0
- data/ext/snowcrash/snowcrash.gyp +141 -0
- data/ext/snowcrash/src/ActionParser.h +503 -0
- data/ext/snowcrash/src/AssetParser.h +215 -0
- data/ext/snowcrash/src/BlockUtility.h +186 -0
- data/ext/snowcrash/src/Blueprint.h +283 -0
- data/ext/snowcrash/src/BlueprintParser.h +347 -0
- data/ext/snowcrash/src/BlueprintParserCore.h +190 -0
- data/ext/snowcrash/src/BlueprintSection.h +140 -0
- data/ext/snowcrash/src/BlueprintUtility.h +126 -0
- data/ext/snowcrash/src/CBlueprint.cc +600 -0
- data/ext/snowcrash/src/CBlueprint.h +354 -0
- data/ext/snowcrash/src/CSourceAnnotation.cc +140 -0
- data/ext/snowcrash/src/CSourceAnnotation.h +106 -0
- data/ext/snowcrash/src/CodeBlockUtility.h +189 -0
- data/ext/snowcrash/src/DescriptionSectionUtility.h +156 -0
- data/ext/snowcrash/src/HTTP.cc +46 -0
- data/ext/snowcrash/src/HTTP.h +105 -0
- data/ext/snowcrash/src/HeaderParser.h +289 -0
- data/ext/snowcrash/src/ListBlockUtility.h +273 -0
- data/ext/snowcrash/src/ListUtility.h +95 -0
- data/ext/snowcrash/src/MarkdownBlock.cc +176 -0
- data/ext/snowcrash/src/MarkdownBlock.h +93 -0
- data/ext/snowcrash/src/MarkdownParser.cc +266 -0
- data/ext/snowcrash/src/MarkdownParser.h +88 -0
- data/ext/snowcrash/src/ParameterDefinitonParser.h +570 -0
- data/ext/snowcrash/src/ParametersParser.h +252 -0
- data/ext/snowcrash/src/Parser.cc +71 -0
- data/ext/snowcrash/src/Parser.h +29 -0
- data/ext/snowcrash/src/ParserCore.cc +120 -0
- data/ext/snowcrash/src/ParserCore.h +82 -0
- data/ext/snowcrash/src/PayloadParser.h +672 -0
- data/ext/snowcrash/src/Platform.h +54 -0
- data/ext/snowcrash/src/RegexMatch.h +32 -0
- data/ext/snowcrash/src/ResourceGroupParser.h +195 -0
- data/ext/snowcrash/src/ResourceParser.h +584 -0
- data/ext/snowcrash/src/SectionUtility.h +142 -0
- data/ext/snowcrash/src/Serialize.cc +52 -0
- data/ext/snowcrash/src/Serialize.h +69 -0
- data/ext/snowcrash/src/SerializeJSON.cc +601 -0
- data/ext/snowcrash/src/SerializeJSON.h +21 -0
- data/ext/snowcrash/src/SerializeYAML.cc +336 -0
- data/ext/snowcrash/src/SerializeYAML.h +21 -0
- data/ext/snowcrash/src/SourceAnnotation.h +177 -0
- data/ext/snowcrash/src/StringUtility.h +109 -0
- data/ext/snowcrash/src/SymbolTable.h +83 -0
- data/ext/snowcrash/src/UriTemplateParser.cc +195 -0
- data/ext/snowcrash/src/UriTemplateParser.h +243 -0
- data/ext/snowcrash/src/Version.h +39 -0
- data/ext/snowcrash/src/csnowcrash.cc +23 -0
- data/ext/snowcrash/src/csnowcrash.h +38 -0
- data/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
- data/ext/snowcrash/src/snowcrash.cc +18 -0
- data/ext/snowcrash/src/snowcrash.h +41 -0
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +170 -0
- data/ext/snowcrash/src/win/RegexMatch.cc +78 -0
- data/ext/snowcrash/sundown/CONTRIBUTING.md +10 -0
- data/ext/snowcrash/sundown/Makefile +83 -0
- data/ext/snowcrash/sundown/Makefile.win +33 -0
- data/ext/snowcrash/sundown/examples/smartypants.c +72 -0
- data/ext/snowcrash/sundown/examples/sundown.c +80 -0
- data/ext/snowcrash/sundown/html/houdini.h +37 -0
- data/ext/snowcrash/sundown/html/houdini_href_e.c +108 -0
- data/ext/snowcrash/sundown/html/houdini_html_e.c +84 -0
- data/ext/snowcrash/sundown/html/html.c +647 -0
- data/ext/snowcrash/sundown/html/html.h +77 -0
- data/ext/snowcrash/sundown/html/html_smartypants.c +389 -0
- data/ext/snowcrash/sundown/html_block_names.txt +25 -0
- data/ext/snowcrash/sundown/src/autolink.c +297 -0
- data/ext/snowcrash/sundown/src/autolink.h +51 -0
- data/ext/snowcrash/sundown/src/buffer.c +225 -0
- data/ext/snowcrash/sundown/src/buffer.h +96 -0
- data/ext/snowcrash/sundown/src/html_blocks.h +206 -0
- data/ext/snowcrash/sundown/src/markdown.c +2701 -0
- data/ext/snowcrash/sundown/src/markdown.h +147 -0
- data/ext/snowcrash/sundown/src/src_map.c +200 -0
- data/ext/snowcrash/sundown/src/src_map.h +58 -0
- data/ext/snowcrash/sundown/src/stack.c +81 -0
- data/ext/snowcrash/sundown/src/stack.h +29 -0
- data/ext/snowcrash/sundown/sundown.def +20 -0
- data/ext/snowcrash/tools/gyp/AUTHORS +11 -0
- data/ext/snowcrash/tools/gyp/DEPS +24 -0
- data/ext/snowcrash/tools/gyp/OWNERS +1 -0
- data/ext/snowcrash/tools/gyp/PRESUBMIT.py +120 -0
- data/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +190 -0
- data/ext/snowcrash/tools/gyp/codereview.settings +10 -0
- data/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
- data/ext/snowcrash/tools/gyp/gyp +8 -0
- data/ext/snowcrash/tools/gyp/gyp.bat +5 -0
- data/ext/snowcrash/tools/gyp/gyp_main.py +18 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1063 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +267 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +409 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +537 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.py +521 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +49 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1143 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +81 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +335 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +87 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2181 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3335 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2156 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1224 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2809 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +510 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +972 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +292 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1440 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2889 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
- data/ext/snowcrash/tools/gyp/pylintrc +307 -0
- data/ext/snowcrash/tools/gyp/samples/samples +81 -0
- data/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
- data/ext/snowcrash/tools/gyp/setup.py +19 -0
- data/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
- data/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
- data/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +252 -0
- data/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
- data/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
- data/ext/snowcrash/tools/gyp/tools/pretty_sln.py +168 -0
- data/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +11 -0
- data/ext/snowcrash/vcbuild.bat +184 -0
- data/lib/redsnow.rb +31 -0
- data/lib/redsnow/binding.rb +132 -0
- data/lib/redsnow/blueprint.rb +365 -0
- data/lib/redsnow/object.rb +18 -0
- data/lib/redsnow/parseresult.rb +107 -0
- data/lib/redsnow/version.rb +4 -0
- data/provisioning.sh +20 -0
- data/redsnow.gemspec +35 -0
- data/test/_helper.rb +15 -0
- data/test/fixtures/sample-api-ast.json +97 -0
- data/test/fixtures/sample-api.apib +20 -0
- data/test/redsnow_binding_test.rb +35 -0
- data/test/redsnow_parseresult_test.rb +50 -0
- data/test/redsnow_test.rb +285 -0
- metadata +358 -0
checksums.yaml
ADDED
|
@@ -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
|
data/.gitignore
ADDED
|
@@ -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
|
data/.gitmodules
ADDED
data/.travis.yml
ADDED
|
@@ -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=
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
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.
|
data/README.md
ADDED
|
@@ -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.
|
data/Rakefile
ADDED
|
@@ -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
|
data/Vagrantfile
ADDED
|
@@ -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
|
|
Binary file
|
|
@@ -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
|
+
}
|