Admin/exec_process/build
author wenzelm
Wed, 19 Sep 2012 18:01:48 +0200
changeset 49447 bec1add86e79
parent 48197 Admin/Windows/exec_process/build@b13dd10ebc77
permissions -rwxr-xr-x
universal component exec_process -- avoids special Admin/components/windows and might actually improve stability of forked processes (without using perl);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47799
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     2
#
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     3
# Multi-platform build script
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     4
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     5
THIS="$(cd "$(dirname "$0")"; pwd)"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     6
PRG="$(basename "$0")"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     7
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     8
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     9
# diagnostics
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    10
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    11
function usage()
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    12
{
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    13
  echo
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    14
  echo "Usage: $PRG TARGET"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    15
  echo
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    16
  exit 1
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    17
}
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    18
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    19
function fail()
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    20
{
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    21
  echo "$1" >&2
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    22
  exit 2
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    23
}
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    24
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    25
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    26
# command line args
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    27
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    28
[ "$#" -eq 0 ] && usage
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    29
TARGET="$1"; shift
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    30
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    31
[ "$#" -eq 0 ] || usage
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    32
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    33
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    34
# main
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    35
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    36
mkdir -p "$TARGET"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    37
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    38
case "$TARGET" in
47801
a832454c4003 added darwin targets;
wenzelm
parents: 47799
diff changeset
    39
  x86_64-linux | x86_64-darwin)
47799
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    40
    cc -m64 exec_process.c -o "$TARGET/exec_process"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    41
    ;;
47801
a832454c4003 added darwin targets;
wenzelm
parents: 47799
diff changeset
    42
  x86-linux | x86-darwin)
47799
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    43
    cc -m32 exec_process.c -o "$TARGET/exec_process"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    44
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    45
  x86-cygwin)
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    46
    cc exec_process.c -o "$TARGET/exec_process.exe"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    47
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    48
  *)
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    49
    cc exec_process.c -o "$TARGET/exec_process"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    50
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    51
esac
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    52
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    53