APP=libcap
VERSION=2.26
BUILD=1sml
HOMEPAGE='https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/'
DOWNLOAD="https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.26.tar.xz"
DESC="library to get/set POSIX capabilities"
REQUIRES="musl"

build() {
  mkandenterbuilddir
  rm -rf $APP-$VERSION

  tar xf $SRCDIR/$APP-$VERSION.tar.?z*
  cd $APP-$VERSION
  fixbuilddirpermissions

  sed -i 's,BUILD_GPERF := ,BUILD_GPERF := no #,' Make.Rules

  cp $SRCDIR/libcap2-cap_names.h libcap/cap_names.h
  touch libcap/cap_names.list.h libcap/_makenames libcap/cap_names.h

  make prefix="" man_prefix=/share/man lib=lib CFLAGS="$CFLAGS" \
     BUILD_CC="$CC" 

  make RAISE_SETFCAP=no FAKEROOT=$PKG prefix="" man_prefix=/share/man \
  SBINDIR=/bin lib=lib install

  LIBDIR=$PKG/lib
  SBINDIR=$PKG/bin

  LD_LIBRARY_PATH=${LIBDIR} ${SBINDIR}/setcap cap_setfacap=i ${SBINDIR}/setcap || echo "oops"

  cp License $PKGDOCS/
  removestaticlibs

  mkfinalpkg
}

SHA512SUMS="
e40340d6a10bb9e935c9112e6ec3274d2b7ce79e3da23bf49fa575b381a21678597a2a1a2dee5732590700634fca5fa18c68ea98e8558dfdd12397247b72c395  libcap-2.26.tar.lz
75e8856399e8007424c1130eecebc4db05abda0ece9fa7533ad674e8f67e34122036238cc950f93b7711877a9b5abab0c46c71253e0a06d8cd7558e149e1baf9  libcap2-cap_names.h
"
