Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / sysui / desktop / share / brand.pl
blobf10e99dab639c20048f7a02a9992fc61370f6b85
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
6 # This file is part of the LibreOffice project.
8 # This Source Code Form is subject to the terms of the Mozilla Public
9 # License, v. 2.0. If a copy of the MPL was not distributed with this
10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 # This file incorporates work covered by the following license notice:
14 # Licensed to the Apache Software Foundation (ASF) under one or more
15 # contributor license agreements. See the NOTICE file distributed
16 # with this work for additional information regarding copyright
17 # ownership. The ASF licenses this file to you under the Apache
18 # License, Version 2.0 (the "License"); you may not use this file
19 # except in compliance with the License. You may obtain a copy of
20 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
24 #*********************************************************************
26 # main
29 $destdir = pop @ARGV;
30 mkdir $destdir,0777;
32 $productname = "LibreOffice";
33 $productfilename = "libreoffice";
34 $prefix = "";
35 $iconprefix = "";
37 while ($_ = $ARGV[0], /^-/) {
38 shift;
39 last if /^--$/;
40 if (/^-p/) {
41 $productname = $ARGV[0];
42 shift;
44 if (/^-u/) {
45 $productfilename = $ARGV[0];
46 shift;
48 if (/^--prefix/) {
49 $prefix = $ARGV[0];
50 shift;
52 if (/^--iconprefix/) {
53 $iconprefix = $ARGV[0];
54 shift;
56 if (/^--category/) {
57 $category = $ARGV[0];
58 shift;
63 while (<>) {
64 unless (open INFILE,$ARGV) {
65 print STDOUT "Can't open input file $ARGV: $!\n";
66 exit 1;
69 $srcfile = substr($ARGV, rindex($ARGV, "/") + 1);
71 unless (open OUTFILE,"> $destdir/$prefix$srcfile") {
72 print STDOUT "Can't open output file $destdir/$prefix$srcfile: $!\n";
73 exit 1;
76 while (<INFILE>) {
77 # remove possible Windows line-ends
78 chomp;
80 # patch all occurrences of openoffice in ICON line with
81 # $prefix
82 s/Icon=/Icon=$iconprefix/;
84 # patch all occurrences of openoffice in icon_filename
85 # line with $prefix
86 s/icon_filename=/icon_filename=$iconprefix/;
88 # patch all occurrences of openoffice in EXEC line with
89 # $productfilename
90 if ( /Exec/ ) {
91 s/openoffice/$productfilename/;
94 # if $productfilename != "openoffice, add it to the list
95 # of applications.
96 if ( /user_level=$/ ) {
97 $_ = $_ . $productfilename;
98 } elsif ( /user_level/ ) {
99 s/$productfilename,//;
100 s/user_level=/user_level=$productfilename,/
103 # append special category if specified
104 if ( /Categories/ ) {
105 if ( length($category) > 0 ) {
106 $_ = "$_$category;";
110 # replace %PRODUCTNAME placeholders
111 s/%PRODUCTNAME/$productname/g;
113 print OUTFILE "$_\n";
116 close(OUTFILE);
117 close(INFILE);