-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlua.sh
More file actions
executable file
·28 lines (23 loc) · 948 Bytes
/
Copy pathlua.sh
File metadata and controls
executable file
·28 lines (23 loc) · 948 Bytes
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
#!/usr/bin/env bash
# Build lua 5.4 through nixgg. Lua is a plain Makefile project — it
# doesn't need autoconf, cmake, or protoc — so `eval $(nixgg env)`
# gives us everything: gcc, make, and the shims that intercept them.
#
# Env knobs:
# LUA_SRC existing checkout (default: /tmp/lua-5.4.7)
# NIXGG_JOBS -j level (default: nproc)
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
LUA_SRC="${LUA_SRC:-/tmp/lua-5.4.7}"
NIXGG_JOBS="${NIXGG_JOBS:-$(nproc)}"
if [[ ! -d "$LUA_SRC" ]]; then
printf '==> Downloading lua into %s\n' "$LUA_SRC" >&2
mkdir -p "$(dirname "$LUA_SRC")"
( cd "$(dirname "$LUA_SRC")" \
&& curl -sSL https://www.lua.org/ftp/lua-5.4.7.tar.gz | tar xz )
fi
eval "$("$here/bin/nixgg" env)"
# NIXGG_AUTOFORCE=1 tells the link shim to realise inline, so plain
# `make` produces real binaries — no `nixgg build` wrapper needed.
cd "$LUA_SRC/src"
exec env NIXGG_AUTOFORCE=1 make -j"$NIXGG_JOBS" linux