Update the script to make PHP-ized man pages to be a bit more
automatic. This commit was SVN r27359.
Этот коммит содержится в:
родитель
662bc05aa6
Коммит
9dbbddc89a
86
contrib/dist/make-html-man-pages.pl
поставляемый
86
contrib/dist/make-html-man-pages.pl
поставляемый
@ -3,18 +3,16 @@
|
|||||||
# Copyright (c) 2010 Cisco Systems, Inc.
|
# Copyright (c) 2010 Cisco Systems, Inc.
|
||||||
#
|
#
|
||||||
# Script to generate PHP-ized files of Open MPI tarball-installed man
|
# Script to generate PHP-ized files of Open MPI tarball-installed man
|
||||||
# pages.
|
# pages. Run it from the top-level directory of an Open MPI tarball
|
||||||
|
# or source checkout. It will:
|
||||||
#
|
#
|
||||||
# Usage: ./make-html-man-pages.pl \
|
# - run autogen if necessary
|
||||||
# --mandir <top-level-man-dir> \
|
# - run configure
|
||||||
# --version <version-string> \
|
# - run make install
|
||||||
# --outdir <outdir>
|
# - frob the generated man pages a bit
|
||||||
|
# - generate PHP versions of the man pages
|
||||||
#
|
#
|
||||||
# If outdir is not specified, it is assumed to be ".". mandir and
|
# The PHP can then be copied to the OMPI web site.
|
||||||
# version must be specified. mandir is typically a directory that
|
|
||||||
# ends in "/man" -- it is the directory that .so roff redirects use as
|
|
||||||
# a base (e.g., MPI_Win_c2f.3 is ".so man3/MPI_Comm_f2c.3" -- so
|
|
||||||
# specify a mandir that makes that work).
|
|
||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
@ -22,10 +20,6 @@ use File::Find;
|
|||||||
use File::Basename;
|
use File::Basename;
|
||||||
use Cwd;
|
use Cwd;
|
||||||
|
|
||||||
my $mandir;
|
|
||||||
my $version;
|
|
||||||
my $outdir_base = ".";
|
|
||||||
|
|
||||||
sub absoluteize {
|
sub absoluteize {
|
||||||
my ($dir) = shift;
|
my ($dir) = shift;
|
||||||
|
|
||||||
@ -48,40 +42,52 @@ sub mkdir_p {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read command line arguments
|
|
||||||
while (@ARGV) {
|
|
||||||
my $a = $ARGV[0];
|
|
||||||
if ($a eq "--mandir" && $#ARGV >= 1) {
|
|
||||||
shift @ARGV;
|
|
||||||
$mandir = absoluteize($ARGV[0]);
|
|
||||||
print "Found mandir: $mandir\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($a eq "--version" && $#ARGV >= 1) {
|
|
||||||
shift @ARGV;
|
|
||||||
$version = $ARGV[0];
|
|
||||||
print "Found version: $version\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($a eq "--outdir" && $#ARGV >= 1) {
|
|
||||||
shift @ARGV;
|
|
||||||
$outdir_base = absoluteize($ARGV[0]);
|
|
||||||
print "Found outdir: $outdir_base\n";
|
|
||||||
}
|
|
||||||
shift @ARGV;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check that we have what we need
|
# Check that we have what we need
|
||||||
if (!defined($mandir) || !defined($version)) {
|
if (!(-f "VERSION" && -f "ompi/include/mpi.h.in")) {
|
||||||
print "Usage: $0 --mandir dir --version version [--outdir outdir]\n";
|
print "Run this script from the top-level Open MPI directory\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
my @files;
|
my @files;
|
||||||
my $pwd = Cwd::cwd();
|
my $pwd = Cwd::cwd();
|
||||||
|
print "PWD: $pwd\n";
|
||||||
|
my $basedir = "$pwd/man-page-generator";
|
||||||
|
my $prefix = "$basedir/install";
|
||||||
|
my $mandir = absoluteize("$prefix/share/man");
|
||||||
|
my $outdir_base = absoluteize("$basedir/php");
|
||||||
|
|
||||||
# Find all *.[0-9] files in the $mandir tree.
|
# Remove old results
|
||||||
|
system("rm -rf $basedir");
|
||||||
|
|
||||||
|
# Configure, build, and install so that we get a full set of man pages
|
||||||
|
|
||||||
|
sub doit {
|
||||||
|
my @cmd = @_;
|
||||||
|
print "Running: @cmd\n";
|
||||||
|
my $ret = system(@cmd);
|
||||||
|
die "Failed to run (@cmd)"
|
||||||
|
if (-1 == $ret);
|
||||||
|
$ret = $ret >> 8;
|
||||||
|
die "Command failed (@cmd) with status $ret"
|
||||||
|
if ($ret != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Autogen if we don't have a configure script
|
||||||
|
doit("./autogen.pl")
|
||||||
|
if (! -x "configure");
|
||||||
|
doit("./configure --prefix=$prefix --enable-mpi-ext=all");
|
||||||
|
|
||||||
|
# Find this OMPI's version
|
||||||
|
my $version = `fgrep PACKAGE_VERSION opal/include/opal_config.h | cut -d\\\" -f2`;
|
||||||
|
chomp($version);
|
||||||
|
print "Open MPI version: $version\n";
|
||||||
|
|
||||||
|
# Build so that we get fresh man pages
|
||||||
|
doit("make clean");
|
||||||
|
doit("make -j 4 install");
|
||||||
|
|
||||||
|
# Find all *.[0-9] files in the installed mandir tree.
|
||||||
&File::Find::find(
|
&File::Find::find(
|
||||||
sub {
|
sub {
|
||||||
push(@files, $File::Find::name) if (-f $_ && $_ =~ /\.[1-9]$/);
|
push(@files, $File::Find::name) if (-f $_ && $_ =~ /\.[1-9]$/);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user