# Description: Portable and efficient API to determine the call-chain of a program
# URL: https://savannah.nongnu.org/projects/libunwind
# Maintainer: CRUX compat-32 Team, compat-32-ports at crux dot nu
# Depends on: libunwind

name=libunwind-32
version=1.8.3
release=1
source=(https://github.com/libunwind/libunwind/releases/download/v$version/libunwind-$version.tar.gz)

build() {
  cd libunwind-$version

  autoreconf -fvi
  ./configure --prefix=/usr \
    --libdir=/usr/lib32 \
    --host=i686-pc-linux-gnu \
    --disable-documentation
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
  make DESTDIR=$PKG install

  find $PKG/usr/include -type f ! -name libunwind-x86.h -delete
  rm -r $PKG/usr/libexec
}
