Skip to content

Commit

Permalink
build.sh: on macOS, help compiling tools with correct path configuration
Browse files Browse the repository at this point in the history
When installing libpng (used by mksprite) via homebrew, we need to
export the correct paths in CFLAGS/LDFLAGS
  • Loading branch information
rasky committed Jul 23, 2022
1 parent 311208e commit 44e84f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
set -euo pipefail
IFS=$'\n\t'

if [[ -z ${N64_INST-} ]]; then
echo N64_INST environment variable is not defined
echo Please set N64_INST to point to your libdragon toolchain directory
exit 1
fi

if [[ $OSTYPE == 'darwin'* ]]; then
if command -v brew >/dev/null; then
brew install libpng
CFLAGS="-I$(brew --prefix)/include"; export CFLAGS
LDFLAGS="-L$(brew --prefix)/lib"; export LDFLAGS
fi
fi

makeWithParams(){
make -j"${JOBS}" "$@" || \
sudo env N64_INST="$N64_INST" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
Expand Down
4 changes: 2 additions & 2 deletions tools/mksprite/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSTALLDIR = $(N64_INST)
CFLAGS = -std=gnu99 -O2 -Wall -Werror -Wno-unused-result -I../../include
LDFLAGS = -lpng
CFLAGS += -std=gnu99 -O2 -Wall -Werror -Wno-unused-result -I../../include
LDFLAGS += -lpng
all: mksprite convtool

mksprite:
Expand Down

0 comments on commit 44e84f7

Please sign in to comment.