Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Side by Side Diff: Source/core/core.gyp/mac/adjust_visibility.sh

Issue 14856004: Finish removing WebKitSystemInterface from Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/bin/sh
2
3 #
4 # Copyright (C) 2009 Google Inc. All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are
8 # met:
9 #
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following disclaimer
14 # in the documentation and/or other materials provided with the
15 # distribution.
16 # * Neither the name of Google Inc. nor the names of its
17 # contributors may be used to endorse or promote products derived from
18 # this software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #
32
33 # usage: adjust_visibility.sh INPUT OUTPUT WORK_DIR
34 #
35 # Transforms a static library at INPUT by marking all of its symbols
36 # private_extern. The output is placed at OUTPUT. WORK_DIR is used as a
37 # scratch directory, which need not exist before this script is invoked,
38 # and which will be left behind when the script exits.
39
40 set -e
41
42 if [ $# -ne 3 ] ; then
43 echo "usage: ${0} INPUT OUTPUT WORK_DIR" >& 2
44 exit 1
45 fi
46
47 INPUT="${1}"
48 OUTPUT="${2}"
49 WORK_DIR="${3}"
50
51 # Start with a clean slate.
52 rm -f "${OUTPUT}"
53 rm -rf "${WORK_DIR}"
54 mkdir -p "${WORK_DIR}"
55
56 # ar doesn't operate on fat files. Figure out what architectures are
57 # involved.
58 ARCHS=$(lipo -info "${INPUT}" | sed -Ene 's/^.* are: (.+)/\1/p')
59 if [ -z "${ARCHS}" ] ; then
60 ARCHS=self
61 fi
62
63 OUTPUT_NAME="output.a"
64
65 for ARCH in ${ARCHS} ; do
66 if [ "${ARCH}" = "ppc" -o "${ARCH}" = "ppc64" ] ; then
67 echo "Please |lipo -remove ppc -remove ppc64| from ${INPUT}."
68 echo "Xcode 4.3's ld can no longer relink ppc files."
69 exit 1
70 fi
71 # Get a thin version of fat input by running lipo. If the input is already
72 # thin, just copy it into place. The extra copy isn't strictly necessary
73 # but it simplifies the script.
74 ARCH_DIR="${WORK_DIR}/${ARCH}"
75 mkdir -p "${ARCH_DIR}"
76 INPUT_NAME=input.a
77 ARCH_INPUT="${ARCH_DIR}/${INPUT_NAME}"
78 if [ "${ARCHS}" = "self" ] ; then
79 cp "${INPUT}" "${ARCH_INPUT}"
80 else
81 lipo -thin "${ARCH}" "${INPUT}" -output "${ARCH_INPUT}"
82 fi
83
84 # Change directories to extract the archive to ensure correct pathnames.
85 (cd "${ARCH_DIR}" && ar -x "${INPUT_NAME}")
86
87 # libWebKitSystemInterfaceLeopard.a's cuDbUtils.o references a few symbols
88 # that are not defined in any framework in OS X 10.5. If it's linked into a
89 # libwebkit.dylib with -Wl,-all_load, linking to libwebkit.dylib will result
90 # in these unresolved symbols:
91 # __ZN8Security12KeychainCore6Schema22X509CrlSchemaIndexListE$non_lazy_ptr
92 # __ZN8Security12KeychainCore6Schema23X509CrlSchemaIndexCountE$non_lazy_ptr
93 # __ZN8Security12KeychainCore6Schema26X509CrlSchemaAttributeListE$non_lazy_ptr
94 # __ZN8Security12KeychainCore6Schema27X509CrlSchemaAttributeCountE$non_lazy_pt r
95 # Since nothing in cuDbUtils.o is needed, just remove it.
96 rm "${ARCH_DIR}"/cuDbUtils.o
97
98 # Use ld -r to relink each object that was in the archive. Providing an
99 # empty -exported_symbols_list will transform all symbols to private_extern;
100 # these symbols are retained with -keep_private_externs.
101 for OBJECT in "${ARCH_DIR}/"*.o ; do
102 NEW_OBJECT="${OBJECT}.new"
103 ld -o "${NEW_OBJECT}" -r "${OBJECT}" \
104 -exported_symbols_list /dev/null -keep_private_externs
105 mv "${NEW_OBJECT}" "${OBJECT}"
106 done
107
108 # Build an architecture-specific archive from the modified object files.
109 ARCH_OUTPUT="${ARCH_DIR}/${OUTPUT_NAME}"
110 (cd "${ARCH_DIR}" && ar -rc "${OUTPUT_NAME}" *.o)
111 ranlib "${ARCH_OUTPUT}"
112
113 # Toss the object files out now that they're in the archive.
114 rm -f "${ARCH_DIR}/"*.o
115 done
116
117 # Create a fat archive from the architecture-specific archives if needed.
118 # If the input was thin, leave the output thin by copying the only output
119 # archive to the destination.
120 if [ "${ARCHS}" = "self" ] ; then
121 cp "${WORK_DIR}/self/${OUTPUT_NAME}" "${OUTPUT}"
122 else
123 lipo -create -output "${OUTPUT}" "${WORK_DIR}/"*"/${OUTPUT_NAME}"
124 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698