0c5946acc2
The ncurses sub-options BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} are currently very badly broken: they only control whether the libform, libmenu and libpanel libraries are installed in $(TARGET_DIR), but do absolutely nothing about their installation in $(STAGING_DIR). This means that when one of those options is disabled, the corresponding library is indeed not installed in the target, but is available in staging. It can therefore be detected by the configure script of another package and used... even though the library will not be in the target, causing a runtime failure. Internally, ncurses.mk uses the "make install" logic of ncurses for the staging installation, but uses a completely hand-written logic for the target installation, which is the reason for this desynchronization between what's installed in staging and target. When BR2_PACKAGE_NCURSES_WCHAR=y, this also causes some build failures. Indeed, when BR2_PACKAGE_NCURSES_WCHAR=y, Buildroot creates some symbolic links lib<foo>.so -> lib<foo>w.so in staging and target, but only for the lib<foo> that have been enabled by BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL}. Due to this, a package that for example needed the libmenu library but forgot to select BR2_PACKAGE_NCURSES_TARGET_MENU was: - Building fine with BR2_PACKAGE_NCURSES_WCHAR disabled (because libmenu.so exists in staging), but would fail to run at runtime because libmenu.so is not in the target. - Fail to build with BR2_PACKAGE_NCURSES_WCHAR=y because only libmenuw.so exists, and not the libmenu.so symbolic link. Since those libraries are small (43K for libform, 21K for libmenu and 8.2K for libpanel), this commit takes the very simple approach of removing those options, and installing the libraries unconditionally. It therefore uses the "make install" logic for both the staging *and* target installation. In detail, this commit: - Removes the NCURSES_PROGS variable, not needed since --without-progs already allows to disable the build and installation of programs. - Removes the NCURSES_LIBS-y variable, and replaces it with a single unconditional assignement to NCURSES_LIBS, only used to create the lib<foo>w.so -> lib<foo>.so symbolic links when wchar support is enabled. - Removes NCURSES_INSTALL_TARGET_CMDS and the functions it was calling: NCURSES_INSTALL_TARGET_LIBS and NCURSES_INSTALL_TARGET_PROGS. - Adds a NCURSES_TARGET_SYMLINK_RESET hook to create the reset -> tset symbolic link, as was done before. - Adds a NCURSES_TARGET_CLEANUP_TERMINFO to cleanup the terminfo files in the target, so that we stay in the same situation in terms of installed terminfo files. - Removes the BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} options from the Config.in files: both their definition and usage. - Simplifies all the symlink dance for lib<foo> -> lib<foo>w, because as Yann E. Morin suggested, this dance is only needed in staging, not in the target. Once binaries have been built, they refer to the SONAME of the library, which is the lib<foo>w variant (for shared linking). For static linking and .pc files, it's obvious that we don't care about them on the target. Therefore the NCURSES_LINK_LIBS_STATIC, NCURSES_LINK_LIBS_SHARED and NCURSES_LINK_PC functions no longer take any argument: they always apply to STAGING_DIR only. NCURSES_LINK_TARGET_LIBS is removed. It is worth mentioning that adding Config.in.legacy support is *NOT* necessary. Indeed: - If they were disabled before this patch, having them in Config.in.legacy would not trigger the legacy warning. - If they were enabled before this patch, then the behavior is unchanged: all libraries are now unconditionally installed. So there is no point in warning the user. We double-checked the installed size of a filesystem containing just ncurses before and after this patch, and the only folder that has its size changed is /usr/lib, growing from 852 KB to 932 KB in the wchar enabled case. That's a 80 KB system size increase. This commit fixes the sngrep build failure and potentially numerous runtime issues with ncurses. Fixes: http://autobuild.buildroot.net/results/7b5db21a6c568e6c6c8fe2b5d5a2f5ca24df510c/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
164 lines
4.4 KiB
Makefile
164 lines
4.4 KiB
Makefile
################################################################################
|
|
#
|
|
# ncurses
|
|
#
|
|
################################################################################
|
|
|
|
NCURSES_VERSION = 5.9
|
|
NCURSES_SITE = $(BR2_GNU_MIRROR)/ncurses
|
|
NCURSES_INSTALL_STAGING = YES
|
|
NCURSES_DEPENDENCIES = host-ncurses
|
|
NCURSES_LICENSE = MIT with advertising clause
|
|
NCURSES_LICENSE_FILES = README
|
|
NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)$(NCURSES_ABI_VERSION)-config
|
|
|
|
NCURSES_CONF_OPTS = \
|
|
--without-cxx \
|
|
--without-cxx-binding \
|
|
--without-ada \
|
|
--without-tests \
|
|
--disable-big-core \
|
|
--without-profile \
|
|
--disable-rpath \
|
|
--disable-rpath-hack \
|
|
--enable-echo \
|
|
--enable-const \
|
|
--enable-overwrite \
|
|
--enable-pc-files \
|
|
$(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
|
|
--without-manpages
|
|
|
|
# Install after busybox for the full-blown versions
|
|
ifeq ($(BR2_PACKAGE_BUSYBOX),y)
|
|
NCURSES_DEPENDENCIES += busybox
|
|
endif
|
|
|
|
ifeq ($(BR2_STATIC_LIBS),y)
|
|
NCURSES_CONF_OPTS += --without-shared --with-normal
|
|
else ifeq ($(BR2_SHARED_LIBS),y)
|
|
NCURSES_CONF_OPTS += --with-shared --without-normal
|
|
else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
|
|
NCURSES_CONF_OPTS += --with-shared --with-normal
|
|
endif
|
|
|
|
# configure can't find the soname for libgpm when cross compiling
|
|
ifeq ($(BR2_PACKAGE_GPM),y)
|
|
NCURSES_CONF_OPTS += --with-gpm=libgpm.so.2
|
|
NCURSES_DEPENDENCIES += gpm
|
|
else
|
|
NCURSES_CONF_OPTS += --without-gpm
|
|
endif
|
|
|
|
NCURSES_TERMINFO_FILES = \
|
|
a/ansi \
|
|
l/linux \
|
|
p/putty \
|
|
p/putty-vt100 \
|
|
s/screen \
|
|
v/vt100 \
|
|
v/vt100-putty \
|
|
v/vt102 \
|
|
v/vt200 \
|
|
v/vt220 \
|
|
x/xterm \
|
|
x/xterm-color \
|
|
x/xterm-xfree86 \
|
|
|
|
ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
|
|
NCURSES_CONF_OPTS += --enable-widec
|
|
NCURSES_LIB_SUFFIX = w
|
|
NCURSES_LIBS = ncurses menu panel form
|
|
|
|
define NCURSES_LINK_LIBS_STATIC
|
|
$(foreach lib,$(NCURSES_LIBS:%=lib%), \
|
|
ln -sf $(lib)$(NCURSES_LIB_SUFFIX).a $(STAGING_DIR)/usr/lib/$(lib).a
|
|
)
|
|
ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
|
|
$(STAGING_DIR)/usr/lib/libcurses.a
|
|
endef
|
|
|
|
define NCURSES_LINK_LIBS_SHARED
|
|
$(foreach lib,$(NCURSES_LIBS:%=lib%), \
|
|
ln -sf $(lib)$(NCURSES_LIB_SUFFIX).so $(STAGING_DIR)/usr/lib/$(lib).so
|
|
)
|
|
ln -sf libncurses$(NCURSES_LIB_SUFFIX).so \
|
|
$(STAGING_DIR)/usr/lib/libcurses.so
|
|
endef
|
|
|
|
define NCURSES_LINK_PC
|
|
$(foreach pc,$(NCURSES_LIBS), \
|
|
ln -sf $(pc)$(NCURSES_LIB_SUFFIX).pc \
|
|
$(STAGING_DIR)/usr/lib/pkgconfig/$(pc).pc
|
|
)
|
|
endef
|
|
|
|
NCURSES_LINK_STAGING_LIBS = \
|
|
$(if $(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_STATIC);) \
|
|
$(if $(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_SHARED))
|
|
|
|
NCURSES_LINK_STAGING_PC = $(call NCURSES_LINK_PC)
|
|
|
|
NCURSES_CONF_OPTS += --enable-ext-colors
|
|
NCURSES_ABI_VERSION = 6
|
|
NCURSES_TERMINFO_FILES += \
|
|
p/putty-256color \
|
|
x/xterm+256color \
|
|
x/xterm-256color
|
|
|
|
NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
|
|
NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC
|
|
|
|
else # BR2_PACKAGE_NCURSES_WCHAR
|
|
NCURSES_ABI_VERSION = 5
|
|
endif # BR2_PACKAGE_NCURSES_WCHAR
|
|
|
|
ifneq ($(BR2_ENABLE_DEBUG),y)
|
|
NCURSES_CONF_OPTS += --without-debug
|
|
endif
|
|
|
|
# ncurses breaks with parallel build, but takes quite a while to
|
|
# build single threaded. Work around it similar to how Gentoo does
|
|
define NCURSES_BUILD_CMDS
|
|
$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) sources
|
|
rm -rf $(@D)/misc/pc-files
|
|
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR)
|
|
endef
|
|
|
|
ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
|
|
define NCURSES_TARGET_SYMLINK_RESET
|
|
ln -sf tset $(TARGET_DIR)/usr/bin/reset
|
|
endef
|
|
NCURSES_POST_INSTALL_TARGET_HOOKS += NCURSES_TARGET_SYMLINK_RESET
|
|
endif
|
|
|
|
define NCURSES_TARGET_CLEANUP_TERMINFO
|
|
$(RM) -rf $(TARGET_DIR)/usr/share/terminfo $(TARGET_DIR)/usr/share/tabset
|
|
$(foreach t,$(NCURSES_TERMINFO_FILES), \
|
|
$(INSTALL) -D -m 0644 $(STAGING_DIR)/usr/share/terminfo/$(t) \
|
|
$(TARGET_DIR)/usr/share/terminfo/$(t)
|
|
)
|
|
endef
|
|
NCURSES_POST_INSTALL_TARGET_HOOKS += NCURSES_TARGET_CLEANUP_TERMINFO
|
|
|
|
#
|
|
# On systems with an older version of tic, the installation of ncurses hangs
|
|
# forever. To resolve the problem, build a static version of tic on host
|
|
# ourselves, and use that during installation.
|
|
#
|
|
define HOST_NCURSES_BUILD_CMDS
|
|
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) sources
|
|
$(HOST_MAKE_ENV) $(MAKE) -C $(@D)/progs tic
|
|
endef
|
|
|
|
HOST_NCURSES_CONF_OPTS = \
|
|
--with-shared \
|
|
--without-gpm \
|
|
--without-manpages \
|
|
--without-cxx \
|
|
--without-cxx-binding \
|
|
--without-ada \
|
|
--without-normal
|
|
|
|
$(eval $(autotools-package))
|
|
$(eval $(host-autotools-package))
|