File: platform.sh

package info (click to toggle)
grok 1.20110708.1-4.3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,460 kB
  • sloc: ansic: 3,469; ruby: 987; makefile: 276; sh: 124; yacc: 106
file content (47 lines) | stat: -rwxr-xr-x 707 bytes parent folder | download | duplicates (5)
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
47
#!/bin/sh

uname=$(uname)

libsuffix() {
  case $uname in
    Darwin)
      if [ -z "$1" ] ; then
        echo "dylib"
      else
        echo "$1.dylib"
      fi
      ;;
    *)
      if [ -z "$1" ] ; then
        echo "so"
      else
        echo so.$1
      fi
      ;;
  esac
}

dynlibflag() {
  case $uname in
    Darwin) echo "-dynamiclib" ;;
    *) echo "-shared" ;;
  esac
}

libnameflag() {
  MAJOR=$1
  INSTALLLIB=$2
  case $uname in
    Darwin) echo "-Wl,-install_name,$INSTALLLIB/libgrok.$MAJOR.dylib" ;;
    *) echo "-Wl,-soname=libgrok.so.$MAJOR" ;;
  esac
}

command=$1
shift
case $command in
  libsuffix) $command "$@" ;;
  dynlibflag) $command "$@" ;;
  libnameflag) $command "$@" ;;
esac