# Maintainer (aur): Mike Swanson <mikeonthecomputer@gmail.com>
# Maintainer: bill-auger <bill-auger@programmer.net>


# parabola changes and rationale:
# - correct license


pkgname=cc65
pkgver=2.19
pkgrel=1
pkgdesc='C compiler for 6502 family microprocessors'
arch=('i686' 'x86_64')
arch+=('armv7h')
license=('custom:zlib')
url='https://cc65.github.io/cc65/'
# makedepends=(linuxdoc-tools) # 2.19 make doc is broken
source=(https://github.com/cc65/cc65/archive/V${pkgver}.tar.gz)
source+=(cc65.sh)
b2sums=('c1c845417e38113c99a9ec8fbff1b90e292798582ac2b394e40419eff3eea62d838ea52165188516efc6157ef02aa7fc23c5a6510fd40d1012ad2b5231d78097')
b2sums+=('0ac1d3611d08871e9075e22c38da9f03a310d719e1526c2dc6b76a3dbb9980f52690008f1737c38d7a1ffdebb79428da4d3fa4d53f766536fa8300884d2f63ec')

build() {
  cd "$pkgname-$pkgver"

  make PREFIX=/usr
#   make doc # 2.19 make doc is broken
}

package() {
  cd "$pkgname-$pkgver"

  make DESTDIR="$pkgdir" PREFIX=/usr install
  install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/license"

  # set 'CC65_HOME' environment variable (compiler search paths)
  install -Dm644 "../cc65.sh" "${pkgdir}"/etc/profile.d/cc65.sh
}
