File: run.sh

package info (click to toggle)
libcorkipset 1.1.1+20150311-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 968 kB
  • sloc: ansic: 5,247; python: 449; sh: 82; makefile: 20
file content (46 lines) | stat: -rwxr-xr-x 976 bytes parent folder | download | duplicates (10)
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
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Usage: run.sh [debug|release] program arguments
#
# Runs a program from one of the build directories, with
# LD_LIBRARY_PATH set correctly so that it can find all of the shared
# libraries before they're installed.


# Check that there are enough command-line parameters.

if [ $# -lt 1 ]; then
    echo "Usage: run.sh [debug|release] program arguments"
    exit 1
fi


# Verify that the user chose a valid build type.

BUILD="$1"
shift

case "$BUILD" in
    debug)
        ;;
    release)
        ;;
    *)
        echo "Unknown build type $BUILD"
        exit 1
        ;;
esac


# Find all of the src subdirectories in the build directory, and use
# those as the LD_LIBRARY_PATH.

SRC_DIRS=$(find build/$BUILD -name src)
JOINED=$(echo $SRC_DIRS | perl -ne 'print join(":", split)')


# Run the desired program, and pass on any command-line arguments
# as-is.

LD_LIBRARY_PATH="$JOINED:$LD_LIBRARY_PATH" \
DYLD_LIBRARY_PATH="$JOINED:$DYLD_LIBRARY_PATH" \
  "$@"