#!/bin/sh

#shellcheck disable=SC2034
#shellcheck disable=SC2154
#shellcheck disable=SC2086

#ebs.formulae
ebsver=1

pkgname=ncurses
pkgver=6.6
pkgsrc=https://ftp.gnu.org/gnu/ncurses/ncurses-$pkgver.tar.gz
pkgchecksum=sha256:355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11
pkgdesc="software emulation of curses"
pkgmaintainer="juanvel400 <me@juanvel400.com>"
pkglicense="MIT"
pkghomepage="https://invisible-island.net/ncurses/ncurses.html"
pkgcheck=false
pkgdeps="musl"

build() {
    ./configure ${CONFIGUREFLAGS:-} \
        --prefix=/usr \
        --mandir=/usr/share/man \
        --with-shared \
        --without-normal \
        --enable-widec \
        --enable-pc-files \
        --with-pkg-config-libdir=/usr/lib/pkgconfig \
        --with-termlib \
        --disable-stripping

    make
}

package() {
    "${1:-fakeroot}" make install DESTDIR="$pkgdir"

    for lib in ncurses ncurses++ form panel menu tinfo; do
        ln -sf lib${lib}w.so "$pkgdir/usr/lib/lib${lib}.so"
    done
}
