File: env_use_destdir

package info (click to toggle)
android-platform-tools 29.0.6-28
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 365,224 kB
  • sloc: cpp: 1,049,638; java: 460,532; ansic: 375,452; asm: 301,257; xml: 134,509; python: 92,731; perl: 62,008; sh: 26,753; makefile: 3,210; javascript: 3,172; yacc: 1,403; lex: 455; awk: 368; ruby: 183; sql: 140
file content (36 lines) | stat: -rwxr-xr-x 1,368 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Set-up environment variables to run programs which are built in DESTDIR folder
#
# Usage example to use variables in the current shell:
#   $ export DESTDIR=$HOME/selinux-destdir
#   $ make install install-pywrap install-rubywrap
#   $ . ./scripts/env_use_destdir
#   $ make test
#
# Or to use variables in a subcommand, for example to run tests:
#   $ export DESTDIR=$HOME/selinux-destdir
#   $ make install install-pywrap install-rubywrap
#   $ ./scripts/env_use_destdir secilc ...
#   $ ./scripts/env_use_destdir make test

if [ -z "${DESTDIR:-}" ] ; then
    echo >&2 "Error: variable DESTDIR needs to be defined in order to use this script."
    echo >&2 "Example:"
    # shellcheck disable=SC2164
    echo >&2 "    DESTDIR=$(cd "$(dirname -- "$0")/.." ; pwd)/DESTDIR . $0"
    exit 1
fi

export LD_LIBRARY_PATH="$DESTDIR/usr/lib:$DESTDIR/lib"
export PATH="$DESTDIR/usr/sbin:$DESTDIR/usr/bin:$DESTDIR/sbin:$DESTDIR/bin:$PATH"

# shellcheck disable=SC2155
export PYTHONPATH="$DESTDIR$(${PYTHON:-python3} -c "from distutils.sysconfig import *;print(get_python_lib(prefix='/usr'))")"

# shellcheck disable=SC2155
export RUBYLIB="$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorlibdir"]'):$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorarchdir"]')"

# Run the command given on the command line
if [ $# -gt 0 ] ; then
    exec "$@"
fi