diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-10 12:49:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-10 12:49:55 +0000 |
commit | 351889eafc0395d1e3f381d281ee89b31c6e42bf (patch) | |
tree | 2b7a82421e690bbccaa6ada61cc80c72c21a7711 | |
parent | 929337db51e1c936856834e0632a76a899464e13 (diff) | |
download | ruby-351889eafc0395d1e3f381d281ee89b31c6e42bf.tar.gz |
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
-rw-r--r-- | configure.in | 2 | ||||
-rwxr-xr-x | tool/rbinstall.rb | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/configure.in b/configure.in index 04767d07fd..aecbcdd8cd 100644 --- a/configure.in +++ b/configure.in @@ -4194,7 +4194,7 @@ AC_ARG_WITH(mantype, AS_HELP_STRING([--with-mantype=TYPE], [specify man page type; TYPE is one of man and doc]), [ AS_CASE(["$withval"], - [man|doc], [MANTYPE=$withval], + [man|man.gz|man.bz2|doc|doc.gz|doc.bz2], [MANTYPE=$withval], [AC_MSG_ERROR(invalid man type: $withval)]) ]) if test -z "$MANTYPE"; then 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 |