diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-01-20 12:51:50 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-01-20 12:51:50 +0000 |
commit | 7828a12f1971d5b722b717112b7f650d62bbc05e (patch) | |
tree | a546081327ebdefbbc0132377dec7a067eae16fe /instruby.rb | |
parent | 244bb8db51a8417e299bed5cea19340a9a30ac33 (diff) |
* configure.in (MANTYPE): Detect if the system's nroff(1) groks
mdoc. Provide a new option --with-mantype={doc|man} in case the
check does not work as expected.
* Makefile.in (MANTYPE): Define MANTYPE and pass it to
instruby.rb.
* instruby.rb: Convert mdoc manpages to man for systems which
nroff(1) does not grok mdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'instruby.rb')
-rw-r--r-- | instruby.rb | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/instruby.rb b/instruby.rb index c05ef2076c..89390f949a 100644 --- a/instruby.rb +++ b/instruby.rb @@ -7,10 +7,11 @@ $:.unshift File.join(CONFIG["srcdir"], "lib") require 'fileutils' require 'shellwords' require 'getopts' +require 'tempfile' File.umask(0) -getopts("n", "make:", "make-flags:") +getopts("n", "make:", "make-flags:", "mantype:doc") $dryrun = $OPT["n"] mflags = Shellwords.shellwords($OPT["make-flags"] || "").uniq mflags[0].sub!(/^\w+$/, '-\&') unless mflags.empty? @@ -18,6 +19,7 @@ make, *mflags[0, 0] = Shellwords.shellwords($OPT['make'] || ENV["MAKE"] || "") mflags = mflags.grep(/^-([^-])/){$1}.join mflags.downcase! if /nmake/i == make $dryrun = true if mflags.include?(?n) +mantype = $OPT["mantype"] ARGV.delete_if{|x|x[0] == ?-} destdir = ARGV[0] || '' @@ -40,14 +42,14 @@ rubylibdir = destdir+CONFIG["rubylibdir"] archlibdir = destdir+CONFIG["archdir"] sitelibdir = destdir+CONFIG["sitelibdir"] sitearchlibdir = destdir+CONFIG["sitearchdir"] -mandir = File.join(destdir+CONFIG["mandir"], "man1") +mandir = File.join(destdir+CONFIG["mandir"], "man") configure_args = Shellwords.shellwords(CONFIG["configure_args"]) enable_shared = CONFIG["ENABLE_SHARED"] == 'yes' dll = CONFIG["LIBRUBY_SO"] lib = CONFIG["LIBRUBY"] arc = CONFIG["LIBRUBY_A"] -makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir] +makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir] install ruby_install_name+exeext, File.join(bindir, ruby_install_name+exeext), 0755 if rubyw_install_name and !rubyw_install_name.empty? @@ -115,14 +117,38 @@ Dir.glob("lib/**/*{.rb,help-message}") do |f| install f, dir, 0644 end -for f in Dir["*.h"] +Dir.glob("*.h") do |f| install f, archlibdir, 0644 end + if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/ makedirs File.join(archlibdir, "win32") install "win32/win32.h", File.join(archlibdir, "win32"), 0644 end -install "ruby.1", File.join(mandir, ruby_install_name+".1"), 0644 +Dir.glob("*.[1-9]") do |mdoc| + section = mdoc[-1,1] + + destdir = mandir + section + destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name)) + + makedirs destdir + + if mantype == "doc" + install mdoc, destfile, 0644 + else + require 'mdoc2man.rb' + + w = Tempfile.open(mdoc) + + open(mdoc) { |r| + Mdoc2Man.mdoc2man(r, w) + } + + w.close + + install w.path, destfile, 0644 + end +end # vi:set sw=2: |