2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 # Generate an exported symbols list out of a map file (as use on Linux/Solaris) in order to
20 # build shared libraries on Mac OS X
22 # The below code fails may fail with 'perverted' mapfiles (using a strange line layout etc.)
24 # Skip 'SECTION_NAME {' lines
25 /^
[\t ]*.
*[\t ]*\
{/ { next }
27 # Skip 'global:' or 'local:' lines
28 /global
:/ || /local
:/ { next }
31 /^
[\t ]*\
*;[\t ]*/ { next }
33 # Skip section end '}?;' lines
34 /^
[\t ]*\
}[\t ]*.
*[;]*/ { next }
36 # Skip comment or empty lines
37 /^
[\t ]*#.*/ || /^[\t ]*$/ || /^$/ { next }
39 # Echo all lines containing symbol names and prefix them with '_'
40 # because symbols on Mac OS X start always with '__'
42 # There may appear multiple symbols in one line
43 # e.g. "sym1; sym2; # and finally a comment"
44 # take this into account
45 for (i =
1; i
<=
NF ; i
++) {
46 if ($i !~
/^
[\t ]*#.*/) { # as long as the current field doesn't start with '#'
47 gsub(/[\t ;]/, "", $i
) # Remove leading spaces and trailing ';'
50 else { # ignore everything after a '#' (comment) sign