tdf#140086 svl: restore PasswordContainer to single-instance
[LibreOffice.git] / bin / update_pch.sh
blob4c17a0374757e6f81040f22c8f9b7a9089951b41
1 #! /bin/bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # Usage: update_pch.sh [<module>/inc/pch/precompiled_xxx.hxx]
11 # Usage: update_pch.sh [<module>]
12 # Invoke: make cmd cmd="./bin/update_pch.sh [..]"
14 if test -n "$SRC_DIR"; then
15 root="$SRC_DIR"
16 else
17 root=`dirname $0`
18 root=`cd $root/.. >/dev/null && pwd`
20 root=`readlink -f $root`
21 cd $root
23 if test -z "$1"; then
24 headers=`ls ./*/inc/pch/precompiled_*.hxx`
25 else
26 headers="$@"
29 # Split the headers into an array.
30 IFS=' ' read -a aheaders <<< $headers
31 hlen=${#aheaders[@]};
32 if [ $hlen -gt 1 ]; then
33 if [ -z "$PARALLELISM" ]; then
34 PARALLELISM=0 # Let xargs decide
36 echo $headers | xargs -n 1 -P $PARALLELISM $0
37 exit $?
40 for x in $headers; do
41 if [ -d "$x" ]; then
42 # We got a directory, find pch files to update.
43 headers=`find $root/$x/ -type f -iname "precompiled_*.hxx"`
44 if test -n "$headers"; then
45 $0 "$headers"
47 else
48 header=$x
49 update_msg=`echo $header | sed -e s%$root/%%`
50 module=`readlink -f $header | sed -e s%$root/%% -e s%/.*%%`
51 if [ "$module" = "pch" ]; then
52 continue # PCH's in pch/inc/pch/ are handled manually
54 echo updating $update_msg
55 if [ "$module" = "external" ]; then
56 module=external/`readlink -f $header | sed -e s%$root/external/%% -e s%/.*%%`
58 libname=`echo $header | sed -e s/.*precompiled_// -e s/\.hxx//`
60 ./bin/update_pch "$module" "$libname"
61 exitcode=$?
62 if test $exitcode -ne 0 -a $exitcode -ne 2; then
63 echo Failed.
64 exit 1
67 done
69 #echo Done.
70 exit 0