File: run.sh

package info (click to toggle)
libcork 1.0.0~rc3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 2,012 kB
  • sloc: ansic: 12,975; python: 605; makefile: 332; sh: 238
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" \
  "$@"