#!/usr/bin/env bash
# Copyright (c) 2020 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(puzzles)
timestamp=2021-03-04T14:03-08:00
maintainer="Mattéo Delabre <spam@delab.re>"
pkgver=0.2.2-4
license=MIT
pkgdesc="Simon Tatham's Puzzle Package"
url="https://github.com/mrichards42/remarkable_puzzles"
section="games"
makedepends=(build:git)
flags=(patch_rm2fb)

image=python:v2.1
source=(
    "https://github.com/mrichards42/remarkable_puzzles/releases/download/v${pkgver%-*}/puzzles-source.tar.gz"
    puzzles.draft
)
sha256sums=(
    3fe3686757e69d1267e830ba527d15ff6d1a68e34f830842dcaf35f58b43d501
    SKIP
)

build() {
    pip3 install okp

    # do the build
    ARCH=arm BUILD=release make puzzles -r
}

package() {
    install -d "$pkgdir"/opt/etc/{draft,puzzles,puzzles/save}
    install -D -m 755 "$srcdir"/build/release/puzzles "$pkgdir"/opt/bin/puzzles
    install -D -m 644 "$srcdir"/puzzles.draft "$pkgdir"/opt/etc/draft/
    install -D -m 644 "$srcdir"/config/* -t "$pkgdir"/opt/etc/puzzles/config/
    install -D -m 644 "$srcdir"/help/* -t "$pkgdir"/opt/etc/puzzles/help/
    install -D -m 644 "$srcdir"/icons/* -t "$pkgdir"/opt/etc/puzzles/icons/
}
