2 ################################################################################
3 # Copyright (C) 2001-2009, Parrot Foundation.
5 ################################################################################
9 tools/dev/install_files.pl - Copy files to their correct locations
13 % perl tools/dev/install_files.pl [options]
17 Use a detailed MANIFEST to install a set of files.
25 The build prefix. Defaults to ''.
29 The install prefix. Defaults to '/usr'.
33 The exec prefix. Defaults to '/usr'.
37 The executables directory. Defaults to '/usr/bin'.
41 The library directory. Defaults to '/usr/lib'.
45 The header directory. Defaults to '/usr/include'.
51 See F<lib/Parrot/Manifest.pm> for a detailed description of the MANIFEST
54 F<tools/dev/mk_manifests.pl>
58 ################################################################################
62 use File
::Basename
qw(basename);
64 use Parrot
::Install
qw(
70 # When run from the makefile, which is probably the only time this
71 # script will ever be used, all of these defaults will get overridden.
76 exec_prefix
=> '/usr',
78 libdir
=> '/usr/lib', # parrot/ subdir added below
79 includedir
=> '/usr/include', # parrot/ subdir added below
80 docdir
=> '/usr/share/doc', # parrot/ subdir added below
83 packages
=> 'main|library|pge',
88 if (/^--([^=]+)=(.*)/) {
96 my $parrotdir = $options{versiondir
};
98 # Set up transforms on filenames
99 my(@transformorder) = qw(lib bin include doc pkgconfig ^compilers);
100 my(%metatransforms) = (
106 local($_) = $filehash->{Dest
};
107 if ( /^install_config\.fpmc/ ) {
108 s/^install_//; # parrot with different config
109 $filehash->{DestDirs
} = [$parrotdir, 'include'];
110 $filehash->{Dest
} = $_;
112 elsif ( /install_config/ ) {
113 s/install_config/parrot_config/;
114 s/^src//; # strip off leading src/ dir
115 $filehash->{DestDirs
} = [$parrotdir];
116 $filehash->{Dest
} = $_;
119 # don't allow libraries to be installed into subdirs of libdir
120 $filehash->{Dest
} = basename
($_);
130 # parrot with different config
131 $filehash->{Installable
} = $filehash->{Dest
} =~ s/^installable_//;
138 optiondir
=> 'include',
141 $filehash->{Dest
} =~ s/^include//;
142 $filehash->{DestDirs
} = [$parrotdir];
151 $filehash->{DestDirs
} = [$parrotdir];
160 # For the time being this is hardcoded as being installed under
161 # libdir as it is typically done with automake installed packages.
162 # If the --pkgconfigdir option is used, then the default value will
163 # be overwritten with the specified subdirectory under libdir.
164 $filehash->{DestDirs
} = ['pkgconfig', $parrotdir];
165 $filehash->{DestDirs
} = [$options{pkgconfigdir
}]
166 if $options{pkgconfigdir
};
174 $filehash->{Dest
} =~ s/^compilers/languages/;
175 $filehash->{DestDirs
} = [$parrotdir];
181 my($filehashes, $directories) = lines_to_files
(
182 \
%metatransforms, \
@transformorder, \
@manifests, \
%options, $parrotdir
185 unless ( $options{'dry-run'} ) {
186 create_directories
($options{destdir
}, $directories);
190 # 1. skip build_dir-only binaries for files marked Installable
191 my($filehash, @removes, $removes);
192 foreach $filehash (grep { $_->{Installable
} } @
$filehashes) {
193 my( $src, $dest ) = map { $filehash->{$_} } qw(Source Dest);
194 my ($file) = $src =~ /installable_(.+)$/;
196 if((grep { $_->{Source
} =~ /^$file$/ } @
$filehashes) and -e
$file) {
197 print "skipping $file, using installable_$file instead\n";
198 push @removes, $file;
201 $removes = join '|', @removes;
202 @
$filehashes = grep { $_->{Source
} !~ /^($removes)$/ } @
$filehashes;
204 # 2. for every .exe check if there's an installable. Fail if not
206 foreach $filehash (grep { ! $_->{Installable
} } @
$filehashes ) {
207 my( $src, $dest ) = map { $filehash->{$_} } qw(Source Dest);
208 next unless $src =~ /\.exe$/;
209 # This logic will fail on non-win32 if the generated files are really
210 # generated as with rt #40817. We don't have [main]bin here.
211 $i = "installable_$src";
212 unless (map {$_->{Source
} =~ /^$i$/} grep { $_->{Installable
} } @
$filehashes) {
213 die "$i is missing in MANIFEST or MANIFEST.generated\n";
217 install_files
($options{destdir
}, $options{'dry-run'}, $filehashes);
219 print "Finished install_files.pl\n";
223 # cperl-indent-level: 4
226 # vim: expandtab shiftwidth=4: