Skip to content

Commit

Permalink
depends: attempt to fix readline
Browse files Browse the repository at this point in the history
Make readline actually compile, and make ncurses use existing terminfo data (if available).
  • Loading branch information
iDunk5400 committed Sep 7, 2019
1 parent 1b93cb7 commit ab2819a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Expand Up @@ -955,7 +955,7 @@ if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
endif()

option(USE_READLINE "Build with GNU readline support." ON)
if(USE_READLINE)
if(USE_READLINE AND NOT DEPENDS)
find_package(Readline)
if(READLINE_FOUND AND GNU_READLINE_FOUND)
add_definitions(-DHAVE_READLINE)
Expand All @@ -965,6 +965,14 @@ if(USE_READLINE)
else()
message(STATUS "Could not find GNU readline library so building without readline support")
endif()
elseif(USE_READLINE AND DEPENDS AND NOT MINGW)
find_path(Readline_INCLUDE_PATH readline/readline.h)
find_library(Readline_LIBRARY readline)
find_library(Terminfo_LIBRARY tinfo)
set(Readline_LIBRARY "${Readline_LIBRARY};${Terminfo_LIBRARY}")
set(GNU_READLINE_LIBRARY ${Readline_LIBRARY})
add_definitions(-DHAVE_READLINE)
set(EPEE_READLINE epee_readline)
endif()

if(ANDROID)
Expand Down
8 changes: 5 additions & 3 deletions contrib/depends/packages/ncurses.mk
Expand Up @@ -21,6 +21,7 @@ define $(package)_set_vars
$(package)_config_opts+=--without-tests
$(package)_config_opts+=--without-tack
$(package)_config_opts+=--without-manpages
$(package)_config_opts+=--with-termlib=tinfo
$(package)_config_opts+=--disable-tic-depends
$(package)_config_opts+=--disable-big-strings
$(package)_config_opts+=--disable-ext-colors
Expand All @@ -30,15 +31,16 @@ define $(package)_set_vars
$(pacakge)_config_opts+=--without-pthread
$(pacakge)_config_opts+=--disable-rpath
$(pacakge)_config_opts+=--disable-colorfgbg
$(pacakge)_config_opts+=--disable-ext-colors
$(pacakge)_config_opts+=--disable-ext-mouse
$(pacakge)_config_opts+=--disable-symlinks
$(pacakge)_config_opts+=--enable-warnings
$(pacakge)_config_opts+=--enable-assertions
$(pacakge)_config_opts+=--disable-home-terminfo
$(package)_config_opts+=--with-default-terminfo-dir=/etc/terminfo
$(package)_config_opts+=--with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo"
$(pacakge)_config_opts+=--enable-database
$(pacakge)_config_opts+=--enable-sp-funcs
$(pacakge)_config_opts+=--enable-term-driver
$(pacakge)_config_opts+=--disable-term-driver
$(pacakge)_config_opts+=--enable-interop
$(pacakge)_config_opts+=--enable-widec
$(package)_build_opts=CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fPIC"
Expand All @@ -53,6 +55,6 @@ define $(package)_build_cmds
endef

define $(package)_stage_cmds
$(MAKE) install DESTDIR=$($(package)_staging_dir)
$(MAKE) install.libs DESTDIR=$($(package)_staging_dir)
endef

5 changes: 4 additions & 1 deletion contrib/depends/packages/readline.mk
Expand Up @@ -6,7 +6,10 @@ $(package)_sha256_hash=e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078
$(package)_dependencies=ncurses

define $(package)_set_vars
$(package)_config_opts=--prefix=$(host_prefix)
$(package)_build_opts=CC="$($(package)_cc)"
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
$(package)_config_env_darwin=RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)"
$(package)_config_opts+=--prefix=$(host_prefix)
$(package)_config_opts+=--exec-prefix=$(host_prefix)
$(package)_config_opts+=--host=$(HOST)
$(package)_config_opts+=--disable-shared --with-curses
Expand Down
3 changes: 2 additions & 1 deletion contrib/depends/toolchain.cmake.in
Expand Up @@ -22,7 +22,8 @@ SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)

SET(Readline_ROOT_DIR @prefix@)
SET(Readline_INCLUDE_DIR @prefix@/include)
SET(Termcap_LIBRARY @prefix@/lib/libncurses.a)
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
SET(Termcap_LIBRARY @prefix@/lib/libtinfo.a)

SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
Expand Down
4 changes: 2 additions & 2 deletions contrib/epee/src/CMakeLists.txt
Expand Up @@ -29,7 +29,7 @@
add_library(epee STATIC byte_slice.cpp hex.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp wipeable_string.cpp
levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp)

if (USE_READLINE AND GNU_READLINE_FOUND)
if (USE_READLINE AND (GNU_READLINE_FOUND OR DEPENDS AND NOT MINGW))
add_library(epee_readline STATIC readline_buffer.cpp)
endif()

Expand Down Expand Up @@ -62,7 +62,7 @@ target_link_libraries(epee
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES})

if (USE_READLINE AND GNU_READLINE_FOUND)
if (USE_READLINE AND (GNU_READLINE_FOUND OR DEPENDS AND NOT MINGW))
target_link_libraries(epee_readline
PUBLIC
easylogging
Expand Down

0 comments on commit ab2819a

Please sign in to comment.