Commit 4ec3ab45 authored by Mot's avatar Mot Committed by Rahix
Browse files

fix(build): Remove GNUisms to allow building on macOS & BSD

Remove -r from ln
-----------------
Quote from Unix Stack Exchange:

> Beware that -r is a GNUism, i.e. non POSIX so won't work [...] as the
> standard OS X ln command is BSD based.

https://unix.stackexchange.com/questions/125132/ln-s-with-a-path-relative-to-pwd#comment455718_263512

Fix tr and dd for macOS
-----------------------

See Unix Stack Exchange question "Filling file with 0xFF gives C3BF in OSX" at

    https://superuser.com/a/1349497/150212

and

https://lists.freebsd.org/pipermail/freebsd-questions/2007-October/160961.html
parent 84e0f76c
......@@ -6,8 +6,8 @@ BIN1="$2"
BIN2="$3"
BINOUT="$4"
dd if=/dev/zero ibs=1k count=448 2>/dev/null | tr "\000" "\377" > "$BINOUT"
dd if=/dev/zero ibs=1k count=448 2>/dev/null | LANG=C tr "\000" "\377" > "$BINOUT"
dd if="$BIN1" of="$BINOUT" conv=notrunc 2>/dev/null
dd if="$BIN2" of="$BINOUT" conv=notrunc oflag=append 2>/dev/null
dd if="$BIN2" >> "$BINOUT" 2>/dev/null
"$PYTHON" "$(dirname "$0")/crc_patch.py" "$BINOUT"
......@@ -12,7 +12,7 @@ shift 5
OUTPUT_DIR="$(dirname "$OUTPUT")"
mkdir -p "$OUTPUT_DIR/genhdr"
ln -sfr "$OUTPUT" "$OUTPUT_DIR/genhdr/$(basename "$OUTPUT")"
ln -sf "$(realpath --relative-to="$OUTPUT_DIR/genhdr" "$OUTPUT")" "$OUTPUT_DIR/genhdr/$(basename "$OUTPUT")"
# call gcc -E to generate qstr.i.last
gcc -E -DNO_QSTR -I"$SOURCE_DIR/micropython" -I"$PROJECT_SRC" -I"$OUTPUT_DIR" "$@" >"$OUTPUT_DIR/qstr.i.last"
......
......@@ -7,7 +7,7 @@ OUT="$(realpath "$3")"
OUTDIR="$(dirname "$OUT")"
mkdir -p "$OUTDIR/genhdr"
ln -sfr "$OUT" "$OUTDIR/genhdr/$(basename "$OUT")"
ln -sf "$(realpath --relative-to="$OUTDIR/genhdr" "$3")" "$OUTDIR/genhdr/$(basename "$OUT")"
cd "$2/micropython"
"$1" "$2/micropython/py/makeversionhdr.py" "$OUT" >/dev/null
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment