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