mini_portile2 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +1 -1
- data/lib/mini_portile2/mini_portile.rb +19 -12
- data/lib/mini_portile2/version.rb +1 -1
- data/mini_portile2.gemspec +8 -1
- data/test/assets/git/config +4 -0
- data/test/assets/patch 1.diff +1 -1
- data/test/assets/test-download-archive.tar.gz +1 -0
- data/test/helper.rb +31 -28
- data/test/test_cook.rb +35 -26
- data/test/test_digest.rb +19 -22
- data/test/test_download.rb +71 -0
- metadata +25 -11
- data/examples/.gitignore +0 -2
- data/examples/Rakefile +0 -127
- data/examples/libiconv-patches/1-avoid-gets-error.patch +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b90aadf075467a1583841db365f7bd1aafb26790
|
4
|
+
data.tar.gz: 7689b3b467a964185225509458770aa60e1214e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0296b213f1e3b0edb2238a660489379ae084beef21ae3dc2b6f22a677d8053111ac0a130f5638c097149294c028676d06b199b8473dd1496552ab62b230e80
|
7
|
+
data.tar.gz: 1a3762db4b474760297a93c9a4a17f29cc96b0999ffca256da2f9124f1fe2a597121ca8d7ef2cb5ace853a569c679a2e6df032d6039741920df3927ec2189ef8
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
### 2.1.0 / 2016-01-06
|
2
|
+
|
3
|
+
#### Enhancements
|
4
|
+
|
5
|
+
* Add support for `file:` protocol for tarballs
|
6
|
+
|
7
|
+
|
8
|
+
#### Bugfixes
|
9
|
+
|
10
|
+
* Raise exception on unsupported URI protocols
|
11
|
+
* Ignore git whitespace config when patching (Thanks, @e2!) (#67)
|
12
|
+
|
13
|
+
|
1
14
|
### 2.0.0 / 2015-11-30
|
2
15
|
|
3
16
|
Many thanks to @larskanis, @knu, and @kirikak2, who all contributed
|
data/LICENSE.txt
CHANGED
@@ -68,7 +68,7 @@ class MiniPortile
|
|
68
68
|
message "Running git apply with #{file}... "
|
69
69
|
# By --work-tree=. git-apply uses the current directory as
|
70
70
|
# the project root and will not search upwards for .git.
|
71
|
-
execute('patch', ["git", "--work-tree=.", "apply", file], :initial_message => false)
|
71
|
+
execute('patch', ["git", "--work-tree=.", "apply", "--whitespace=warn", file], :initial_message => false)
|
72
72
|
}
|
73
73
|
when which('patch')
|
74
74
|
lambda { |file|
|
@@ -393,18 +393,20 @@ private
|
|
393
393
|
def download_file(url, full_path, count = 3)
|
394
394
|
return if File.exist?(full_path)
|
395
395
|
uri = URI.parse(url)
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
raise "Failed to complete download task"
|
396
|
+
|
397
|
+
case uri.scheme.downcase
|
398
|
+
when /ftp/
|
399
|
+
download_file_ftp(uri, full_path)
|
400
|
+
when /http|https/
|
401
|
+
download_file_http(url, full_path, count)
|
402
|
+
when /file/
|
403
|
+
download_file_file(uri, full_path)
|
404
|
+
else
|
405
|
+
raise ArgumentError.new("Unsupported protocol for #{url}")
|
407
406
|
end
|
407
|
+
rescue Exception => e
|
408
|
+
File.unlink full_path if File.exist?(full_path)
|
409
|
+
raise e
|
408
410
|
end
|
409
411
|
|
410
412
|
def download_file_http(url, full_path, count = 3)
|
@@ -448,6 +450,11 @@ private
|
|
448
450
|
end
|
449
451
|
end
|
450
452
|
|
453
|
+
def download_file_file(uri, full_path)
|
454
|
+
FileUtils.mkdir_p File.dirname(full_path)
|
455
|
+
FileUtils.cp uri.path, full_path
|
456
|
+
end
|
457
|
+
|
451
458
|
def download_file_ftp(uri, full_path)
|
452
459
|
filename = File.basename(uri.path)
|
453
460
|
with_tempfile(filename, full_path) do |temp_file|
|
data/mini_portile2.gemspec
CHANGED
@@ -17,13 +17,20 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.licenses = ['MIT']
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0")
|
20
|
+
|
21
|
+
# omit the `examples` directory from the gem, because it's large and
|
22
|
+
# not necessary to be packaged in the gem.
|
23
|
+
example_files = spec.files.grep(%r{^examples/})
|
24
|
+
spec.files -= example_files
|
25
|
+
|
20
26
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
27
|
spec.test_files = spec.files.grep(%r{^(test|spec|features|examples)/})
|
22
28
|
spec.require_paths = ["lib"]
|
23
29
|
|
24
30
|
spec.add_development_dependency "bundler", "~> 1.7"
|
25
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
-
spec.add_development_dependency "
|
32
|
+
spec.add_development_dependency "minitest", "~> 5.8.0"
|
33
|
+
spec.add_development_dependency "minitest-hooks", "~> 1.4.0"
|
27
34
|
spec.add_development_dependency "minitar", "~> 0.5.4"
|
28
35
|
|
29
36
|
spec.required_ruby_version = ">= 1.9.2"
|
data/test/assets/patch 1.diff
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
TEST FILE
|
data/test/helper.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'minitest/unit'
|
3
|
+
require 'minitest/spec'
|
4
|
+
require 'minitest/hooks/test'
|
2
5
|
require 'webrick'
|
3
6
|
require 'fileutils'
|
4
7
|
require 'zlib'
|
@@ -7,43 +10,43 @@ require 'fileutils'
|
|
7
10
|
require 'erb'
|
8
11
|
require 'mini_portile2'
|
9
12
|
|
10
|
-
class TestCase < Test
|
11
|
-
|
12
|
-
HTTP_PORT = 23523
|
13
|
+
class TestCase < Minitest::Test
|
14
|
+
include Minitest::Hooks
|
13
15
|
|
14
|
-
|
16
|
+
HTTP_PORT = 23523
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
attr_accessor :webrick
|
19
|
+
|
20
|
+
def start_webrick(path)
|
21
|
+
@webrick = WEBrick::HTTPServer.new(:Port => HTTP_PORT, :DocumentRoot => path).tap do |w|
|
22
|
+
Thread.new do
|
23
|
+
w.start
|
24
|
+
end
|
25
|
+
until w.status==:Running
|
26
|
+
sleep 0.1
|
24
27
|
end
|
25
28
|
end
|
29
|
+
end
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
31
|
+
def stop_webrick
|
32
|
+
if w=@webrick
|
33
|
+
w.shutdown
|
34
|
+
until w.status==:Stop
|
35
|
+
sleep 0.1
|
33
36
|
end
|
34
37
|
end
|
38
|
+
end
|
35
39
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
40
|
+
def create_tar(tar_path, assets_path)
|
41
|
+
FileUtils.mkdir_p(File.dirname(tar_path))
|
42
|
+
Zlib::GzipWriter.open(tar_path) do |fdtgz|
|
43
|
+
Dir.chdir(assets_path) do
|
44
|
+
Archive::Tar::Minitar.pack("test mini portile-1.0.0", fdtgz)
|
42
45
|
end
|
43
46
|
end
|
47
|
+
end
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
49
|
+
def work_dir(r=recipe)
|
50
|
+
"tmp/#{r.host}/ports/#{r.name}/#{r.version}/#{r.name}-#{r.version}"
|
48
51
|
end
|
49
52
|
end
|
data/test/test_cook.rb
CHANGED
@@ -1,33 +1,42 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
3
|
class TestCook < TestCase
|
4
|
-
|
5
|
-
attr_accessor :assets_path
|
6
|
-
attr_accessor :tar_path
|
7
|
-
attr_accessor :recipe
|
4
|
+
attr_accessor :assets_path, :tar_path, :recipe
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def with_custom_git_dir(dir)
|
7
|
+
old = ENV['GIT_DIR']
|
8
|
+
ENV['GIT_DIR'] = dir
|
9
|
+
yield
|
10
|
+
ensure
|
11
|
+
ENV['GIT_DIR'] = old
|
12
|
+
end
|
13
|
+
|
14
|
+
def before_all
|
15
|
+
super
|
16
|
+
@assets_path = File.expand_path("../assets", __FILE__)
|
17
|
+
@tar_path = File.expand_path("../../tmp/test mini portile-1.0.0.tar.gz", __FILE__)
|
12
18
|
|
13
|
-
|
14
|
-
|
19
|
+
# remove any previous test files
|
20
|
+
FileUtils.rm_rf("tmp")
|
15
21
|
|
16
|
-
|
17
|
-
|
22
|
+
create_tar(@tar_path, @assets_path)
|
23
|
+
start_webrick(File.dirname(@tar_path))
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
@recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
|
26
|
+
recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
|
27
|
+
recipe.patch_files << File.join(@assets_path, "patch 1.diff")
|
28
|
+
recipe.configure_options << "--option=\"path with 'space'\""
|
29
|
+
git_dir = File.join(@assets_path, "git")
|
30
|
+
with_custom_git_dir(git_dir) do
|
23
31
|
recipe.cook
|
24
32
|
end
|
25
33
|
end
|
34
|
+
end
|
26
35
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
36
|
+
def after_all
|
37
|
+
super
|
38
|
+
stop_webrick
|
39
|
+
# leave test files for inspection
|
31
40
|
end
|
32
41
|
|
33
42
|
def test_download
|
@@ -36,32 +45,32 @@ class TestCook < TestCase
|
|
36
45
|
end
|
37
46
|
|
38
47
|
def test_untar
|
39
|
-
configure = File.join(
|
48
|
+
configure = File.join(work_dir, "configure")
|
40
49
|
assert File.exist?(configure), configure
|
41
50
|
assert_match( /^#!\/bin\/sh/, IO.read(configure) )
|
42
51
|
end
|
43
52
|
|
44
53
|
def test_patch
|
45
|
-
patch1 = File.join(
|
54
|
+
patch1 = File.join(work_dir, "patch 1.txt")
|
46
55
|
assert File.exist?(patch1), patch1
|
47
|
-
assert_match(
|
56
|
+
assert_match( /^\tchange 1/, IO.read(patch1) )
|
48
57
|
end
|
49
58
|
|
50
59
|
def test_configure
|
51
|
-
txt = File.join(
|
60
|
+
txt = File.join(work_dir, "configure.txt")
|
52
61
|
assert File.exist?(txt), txt
|
53
|
-
opts =
|
62
|
+
opts = recipe.configure_options + ["--prefix=#{recipe.path}"]
|
54
63
|
assert_equal( opts.inspect, IO.read(txt).chomp )
|
55
64
|
end
|
56
65
|
|
57
66
|
def test_compile
|
58
|
-
txt = File.join(
|
67
|
+
txt = File.join(work_dir, "compile.txt")
|
59
68
|
assert File.exist?(txt), txt
|
60
69
|
assert_equal( ["all"].inspect, IO.read(txt).chomp )
|
61
70
|
end
|
62
71
|
|
63
72
|
def test_install
|
64
|
-
txt = File.join(
|
73
|
+
txt = File.join(work_dir, "install.txt")
|
65
74
|
assert File.exist?(txt), txt
|
66
75
|
assert_equal( ["install"].inspect, IO.read(txt).chomp )
|
67
76
|
end
|
data/test/test_digest.rb
CHANGED
@@ -1,49 +1,45 @@
|
|
1
1
|
require File.expand_path('../helper', __FILE__)
|
2
2
|
|
3
3
|
class TestDigest < TestCase
|
4
|
-
|
5
|
-
attr_accessor :assets_path
|
6
|
-
attr_accessor :tar_path
|
7
|
-
attr_accessor :recipe
|
4
|
+
attr :assets_path, :tar_path, :recipe
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def before_all
|
7
|
+
super
|
8
|
+
@assets_path = File.expand_path("../assets", __FILE__)
|
9
|
+
@tar_path = File.expand_path("../../tmp/test-digest-1.0.0.tar.gz", __FILE__)
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
# remove any previous test files
|
12
|
+
FileUtils.rm_rf("tmp")
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
create_tar(@tar_path, @assets_path)
|
15
|
+
start_webrick(File.dirname(@tar_path))
|
16
|
+
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
18
|
+
def after_all
|
19
|
+
stop_webrick
|
20
|
+
# leave test files for inspection
|
24
21
|
end
|
25
22
|
|
26
23
|
def setup
|
27
|
-
|
24
|
+
super
|
28
25
|
FileUtils.rm_rf("ports/archives")
|
29
|
-
|
30
26
|
@recipe = MiniPortile.new("test-digest", "1.0.0")
|
31
27
|
end
|
32
28
|
|
33
29
|
def download_with_digest(key, klass)
|
34
30
|
@recipe.files << {
|
35
|
-
:url => "http://localhost:#{
|
36
|
-
key => klass.file(
|
31
|
+
:url => "http://localhost:#{webrick.config[:Port]}/#{ERB::Util.url_encode(File.basename(tar_path))}",
|
32
|
+
key => klass.file(tar_path).hexdigest,
|
37
33
|
}
|
38
34
|
@recipe.download
|
39
35
|
end
|
40
36
|
|
41
37
|
def download_with_wrong_digest(key)
|
42
38
|
@recipe.files << {
|
43
|
-
:url => "http://localhost:#{
|
39
|
+
:url => "http://localhost:#{webrick.config[:Port]}/#{ERB::Util.url_encode(File.basename(tar_path))}",
|
44
40
|
key => "0011223344556677",
|
45
41
|
}
|
46
|
-
|
42
|
+
assert_raises(RuntimeError){ @recipe.download }
|
47
43
|
end
|
48
44
|
|
49
45
|
def test_sha256
|
@@ -70,3 +66,4 @@ class TestDigest < TestCase
|
|
70
66
|
download_with_wrong_digest(:md5)
|
71
67
|
end
|
72
68
|
end
|
69
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path('../helper', __FILE__)
|
2
|
+
|
3
|
+
cert_name = [['CN', 'localhost', OpenSSL::ASN1::PRINTABLESTRING]]
|
4
|
+
|
5
|
+
describe "recipe download" do
|
6
|
+
include Minitest::Hooks
|
7
|
+
|
8
|
+
attr :recipe
|
9
|
+
|
10
|
+
def server_must_receive_connection &block
|
11
|
+
request_count = 0
|
12
|
+
|
13
|
+
server = TCPServer.open('localhost', TestCase::HTTP_PORT)
|
14
|
+
thread = Thread.new do
|
15
|
+
conn = server.accept
|
16
|
+
request_count += 1
|
17
|
+
conn.puts "CONNECTION SUCESSFULLY MADE"
|
18
|
+
conn.close
|
19
|
+
end
|
20
|
+
|
21
|
+
block.call
|
22
|
+
|
23
|
+
thread.kill
|
24
|
+
server.close
|
25
|
+
|
26
|
+
request_count.must_be :>, 0
|
27
|
+
end
|
28
|
+
|
29
|
+
before do
|
30
|
+
@request_count = 0
|
31
|
+
@recipe = MiniPortile.new("test-download", "1.1.1")
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "urls" do
|
35
|
+
it "ftp" do
|
36
|
+
@recipe.files << "ftp://localhost:#{TestCase::HTTP_PORT}/foo"
|
37
|
+
server_must_receive_connection do
|
38
|
+
@recipe.download
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "handles http" do
|
43
|
+
@recipe.files << "http://localhost:#{TestCase::HTTP_PORT}/foo"
|
44
|
+
server_must_receive_connection do
|
45
|
+
@recipe.download
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "handles https" do
|
50
|
+
@recipe.files << "https://localhost:#{TestCase::HTTP_PORT}/foo"
|
51
|
+
server_must_receive_connection do
|
52
|
+
@recipe.download
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "file" do
|
57
|
+
dest = "ports/archives/test-download-archive.tar.gz"
|
58
|
+
FileUtils.rm_f dest
|
59
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), "assets", "test-download-archive.tar.gz"))
|
60
|
+
@recipe.files << "file://#{path}"
|
61
|
+
@recipe.download
|
62
|
+
assert File.exist?(dest)
|
63
|
+
Digest::MD5.file(dest).hexdigest.must_equal "5deffb997041bbb5f11bdcafdbb47975"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "other" do
|
67
|
+
@recipe.files << "foo://foo"
|
68
|
+
proc { @recipe.download }.must_raise ArgumentError
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_portile2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Lavena
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -41,19 +41,33 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '10.0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
44
|
+
name: minitest
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 5.8.0
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: 5.8.0
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: minitest-hooks
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.4.0
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.4.0
|
57
71
|
- !ruby/object:Gem::Dependency
|
58
72
|
name: minitar
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,18 +98,18 @@ files:
|
|
84
98
|
- README.md
|
85
99
|
- Rakefile
|
86
100
|
- appveyor.yml
|
87
|
-
- examples/.gitignore
|
88
|
-
- examples/Rakefile
|
89
|
-
- examples/libiconv-patches/1-avoid-gets-error.patch
|
90
101
|
- lib/mini_portile2.rb
|
91
102
|
- lib/mini_portile2/mini_portile.rb
|
92
103
|
- lib/mini_portile2/version.rb
|
93
104
|
- mini_portile2.gemspec
|
105
|
+
- test/assets/git/config
|
94
106
|
- test/assets/patch 1.diff
|
95
107
|
- test/assets/test mini portile-1.0.0/configure
|
108
|
+
- test/assets/test-download-archive.tar.gz
|
96
109
|
- test/helper.rb
|
97
110
|
- test/test_cook.rb
|
98
111
|
- test/test_digest.rb
|
112
|
+
- test/test_download.rb
|
99
113
|
- test/test_proxy.rb
|
100
114
|
homepage: http://github.com/flavorjones/mini_portile
|
101
115
|
licenses:
|
@@ -122,12 +136,12 @@ signing_key:
|
|
122
136
|
specification_version: 4
|
123
137
|
summary: Simplistic port-like solution for developers
|
124
138
|
test_files:
|
125
|
-
-
|
126
|
-
- examples/Rakefile
|
127
|
-
- examples/libiconv-patches/1-avoid-gets-error.patch
|
139
|
+
- test/assets/git/config
|
128
140
|
- test/assets/patch 1.diff
|
129
141
|
- test/assets/test mini portile-1.0.0/configure
|
142
|
+
- test/assets/test-download-archive.tar.gz
|
130
143
|
- test/helper.rb
|
131
144
|
- test/test_cook.rb
|
132
145
|
- test/test_digest.rb
|
146
|
+
- test/test_download.rb
|
133
147
|
- test/test_proxy.rb
|
data/examples/.gitignore
DELETED
data/examples/Rakefile
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
$: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
4
|
-
require "mini_portile2"
|
5
|
-
|
6
|
-
recipes = []
|
7
|
-
|
8
|
-
def windows?
|
9
|
-
RbConfig::CONFIG['target_os'] =~ /mswin|mingw32/
|
10
|
-
end
|
11
|
-
|
12
|
-
# libiconv
|
13
|
-
libiconv = MiniPortile.new "libiconv", "1.14"
|
14
|
-
libiconv.files << "ftp://ftp.gnu.org/pub/gnu/#{libiconv.name}/#{libiconv.name}-#{libiconv.version}.tar.gz"
|
15
|
-
unless windows?
|
16
|
-
libiconv.patch_files = Dir["libiconv-patches/*.patch"].map { |dir| File.expand_path dir }
|
17
|
-
end
|
18
|
-
|
19
|
-
recipes.push libiconv
|
20
|
-
|
21
|
-
# sqlite3
|
22
|
-
sqlite3 = MiniPortile.new "sqlite3", "3.8.4.1"
|
23
|
-
sqlite3.files << "http://sqlite.org/2014/sqlite-autoconf-3080401.tar.gz"
|
24
|
-
|
25
|
-
recipes.push sqlite3
|
26
|
-
|
27
|
-
# c-ares
|
28
|
-
c_ares = MiniPortile.new "c-ares", "1.7.5"
|
29
|
-
c_ares.files << "http://distfiles.openknapsack.org/#{c_ares.name}/#{c_ares.name}-#{c_ares.version}.tar.gz"
|
30
|
-
|
31
|
-
recipes.push c_ares
|
32
|
-
|
33
|
-
# zlib
|
34
|
-
class ZlibRecipe < MiniPortile
|
35
|
-
def windows?
|
36
|
-
!(host =~ /mswin|mingw/).nil?
|
37
|
-
end
|
38
|
-
|
39
|
-
def configure
|
40
|
-
return super unless windows?
|
41
|
-
|
42
|
-
Dir.chdir work_path do
|
43
|
-
mk = File.read 'win32/Makefile.gcc'
|
44
|
-
File.open 'win32/Makefile.gcc', 'wb' do |f|
|
45
|
-
f.puts "BINARY_PATH = #{path}/bin"
|
46
|
-
f.puts "LIBRARY_PATH = #{path}/lib"
|
47
|
-
f.puts "INCLUDE_PATH = #{path}/include"
|
48
|
-
|
49
|
-
cross_build? and
|
50
|
-
mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-")
|
51
|
-
|
52
|
-
f.puts mk
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def configure_defaults
|
58
|
-
["--static"]
|
59
|
-
end
|
60
|
-
|
61
|
-
def configured?
|
62
|
-
return super unless windows?
|
63
|
-
|
64
|
-
!!(File.read(File.join(work_path, 'win32/Makefile.gcc')) =~ /^BINARY_PATH/)
|
65
|
-
end
|
66
|
-
|
67
|
-
def compile
|
68
|
-
return super unless windows?
|
69
|
-
|
70
|
-
execute "compile", "make -f win32/Makefile.gcc"
|
71
|
-
end
|
72
|
-
|
73
|
-
def install
|
74
|
-
return if installed?
|
75
|
-
return super unless windows?
|
76
|
-
|
77
|
-
execute "install", %Q(#{make_cmd} -f win32/Makefile.gcc install)
|
78
|
-
end
|
79
|
-
|
80
|
-
def cross_build?
|
81
|
-
host != original_host
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
zlib = ZlibRecipe.new "zlib", "1.2.8"
|
86
|
-
zlib.files << {
|
87
|
-
url: "http://zlib.net/#{zlib.name}-#{zlib.version}.tar.gz",
|
88
|
-
md5: "44d667c142d7cda120332623eab69f40",
|
89
|
-
}
|
90
|
-
|
91
|
-
|
92
|
-
recipes.push zlib
|
93
|
-
|
94
|
-
namespace :ports do
|
95
|
-
directory "ports"
|
96
|
-
|
97
|
-
recipes.each do |recipe|
|
98
|
-
desc "Install port #{recipe.name} #{recipe.version}"
|
99
|
-
task recipe.name => ["ports"] do |t|
|
100
|
-
checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
101
|
-
|
102
|
-
unless File.exist?(checkpoint)
|
103
|
-
recipe.cook
|
104
|
-
touch checkpoint
|
105
|
-
end
|
106
|
-
|
107
|
-
recipe.activate
|
108
|
-
end
|
109
|
-
|
110
|
-
task :all => recipe.name
|
111
|
-
end
|
112
|
-
|
113
|
-
desc "Install all ports and display installation location"
|
114
|
-
task :all do
|
115
|
-
recipes.each do |recipe|
|
116
|
-
puts "Artifacts of '#{recipe.name}' in '#{recipe.path}'"
|
117
|
-
end
|
118
|
-
puts "LDFLAGS: " << ENV['LDFLAGS'].inspect
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
desc "Adjust all recipes host for cross-compilation"
|
123
|
-
task :cross do
|
124
|
-
recipes.each do |recipe|
|
125
|
-
recipe.host = "i686-w64-mingw32"
|
126
|
-
end
|
127
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
This file tests the 'patch' functionality, as well as working around a
|
2
|
-
libiconv compilation issue with glibc >= 2.16.
|
3
|
-
|
4
|
-
--- a/srclib/stdio.in.h 2015-08-23 13:59:57.395880263 -0400
|
5
|
-
+++ b/srclib/stdio.in.h 2015-08-23 14:00:00.047880153 -0400
|
6
|
-
@@ -695,8 +695,10 @@
|
7
|
-
/* It is very rare that the developer ever has full control of stdin,
|
8
|
-
so any use of gets warrants an unconditional warning. Assume it is
|
9
|
-
always declared, since it is required by C89. */
|
10
|
-
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
|
11
|
-
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
12
|
-
#endif
|
13
|
-
+#endif
|
14
|
-
|
15
|
-
|
16
|
-
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
|