easyblock = 'ConfigureMake'

name = 'ncurses'
version = '5.9-20130406'

homepage = 'http://www.gnu.org/software/ncurses/'
description = """The Ncurses (new curses) library is a free software emulation of curses in System V Release 4.0,
and more. It uses Terminfo format, supports pads and color and multiple highlights and forms characters and
function-key mapping, and has all the other SYSV-curses enhancements over BSD Curses."""

toolchain = {'name': 'cgoolf', 'version': '1.1.7'}
toolchainopts = {'optarch': True, 'pic': True}

# In future, this URL will not be sufficient to obtain this tarball, because
# the directory contains only a couple of older ncurses 5.9 snapshots.
source_urls = ['ftp://invisible-island.net/ncurses/current/']
sources = [SOURCE_TGZ]

patches = ['ncurses-%(version)s_configure_darwin.patch']

configopts = [
    # default build
    '--with-shared --enable-overwrite',
    # the UTF-8 enabled version (ncursesw)
    '--with-shared --enable-overwrite --enable-ext-colors --enable-widec --includedir=%(installdir)s/include/ncursesw/'
]

# Parallel build contains a race on etip.h, needed for c++/demo.cc.
parallel = 1

libs = ["form", "menu", "ncurses", "panel"]
sanity_check_paths = {
    'files': ['bin/%s' % x for x in ["captoinfo", "clear", "infocmp", "infotocap", "ncurses5-config",
                                     "reset", "tabs", "tic", "toe", "tput", "tset"]] +
             ['lib/lib%s%s.a' % (x, y) for x in libs for y in ['', '_g', 'w', 'w_g']] +
             ['lib/lib%s%s.so' % (x, y) for x in libs for y in ['', 'w']] +
             ['lib/libncurses++%s.a' % x for x in ['', 'w']],
    'dirs': ['include', 'include/ncursesw'],
}

moduleclass = 'devel'
