libsqreen 0.3.0.0.3 → 0.6.1.0.0
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 +4 -4
- data/ext/env_overrides.rb +5 -0
- data/ext/libsqreen_extension/extconf.rb +67 -19
- data/ext/libsqreen_extension/libsqreen_extension.c +285 -280
- data/ext/libsqreen_extension/logging.c +207 -0
- data/ext/libsqreen_extension/logging.h +29 -0
- data/ext/libsqreen_extension/stub/libsqreen_stub.c +2 -0
- data/lib/libsqreen.rb +1 -8
- data/lib/libsqreen/version.rb +1 -1
- data/libsqreen.gemspec +11 -1
- data/vendor/libsqreen/include/waf.h +31 -12
- data/vendor/libsqreen/x86_64/darwin/libsqreen.a +0 -0
- data/vendor/libsqreen/x86_64/linux/libsqreen.a +0 -0
- metadata +34 -14
- data/.gitignore +0 -6
- data/.gitmodules +0 -3
- data/Makefile +0 -206
- data/Rakefile +0 -33
- data/azure-pipelines.yml +0 -28
- data/ext/libsqreen/arch.rb +0 -23
- data/ext/libsqreen/extconf.rb +0 -20
- data/ext/libsqreen/libsqreen.c +0 -29
- data/ext/libsqreen/location.rb +0 -78
- data/ext/libsqreen/paths.rb +0 -53
- data/s3get +0 -47
data/.gitignore
DELETED
data/.gitmodules
DELETED
data/Makefile
DELETED
@@ -1,206 +0,0 @@
|
|
1
|
-
LIBSQREEN_VERSION := 0.3.0
|
2
|
-
LIBSQREEN_PLATFORM := $(shell ruby -e 'puts case RUBY_PLATFORM; when /-linux-musl/; "Linux-x86_64-muslc"; when /-linux(-gnu|)/; "Linux-x86_64-glibc"; when /-darwin\d+/; "Darwin-x86_64"; when /-mingw64/; "Windows-AMD64"; else "UNSUPPORTED"; end')
|
3
|
-
RUBY_PLATFORM := $(shell ruby -e 'puts RUBY_PLATFORM')
|
4
|
-
RUBY_VERSION := $(shell ruby -e 'puts RUBY_VERSION')
|
5
|
-
RUBY_API_VERSION := $(shell ruby -e 'RUBY_VERSION =~ /^(\d+\.\d+)/ && puts($$1)')
|
6
|
-
|
7
|
-
all:
|
8
|
-
|
9
|
-
.PHONY: vars
|
10
|
-
vars:
|
11
|
-
@echo $(LIBSQREEN_VERSION)
|
12
|
-
@echo $(LIBSQREEN_PLATFORM)
|
13
|
-
@echo $(RUBY_PLATFORM)
|
14
|
-
@echo $(RUBY_VERSION)
|
15
|
-
@echo $(RUBY_API_VERSION)
|
16
|
-
|
17
|
-
.PHONY: vendor
|
18
|
-
vendor: vendor/libsqreen
|
19
|
-
|
20
|
-
vendor/libsqreen/git:
|
21
|
-
git submodule init
|
22
|
-
git submodule update
|
23
|
-
cd vendor/libsqreen && git submodule init && git submodule update
|
24
|
-
|
25
|
-
vendor/libsqreen/build/Makefile: vendor/libsqreen
|
26
|
-
cd vendor/libsqreen/build && cmake ..
|
27
|
-
|
28
|
-
vendor/libsqreen/build/libSqreenStatic.a: vendor/libsqreen/build/Makefile
|
29
|
-
cd vendor/libsqreen/build && make
|
30
|
-
cd vendor/libsqreen/build && rm -f libSqreen.{so,dylib}
|
31
|
-
|
32
|
-
vendor/libsqreen/build/libSqreen.a: vendor/libsqreen/build/libSqreenStatic.a
|
33
|
-
cd vendor/libsqreen/build && ln -sf libSqreenStatic.a libSqreen.a
|
34
|
-
|
35
|
-
vendor/libsqreen/include/PowerWAF.h: vendor/libsqreen
|
36
|
-
|
37
|
-
vendor/libsqreen/include/Sqreen.h: vendor/libsqreen/include/PowerWAF.h
|
38
|
-
cd vendor/libsqreen/include && ln -sf PowerWAF.h Sqreen.h
|
39
|
-
|
40
|
-
.PHONY: vendor/compile
|
41
|
-
vendor/compile: vendor/libsqreen/build/libSqreen.a vendor/libsqreen/include/Sqreen.h
|
42
|
-
|
43
|
-
tmp/fetch:
|
44
|
-
mkdir -p tmp/fetch
|
45
|
-
|
46
|
-
tmp/fetch/SqreenLibrary/SqreenLibrary-$(LIBSQREEN_VERSION)-$(LIBSQREEN_PLATFORM).tar.gz:
|
47
|
-
$(eval export AWS_ACCESS_KEY := $(shell test -f s3auth && cat s3auth | grep access_key | sed 's/^.*= //'))
|
48
|
-
$(eval export AWS_SECRET_KEY := $(shell test -f s3auth && cat s3auth | grep secret_key | sed 's/^.*= //'))
|
49
|
-
./s3get sqreen-download-private.s3-eu-west-1.amazonaws.com/SqreenLibrary/SqreenLibrary-$(LIBSQREEN_VERSION)-$(LIBSQREEN_PLATFORM).tar.gz tmp/fetch/
|
50
|
-
|
51
|
-
.PHONY: fetch
|
52
|
-
fetch: tmp/fetch/SqreenLibrary/SqreenLibrary-$(LIBSQREEN_VERSION)-$(LIBSQREEN_PLATFORM).tar.gz
|
53
|
-
|
54
|
-
.PHONY: vendor/libsqreen/fetch
|
55
|
-
vendor/libsqreen/fetch: fetch
|
56
|
-
mkdir -p vendor/libsqreen
|
57
|
-
tar -xvz -C vendor/libsqreen -f tmp/fetch/SqreenLibrary/SqreenLibrary-$(LIBSQREEN_VERSION)-$(LIBSQREEN_PLATFORM).tar.gz --strip-components 1 >/dev/null
|
58
|
-
|
59
|
-
.PHONY: vendor/fetch
|
60
|
-
vendor/fetch: vendor/libsqreen/fetch vendor/libsqreen/include/Sqreen.h
|
61
|
-
|
62
|
-
.PHONY: compile
|
63
|
-
compile:
|
64
|
-
bundle exec rake compile
|
65
|
-
|
66
|
-
compile/darwin/1.9.3:
|
67
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 1.9.3; make bundle compile
|
68
|
-
|
69
|
-
compile/darwin/2.0:
|
70
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.0.; make bundle compile
|
71
|
-
|
72
|
-
compile/darwin/2.1:
|
73
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.1.; make bundle compile
|
74
|
-
|
75
|
-
compile/darwin/2.2:
|
76
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.2.; make bundle compile
|
77
|
-
|
78
|
-
compile/darwin/2.3:
|
79
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.3.; make bundle compile
|
80
|
-
|
81
|
-
compile/darwin/2.4:
|
82
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.4.; make bundle compile
|
83
|
-
|
84
|
-
compile/darwin/2.5:
|
85
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.5.; make bundle compile
|
86
|
-
|
87
|
-
compile/darwin/2.6:
|
88
|
-
source /opt/arch/share/chruby/chruby.sh; chruby 2.6.; make bundle compile
|
89
|
-
|
90
|
-
compile/linux/1.9.3:
|
91
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:1.9.3 make bundle compile
|
92
|
-
|
93
|
-
compile/linux/2.0:
|
94
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.0 make bundle compile
|
95
|
-
|
96
|
-
compile/linux/2.1:
|
97
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.1 make bundle compile
|
98
|
-
|
99
|
-
compile/linux/2.2:
|
100
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.2 make bundle compile
|
101
|
-
|
102
|
-
compile/linux/2.3:
|
103
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.3 make bundle compile
|
104
|
-
|
105
|
-
compile/linux/2.4:
|
106
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.4 make bundle compile
|
107
|
-
|
108
|
-
compile/linux/2.5:
|
109
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.5 make bundle compile
|
110
|
-
|
111
|
-
compile/linux/2.6:
|
112
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.6 make bundle compile
|
113
|
-
|
114
|
-
compile/linux-musl/2.4:
|
115
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.4-alpine make bundle compile
|
116
|
-
|
117
|
-
compile/linux-musl/2.5:
|
118
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.5-alpine make bundle compile
|
119
|
-
|
120
|
-
compile/linux-musl/2.6:
|
121
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/ruby:2.6-alpine make bundle compile
|
122
|
-
|
123
|
-
compile/darwin/all: compile/darwin/1.9.3 compile/darwin/2.0 compile/darwin/2.1 compile/darwin/2.2 compile/darwin/2.3 compile/darwin/2.4 compile/darwin/2.5 compile/darwin/2.6
|
124
|
-
compile/linux/all: compile/linux/1.9.3 compile/linux/2.0 compile/linux/2.1 compile/linux/2.2 compile/linux/2.3 compile/linux/2.4 compile/linux/2.5 compile/linux/2.6
|
125
|
-
compile/linux-musl/all: compile/linux-musl/2.4 compile/linux-musl/2.5 compile/linux-musl/2.6
|
126
|
-
|
127
|
-
.PHONY: gem
|
128
|
-
gem:
|
129
|
-
bundle exec rake build
|
130
|
-
|
131
|
-
.PHONY: test
|
132
|
-
test:
|
133
|
-
bundle exec ruby test/test_libsqreen.rb
|
134
|
-
|
135
|
-
.PHONY: pry
|
136
|
-
pry:
|
137
|
-
bundle exec ruby -I ext:lib -r libsqreen -r pry -e 'binding.pry'
|
138
|
-
|
139
|
-
.PHONY: clean/gem
|
140
|
-
clean/gem:
|
141
|
-
rm -rvf pkg
|
142
|
-
|
143
|
-
.PHONY: clean/vendor/compile
|
144
|
-
clean/vendor/compile:
|
145
|
-
cd vendor/libsqreen && git clean -f -d -x
|
146
|
-
|
147
|
-
.PHONY: clean/compile
|
148
|
-
clean/compile:
|
149
|
-
rm -rvf tmp lib/ext/$(RUBY_PLATFORM)
|
150
|
-
|
151
|
-
.PHONY: clean/compile/all
|
152
|
-
clean/compile/all:
|
153
|
-
rm -rvf tmp lib/ext/*
|
154
|
-
|
155
|
-
.PHONY: clean
|
156
|
-
clean: clean/gem clean/compile/all
|
157
|
-
|
158
|
-
bundle:
|
159
|
-
bundle install
|
160
|
-
|
161
|
-
docker/ruby/1.9.3/image:
|
162
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=1.9.3-p551 -t sqreen/native/ruby:1.9.3 docker
|
163
|
-
docker/ruby/2.0/image:
|
164
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.0.0-p648 -t sqreen/native/ruby:2.0 docker
|
165
|
-
docker/ruby/2.1/image:
|
166
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.1.10 -t sqreen/native/ruby:2.1 docker
|
167
|
-
docker/ruby/2.2/image:
|
168
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.2.10 -t sqreen/native/ruby:2.2 docker
|
169
|
-
docker/ruby/2.3/image:
|
170
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.3.8 -t sqreen/native/ruby:2.3 docker
|
171
|
-
docker/ruby/2.4/image:
|
172
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.4.7 -t sqreen/native/ruby:2.4 docker
|
173
|
-
docker/ruby/2.5/image:
|
174
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.5.6 -t sqreen/native/ruby:2.5 docker
|
175
|
-
docker/ruby/2.6/image:
|
176
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.6.4 -t sqreen/native/ruby:2.6 docker
|
177
|
-
docker/ruby/2.7/image:
|
178
|
-
docker build -f docker/Dockerfile.ruby --build-arg RUBY_VERSION=2.7.0-preview1 -t sqreen/native/ruby:2.7 docker
|
179
|
-
docker/ruby/image: docker/ruby/1.9.3/image docker/ruby/2.0/image docker/ruby/2.1/image docker/ruby/2.2/image docker/ruby/2.3/image docker/ruby/2.4/image docker/ruby/2.5/image docker/ruby/2.6/image docker/ruby/2.7/image
|
180
|
-
|
181
|
-
docker/ruby/2.4-alpine/image:
|
182
|
-
docker build -f docker/Dockerfile.ruby-alpine --build-arg RUBY_VERSION=2.4.7 -t sqreen/native/ruby:2.4-alpine docker
|
183
|
-
docker/ruby/2.5-alpine/image:
|
184
|
-
docker build -f docker/Dockerfile.ruby-alpine --build-arg RUBY_VERSION=2.5.6 -t sqreen/native/ruby:2.5-alpine docker
|
185
|
-
docker/ruby/2.6-alpine/image:
|
186
|
-
docker build -f docker/Dockerfile.ruby-alpine --build-arg RUBY_VERSION=2.6.4 -t sqreen/native/ruby:2.6-alpine docker
|
187
|
-
docker/ruby/2.7-alpine/image:
|
188
|
-
docker build -f docker/Dockerfile.ruby-alpine --build-arg RUBY_VERSION=2.7.0-preview1 -t sqreen/native/ruby:2.7-alpine docker
|
189
|
-
|
190
|
-
docker/debian/image:
|
191
|
-
docker build -f docker/Dockerfile.debian9 -t sqreen/native/debian docker
|
192
|
-
|
193
|
-
docker/arch/image:
|
194
|
-
docker build -f docker/Dockerfile.arch -t sqreen/native/arch docker
|
195
|
-
|
196
|
-
docker/alpine/image:
|
197
|
-
docker build -f docker/Dockerfile.alpine3 -t sqreen/native/alpine docker
|
198
|
-
|
199
|
-
docker/debian: docker/debian/image
|
200
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/debian /bin/bash
|
201
|
-
|
202
|
-
docker/alpine: docker/alpine/image
|
203
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/alpine /bin/sh
|
204
|
-
|
205
|
-
docker/arch: docker/arch/image
|
206
|
-
docker run --rm -it -v $$PWD:/libsqreen -w /libsqreen sqreen/native/arch /bin/bash
|
data/Rakefile
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require "rake/testtask"
|
3
|
-
require "rake/extensiontask"
|
4
|
-
|
5
|
-
Bundler::GemHelper.install_tasks
|
6
|
-
|
7
|
-
Rake::TestTask.new(:test) do |t|
|
8
|
-
t.libs << 'test'
|
9
|
-
t.libs << 'lib'
|
10
|
-
t.test_files = FileList['test/**/*_test.rb']
|
11
|
-
end
|
12
|
-
|
13
|
-
DISTRIBUTIONS = [
|
14
|
-
'x86_64-linux',
|
15
|
-
'x86-linux',
|
16
|
-
'x86_64-freebsd-10',
|
17
|
-
'x86_64-freebsd-11',
|
18
|
-
'amd64-freebsd-10',
|
19
|
-
'amd64-freebsd-11',
|
20
|
-
'arm-linux',
|
21
|
-
'aarch64-linux',
|
22
|
-
'x86_64-linux-musl'
|
23
|
-
]
|
24
|
-
|
25
|
-
gem = Gem::Specification.load(File.dirname(__FILE__) + '/libsqreen.gemspec')
|
26
|
-
Rake::ExtensionTask.new('libsqreen', gem) do |ext|
|
27
|
-
RUBY_VERSION =~ /^(\d+\.\d+)/
|
28
|
-
ext.lib_dir = "lib/ext/#{RUBY_PLATFORM}/#{$1}"
|
29
|
-
end
|
30
|
-
Rake::ExtensionTask.new('libsqreen_extension', gem) do |ext|
|
31
|
-
RUBY_VERSION =~ /^(\d+\.\d+)/
|
32
|
-
ext.lib_dir = "lib/ext/#{RUBY_PLATFORM}/#{$1}"
|
33
|
-
end
|
data/azure-pipelines.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
strategy:
|
2
|
-
matrix:
|
3
|
-
Ubuntu:
|
4
|
-
imageName: 'ubuntu-latest'
|
5
|
-
macOS High Sierra:
|
6
|
-
imageName: 'macos-10.13'
|
7
|
-
macOS Mojave:
|
8
|
-
imageName: 'macos-10.14'
|
9
|
-
pool:
|
10
|
-
vmImage: $(imageName)
|
11
|
-
steps:
|
12
|
-
- checkout: self
|
13
|
-
clean: true
|
14
|
-
submodules: recursive
|
15
|
-
- script: if uname -s | grep -i -v darwin; then sudo apt-get install -y build-essential ruby ruby-dev cmake git curl; fi
|
16
|
-
- script: sudo gem install bundler --version '< 2.0' --no-document
|
17
|
-
- script: bundle install
|
18
|
-
- script: make compile
|
19
|
-
- script: make gem
|
20
|
-
- script: make test
|
21
|
-
- script: sudo gem install pkg/*.gem
|
22
|
-
- script: ls -l pkg
|
23
|
-
- script: cp -v pkg/*.gem $(Build.ArtifactStagingDirectory)/
|
24
|
-
- task: PublishBuildArtifacts@1
|
25
|
-
displayName: Save Artifacts
|
26
|
-
inputs:
|
27
|
-
pathtoPublish: "$(Build.ArtifactStagingDirectory)"
|
28
|
-
artifactName: "$(Agent.JobName) Gem"
|
data/ext/libsqreen/arch.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
-
# Please refer to our terms for more information: https://www.sqreen.com/terms.html
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
|
6
|
-
module LibSqreen
|
7
|
-
module Arch
|
8
|
-
module_function
|
9
|
-
|
10
|
-
def libsqreen_arch
|
11
|
-
case Gem::Platform.local.cpu
|
12
|
-
when /^arm(v6.*|v7.*)*$/ then 'arm'
|
13
|
-
when /^a(rm|arch)64$/ then 'arm64'
|
14
|
-
when /^x86$/ then 'ia32'
|
15
|
-
when /^(x86_64|amd64)$/ then 'x64'
|
16
|
-
when /^universal$/ then 'x64' # OS X
|
17
|
-
else
|
18
|
-
warn "Unsupported target: #{Gem::Platform.local.cpu}"
|
19
|
-
Gem::Platform.local.cpu
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/ext/libsqreen/extconf.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
-
# Please refer to our terms for more information: https://www.sqreen.com/terms.html
|
3
|
-
|
4
|
-
require 'mkmf'
|
5
|
-
create_makefile('libsqreen')
|
6
|
-
|
7
|
-
require File.expand_path '../location', __FILE__
|
8
|
-
|
9
|
-
begin
|
10
|
-
location = LibSqreen::Location::Vendor.new
|
11
|
-
location.install!
|
12
|
-
rescue LibSqreen::Location::Vendor::HeaderNotFound => reason
|
13
|
-
puts 'could not find header. fallback to stubbing.'
|
14
|
-
location = LibSqreen::Location::Stub.new(reason)
|
15
|
-
location.install!
|
16
|
-
rescue LibSqreen::Location::Vendor::ArchiveNotFound => reason
|
17
|
-
puts "could not find binary archive: native features for platform #{RUBY_PLATFORM} not supported. fallback to stubbing."
|
18
|
-
location = LibSqreen::Location::Stub.new(reason)
|
19
|
-
location.install!
|
20
|
-
end
|
data/ext/libsqreen/libsqreen.c
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
// Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
-
// Please refer to our terms for more information: https://www.sqreen.com/terms.html
|
3
|
-
|
4
|
-
#include <ruby.h>
|
5
|
-
|
6
|
-
void
|
7
|
-
Init_libsqreen(void) {
|
8
|
-
VALUE mLibSqreen;
|
9
|
-
|
10
|
-
mLibSqreen = rb_define_module("LibSqreen");
|
11
|
-
|
12
|
-
// record load order
|
13
|
-
{
|
14
|
-
ID i_load_order;
|
15
|
-
VALUE load_order;
|
16
|
-
|
17
|
-
i_load_order = rb_intern("@load_order");
|
18
|
-
load_order = rb_ivar_get(mLibSqreen, i_load_order);
|
19
|
-
if (load_order == Qnil) {
|
20
|
-
load_order = rb_ary_new();
|
21
|
-
rb_ivar_set(mLibSqreen, i_load_order, load_order);
|
22
|
-
}
|
23
|
-
|
24
|
-
rb_ary_push(load_order, ID2SYM(rb_intern("libsqreen.c")));
|
25
|
-
}
|
26
|
-
|
27
|
-
// ensure libsqreen.rb is required too if this is loaded first
|
28
|
-
rb_require("libsqreen.rb");
|
29
|
-
}
|
data/ext/libsqreen/location.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
-
# Please refer to our terms for more information: https://www.sqreen.com/terms.html
|
3
|
-
|
4
|
-
require 'yaml'
|
5
|
-
require 'pathname'
|
6
|
-
require File.expand_path '../paths', __FILE__
|
7
|
-
|
8
|
-
module LibSqreen
|
9
|
-
class Location
|
10
|
-
def install!
|
11
|
-
File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f|
|
12
|
-
f.write(self.to_yaml)
|
13
|
-
end
|
14
|
-
return 0
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.load!
|
18
|
-
File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f|
|
19
|
-
YAML.load(f)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class Stub < Location
|
24
|
-
def initialize(reason)
|
25
|
-
@reason = reason
|
26
|
-
end
|
27
|
-
|
28
|
-
def verify!
|
29
|
-
raise @reason
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Vendor < Location
|
34
|
-
def install!
|
35
|
-
verify!
|
36
|
-
super
|
37
|
-
end
|
38
|
-
|
39
|
-
def configure(context = MkmfContext.new)
|
40
|
-
context.incflags.insert(0, LibSqreen::Paths.include_paths.map { |p| "-I#{p}" }.join(" ") + " ")
|
41
|
-
context.ldflags.insert(0, LibSqreen::Paths.object_paths.select { |p| File.exist?(p) }.join(" ") + " ")
|
42
|
-
end
|
43
|
-
|
44
|
-
def verify!
|
45
|
-
include_paths = LibSqreen::Paths.include_paths
|
46
|
-
header_files = LibSqreen::Paths.header_files
|
47
|
-
object_paths = LibSqreen::Paths.object_paths
|
48
|
-
|
49
|
-
header_files.each do |h|
|
50
|
-
unless include_paths.detect { |p| Pathname(p).join(h).exist? }
|
51
|
-
fail HeaderNotFound, "Unable to locate '#{h}' in the libsqreen header paths: #{include_paths.inspect}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
object_paths.each do |p|
|
55
|
-
fail(ArchiveNotFound, p) unless File.exist?(p)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class HeaderNotFound < StandardError; end
|
60
|
-
|
61
|
-
class ArchiveNotFound < StandardError
|
62
|
-
def initialize(filename)
|
63
|
-
super "Unable to find '#{filename}'"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
class MkmfContext
|
69
|
-
def incflags
|
70
|
-
$INCFLAGS
|
71
|
-
end
|
72
|
-
|
73
|
-
def ldflags
|
74
|
-
$LDFLAGS
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
data/ext/libsqreen/paths.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
|
-
# Please refer to our terms for more information: https://www.sqreen.com/terms.html
|
3
|
-
|
4
|
-
require 'rbconfig'
|
5
|
-
require 'shellwords'
|
6
|
-
|
7
|
-
module LibSqreen
|
8
|
-
module Paths
|
9
|
-
module_function
|
10
|
-
|
11
|
-
def include_paths
|
12
|
-
[Shellwords.escape(File.join(vendored_source_path, 'libsqreen', 'include'))]
|
13
|
-
end
|
14
|
-
|
15
|
-
def object_paths
|
16
|
-
objects = [
|
17
|
-
File.join(vendored_source_path, 'libsqreen', cpu, platform, libname),
|
18
|
-
]
|
19
|
-
|
20
|
-
return objects if platform == 'darwin'
|
21
|
-
|
22
|
-
objects << File.join(vendored_source_path, 'libc++', cpu, platform, 'libc++.a')
|
23
|
-
objects << File.join(vendored_source_path, 'libc++', cpu, platform, 'libc++abi.a')
|
24
|
-
objects << File.join(vendored_source_path, 'libc++', cpu, platform, 'libunwind.a')
|
25
|
-
|
26
|
-
objects
|
27
|
-
end
|
28
|
-
|
29
|
-
def header_files
|
30
|
-
['waf.h']
|
31
|
-
end
|
32
|
-
|
33
|
-
def config
|
34
|
-
RbConfig::MAKEFILE_CONFIG
|
35
|
-
end
|
36
|
-
|
37
|
-
def platform
|
38
|
-
RUBY_PLATFORM =~ /(solaris|darwin|linux(?=-.*$)|linux$)/ && $1
|
39
|
-
end
|
40
|
-
|
41
|
-
def cpu
|
42
|
-
RUBY_PLATFORM =~ /^(universal\.|)(.*?)-/ && $2
|
43
|
-
end
|
44
|
-
|
45
|
-
def libname
|
46
|
-
"libsqreen.#{config['LIBEXT']}"
|
47
|
-
end
|
48
|
-
|
49
|
-
def vendored_source_path
|
50
|
-
File.expand_path('../../../vendor', __FILE__)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|