1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Use iconv from Homebrew on macOS (#2374)

* Use iconv from Homebrew on macOS

* Use `brew --prefix`
This commit is contained in:
cadmic 2024-12-15 14:53:07 -08:00 committed by GitHub
parent 4873788e2d
commit bdb3656af9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 5 deletions

View file

@ -4,7 +4,9 @@
# SPDX-License-Identifier: CC0-1.0
# Usage: preprocess [flags] -- [compile command minus input file...] [single input file]
# Flags: -v OOT_VERSION (required)
# Flags:
# -v OOT_VERSION (required)
# -i ICONV_PATH (optional, default: iconv)
# Preprocess a C file to:
# * Re-encode from UTF-8 to EUC-JP
# (the repo uses UTF-8 for text encoding, but the strings in the ROM are encoded in EUC-JP)
@ -39,12 +41,17 @@ then
echo srcfile="$srcfile"
fi
while getopts "v:" opt "${flags[@]}"
ICONV=iconv
while getopts "v:i:" opt "${flags[@]}"
do
case $opt in
v)
OOT_VERSION=$OPTARG
;;
i)
ICONV=$OPTARG
;;
?)
echo "Error: Bad flags"
exit 1
@ -76,7 +83,7 @@ trap "rm -rf $tempdir" EXIT
{
printf '#line 1 "%s"\n' "$srcfile" # linemarker
./tools/preprocess_pragmas $OOT_VERSION "$srcfile" < "$srcfile"
} | iconv -f UTF-8 -t EUC-JP > "$tempfile"
} | "${ICONV}" -f UTF-8 -t EUC-JP > "$tempfile"
# Also include the source file's directory to have the include path as if we compiled the original source.
# Pass the processed temporary file for compilation.