1
1
require 'rbconfig'
2
+ require 'mkmf'
2
3
3
4
$: << File . expand_path ( File . join ( File . dirname ( __FILE__ ) , "../lib" ) )
4
5
require "mini_portile2"
5
6
6
7
recipes = [ ]
8
+ recipe_hooks = { }
7
9
8
10
def windows?
9
11
RbConfig ::CONFIG [ 'target_os' ] =~ /mswin|mingw32/
@@ -119,6 +121,28 @@ zlib.files << {
119
121
120
122
recipes . push zlib
121
123
124
+ #
125
+ # libyaml, using pkgconf for configuration
126
+ #
127
+ yaml = MiniPortile . new ( "yaml" , "0.2.5" )
128
+ yaml . files = [ {
129
+ url : "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz" ,
130
+ sha256 : "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4" ,
131
+ } ]
132
+ recipes . push ( yaml )
133
+ recipe_hooks [ "yaml" ] = lambda do |recipe |
134
+ expected = "-L" + File . join ( recipe . path , "lib" )
135
+ !$LDFLAGS. split . include? ( expected ) or raise "assertion failed on setup"
136
+
137
+ conf = pkg_config ( File . join ( recipe . path , "lib" , "pkgconfig" , "yaml-0.1.pc" ) )
138
+ puts "pkg_config: #{ conf . inspect } "
139
+
140
+ $LDFLAGS. split . include? ( expected ) or raise ( <<~MSG )
141
+ assertion failed: LDFLAGS not updated correctly:
142
+ #{ $LDFLAGS}
143
+ should have included '#{ expected } '
144
+ MSG
145
+ end
122
146
123
147
namespace :ports do
124
148
directory "ports"
@@ -136,6 +160,9 @@ namespace :ports do
136
160
task recipe . name => [ "ports" ] do |t |
137
161
recipe . cook
138
162
recipe . activate
163
+ if hook = recipe_hooks [ recipe . name ]
164
+ hook . call ( recipe )
165
+ end
139
166
end
140
167
141
168
task :all => recipe . name
@@ -146,7 +173,7 @@ namespace :ports do
146
173
recipes . each do |recipe |
147
174
puts "Artifacts of '#{ recipe . name } ' in '#{ recipe . path } '"
148
175
end
149
- puts "LDFLAGS: " + ENV [ 'LDFLAGS' ] . inspect
176
+ puts "LDFLAGS: #{ ENV [ 'LDFLAGS' ] . inspect } , #{ $LDFLAGS . inspect } "
150
177
end
151
178
end
152
179
0 commit comments