#!/bin/sh
name="readline"
short_desc="Library for editing command lines as they are typed"
desc="The GNU Readline library provides a set of functions for use by applications
that allow users to edit command lines as they are typed in. Both Emacs and vi
editing modes are available. The Readline library includes additional functions
to maintain a list of previously-entered command lines, to recall and perhaps
reedit those lines, and perform csh-like history expansion on previous commands."
category="devel"
version="8.2"
maintainer="ffqq@danwin1210.de"
www="https://tiswww.cwru.edu/php/chet/readline/rltop.html"
master_site="ftp://ftp.cwru.edu/pub/bash"
source_name="$name-$version.tar.gz"
license_logic="single" # accepted values: single, and, or
licenses=("GPLv3")

build_dependencies=("devel/gmake" "lang/gcc" "devel/ncurses")
run_dependencies=("system/glibc" "devel/ncurses")

build_process() {
    cd $name-$version || exit 1
    sed -i '/MV.*old/d' Makefile.in
    sed -i '/{OLDSUFF}/c:' support/shlib-install
    patch -Np1 -i $TAMANDUA_FILES_DIR/readline-8.2-upstream_fix-1.patch
    ./configure --prefix=/usr   \
    --disable-static            \
    --with-curses               || exit 1
    make SHLIB_LIBS="-lncursesw" -j$(nproc) || exit 1
    make SHLIB_LIBS="-lncursesw" DESTDIR="$TAMANDUA_STAGE_DIR" install || exit 1
    rm -r $TAMANDUA_STAGE_DIR/usr/share/info
    install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline
}