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

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

Issue 244593002: pkg-config-wrapper: use system_libdir for libpath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | build/linux/system.gyp » ('j') | 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.
11 # This assumption is valid for a range of sysroots, in particular: a 11 # This assumption is valid for a range of sysroots, in particular: a
12 # LSB-compliant root filesystem mounted at the sysroot, and a board build 12 # LSB-compliant root filesystem mounted at the sysroot, and a board build
13 # directory of a Chromium OS chroot. 13 # directory of a Chromium OS chroot.
14 # Additional directories containing .pc files may be specified by setting 14 # Additional directories containing .pc files may be specified by setting
15 # the PKG_CONFIG_PATH environment variable- these will be prepended to the 15 # the PKG_CONFIG_PATH environment variable- these will be prepended to the
16 # generated paths. 16 # generated paths.
17 17
18 root="$1" 18 root="$1"
19 shift 19 shift
20 target_arch="$1" 20 target_arch="$1"
21 shift 21 shift
22 libpath="$1"
23 shift
22 24
23 if [ -z "$root" -o -z "$target_arch" ] 25 if [ -z "$root" -o -z "$target_arch" ]
24 then 26 then
25 echo "usage: $0 /path/to/sysroot target_arch [pkg-config-arguments] package" > &2 27 echo "usage: $0 /path/to/sysroot target_arch libdir [pkg-config-arguments] pac kage" >&2
26 exit 1 28 exit 1
27 fi 29 fi
28 30
29 if [ "$target_arch" = "x64" ] 31 if [ "$target_arch" = "x64" ]
30 then 32 then
31 libpath="lib64" 33 : ${libpath:="lib64"}
Alexander Potapenko 2014/06/03 08:52:23 |libpath| (which is |system_libdir| is always "lib
vapier 2014/06/03 14:15:09 if system_libdir is being set to lib on x64, then
32 else 34 else
33 libpath="lib" 35 : ${libpath:="lib"}
34 fi 36 fi
35 37
36 rewrite=`dirname $0`/rewrite_dirs.py 38 rewrite=`dirname $0`/rewrite_dirs.py
37 package=${!#} 39 package=${!#}
38 40
39 config_path=$root/usr/$libpath/pkgconfig:$root/usr/share/pkgconfig 41 config_path=$root/usr/$libpath/pkgconfig:$root/usr/share/pkgconfig
40 42
41 # prepend any paths specified by the environment 43 # prepend any paths specified by the environment
42 if [ -n "$PKG_CONFIG_PATH" ] 44 if [ -n "$PKG_CONFIG_PATH" ]
43 then 45 then
44 config_path="$PKG_CONFIG_PATH:$config_path" 46 config_path="$PKG_CONFIG_PATH:$config_path"
45 fi 47 fi
46 48
47 set -e 49 set -e
48 # Some sysroots, like the Chromium OS ones, may generate paths that are not 50 # Some sysroots, like the Chromium OS ones, may generate paths that are not
49 # relative to the sysroot. For example, 51 # relative to the sysroot. For example,
50 # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths 52 # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths
51 # relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of 53 # relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of
52 # relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). 54 # relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr).
53 # To support this correctly, it's necessary to extract the prefix to strip from 55 # To support this correctly, it's necessary to extract the prefix to strip from
54 # pkg-config's |prefix| variable. 56 # pkg-config's |prefix| variable.
55 prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | s ed -e 's|/usr$||'` 57 prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | s ed -e 's|/usr$||'`
56 result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"` 58 result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"`
57 echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix" 59 echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix"
OLDNEW
« no previous file with comments | « no previous file | build/linux/system.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698