Skip to content

Commit

Permalink
[install] add a target install-doc which currently handles only examp…
Browse files Browse the repository at this point in the history
…les files

git-svn-id: https://svn.parrot.org/parrot/trunk@43404 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
fperrad committed Jan 7, 2010
1 parent 16749e4 commit 18b961e
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MANIFEST
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
# generated by tools/dev/mk_manifest_and_skip.pl Wed Dec 16 15:31:13 2009 UT
# generated by tools/dev/mk_manifest_and_skip.pl Wed Jan 6 18:11:31 2010 UT
#
# See below for documentation on the format of this file.
#
Expand Down Expand Up @@ -2157,6 +2157,7 @@ tools/dev/gen_class.pl []
tools/dev/gen_makefile.pl [devel]
tools/dev/gen_valgrind_suppressions.pl []
tools/dev/install_dev_files.pl []
tools/dev/install_doc_files.pl []
tools/dev/install_files.pl []
tools/dev/lib_deps.pl []
tools/dev/list_unjitted.pl []
Expand Down
8 changes: 8 additions & 0 deletions config/gen/makefiles/root.in
Expand Up @@ -2654,6 +2654,14 @@ install-dev-only: installable
--versiondir=$(VERSION_DIR) \
MANIFEST MANIFEST.generated

install-doc:
$(PERL) tools/dev/install_doc_files.pl \
--buildprefix=$(BUILDPREFIX) \
--prefix=$(PREFIX) \
--docdir=$(DOC_DIR) \
--versiondir=$(VERSION_DIR) \
MANIFEST MANIFEST.generated

###############################################################################
#
# release targets
Expand Down
127 changes: 127 additions & 0 deletions tools/dev/install_doc_files.pl
@@ -0,0 +1,127 @@
#! perl
################################################################################
# Copyright (C) 2001-2009, Parrot Foundation.
# $Id$
################################################################################

=head1 TITLE
tools/dev/install_doc_files.pl - Copy documentation files to their correct locations
=head1 SYNOPSIS
% perl tools/dev/install_doc_files.pl [options]
=head1 DESCRIPTION
Use a detailed MANIFEST to install a set of documentation files.
=head2 Options
=over 4
=item C<buildprefix>
The build prefix. Defaults to ''.
=item C<prefix>
The install prefix. Defaults to '/usr'.
=item C<exec_prefix>
The exec prefix. Defaults to '/usr'.
=item C<bindir>
The executables directory. Defaults to '/usr/bin'.
=item C<libdir>
The library directory. Defaults to '/usr/lib'.
=item C<includedir>
The header directory. Defaults to '/usr/include'.
=back
=head1 SEE ALSO
See F<lib/Parrot/Manifest.pm> for a detailed description of the MANIFEST
format.
=cut

################################################################################

use strict;
use warnings;
use File::Basename qw(basename);
use lib qw( lib );
use Parrot::Install qw(
install_files
create_directories
lines_to_files
);

# When run from the makefile, which is probably the only time this
# script will ever be used, all of these defaults will get overridden.
my %options = (
buildprefix => '',
prefix => '/usr',
destdir => '',
exec_prefix => '/usr',
bindir => '/usr/bin',
libdir => '/usr/lib', # parrot/ subdir added below
includedir => '/usr/include', # parrot/ subdir added below
docdir => '/usr/share/doc', # parrot/ subdir added below
datadir => '/usr/share/', # parrot/ subdir added below
srcdir => '/usr/src/', # parrot/ subdir added below
versiondir => '',
'dry-run' => 0,
packages => 'examples',
);

my @manifests;
foreach (@ARGV) {
if (/^--([^=]+)=(.*)/) {
$options{$1} = $2;
}
else {
push @manifests, $_;
}
}

my $parrotdir = $options{versiondir};

# Set up transforms on filenames
my(@transformorder) = (qw(examples));
my(%metatransforms) = (
examples => {
optiondir => 'doc',
transform => sub {
my($filehash) = @_;
$filehash->{DestDirs} = [$parrotdir];
return($filehash);
},
},
);

my($filehashes, $directories) = lines_to_files(
\%metatransforms, \@transformorder, \@manifests, \%options, $parrotdir
);

unless ( $options{'dry-run'} ) {
create_directories($options{destdir}, $directories);
}
install_files($options{destdir}, $options{'dry-run'}, $filehashes);

print "Finished install_doc_files.pl\n";

# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:

0 comments on commit 18b961e

Please sign in to comment.