Skip to content
Browse files

* 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: http://svn.ruby-lang.org/repos/ruby/trunk@3377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent cdb5612 commit 6c80c881b855fcb1a66c49c3ff12a01ba36b1e9e @knu knu committed Jan 20, 2003
Showing with 69 additions and 7 deletions.
  1. +12 −0 ChangeLog
  2. +4 −2 Makefile.in
  3. +22 −0 configure.in
  4. +31 −5 instruby.rb
View
12 ChangeLog
@@ -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
View
6 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:
View
22 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
View
36 instruby.rb
@@ -7,17 +7,19 @@
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?
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 @@
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 @@
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:

0 comments on commit 6c80c88

Please sign in to comment.
Something went wrong with that request. Please try again.