makedepends=()

packager="Great-OS Team"
maintainer="Great-OS Team"

description="The Apache Portable Runtime"
url="http://apr.apache.org/"

name=apr
version=1.7.6
release=1

source=(https://dlcdn.apache.org/apr/apr-$version.tar.bz2
    ship_find_apr.m4.patch 
    fix-apr.pc.patch 
    omit_extra_libs.patch 
    dont_override_external_buildflags
    )

prepare(){
  cd apr-$version
  patch -Np1 -i ../ship_find_apr.m4.patch
  patch -Np1 -i ../fix-apr.pc.patch
  patch -Np1 -i ../omit_extra_libs.patch
  patch -Np1 -i ../dont_override_external_buildflags
  sed -e 's/env python/env python3/' -i build/gen-build.py
  sed -e 's/python/python3/g' -i build/buildcheck.sh
  ./buildconf
}

build() {
  cd apr-$version
  ./configure --prefix=/usr --includedir=/usr/include/apr-1 \
    --with-installbuilddir=/usr/share/apr-1/build \
    --enable-nonportable-atomics \
    --with-devrandom=/dev/urandom --disable-static
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd apr-$version
  make DESTDIR="$PKG" install
  rm $PKG/usr/lib/libapr-1.la
}
