2 eval 'exec perl -wS $0 ${1+"$@"}'
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2000, 2010 Oracle and/or its affiliates.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # This file is part of OpenOffice.org.
14 # OpenOffice.org is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU Lesser General Public License version 3
16 # only, as published by the Free Software Foundation.
18 # OpenOffice.org is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU Lesser General Public License version 3 for more details
22 # (a copy is included in the LICENSE file that accompanied this code).
24 # You should have received a copy of the GNU Lesser General Public License
25 # version 3 along with OpenOffice.org. If not, see
26 # <http://www.openoffice.org/license.html>
27 # for a copy of the LGPLv3 License.
29 #*************************************************************************
32 # mkout.pl - create output tree
41 ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
47 $base_dir = 0; # path to module base directory
48 $dir_mode = 0755; # default directory creation mode
50 $envpath = 0; # platform/product combination
51 $opt_r = 0; # create 'remote' subdirs
54 # dirname remote(yes/no)
75 #### subroutines #####
82 if ( !$rc || $#ARGV > 0 ) {
86 $envpath = $ARGV[0] if defined($ARGV[0]);
91 $base_dir = get_base
();
92 print "Base_Diri=$base_dir\n" if $is_debug;
95 if ( defined($umask) ) {
96 $dir_mode = 0777 - $umask;
98 $envpath = $ENV{INPATH
} unless $envpath;
101 print_error
("can't determine platform/environment");
104 print "Platform/Environment: $envpath\n" if $is_debug;
108 # a module base dir contains a subdir 'prj'
109 # which in turn contains a file 'd.lst'
110 my (@field, $base, $dlst);
113 @field = split(/\//, $path);
115 while ( $#field != -1 ) {
116 $base = join('/', @field);
117 $dlst = $base . '/prj/d.lst';
122 if ( $#field == -1 ) {
123 print_error
("can't determine module");
132 foreach $dir ( keys %sub_dirs ) {
133 $path = $base_dir . '/' . $envpath . '/' . $dir;
134 if ( $opt_r && $sub_dirs{$dir} ) {
137 eval { mkpath
($path, 0, $dir_mode) };
141 print "Create path: $path\n" if $is_debug;
148 print STDERR
"$script_name: ERROR: $message\n";
152 print STDERR
"Usage:\n$script_name [-r] [platform/environment]\n";
153 print STDERR
"Options:\n -r create 'remote' directories\n";
156 # vim: set ts=4 shiftwidth=4 expandtab syntax=perl: