# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgname=acme
# acme -V says version 0.97, but the source repo has no branches or tags
pkgver=2020.08.26
pkgrel=2
pkgdesc='Assembler for the 6502, 6510, 65c02 and 65816 processors'
arch=(x86_64)
url='https://sourceforge.net/projects/acme-crossass/'
license=(GPL)
makedepends=(setconf subversion)
conflicts=(plan9port)
source=("$pkgname::svn+https://svn.code.sf.net/p/acme-crossass/code-0/trunk#revision=r295")
sha256sums=('SKIP')

prepare() {
  cd $pkgname/src
  setconf Makefile CFLAGS "$CFLAGS -w"
  setconf Makefile LIBS "$LDFLAGS -lm"
}

build() {
  make -s -C $pkgname/src
}

package() {
  cd $pkgname
  install -Dm755 src/acme "$pkgdir/usr/bin/acme"
  install -d "$pkgdir/usr/share/doc/acme"
  install -t "$pkgdir/usr/share/doc/acme" docs/*.txt

  # Joe syntax highlighting
  install -Dm644 contrib/joe_syntax/acme.jsf \
    "$pkgdir/usr/share/joe/syntax/acme.jsf"
  install -Dm644 contrib/joe_syntax/INSTALL \
    "$pkgdir/usr/share/doc/acme/joe.txt"

  # FS#69332
  chmod 644 "$pkgdir/usr/share/doc/acme/"*
}
