# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Jeremie Dimino <jeremie@dimino.org>
# Contributor: bender02 at gmx dot com

pkgname=lrzsz
pkgver=0.12.20
pkgrel=13
pkgdesc="xmodem, ymodem and zmodem file transfer protocols"
url="https://www.ohse.de/uwe/software/lrzsz.html"
license=('GPL2')
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
source=(https://www.ohse.de/uwe/releases/$pkgname-$pkgver.tar.gz
	https://src.fedoraproject.org/rpms/lrzsz/raw/rawhide/f/lrzsz-0.12.20.patch
	lrzsz.patch
        program-name.patch)
sha512sums=('9bce64036f1f1c65f5910f19802aecaf3dc5ffeab0feeca10fa8d2fe1b83e212391cce23056d22fd0eda52df89e12ede68eb5d22ffcf22f935910d2af7399f12'
            '71c527712b0909b77e7d68dedb816b3229d53ef39e76f617661640d05e20ade8129347ee2801f636705abca4cf1b591963e7067d26e7e822e01e6cfa8cea8d8e'
            '4912ec15bb1bd63b2af0c74970daf3023bdc441ad3f5f3c95b3bf46b5f11e21022dcfe5c80151ffc99ae1fd3df9b7fe01f44d00a1d8f1a35e04f68e7f3f38430'
            '628b5ed820ae04508958fdf970c5bb2ebb916a4f075688fb21e85f8492228431843116617f63f5fd29e77356a1a913f722211b7b661cafc0107f03761f68abbe')

prepare() {
  cd "$srcdir"/$pkgname-$pkgver
  patch -Np1 -i ../lrzsz.patch
  patch -Np1 -i ../lrzsz-0.12.20.patch
  patch -Np1 -i ../program-name.patch # Make it work with modified binary names
  sed -i 's|${CC-cc} -E|${CC-cc} -O2 -E|g' configure
}

build() {
  cd "$srcdir"/$pkgname-$pkgver
  ./configure --prefix=/usr --mandir=/usr/share/man \
    --program-transform-name=s/l/lrzsz-/
  make -j1
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  make -j1 DESTDIR="$pkgdir" install
}
