summaryrefslogtreecommitdiff
path: root/tool/extlibs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/extlibs.rb')
-rwxr-xr-xtool/extlibs.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/tool/extlibs.rb b/tool/extlibs.rb
index 720f1c767d..8a9c5a8fd0 100755
--- a/tool/extlibs.rb
+++ b/tool/extlibs.rb
@@ -125,6 +125,15 @@ class ExtLibs
end
end
+ def do_exec(command, dir, dest)
+ dir = dir ? File.join(dest, dir) : dest
+ if $VERBOSE
+ $stdout.puts "running #{command.dump} under #{dir}"
+ $stdout.flush
+ end
+ system(command, chdir: dir) or raise "failed #{command.dump}"
+ end
+
def do_command(mode, dest, url, cache_dir, chksums)
extracted = false
base = /.*(?=\.tar(?:\.\w+)?\z)/
@@ -206,6 +215,13 @@ class ExtLibs
do_patch(dest, patch, args)
end
next
+ elsif /^!\s*(?:chdir:\s*([^|\s]+)\|\s*)?(.*)/ =~ line
+ if extracted and (mode == :all or mode == :patch)
+ command = vars.expand($2.strip)
+ chdir = $1 and chdir = vars.expand(chdir)
+ do_exec(command, chdir, dest)
+ end
+ next
elsif /->/ =~ line
if extracted and (mode == :all or mode == :patch)
link, file = $`.strip, $'.strip