| 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 |
|
| 8 | set -o nounset
|
| 9 | set -o errexit
|
| 10 |
|
| 11 | show_help() {
|
| 12 | echo '
|
| 13 | Compile oils-for-unix and statically link it.
|
| 14 |
|
| 15 | Usage:
|
| 16 | build/static-oils.sh
|
| 17 |
|
| 18 | This is a one-line wrapper around _build/oils.sh.
|
| 19 | '
|
| 20 | }
|
| 21 |
|
| 22 | parse_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 |
|
| 43 | main() {
|
| 44 | parse_flags "$@" # sets FLAG_*, or prints help
|
| 45 |
|
| 46 | LDFLAGS='-static' _build/oils.sh \
|
| 47 | --suffix '-static' --without-readline --skip-rebuild
|
| 48 | }
|
| 49 |
|
| 50 | main "$@"
|