summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fiddle/extlibs7
-rwxr-xr-xtool/extlibs.rb27
2 files changed, 30 insertions, 4 deletions
diff --git a/ext/fiddle/extlibs b/ext/fiddle/extlibs
index 1f0c9348e6..2282eabc18 100644
--- a/ext/fiddle/extlibs
+++ b/ext/fiddle/extlibs
@@ -1,5 +1,8 @@
-https://ftp.osuosl.org/pub/blfs/conglomeration/libffi/libffi-3.2.1.tar.gz \
+ver = 3.2.1
+pkg = libffi-$(ver)
+
+https://ftp.osuosl.org/pub/blfs/conglomeration/libffi/$(pkg).tar.gz \
md5:83b89587607e3eb65c70d361f13bab43 \
sha512:980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483 \
#
- win32/libffi-3.2.1-mswin.patch -p0
+ win32/$(pkg)-mswin.patch -p0
diff --git a/tool/extlibs.rb b/tool/extlibs.rb
index f021a2bf01..e7184b8fe3 100755
--- a/tool/extlibs.rb
+++ b/tool/extlibs.rb
@@ -7,6 +7,20 @@ require 'digest'
require_relative 'downloader'
require_relative 'lib/colorize'
+class Vars < Hash
+ def pattern
+ /\$\((#{Regexp.union(keys)})\)/
+ end
+
+ def expand(str)
+ if empty?
+ str
+ else
+ str.gsub(pattern) {self[$1]}
+ end
+ end
+end
+
class ExtLibs
def initialize
@colorize = Colorize.new
@@ -143,16 +157,21 @@ class ExtLibs
$stdout.puts "downloading for #{list}"
$stdout.flush
end
+ vars = Vars.new
extracted = false
dest = File.dirname(list)
url = chksums = nil
IO.foreach(list) do |line|
line.sub!(/\s*#.*/, '')
+ if /^(\w+)\s*=\s*(.*)/ =~ line
+ vars[$1] = vars.expand($2)
+ next
+ end
if chksums
chksums.concat(line.split)
elsif /^\t/ =~ line
if extracted and (mode == :all or mode == :patch)
- patch, *args = line.split
+ patch, *args = line.split.map {|s| vars.expand(s)}
do_patch(dest, patch, args)
end
next
@@ -163,7 +182,11 @@ class ExtLibs
chksums.pop
next
end
- next unless url
+ unless url
+ chksums = nil
+ next
+ end
+ url = vars.expand(url)
begin
extracted = do_command(mode, dest, url, cache_dir, chksums)
rescue => e