[source]
tar = "https://neverball.org/neverball-1.6.0.tar.gz"
blake3 = "74f3b68595f475e89fd2ca8b5fc349837ff36fbbe141f321dfc232dbf8fccf51"
patches = ["redox.patch"]

[build]
dependencies = [
    "freetype2",
    "libjpeg",
    "libvorbis",
    "sdl2",
    "sdl2-ttf",
]
dev-dependencies = [
    "host:neverball-sols"
]
template = "custom"
script = """
DYNAMIC_INIT

rsync -av --delete "${COOKBOOK_SOURCE}/" ./

"${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}" ENABLE_FS=stdio ENABLE_NLS=0 neverball neverputt

# Create install directories
mkdir -pv "${COOKBOOK_STAGE}/usr/games/neverball" "${COOKBOOK_STAGE}/usr/share/ui/apps" "${COOKBOOK_STAGE}/usr/share/icons/apps"

# Copy assets
cp -rv ${COOKBOOK_TOOLCHAIN}/usr/games/neverball/data "${COOKBOOK_STAGE}/usr/games/neverball"

# For each game
for bin in neverball neverputt
do
    # Install binary
    "${STRIP}" -v "${bin}" -o "${COOKBOOK_STAGE}/usr/games/neverball/${bin}"

    # Install manifest
    cp -v "${COOKBOOK_RECIPE}/manifest-${bin}" "${COOKBOOK_STAGE}/usr/share/ui/apps/${bin}"

    # Install icon
    cp -v "dist/${bin}_64.png" "${COOKBOOK_STAGE}/usr/share/icons/apps/${bin}.png"
done
"""
