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 | |
parent | 244bb8db51a8417e299bed5cea19340a9a30ac33 (diff) | |
download | ruby-7828a12f1971d5b722b717112b7f650d62bbc05e.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | configure.in | 22 | ||||
-rw-r--r-- | instruby.rb | 36 |
4 files changed, 69 insertions, 7 deletions
@@ -1,3 +1,15 @@ +Mon Jan 20 21:48:43 2003 Akinori MUSHA <knu@iDaemons.org> + + * 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. + Mon Jan 20 21:25:18 2003 Akinori MUSHA <knu@iDaemons.org> * lib/tempfile.rb (self.open): If a block is given, call it with diff --git a/Makefile.in b/Makefile.in index df6d52bc17..c4a229cf15 100644 --- a/Makefile.in +++ b/Makefile.in @@ -100,6 +100,8 @@ OBJS = array.@OBJEXT@ \ version.@OBJEXT@ \ $(MISSING) +MANTYPE = @MANTYPE@ + all: @MAKEFILES@ miniruby$(EXEEXT) rbconfig.rb $(LIBRUBY) @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic="@EXTSTATIC@" --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS)" @@ -126,11 +128,11 @@ ruby.imp: $(LIBRUBY_A) # $(MINIRUBY) $< $@ install: rbconfig.rb - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS)" $(DESTDIR) + $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS)" --mantype=$(MANTYPE) $(DESTDIR) $(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR)" install what-where no-install: rbconfig.rb - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) -n" $(DESTDIR) + $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) -n" --mantype=$(MANTYPE) $(DESTDIR) $(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --make-flags="$(MFLAGS)$(MAKEFLAGS) -n DESTDIR=$(DESTDIR)" install clean-ext: diff --git a/configure.in b/configure.in index da620ec081..0ea68cca99 100644 --- a/configure.in +++ b/configure.in @@ -1304,6 +1304,28 @@ if test "$search_path" != ""; then AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path") fi +AC_ARG_WITH(mantype, + [ --with-mantype=TYPE specify man page type; TYPE is one of man and doc], + [ + case "$withval" in + man|doc) + MANTYPE=$withval + ;; + *) + AC_MSG_ERROR(invalid man type: $withval) + ;; + esac + ]) +if test -z "$MANTYPE"; then + AC_PATH_PROGS(NROFF, nroff awf, /bin/false, "/usr/bin:/usr/ucb") + if ${NROFF} -mdoc ${srcdir}/ruby.1 >/dev/null 2>&1; then + MANTYPE=doc + else + MANTYPE=man + fi +fi +AC_SUBST(MANTYPE) + if test -f config.h && tr -d '\015' < confdefs.h | cmp -s config.h -; then echo "config.h unchanged" else 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: |