OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Reads etc/ld.so.conf and/or etc/ld.so.conf.d/*.conf and returns the | 6 # Reads etc/ld.so.conf and/or etc/ld.so.conf.d/*.conf and returns the |
7 # appropriate linker flags. | 7 # appropriate linker flags. |
8 # | 8 # |
9 # sysroot_ld_path.sh /abspath/to/sysroot | 9 # sysroot_ld_path.sh /abspath/to/sysroot |
10 # | 10 # |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 # ld.so.conf may include relative include paths. pushd is a bashism. | 40 # ld.so.conf may include relative include paths. pushd is a bashism. |
41 local saved_pwd=$(pwd) | 41 local saved_pwd=$(pwd) |
42 cd $(dirname "$ld_so_conf") | 42 cd $(dirname "$ld_so_conf") |
43 | 43 |
44 cat "$ld_so_conf" | \ | 44 cat "$ld_so_conf" | \ |
45 while read ENTRY; do | 45 while read ENTRY; do |
46 echo "$ENTRY" | grep -qs ^include | 46 echo "$ENTRY" | grep -qs ^include |
47 if [ $? -eq 0 ]; then | 47 if [ $? -eq 0 ]; then |
48 local included_files=$(echo "$ENTRY" | sed 's/^include //') | 48 local included_files=$(echo "$ENTRY" | sed 's/^include //') |
49 for inc_file in $included_files; do | 49 if ls $included_files >/dev/null 2>&1 ; then |
50 echo $inc_file | grep -qs ^/ | 50 for inc_file in $included_files; do |
51 if [ $? -eq 0 ]; then | 51 echo $inc_file | grep -qs ^/ |
52 process_ld_so_conf "$root" "$root$inc_file" | 52 if [ $? -eq 0 ]; then |
53 else | 53 process_ld_so_conf "$root" "$root$inc_file" |
54 process_ld_so_conf "$root" "$(pwd)/$inc_file" | 54 else |
55 fi | 55 process_ld_so_conf "$root" "$(pwd)/$inc_file" |
56 done | 56 fi |
| 57 done |
| 58 fi |
57 continue | 59 continue |
58 fi | 60 fi |
59 | 61 |
60 echo "$ENTRY" | grep -qs ^/ | 62 echo "$ENTRY" | grep -qs ^/ |
61 if [ $? -eq 0 ]; then | 63 if [ $? -eq 0 ]; then |
62 process_entry "$root" "$ENTRY" | 64 process_entry "$root" "$ENTRY" |
63 fi | 65 fi |
64 done | 66 done |
65 | 67 |
66 # popd is a bashism | 68 # popd is a bashism |
(...skipping 18 matching lines...) Expand all Loading... |
85 if [ -e "$LD_SO_CONF" ]; then | 87 if [ -e "$LD_SO_CONF" ]; then |
86 process_ld_so_conf "$1" "$LD_SO_CONF" | xargs echo | 88 process_ld_so_conf "$1" "$LD_SO_CONF" | xargs echo |
87 elif [ -e "$LD_SO_CONF_D" ]; then | 89 elif [ -e "$LD_SO_CONF_D" ]; then |
88 find "$LD_SO_CONF_D" -maxdepth 1 -name '*.conf' -print -quit > /dev/null | 90 find "$LD_SO_CONF_D" -maxdepth 1 -name '*.conf' -print -quit > /dev/null |
89 if [ $? -eq 0 ]; then | 91 if [ $? -eq 0 ]; then |
90 for entry in $LD_SO_CONF_D/*.conf; do | 92 for entry in $LD_SO_CONF_D/*.conf; do |
91 process_ld_so_conf "$1" "$entry" | 93 process_ld_so_conf "$1" "$entry" |
92 done | xargs echo | 94 done | xargs echo |
93 fi | 95 fi |
94 fi | 96 fi |
OLD | NEW |