# XXX: Do not distribute https://github.com/sm64pc/sm64ex/issues/89
[source]
git = "https://github.com/jackpot51/sm64ex.git"

[build]
template = "custom"
dependencies = [
    "liborbital",
    "mesa",
    "sdl2",
    "zlib",
]
script = """
DYNAMIC_INIT

rsync -av --delete "${COOKBOOK_SOURCE}/" ./
# You must find your own ROM
cp -v "${COOKBOOK_RECIPE}/baserom.us.z64" baserom.us.z64

#TODO: do this in cook instead
unset AR AS CC CXX LD NM OBJCOPY OBJDUMP RANLIB READELF STRIP

export REDOX_CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include"
export REDOX_LDFLAGS="${LDFLAGS}"
unset CFLAGS LDFLAGS

export CROSS="${TARGET}-"
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}"
mkdir -p "${COOKBOOK_STAGE}/bin"
cp -v build/us_pc/sm64.us.f3dex2e "${COOKBOOK_STAGE}/bin/sm64"

mkdir -pv "${COOKBOOK_STAGE}/usr/share/ui/apps"
cp -v "${COOKBOOK_RECIPE}/manifest" "${COOKBOOK_STAGE}/usr/share/ui/apps/sm64ex"

mkdir -pv "${COOKBOOK_STAGE}/usr/share/icons/apps"
wget -O "${COOKBOOK_STAGE}/usr/share/icons/apps/sm64ex.png" https://evilgames.eu/texture-packs/thumb/sm64-reloaded.png
"""
