pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cmake needs -ltinfo on Linux



Let me see if I can put this mess together.

Gentoo, system split ncurses.

If CURSES_DEFAULT is set to ncurses, it will include
devel/ncurses/buildlink3.mk

This is not desirable because we have already ncurses.

Modules/FindCurses.cmake checks that the system has an usable curses or
ncurses (that may need tinfo).

The code responsible to include tinfo depends on CURSES_USE_NCURSES.
This will be set only if CURSES_NEED_NCURSES is set, or if there is
only ncurses.

CURSES_USE_NCURSES is set by default in
Source/Checks/Curses/CMakeLists.txt, so in

if(CURSES_NCURSES_LIBRARY  AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
  set(CURSES_USE_NCURSES TRUE)
endif()

CURSES_USE_NCURSES will be set even having ncurses.h and curses.h

Yes, this is going to be over-complicated.

Now patches/patch-Source_Checks_Curses_CMakeLists.txt unset CURSES_USE_NCURSES:

==========================================
$NetBSD: patch-Source_Checks_Curses_CMakeLists.txt,v 1.1 2018/10/16 16:37:21 leot Exp $

- Don't insist on ncurses

--- Source/Checks/Curses/CMakeLists.txt.orig    2018-10-03 12:35:51.000000000 +0000
+++ Source/Checks/Curses/CMakeLists.txt
@@ -4,7 +4,6 @@ if(POLICY CMP0060)
 endif()
 project(CheckCurses C)

-set(CURSES_NEED_NCURSES TRUE)
 find_package(Curses)
 if(NOT CURSES_FOUND)
   return()
==========================================

So if system curses is a split ncurses, it will not include
tinfo.

This part checks if curses is usable (thinking on NetBSD) with
CURSES_NEED_NCURSES set.

[...]
if(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES)
  include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
  cmake_push_check_state()
  set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
  CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
    wsyncup "" CURSES_CURSES_HAS_WSYNCUP)

  if(CURSES_NCURSES_LIBRARY  AND NOT  CURSES_CURSES_HAS_WSYNCUP)
    CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
      wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
    if( CURSES_NCURSES_HAS_WSYNCUP)
      set(CURSES_USE_NCURSES TRUE)
[...]

Now I eliminate the patch. CURSES_USE_NCURSES should be set. The other patches are harmless.

bmake configure
[...]
-- Found Curses: /usr/lib/libcurses.so
[...]

So libcurses is set, tinfo is not included.

I can compile the same tar without pkgsrc. libncurses is set, tinfo is
included.

There is something I'm missing.

Any hint?


Regards,
adr.


Home | Main Index | Thread Index | Old Index