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

Side by Side Diff: build/linux/pkg-config-wrapper

Issue 12318018: don't clobber PKG_CONFIG_PATH, allow cross-compilation without a sysroot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 # This program wraps around pkg-config to generate the correct include and 6 # This program wraps around pkg-config to generate the correct include and
7 # library paths when cross-compiling using a sysroot. 7 # library paths when cross-compiling using a sysroot.
8 # The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig 8 # The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig
9 # and usr/share/pkgconfig (relative to the sysroot) and that they output paths 9 # and usr/share/pkgconfig (relative to the sysroot) and that they output paths
10 # relative to some parent path of the sysroot. 10 # relative to some parent path of the sysroot.
(...skipping 15 matching lines...) Expand all
26 if [ "$target_arch" = "x64" ] 26 if [ "$target_arch" = "x64" ]
27 then 27 then
28 libpath="lib64" 28 libpath="lib64"
29 else 29 else
30 libpath="lib" 30 libpath="lib"
31 fi 31 fi
32 32
33 rewrite=`dirname $0`/rewrite_dirs.py 33 rewrite=`dirname $0`/rewrite_dirs.py
34 package=${!#} 34 package=${!#}
35 35
36 config_path=$root/usr/$libpath/pkgconfig:$root/usr/share/pkgconfig 36 if [ -z "$PKG_CONFIG_PATH" ]
37 then
38 config_path=$root/usr/$libpath/pkgconfig:$root/usr/share/pkgconfig
39 else
40 config_path="$PKG_CONFIG_PATH"
41 fi
42
37 set -e 43 set -e
38 # Some sysroots, like the Chromium OS ones, may generate paths that are not 44 # Some sysroots, like the Chromium OS ones, may generate paths that are not
39 # relative to the sysroot. For example, 45 # relative to the sysroot. For example,
40 # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths 46 # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths
41 # relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of 47 # relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of
42 # relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). 48 # relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr).
43 # To support this correctly, it's necessary to extract the prefix to strip from 49 # To support this correctly, it's necessary to extract the prefix to strip from
44 # pkg-config's |prefix| variable. 50 # pkg-config's |prefix| variable.
45 prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | s ed -e 's|/usr$||'` 51 prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | s ed -e 's|/usr$||'`
46 result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"` 52 result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"`
47 echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix" 53 echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix"
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698