mini_portile 0.6.2 → 0.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +15 -0
- data/{History.txt → CHANGELOG.md} +36 -14
- data/Gemfile +4 -0
- data/README.md +185 -0
- data/Rakefile +16 -44
- data/appveyor.yml +21 -0
- data/examples/.gitignore +2 -0
- data/examples/Rakefile +17 -3
- data/examples/libiconv-patches/1-avoid-gets-error.patch +16 -0
- data/lib/mini_portile.rb +2 -437
- data/lib/mini_portile/mini_portile.rb +494 -0
- data/lib/mini_portile/version.rb +3 -0
- data/mini_portile.gemspec +30 -0
- data/test/assets/patch 1.diff +7 -0
- data/test/assets/test mini portile-1.0.0/configure +11 -0
- data/test/helper.rb +46 -0
- data/test/test_cook.rb +71 -0
- data/test/test_digest.rb +75 -0
- data/test/test_proxy.rb +124 -0
- metadata +92 -19
- data/README.rdoc +0 -169
data/README.rdoc
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
= MiniPortile
|
2
|
-
|
3
|
-
* {Source Code}[https://github.com/flavorjones/mini_portile]
|
4
|
-
* {Bug Reports}[https://github.com/flavorjones/mini_portile/issues]
|
5
|
-
|
6
|
-
This project is a minimalistic, simplistic and stupid implementation of a port/recipe
|
7
|
-
system <b>for developers</b>.
|
8
|
-
|
9
|
-
== Another port system, srsly?
|
10
|
-
|
11
|
-
No, is not a general port system, is not aimed to take over apt, macports or
|
12
|
-
anything like that.
|
13
|
-
|
14
|
-
The rationale is simple.
|
15
|
-
|
16
|
-
You create a library A that uses B at runtime or compile time. Target audience
|
17
|
-
of your library might have different versions of B installed than yours.
|
18
|
-
|
19
|
-
You know, <em>Works on my machine</em> is not what you expect from one
|
20
|
-
developer to another.
|
21
|
-
|
22
|
-
Developers having problems report them back to you, and what you do then?
|
23
|
-
Compile B locally, replacing your existing installation of B or simply hacking
|
24
|
-
things around so nothing breaks.
|
25
|
-
|
26
|
-
All this, manually.
|
27
|
-
|
28
|
-
Computers are tools, are meant to help us, not the other way around.
|
29
|
-
|
30
|
-
What if I tell you the above scenario can be simplified with something like
|
31
|
-
this:
|
32
|
-
|
33
|
-
rake compile B_VERSION=1.2.3
|
34
|
-
|
35
|
-
And your library will use the version of B you specified. Done.
|
36
|
-
|
37
|
-
== You make it sound easy, where is the catch?
|
38
|
-
|
39
|
-
You got me, there is a catch. At this time (and highly likely will be always)
|
40
|
-
MiniPortile is only compatible with GCC compilers and autoconf/configure-based
|
41
|
-
projects.
|
42
|
-
|
43
|
-
It assumes the library you want to build contains a <tt>configure</tt> script,
|
44
|
-
which all the autoconf-based libraries do.
|
45
|
-
|
46
|
-
=== How to use
|
47
|
-
|
48
|
-
Now that you know the catch, and you're still reading this, let me show you a
|
49
|
-
quick example:
|
50
|
-
|
51
|
-
require "mini_portile"
|
52
|
-
recipe = MiniPortile.new("libiconv", "1.13.1")
|
53
|
-
recipe.files = ["http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz"]
|
54
|
-
recipe.cook
|
55
|
-
recipe.activate
|
56
|
-
|
57
|
-
That's all. <tt>cook</tt> will download, extract, patch, configure and compile
|
58
|
-
the library into a namespaced structure. <tt>activate</tt> ensures GCC find
|
59
|
-
this library and prefers it over a system-wide installation.
|
60
|
-
|
61
|
-
=== Structure
|
62
|
-
|
63
|
-
At this time, if you haven't digged into the code yet, are wondering <em>what
|
64
|
-
is all that structure talk about?</em>.
|
65
|
-
|
66
|
-
MiniPortile follows the principle of <b>convention over configuration</b> and
|
67
|
-
established a folder structure where is going to place files and perform work.
|
68
|
-
|
69
|
-
Take the above example, and let's draw some picture:
|
70
|
-
|
71
|
-
mylib
|
72
|
-
|-- ports
|
73
|
-
| |-- archives
|
74
|
-
| | `-- libiconv-1.13.1.tar.gz
|
75
|
-
| `-- <platform>
|
76
|
-
| `-- libiconv
|
77
|
-
| `-- 1.13.1
|
78
|
-
| |-- bin
|
79
|
-
| |-- include
|
80
|
-
| `-- lib
|
81
|
-
`-- tmp
|
82
|
-
`-- <platform>
|
83
|
-
`-- ports
|
84
|
-
|
85
|
-
In above structure, <tt>platform</tt> refers to the architecture that represents
|
86
|
-
the operating system you're using (e.g. i686-linux, i386-mingw32, etc).
|
87
|
-
|
88
|
-
Inside this folder, MiniPortile will store the artifacts that result from the
|
89
|
-
compilation process. As you cans see, it versions out the library so you can
|
90
|
-
run multiple version combination without compromising these overlap each other.
|
91
|
-
|
92
|
-
<tt>archives</tt> is where downloaded source files are stored. It is recommended
|
93
|
-
you avoid trashing that folder so no further downloads will be required (save
|
94
|
-
bandwidth, save the world).
|
95
|
-
|
96
|
-
The <tt>tmp</tt> is where compilation is performed and can be safely discarded.
|
97
|
-
|
98
|
-
Don't worry, you don't need to know the path structure by memory, just use recipe's
|
99
|
-
<tt>path</tt> to obtain the full path to the installation directory:
|
100
|
-
|
101
|
-
recipe.cook
|
102
|
-
recipe.path # => /home/luis/projects/myapp/ports/i686-linux/libiconv/1.13.1
|
103
|
-
|
104
|
-
=== How can I combine this with my compilation task?
|
105
|
-
|
106
|
-
In the simplified proposal, the idea is that using Rake, your <tt>compile</tt>
|
107
|
-
task depends on MiniPortile compilation and most important, activation.
|
108
|
-
|
109
|
-
Take the following as a simplification of how you can use MiniPortile with
|
110
|
-
Rake:
|
111
|
-
|
112
|
-
task :libiconv do
|
113
|
-
recipe = MiniPortile.new("libiconv", "1.13.1")
|
114
|
-
recipe.files = ["http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz"]
|
115
|
-
checkpoint = ".#{recipe.name}-#{recipe.version}.installed"
|
116
|
-
|
117
|
-
unless File.exist?(checkpoint)
|
118
|
-
recipe.cook
|
119
|
-
touch checkpoint
|
120
|
-
end
|
121
|
-
|
122
|
-
recipe.activate
|
123
|
-
end
|
124
|
-
|
125
|
-
task :compile => [:libiconv] do
|
126
|
-
# ...
|
127
|
-
end
|
128
|
-
|
129
|
-
This example will:
|
130
|
-
|
131
|
-
* Compile the library only once (using a timestamp file)
|
132
|
-
* Ensure compiled library gets activated every time
|
133
|
-
* Make compile task depend on compiled library activation
|
134
|
-
|
135
|
-
For your homework, you can make libiconv version be taken from <tt>ENV</tt>
|
136
|
-
variables.
|
137
|
-
|
138
|
-
=== Native or cross-compilation
|
139
|
-
|
140
|
-
Above examples cover the normal use case: compile support libraries natively.
|
141
|
-
|
142
|
-
MiniPortile also covers another use case, which is the cross-compilation of the
|
143
|
-
support libraries to be used as part of a binary gem compilation.
|
144
|
-
|
145
|
-
It is the perfect complementary tool for rake-compiler and it's <tt>cross</tt>
|
146
|
-
Rake task.
|
147
|
-
|
148
|
-
Depending on your usage of rake-compiler, you will need to use <tt>host</tt> to
|
149
|
-
match the installed cross-compiler toolchain.
|
150
|
-
|
151
|
-
Please refer to the examples directory for simplified and practical usage.
|
152
|
-
|
153
|
-
=== Supported scenarios
|
154
|
-
|
155
|
-
As mentioned before, MiniPortile requires a GCC compiler toolchain. This has
|
156
|
-
been tested against Ubuntu, OSX and even Windows (RubyInstaller with DevKit)
|
157
|
-
|
158
|
-
== Disclaimer
|
159
|
-
|
160
|
-
If you have any trouble, don't hesitate to contact the author. As always,
|
161
|
-
I'm not going to say <em>Use at your own risk</em> because I don't want this
|
162
|
-
library to be risky.
|
163
|
-
|
164
|
-
If you trip on something, I'll share the liability by repairing things
|
165
|
-
as quickly as I can. Your responsibility is to report the inadequacies.
|
166
|
-
|
167
|
-
== License
|
168
|
-
|
169
|
-
This library is licensed under MIT license. Please see LICENSE.txt for details.
|