Admin/bash_process/build
author wenzelm
Sun, 28 Apr 2019 22:22:29 +0200
changeset 70207 511352b4d5d3
parent 66691 a8703e8ee1d3
permissions -rwxr-xr-x
tuned -- according to main website;
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)
62566
wenzelm
parents: 62293
diff changeset
    40
    cc -Wall -m64 bash_process.c -o "$TARGET/bash_process"
47799
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)
62566
wenzelm
parents: 62293
diff changeset
    43
    cc -Wall -m32 bash_process.c -o "$TARGET/bash_process"
47799
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    44
    ;;
66691
a8703e8ee1d3 basic support for x86_64-cygwin;
wenzelm
parents: 62566
diff changeset
    45
  x86_64-cygwin | x86-cygwin)
62566
wenzelm
parents: 62293
diff changeset
    46
    cc -Wall bash_process.c -o "$TARGET/bash_process.exe"
47799
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
  *)
62566
wenzelm
parents: 62293
diff changeset
    49
    cc -Wall bash_process.c -o "$TARGET/bash_process"
47799
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