#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=lz4
epoch=1
pkgver=1.9.4
pkgrel=02
pkgdesc='Extremely fast compression algorithm'
#url='http://www.lz4.org/'
url='https://lz4.github.io/lz4/'
makedepends=('git' 'cmake' 'ninja')
checkdepends=('diffutils')
depends=('glibc')
source=("git+https://github.com/lz4/lz4.git#tag=v$pkgver")

#prepare() {
#  cd $pkgname
#  # apply patch from the source array (should be a pacman feature)
#  local src
#  for src in "${source[@]}"; do
#    src="${src%%::*}"
#    src="${src##*/}"
#    [[ $src = *.patch ]] || continue
#    msg2 "Applying patch $src..."
#    patch -Np1 < "../$src"
#  done
#}

build() {
  cmake -B build -S "$pkgname"/build/cmake \
    -G Ninja \
    -DCMAKE_BUILD_TYPE='None' \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -Wno-dev
  cmake --build build
}

check() {
  rm -f passwd.lz4
  build/lz4 /etc/passwd passwd.lz4
  build/lz4 -d passwd.lz4 passwd
  diff -q /etc/passwd passwd
  rm passwd
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL2')

sha256sums=(SKIP)

# Note to packager: 
#ls -l *pkg.tar.lz 
#echo "you must rename this package to meet SF naming before you move to the repo"
#mv $(ls -l $pkgname*pkg.tar.lz) $pkgname-$epoch_$pkgver-$pkgrel-$arch.pkg.tar.lz >pkg-mv.log

##  c87b197b2531332824b5b001b1761d6878c96b157a8d2e7ed3901918b5c9c092  lz4-1_1.9.4-02-x86_64.pkg.tar.lz

