Hi Douglas,

Jason McIntyre wrote on Sat, Oct 22, 2011 at 03:27:11PM +0100:
> On Sun, Oct 23, 2011 at 01:01:41AM +1100, Douglas Ray wrote:

>> OpenBSD 4.9 has /usr/share/man/cat* populated, but not
>> /usr/share/man/man[0-9n] .
>> 
>> What options are there to populate man[0-9n]/ ?
>> A complete build of kernel and userland seems extreme.

That wouldn't even help you: The 4.9 build system does not
install source manuals.

I committed build system changes to install source manuals
and no longer install formatted manuals from 5.0 onwards.
Of course, you *could* try to backport these to 4.9,
but i advise against that.
The backport would be tedious and error-prone, in particular
if you are not used to the OpenBSD build system.

>> The man49.tgz set contains only the cat* content.
>> (Was that intended?)

Yes.

>> The src49.tgz set has a small subset in it's src/share/man
>> subdirs.

Yes, the rest ist scattered around the tree.

> your best bet is to save your pennies for a nice, shiny, copy of openbsd
> 5.0 when it comes out. openbsd does not now preformat man pages - they
> are installed in the man dirs now, and formatted at viewing time. that
> differs to what 4.9 did.
> 
> failing that i guess you'd have to download the sources and copy them
> over by hand, or run current.

What Jason says is all good advice, except that copying over the
sources would cause even more hassle than backporting the build
system, in particular in view of the fact that the sources of
lots of manuals are autogenerated by pod2man(1) and do not even
exist as files in the source tree.  For example, that applies to
all the Perl and OpenSSL manuals.  So before you could copy over
those thousands of files per hand (ugh), you would still have to
run a full build.


By the way, here is a script for the inverse task,
written during s2k11 in Ljubljana:
When you have a -current or 5.0 system and want preformatted
manuals as well, you can do:

  # cd /usr/share/man/
  # find man* -type f > FILES
  # ./build.pl 2>&1 | tee build.log

You need *not* worry about the preformatted versions
becoming outdated:  The man(1) utility automatically shows the
newer one if both a source and preformatted version of the same
manual are installed.  And, of course, you can always
  rm -rf /usr/share/man/cat*
if you no longer want to have the preformatted versions around.

Yours,
  Ingo


#!/usr/bin/perl
#
# Copyright (c) 2011 Ingo Schwarze <schwa...@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# /usr/share/man/build.pl
# Build preformatted manuals from source manuals.
# This only makes sense on OpenBSD 5.0 and higher.
#
# cd /usr/share/man/
# find man* -type f > FILES
# ./build.pl 2>&1 | tee build.log
#
# THIS VERSION OF THE SCRIPT IS ALPHA QUALITY, USE WITH CARE.
#
use warnings;
use strict;

use File::Path qw(make_path);

open my $fh, 'FILES' or die $!;

my (%dirs, %inos);
my $count = 0;

while (<$fh>) {
        chomp;
        my $src = $_;
        my (undef, $ino) = stat $src;

        my $dst = $src;
        $dst =~ s/^man/cat/ or die "dst -> cat: $dst";
        $dst =~ s/[^.]+$/0/ or die "dst -> 0: $dst";

        my $dir = $dst;
        $dir =~ s/[^\/]+$// or die "dir: $dir";
        unless ($dirs{$dir}) {
                make_path $dir;
                $dirs{$dir} = 1;
        }

        if ($inos{$ino}) {
                link $inos{$ino}, $dst or die "ln $inos{$ino} $dst";
                my $dummy = $count;
                $dummy =~ s/./*/g;
                print "$dummy: ln $inos{$ino} $dst\n";
                next;
        }
        $inos{$ino} = $dst;

        system "mandoc $src > $dst";
        print ++$count, ": mandoc $src > $dst\n";
}

close $fh;

exit 0;

Reply via email to