gear 0.0.3 → 0.0.4
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/gear.gemspec +1 -1
- data/lib/gear.rb +12 -2
- data/lib/gears/apngasm.rb +24 -13
- data/lib/gears/boost.rb +30 -10
- data/lib/gears/cmake.rb +13 -7
- data/lib/gears/libarchive.rb +24 -12
- data/lib/gears/swig.rb +20 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a0f33ba31dc188dbed79ba6fe362d2160a7102
|
4
|
+
data.tar.gz: 2d1c2b6dced79059cec1dc13b0fbd97f8047a5ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36c41d48bf7007acdc105c7ceb58413584644a99c2a41fe50f485d6f585ea255fd8e78fc9bb7c06e3ee953d980bed7d33205562ba353a1af26cbe58f4e0192a7
|
7
|
+
data.tar.gz: 779b3ae98314e59cd1fb28cf5702945325980b222702f37eb03b7d5634247630d1cbefdf87077457ba1188a118995c773184e89679982346f9a53c18c4e33fcf
|
data/gear.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'gear'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.4'
|
4
4
|
s.license = 'GPL-3'
|
5
5
|
s.summary = 'modular dependency build system for native extensions'
|
6
6
|
s.description = 'gear provides a modular framework to encapsulate build tasks for native ' +
|
data/lib/gear.rb
CHANGED
@@ -46,8 +46,9 @@ class Gear
|
|
46
46
|
|
47
47
|
def initialize()
|
48
48
|
@obtained = @built = @installed = @checked = false
|
49
|
-
@build_path =
|
49
|
+
@build_path = _root_path() + "/build/#{name()}"
|
50
50
|
_setup_paths()
|
51
|
+
Dir.chdir(_root_path() + "/build")
|
51
52
|
|
52
53
|
@@initialized = true
|
53
54
|
end
|
@@ -85,6 +86,7 @@ class Gear
|
|
85
86
|
end
|
86
87
|
|
87
88
|
def remove()
|
89
|
+
Dir.chdir(_root_path + '/build')
|
88
90
|
FileUtils.rm_rf("#{@build_path}")
|
89
91
|
@obtained = false
|
90
92
|
return true
|
@@ -103,6 +105,7 @@ class Gear
|
|
103
105
|
|
104
106
|
#======== obtain helpers ========#
|
105
107
|
def git_obtain(repository, branch)
|
108
|
+
Dir.chdir(_root_path + '/build')
|
106
109
|
begin
|
107
110
|
if Dir.exist? build_path
|
108
111
|
@git = Git.open(build_path)
|
@@ -139,6 +142,7 @@ class Gear
|
|
139
142
|
end
|
140
143
|
|
141
144
|
def std_make_install()
|
145
|
+
Dir.chdir(@build_path)
|
142
146
|
`make install`
|
143
147
|
@installed = true
|
144
148
|
return true
|
@@ -149,8 +153,12 @@ class Gear
|
|
149
153
|
`LD_LIBRARY_PATH=#{@@install_path}/lib:$LD_LIBRARY_PATH C_INCLUDE_PATH=#{@@install_path}/include:$C_INCLUDE_PATH PATH=#{@@install_path}/bin:$PATH #{command}`
|
150
154
|
end
|
151
155
|
|
156
|
+
def gear_exec_mac()
|
157
|
+
`mdfind -onlyin #{@@install_path} -name #{name} -count`.chomp.to_i
|
158
|
+
end
|
159
|
+
|
152
160
|
private
|
153
|
-
def
|
161
|
+
def _root_path()
|
154
162
|
File.expand_path('../..', __FILE__)
|
155
163
|
end
|
156
164
|
|
@@ -158,6 +166,8 @@ class Gear
|
|
158
166
|
def _setup_paths()
|
159
167
|
#puts "⚙Preparing directory structure in #{@@install_path}"
|
160
168
|
return if @@initialized
|
169
|
+
|
170
|
+
FileUtils.mkdir_p("#{_root_path}/build")
|
161
171
|
FileUtils.mkdir_p("#{@@install_path}/bin")
|
162
172
|
FileUtils.mkdir_p("#{@@install_path}/include")
|
163
173
|
FileUtils.mkdir_p("#{@@install_path}/lib")
|
data/lib/gears/apngasm.rb
CHANGED
@@ -8,37 +8,48 @@ module Gears
|
|
8
8
|
@gear_name = "APNGAsm"
|
9
9
|
|
10
10
|
def check()
|
11
|
-
|
12
|
-
if
|
13
|
-
@checked = true
|
14
|
-
|
11
|
+
puts 'Checking for APNGAsm libraries'
|
12
|
+
if RUBY_PLATFORM.match(/darwin/)
|
13
|
+
@checked = gear_exec_mac > 0 ? true : false
|
14
|
+
else
|
15
|
+
gear_exec 'ldconfig -p | grep libapngasm'
|
16
|
+
@checked = $?.exitstatus == 0 ? true : false
|
15
17
|
end
|
16
|
-
@checked
|
17
|
-
return false
|
18
|
+
@checked
|
18
19
|
end
|
19
20
|
|
20
21
|
def obtain()
|
22
|
+
puts 'Obtaining APNGAsm sources'
|
21
23
|
github_obtain('apngasm', 'apngasm')
|
22
24
|
end
|
23
25
|
|
24
26
|
def build()
|
25
|
-
|
27
|
+
puts 'Engaging APNGAsm dependencies'
|
26
28
|
cm = Gears::CMake.new
|
27
|
-
cm.engage
|
29
|
+
cm_run = Thread.new { cm.engage }
|
28
30
|
boost = Gears::Boost.new
|
29
|
-
boost.engage
|
31
|
+
boost_run = Thread.new { boost.engage }
|
32
|
+
cm_run.join
|
33
|
+
boost_run.join
|
30
34
|
|
35
|
+
puts "Building APNGAsm in #{@build_path}"
|
31
36
|
Dir.chdir(@build_path)
|
37
|
+
`git checkout swig_interfaces`
|
32
38
|
FileUtils.mkdir_p('build') # `mkdir build`
|
33
39
|
Dir.chdir('build') # `cd build`
|
34
|
-
|
35
|
-
|
40
|
+
puts "cmake -DCMAKE_INSTALL_PREFIX=#{@@install_path} .."
|
41
|
+
`cmake -DCMAKE_INSTALL_PREFIX=#{@@install_path} ..`
|
42
|
+
`make`
|
36
43
|
@built = true
|
37
|
-
|
44
|
+
true
|
38
45
|
end
|
39
46
|
|
40
47
|
def install()
|
41
|
-
|
48
|
+
puts "Installing APNGAsm to #{@@install_path}"
|
49
|
+
Dir.chdir(@build_path + '/build')
|
50
|
+
`make install`
|
51
|
+
@installed = true
|
52
|
+
true
|
42
53
|
end
|
43
54
|
|
44
55
|
#TODO uninstall
|
data/lib/gears/boost.rb
CHANGED
@@ -5,35 +5,55 @@ module Gears
|
|
5
5
|
@gear_name = "Boost"
|
6
6
|
|
7
7
|
def check()
|
8
|
-
|
9
|
-
if
|
10
|
-
@checked = true
|
11
|
-
|
8
|
+
puts 'Checking for Boost'
|
9
|
+
if RUBY_PLATFORM.match(/darwin/)
|
10
|
+
@checked = gear_exec_mac > 0 ? true : false
|
11
|
+
else
|
12
|
+
gear_exec 'ldconfig -p | grep libboost'
|
13
|
+
@checked = $?.exitstatus == 0 ? true : false
|
12
14
|
end
|
13
|
-
@checked
|
14
|
-
return false
|
15
|
+
@checked
|
15
16
|
end
|
16
17
|
|
17
18
|
def obtain()
|
18
|
-
|
19
|
+
puts 'Obtaining Boost'
|
20
|
+
# github_obtain('boostorg', 'boost')
|
21
|
+
Dir.chdir(_root_path + '/build')
|
22
|
+
return true if Dir.exist? 'Boost'
|
23
|
+
|
24
|
+
`wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.zip`
|
25
|
+
`unzip boost_1_59_0.zip`
|
26
|
+
`mv boost_1_59_0 Boost`
|
27
|
+
FileUtils.rm('boost_1_59_0.zip')
|
28
|
+
true
|
19
29
|
end
|
20
30
|
|
21
31
|
def build()
|
32
|
+
puts "Building Boost in #{@build_path}"
|
22
33
|
Dir.chdir(@build_path)
|
34
|
+
puts '...boostrapping'
|
23
35
|
`./bootstrap.sh --without-libraries=python --prefix=#{@@install_path}`
|
36
|
+
puts '...compiling headers'
|
24
37
|
`./b2 headers`
|
38
|
+
puts '...building'
|
25
39
|
`./b2`
|
26
|
-
`./b2 install --prefix=#{@@install_path}`
|
27
40
|
@built = true
|
28
41
|
return true
|
29
42
|
end
|
30
43
|
|
31
44
|
def install()
|
32
|
-
|
45
|
+
puts "Installing Boost to #{@@install_path}"
|
46
|
+
Dir.chdir(@build_path)
|
47
|
+
`./b2 install --prefix=#{@@install_path}`
|
48
|
+
@installed = true
|
49
|
+
true
|
33
50
|
end
|
34
51
|
|
35
52
|
def uninstall()
|
36
|
-
#
|
53
|
+
FileUtils.rm_f(Dir.glob("#{@@install_path}/lib/libboost.*"))
|
54
|
+
FileUtils.rm_rf("#{@@install_path}/include/boost")
|
55
|
+
@installed = false
|
56
|
+
true
|
37
57
|
end
|
38
58
|
end
|
39
59
|
end
|
data/lib/gears/cmake.rb
CHANGED
@@ -7,35 +7,41 @@ module Gears
|
|
7
7
|
@gear_name = "CMake"
|
8
8
|
|
9
9
|
def check()
|
10
|
-
|
11
|
-
if
|
12
|
-
@checked = true
|
13
|
-
|
10
|
+
puts 'Checking for CMake'
|
11
|
+
if RUBY_PLATFORM.match(/darwin/)
|
12
|
+
@checked = gear_exec_mac > 0 ? true : false
|
13
|
+
else
|
14
|
+
gear_exec 'cmake --version'
|
15
|
+
@checked = $?.exitstatus == 0 ? true : false
|
14
16
|
end
|
15
|
-
@checked
|
16
|
-
return false
|
17
|
+
return @checked
|
17
18
|
end
|
18
19
|
|
19
20
|
def obtain()
|
21
|
+
puts 'Obtaining CMake'
|
20
22
|
github_obtain('Kitware', 'CMake')
|
21
23
|
end
|
22
24
|
|
23
25
|
def build()
|
26
|
+
puts 'Engaging CMake dependencies'
|
24
27
|
la = Gears::LibArchive.new
|
25
28
|
la.engage
|
26
29
|
|
30
|
+
puts "Building CMake in #{@build_path}"
|
27
31
|
Dir.chdir(@build_path)
|
28
|
-
|
32
|
+
`./configure --prefix=#{@@install_path}`
|
29
33
|
`make`
|
30
34
|
@built = true
|
31
35
|
return true
|
32
36
|
end
|
33
37
|
|
34
38
|
def install()
|
39
|
+
puts "Installing CMake to #{@@install_path}"
|
35
40
|
std_make_install
|
36
41
|
end
|
37
42
|
|
38
43
|
def uninstall()
|
44
|
+
puts 'Uninstalling CMake'
|
39
45
|
FileUtils.rm_f("#{@@install_path}/bin/ccmake")
|
40
46
|
FileUtils.rm_f("#{@@install_path}/bin/cmake")
|
41
47
|
FileUtils.rm_f("#{@@install_path}/bin/cmakexbuild")
|
data/lib/gears/libarchive.rb
CHANGED
@@ -5,26 +5,38 @@ module Gears
|
|
5
5
|
@gear_name = "libarchive"
|
6
6
|
|
7
7
|
def check()
|
8
|
-
|
9
|
-
if
|
10
|
-
@checked = true
|
11
|
-
|
8
|
+
puts 'Checking for libarchive'
|
9
|
+
if RUBY_PLATFORM.match(/darwin/)
|
10
|
+
@checked = gear_exec_mac > 0 ? true : false
|
11
|
+
else
|
12
|
+
gear_exec 'ldconfig -p | grep libarchive'
|
13
|
+
@checked = $?.exitstatus == 0 ? true : false
|
12
14
|
end
|
13
|
-
@checked
|
14
|
-
return false
|
15
|
+
@checked
|
15
16
|
end
|
16
17
|
|
17
18
|
def obtain()
|
18
|
-
|
19
|
+
puts 'Obtaining libarchive'
|
20
|
+
# github_obtain('libarchive', 'libarchive', 'release')
|
21
|
+
return true if File.exist? 'libarchive'
|
22
|
+
Dir.chdir(_root_path + '/build')
|
23
|
+
`wget http://www.libarchive.org/downloads/libarchive-3.1.2.zip`
|
24
|
+
`unzip libarchive-3.1.2.zip`
|
25
|
+
`mv libarchive-3.1.2 libarchive`
|
19
26
|
end
|
20
27
|
|
21
28
|
def build()
|
29
|
+
puts "Building libarchive in #{@build_path}"
|
30
|
+
# TODO: fix build error
|
22
31
|
Dir.chdir(@build_path)
|
23
|
-
`
|
24
|
-
|
32
|
+
# `git checkout release`
|
33
|
+
# `sh build/autogen.sh`
|
34
|
+
puts '...configuring'
|
35
|
+
`./configure --prefix=#{@@install_path} --without-lzo2 --without-nettle --without-xml2`
|
36
|
+
puts '...making'
|
25
37
|
`make`
|
26
38
|
@built = true
|
27
|
-
|
39
|
+
true
|
28
40
|
end
|
29
41
|
|
30
42
|
def install()
|
@@ -45,7 +57,7 @@ module Gears
|
|
45
57
|
FileUtils.rm_rf("#{@@install_path}/share/man/man3")
|
46
58
|
FileUtils.rm_rf("#{@@install_path}/share/man/man5")
|
47
59
|
@installed = false
|
48
|
-
|
60
|
+
true
|
49
61
|
end
|
50
62
|
end
|
51
|
-
end
|
63
|
+
end
|
data/lib/gears/swig.rb
CHANGED
@@ -5,39 +5,48 @@ module Gears
|
|
5
5
|
@gear_name = "SWIG"
|
6
6
|
|
7
7
|
def check()
|
8
|
-
|
9
|
-
if
|
10
|
-
@checked = true
|
11
|
-
|
8
|
+
puts 'Checking for SWIG'
|
9
|
+
if RUBY_PLATFORM.match(/darwin/)
|
10
|
+
@checked = gear_exec_mac > 0 ? true : false
|
11
|
+
else
|
12
|
+
gear_exec 'swig -version'
|
13
|
+
@checked = $?.exitstatus == 0 ? true : false
|
12
14
|
end
|
13
|
-
@checked
|
14
|
-
return false
|
15
|
+
@checked
|
15
16
|
end
|
16
17
|
|
17
18
|
def obtain()
|
19
|
+
puts 'Obtaining SWIG'
|
18
20
|
github_obtain('swig', 'swig')
|
19
21
|
end
|
20
22
|
|
21
23
|
def build()
|
24
|
+
puts "Building SWIG in #{@build_path}"
|
22
25
|
Dir.chdir(@build_path)
|
23
|
-
|
24
|
-
|
26
|
+
`./autogen.sh`
|
27
|
+
`./configure --prefix=#{@@install_path}`
|
25
28
|
`make`
|
26
29
|
@built = true
|
27
|
-
|
30
|
+
true
|
28
31
|
end
|
29
32
|
|
30
33
|
def install()
|
31
|
-
|
34
|
+
puts "Installing SWIG to #{@@install_path}"
|
35
|
+
Dir.chdir(@build_path)
|
36
|
+
`make install-main`
|
37
|
+
`make install-lib`
|
38
|
+
@installed = true
|
39
|
+
true
|
32
40
|
end
|
33
41
|
|
34
42
|
def uninstall()
|
43
|
+
puts 'Uninstalling SWIG'
|
35
44
|
FileUtils.rm_f("#{@@install_path}/bin/swig")
|
36
45
|
FileUtils.rm_f("#{@@install_path}/bin/ccache-swig")
|
37
46
|
FileUtils.rm_rf("#{@@install_path}/share/swig")
|
38
47
|
FileUtils.rm_f("#{@@install_path}/share/man/man1/ccache-swig.1")
|
39
48
|
@installed = false
|
40
|
-
|
49
|
+
true
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|