app=attr
version=2.4.47
build=1sml
homepage="https://savannah.nongnu.org/projects/attr"
download="https://download.savannah.nongnu.org/releases/attr/attr-$version.src.tar.gz"
requires="musl"
desc="Tools for manipulating extended attributes on filesystems"

build() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions

  sed -i 's@-o $(PKG_USER) -g $(PKG_GROUP)@@' include/buildmacros
  sed -i 's@CHOWN=_chown@CHOWN=true@' include/install-sh
  applypatch $srcdir/attr-cdefs.patch

  make clean

  CFLAGS="-static" \
  ./configure \
    --prefix="" \
    --sysconfdir=/etc \
    --enable-gettext=no 

  for i in po ; do
     printf 'all:\n\ttrue\ninstall:\n\ttrue\ninstall-lib:\n\ttrue\ninstall-dev:\n\ttrue\nclean:\n\ttrue\n' > "$i"/Makefile
  done

  make LDFLAGS=-all-static

  make DESTDIR="$pkg" install install-lib install-dev

  cp doc/{COPYING,COPYING.LGPL} $pkgdocs/

  mkfinalpkg
}

sha512sums="
8d1c8b506db2e0c8290d49dc2672a59d7fb5a8e74e784835132d706ebd0c52a14d848fde8fe629c551b51bdc098152f0e5ee0290d0ef51dd5f90dca3c113d24b  attr-2.4.47.tar.lz
28236fb6bd7021d249bb2f4fc98a4445f86d336afd4289708b3580d126f08c0c952595f78aa14b203f857df06e5c7262348b660c0e206de3efb1caecf6d19f8c  attr-cdefs.patch
"
