diff options
author | Peter Foley <pefoley2@verizon.net> | 2012-12-15 17:35:28 -0500 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-12-17 17:10:30 +0000 |
commit | 34e79c19babc0e6cc281025b40635b91dca444f3 (patch) | |
tree | 73e2bd1ab4122cec69780da6ea83770a879048c1 | |
parent | f55f86e016e8d1b509be1e7ba59919301dc17d67 (diff) |
add script to regenerate pch files
based on a script by Lubos Lunak
(http://article.gmane.org/gmane.comp.documentfoundation.libreoffice.devel/40210)
Change-Id: Ib32de8be8a57b3b430f4b5b298b7f417e5a02ccb
Reviewed-on: https://gerrit.libreoffice.org/1350
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Tested-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r-- | sal/Library_sal.mk | 6 | ||||
-rwxr-xr-x | solenv/bin/update_pch.sh | 92 | ||||
-rw-r--r-- | xmloff/Library_xo.mk | 2 | ||||
-rw-r--r-- | xmloff/inc/pch/precompiled_xo.cxx (renamed from xmloff/inc/pch/precompiled_xmloff.cxx) | 2 | ||||
-rw-r--r-- | xmloff/inc/pch/precompiled_xo.hxx (renamed from xmloff/inc/pch/precompiled_xmloff.hxx) | 0 |
5 files changed, 99 insertions, 3 deletions
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index 107f0b3703ef..5ea6b55e95f0 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk | |||
@@ -181,9 +181,13 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ | |||
181 | sal/osl/unx/module \ | 181 | sal/osl/unx/module \ |
182 | sal/osl/unx/process \ | 182 | sal/osl/unx/process \ |
183 | sal/osl/unx/process_impl \ | 183 | sal/osl/unx/process_impl \ |
184 | $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \ | ||
185 | sal/osl/unx/uunxapi \ | 184 | sal/osl/unx/uunxapi \ |
186 | )) | 185 | )) |
186 | ifeq ($(filter-out DESKTOP,$(BUILD_TYPE)),) | ||
187 | $(eval $(call gb_Library_add_exception_objects,sal,\ | ||
188 | sal/osl/unx/salinit \ | ||
189 | )) | ||
190 | endif | ||
187 | $(eval $(call gb_Library_add_cobjects,sal,\ | 191 | $(eval $(call gb_Library_add_cobjects,sal,\ |
188 | sal/osl/unx/mutex \ | 192 | sal/osl/unx/mutex \ |
189 | sal/osl/unx/nlsupport \ | 193 | sal/osl/unx/nlsupport \ |
diff --git a/solenv/bin/update_pch.sh b/solenv/bin/update_pch.sh new file mode 100755 index 000000000000..864d0df3bdcb --- /dev/null +++ b/solenv/bin/update_pch.sh | |||
@@ -0,0 +1,92 @@ | |||
1 | #! /bin/bash | ||
2 | # | ||
3 | # This file is part of the LibreOffice project. | ||
4 | # | ||
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/. | ||
8 | # | ||
9 | |||
10 | root=`dirname $0` | ||
11 | root=`cd $root/../.. && pwd` | ||
12 | |||
13 | if test -z $1; then | ||
14 | headers=`ls $root/*/inc/pch/precompiled_*.hxx` | ||
15 | else | ||
16 | headers="$1" | ||
17 | fi | ||
18 | |||
19 | for x in $headers; do | ||
20 | header=$x | ||
21 | echo updating `echo $header | sed -e s%$root/%%` | ||
22 | module=`echo $header | sed -e s%$root/%% -e s%/.*%%` | ||
23 | name=`echo $header | sed -e s/.*precompiled_// -e s/\.hxx//` | ||
24 | makefile="$root/$module/Library_$name.mk" | ||
25 | |||
26 | tmpfile=`mktemp` | ||
27 | |||
28 | cat "$makefile" | sed 's#\\$##' | \ | ||
29 | ( | ||
30 | inobjects= | ||
31 | while read line ; do | ||
32 | if (test "$line" = "))") || (echo $line | grep -q ", "); then | ||
33 | inobjects= | ||
34 | elif echo $line | grep -q -e add_exception_objects -e add_noexception_objects -e add_cxxobject -e add_cxxobjects ; then | ||
35 | inobjects=1 | ||
36 | elif test -n "$inobjects"; then | ||
37 | file=$line | ||
38 | if ! test -f "$root/$file".cxx ; then | ||
39 | echo No file $file in makefile `echo $makefile | sed -e s%$root/%%` >&2 | ||
40 | else | ||
41 | cat "$root/$file".cxx | grep -e '^\s*#include' | sed 's/\(#include [<"][^<"]*[>"]\).*/\1/' | sed 's#\.\./##g#' >>$tmpfile | ||
42 | fi | ||
43 | fi | ||
44 | done | ||
45 | ) | ||
46 | |||
47 | cat >$header <<EOF | ||
48 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
49 | /* | ||
50 | * This file is part of the LibreOffice project. | ||
51 | * | ||
52 | * This Source Code Form is subject to the terms of the Mozilla Public | ||
53 | * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
54 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
55 | */ | ||
56 | |||
57 | EOF | ||
58 | |||
59 | localdir="`dirname $makefile`" | ||
60 | |||
61 | function local_file() | ||
62 | ( | ||
63 | file="$1" | ||
64 | find "$localdir" -type f | grep /"$file"'$' -q | ||
65 | ) | ||
66 | |||
67 | function skip_ignore() | ||
68 | ( | ||
69 | grep -v -F -e '#include "gperffasttoken.hxx"' | ||
70 | ) | ||
71 | |||
72 | # " in #include "foo" breaks echo down below, so " -> @ | ||
73 | cat $tmpfile | sort -u | skip_ignore | sed 's/"/@/g' | \ | ||
74 | ( | ||
75 | while read line; do | ||
76 | file=`echo $line | sed 's/.*[<"@]\(.*\)[>"@].*/\1/'` | ||
77 | if ! local_file "$file"; then | ||
78 | echo $line | sed 's/@/"/g' >>$header | ||
79 | fi | ||
80 | done | ||
81 | ) | ||
82 | |||
83 | cat >>$header <<EOF | ||
84 | |||
85 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ | ||
86 | EOF | ||
87 | |||
88 | |||
89 | rm $tmpfile | ||
90 | done | ||
91 | #echo Done. | ||
92 | exit 0 | ||
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 95f9ba893eda..b8164826f2df 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk | |||
@@ -23,7 +23,7 @@ $(eval $(call gb_Library_set_componentfile,xo,xmloff/util/xo)) | |||
23 | 23 | ||
24 | $(eval $(call gb_Library_use_package,xo,xmloff_inc)) | 24 | $(eval $(call gb_Library_use_package,xo,xmloff_inc)) |
25 | 25 | ||
26 | $(eval $(call gb_Library_set_precompiled_header,xo,$(SRCDIR)/xmloff/inc/pch/precompiled_xmloff)) | 26 | $(eval $(call gb_Library_set_precompiled_header,xo,$(SRCDIR)/xmloff/inc/pch/precompiled_xo)) |
27 | 27 | ||
28 | $(eval $(call gb_Library_set_include,xo,\ | 28 | $(eval $(call gb_Library_set_include,xo,\ |
29 | -I$(SRCDIR)/xmloff/inc \ | 29 | -I$(SRCDIR)/xmloff/inc \ |
diff --git a/xmloff/inc/pch/precompiled_xmloff.cxx b/xmloff/inc/pch/precompiled_xo.cxx index b9a0df6a1a0b..64b16a2cb1ab 100644 --- a/xmloff/inc/pch/precompiled_xmloff.cxx +++ b/xmloff/inc/pch/precompiled_xo.cxx | |||
@@ -7,6 +7,6 @@ | |||
7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. | 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "precompiled_xmloff.hxx" | 10 | #include "precompiled_xo.hxx" |
11 | 11 | ||
12 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ | 12 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
diff --git a/xmloff/inc/pch/precompiled_xmloff.hxx b/xmloff/inc/pch/precompiled_xo.hxx index 845df837457f..845df837457f 100644 --- a/xmloff/inc/pch/precompiled_xmloff.hxx +++ b/xmloff/inc/pch/precompiled_xo.hxx | |||