From d85096ad454d8bffd41af18757c2bd63cac3f874 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 10 Jul 2015 12:49:55 +0000 Subject: compressed mantypes * configure.in (--with-mantype): add compressed mantypes. * tool/rbinstall.rb (man): compress man pages if specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/rbinstall.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tool/rbinstall.rb') diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index fab8a7b8f9..1a17f093a8 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -545,7 +545,22 @@ install?(:local, :comm, :man) do alias print push end open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)} - open_for_install(destfile, $data_mode) {w.join("")} + w = w.join("") + case $mantype + when /\.(?:(gz)|bz2)\z/ + suffix = $& + compress = $1 ? "gzip" : "bzip2" + require 'tmpdir' + Dir.mktmpdir("man") {|d| + dest = File.join(d, File.basename(destfile)) + File.open(dest, "wb") {|f| f.write w} + if system(compress, dest) + w = File.open(dest+suffix, "rb") {|f| f.read} + destfile << suffix + end + } + end + open_for_install(destfile, $data_mode) {w} end end end -- cgit v1.2.3