Update ooo320-m1
[ooovba.git] / zlib / make_patched_header.pl
blob8f7b39001d47cdbbfea4e2a1857fa3aeb6731906
2 eval 'exec perl -S $0 ${1+"$@"}'
3 if 0;
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 #
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: make_patched_header.pl,v $
14 # $Revision: 1.3 $
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 #*************************************************************************
35 # make_patched_header - make patched header
38 use strict;
39 use File::Basename;
40 use File::Path;
41 use Carp;
43 my $patched_file = shift @ARGV;
44 $patched_file =~ s/\\/\//g;
45 my $module = shift @ARGV;
46 my $patch_dir = dirname($patched_file);
47 my $orig_file = $patched_file;
48 $orig_file =~ s/\/patched\//\//;
50 if (!-f $orig_file) { carp("Cannot find file $orig_file\n"); };
51 if (!-d $patch_dir) {
52 mkpath($patch_dir, 0, 0775);
53 if (!-d $patch_dir) {("mkdir: could not create directory $patch_dir\n"); };
56 open(PATCHED_FILE, ">$patched_file") or carp("Cannot open file $patched_file\n");
57 open(ORIG_FILE, "<$orig_file") or carp("Cannot open file $orig_file\n");
58 foreach (<ORIG_FILE>) {
59 if (/#include\s*"(\w+\.h\w*)"/) {
60 my $include = $1;
61 s/#include "$include"/#include <$module\/$include>/g;
63 print PATCHED_FILE $_;
65 close PATCHED_FILE;
66 close ORIG_FILE;
68 exit(0);