# Maintainer: PktSurf <smlinux@pktsurf.in>
app=tar
version=1.34
build=2sml
homepage="https://www.gnu.org/software/tar/"
download="https://ftp.gnu.org/gnu/tar/tar-$version.tar.xz"
desc="GNU archiving utility"
requires="bzip2 gzip xz attr acl lzip plzip"

prepbuilddir() {
  mkandenterbuilddir
  tar xf $srcdir/$app-$version.tar.?z*

  cd $app-$version
  fixbuilddirpermissions

  # The "A lone zero block at %s" messages also cause problems:
  applypatch $srcdir/tar.nolonezero.diff
  # CVE-2022-48303 patch
  applypatch $srcdir/Fix-savannah-bug-62387.patch
}

build() {
  FORCE_UNSAFE_CONFIGURE=1 \
  LDFLAGS="-static" \
  ./configure \
    --prefix="" \
    --sbindir=/bin \
    --libexecdir=/lib \
    --enable-backup-scripts 

  make
  make install DESTDIR=$pkg

  cp COPYING $pkgdocs/

  mkfinalpkg
}

sha512sums="
ea24e691caa5d6064d6be657f11f41ca607257b5eaa8b15225b6cbd3cb681881b0311082ad4d069277d04822ff03acc759f7c15b7f4689ef3ba6de5b8eaa2b23  tar-1.34.tar.lz
90b764cd2128d6c316a0cd9e24ae734ee94b1e2794e6cf724e60592d23ca6dac2d9a44552054610747cadd733263ee56971062f4201227bfda93966f287984bd  tar.nolonezero.diff
"
