2 eval 'exec perl -wS $0 ${1+"$@"}'
5 # This file is part of the LibreOffice project.
7 # This Source Code Form is subject to the terms of the Mozilla Public
8 # License, v. 2.0. If a copy of the MPL was not distributed with this
9 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # This file incorporates work covered by the following license notice:
13 # Licensed to the Apache Software Foundation (ASF) under one or more
14 # contributor license agreements. See the NOTICE file distributed
15 # with this work for additional information regarding copyright
16 # ownership. The ASF licenses this file to you under the Apache
17 # License, Version 2.0 (the "License"); you may not use this file
18 # except in compliance with the License. You may obtain a copy of
19 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 # mkout.pl - create output tree
32 ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
38 $base_dir = 0; # path to module base directory
39 $dir_mode = 0755; # default directory creation mode
41 $envpath = 0; # platform/product combination
42 $opt_r = 0; # create 'remote' subdirs
45 # dirname remote(yes/no)
66 #### subroutines #####
73 if ( !$rc || $#ARGV > 0 ) {
77 $envpath = $ARGV[0] if defined($ARGV[0]);
82 $base_dir = get_base
();
83 print "Base_Diri=$base_dir\n" if $is_debug;
86 if ( defined($umask) ) {
87 $dir_mode = 0777 - $umask;
89 $envpath = $ENV{INPATH
} unless $envpath;
92 print_error
("can't determine platform/environment");
95 print "Platform/Environment: $envpath\n" if $is_debug;
99 # a module base dir contains a subdir 'prj'
100 # which in turn contains a file 'd.lst'
101 my (@field, $base, $dlst);
104 @field = split(/\//, $path);
106 while ( $#field != -1 ) {
107 $base = join('/', @field);
108 $dlst = $base . '/prj/d.lst';
113 if ( $#field == -1 ) {
114 print_error
("can't determine module");
123 foreach $dir ( keys %sub_dirs ) {
124 $path = $base_dir . '/' . $envpath . '/' . $dir;
125 if ( $opt_r && $sub_dirs{$dir} ) {
128 eval { mkpath
($path, 0, $dir_mode) };
132 print "Create path: $path\n" if $is_debug;
139 print STDERR
"$script_name: ERROR: $message\n";
143 print STDERR
"Usage:\n$script_name [-r] [platform/environment]\n";
144 print STDERR
"Options:\n -r create 'remote' directories\n";
147 # vim: set ts=4 shiftwidth=4 expandtab syntax=perl: