# vim: ft=make ts=4 sw=4 noet
NAME    = readline
VERSION = 8.3
GARTYPE = v2

MASTER_SITES = http://ftp.gnu.org/gnu/readline/
DISTFILES   += $(DISTNAME).tar.gz

LICENSE = COPYING

PACKAGES                  += OZSWreadline
SPKG_DESC_OZSWreadline     = GNU readline library
CATALOGNAME_OZSWreadline   = readline

# Keep static libs alongside shared (for static linking by bash etc.)
MERGE_EXCLUDE_STATICLIBS =

# Include ncurses headers
CPPFLAGS += -I$(prefix)/include/ncursesw

EXTRA_CONFIGURE_ARGS += --with-curses
EXTRA_CONFIGURE_ARGS += --enable-shared
EXTRA_CONFIGURE_ARGS += --enable-static

# Link against libncurses.so (-> libncursesw.so via symlink) so Python
# setup.py detects 'ncurses' (not 'ncursesw') and avoids HAVE_NCURSESW
# wide-char code path that requires _XOPEN_SOURCE_EXTENDED.
EXTRA_LD_FLAGS += -lncurses

# Fix libtool ECHO="print -r --" (ksh93 builtin, fails under bash)
post-configure:
	@if [ -f $(WORKSRC)/libtool ]; then \
	    find $(WORKSRC) -name "libtool" -type f -exec \
	        gsed -i 's/ECHO="print -r --"/ECHO="printf %s\\n"/g' {} \; ; \
	fi
	@$(MAKECOOKIE)

include gar/category.mk
