Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/bash |
|
Evan Martin
2010/11/18 22:19:00
Can you add some comments at the top of this expla
piman
2010/11/18 23:05:29
Done.
| |
| 2 | 2 |
| 3 root="$1" | 3 root="$1" |
| 4 if [ -z "$root" ] | 4 if [ -z "$root" ] |
| 5 then | 5 then |
| 6 echo "usage: $0 /path/to/sysroot [pkg-config-arguments]" >&2 | 6 echo "usage: $0 /path/to/sysroot [pkg-config-arguments] package" >&2 |
| 7 exit 1 | 7 exit 1 |
| 8 fi | 8 fi |
| 9 | 9 |
| 10 rewrite=`dirname $0`/rewrite_dirs.py | 10 rewrite=`dirname $0`/rewrite_dirs.py |
| 11 package=${!#} | |
| 11 | 12 |
| 12 shift | 13 shift |
| 13 config_path=$root/usr/lib/pkgconfig:$root/usr/share/pkgconfig | 14 config_path=$root/usr/lib/pkgconfig:$root/usr/share/pkgconfig |
| 14 set -e | 15 set -e |
| 15 result=`PKG_CONFIG_PATH=$config_path pkg-config --define-variable=prefix=/usr "$ @"` | 16 # Some sysroots, like the Chromium OS ones, may generate paths that are not |
| 16 echo "$result"| $rewrite $root | 17 # relative to the sysroot. For example, |
| 18 # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths | |
| 19 # relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of | |
| 20 # relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). | |
| 21 # To support this correctly, it's necessary to extract the prefix to strip from | |
| 22 # pkg-config's |prefix| variable. | |
| 23 prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | s ed -e 's|/usr$||'` | |
| 24 result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"` | |
| 25 echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix" | |
| OLD | NEW |