2 eval 'exec perl -wS $0 ${1+"$@"}'
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: mkout.pl,v $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
36 # mkout.pl - create output tree
45 ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
47 $id_str = ' $Revision: 1.8 $ ';
48 $id_str =~ /Revision:\s+(\S+)\s+\$/
49 ?
($script_rev = $1) : ($script_rev = "-");
51 print "$script_name -- version: $script_rev\n";
57 $base_dir = 0; # path to module base directory
58 $dir_mode = 0755; # default directory creation mode
60 $envpath = 0; # platform/product combination
61 $opt_r = 0; # create 'remote' subdirs
64 # dirname remote(yes/no)
85 #### subroutines #####
92 if ( !$rc || $#ARGV > 0 ) {
96 $envpath = $ARGV[0] if defined($ARGV[0]);
101 $base_dir = get_base
();
102 print "Base_Diri=$base_dir\n" if $is_debug;
105 if ( defined($umask) ) {
106 $dir_mode = 0777 - $umask;
108 $envpath = $ENV{INPATH
} unless $envpath;
111 print_error
("can't determine platform/environment");
114 print "Platform/Environment: $envpath\n" if $is_debug;
118 # a module base dir contains a subdir 'prj'
119 # which in turn contains a file 'd.lst'
120 my (@field, $base, $dlst);
123 @field = split(/\//, $path);
125 while ( $#field != -1 ) {
126 $base = join('/', @field);
127 $dlst = $base . '/prj/d.lst';
132 if ( $#field == -1 ) {
133 print_error
("can't determine module");
142 foreach $dir ( keys %sub_dirs ) {
143 $path = $base_dir . '/' . $envpath . '/' . $dir;
144 if ( $opt_r && $sub_dirs{$dir} ) {
147 eval { mkpath
($path, 0, $dir_mode) };
151 print "Create path: $path\n" if $is_debug;
158 print STDERR
"$script_name: ERROR: $message\n";
162 print STDERR
"Usage:\n$script_name [-r] [platform/environment]\n";
163 print STDERR
"Options:\n -r create 'remote' directories\n";
166 # vim: set ts=4 shiftwidth=4 expandtab syntax=perl: