OILS / build / static-oils.sh View on Github | oils.pub

50 lines, 29 significant
1#!/usr/bin/env bash
2#
3# Make a statically linked build. Works with GNU libc and musl libc.
4#
5# Usage:
6# build/static-oils.sh
7
8set -o nounset
9set -o errexit
10
11show_help() {
12 echo '
13Compile oils-for-unix and statically link it.
14
15Usage:
16 build/static-oils.sh
17
18This is a one-line wrapper around _build/oils.sh.
19'
20}
21
22parse_flags() {
23 while true; do
24 case "${1:-}" in
25 -h|--help)
26 show_help
27 exit 0
28 ;;
29 -*)
30 echo "Invalid flag '$1'" >& 2
31 exit 2
32 ;;
33 *)
34 # No more flags
35 break
36 ;;
37 esac
38 shift
39 done
40}
41
42
43main() {
44 parse_flags "$@" # sets FLAG_*, or prints help
45
46 LDFLAGS='-static' _build/oils.sh \
47 --suffix '-static' --without-readline --skip-rebuild
48}
49
50main "$@"