2 eval 'exec perl -wS $0 ${1+"$@"}'
5 #*************************************************************************
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 # Copyright 2000, 2010 Oracle and/or its affiliates.
11 # OpenOffice.org - a multi-platform office productivity suite
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
33 #*********************************************************************
38 my($product, $buildid, $id, $os, $arch, $lstfile, $languages, $productname, $productversion, $productedition);
40 while ($_ = $ARGV[0], /^-/) {
64 $languages = $ARGV[0];
69 $sourcefile = $ARGV[0];
71 if( $^O
=~ /cygwin/i ) {
72 # We might get paths with backslashes, fix that.
73 $lstfile =~ s/\\/\//g
;
74 $sourcefile =~ s/\\/\//g
;
78 # reading Globals section
79 unless(open(LSTFILE
, "sed -n \"/^Globals\$/,/^}\$/ p\" $lstfile |")) {
80 print STDERR
"Can't open $lstfile file: $!\n";
85 if( /\bPRODUCTNAME / ) {
90 if( /\bPACKAGEVERSION / ) {
92 s/.*PACKAGEVERSION //;
95 if( /\bPRODUCTEDITION / ) {
97 s/.*PRODUCTEDITION //;
104 ### may be hierarchical ...
105 if(open(LSTFILE
, "sed -n \"/^$product:/,/^}\$/ p\" $lstfile |")) {
107 if ( /^$product\s?:\s?(\w+)$/ ) {
110 if( /\bPRODUCTEDITION / ) {
112 s/.*PRODUCTEDITION //;
113 $productedition = $_;
119 # Reading product specific settings
121 unless(open(LSTFILE
, "sed -n \"/^$product\$/,/^}\$/ p\" $lstfile |")) {
122 print STDERR
"Can't open $lstfile file: $!\n";
127 if( /\bPRODUCTNAME / ) {
132 if( /\bPACKAGEVERSION / ) {
134 s/.*PACKAGEVERSION //;
135 $productversion = $_;
137 if( /\bPRODUCTEDITION / ) {
139 s/.*PRODUCTEDITION //;
140 $productedition = $_;
146 # simulate the behavior of make_installer.pl when writing versionrc
147 unless( "$os" eq "Windows" ) {
148 $languages =~ s/_.*//;
151 $id = $productversion;
153 $id = $productname . "_" . $id . "_" . $languages;
156 unless (open(SOURCE
, $sourcefile)) {
157 print STDERR
"Can't open $sourcefile file: $!\n";
163 s/buildid></buildid>$buildid</;
165 s/arch></arch>$arch</;
166 if ( $productedition ) {
167 s/edition></edition>$productedition</;
169 next if ( /edition></ );
171 s/version></version>$productversion</;
172 s/name></name>$productname</;