Skip to content

Commit

Permalink
handle ncursesw pkg-config when cross-compiling
Browse files Browse the repository at this point in the history
strip extra args from pkg-config --cflags-only-I, setup.py is only expecting a single path.

Use pkg-config ncursesw include dir even if cross-compiling (PKG_CONFIG_PATH should be set in that case).
  • Loading branch information
jeremyd2019 authored and lazka committed Aug 25, 2023
1 parent 3972f70 commit 716cb91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3872,7 +3872,7 @@ else
fi

if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ .*$//'`"
else
LIBFFI_INCLUDEDIR=""
fi
Expand Down Expand Up @@ -6443,17 +6443,15 @@ then
fi

if test -n "$PKG_CONFIG"; then
NCURSESW_INCLUDEDIR="`"$PKG_CONFIG" ncursesw --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
NCURSESW_INCLUDEDIR="`"$PKG_CONFIG" ncursesw --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ .*$//'`"
else
NCURSESW_INCLUDEDIR=""
fi
AC_SUBST(NCURSESW_INCLUDEDIR)

# first curses header check
ac_save_cppflags="$CPPFLAGS"
if test "$cross_compiling" = no; then
CPPFLAGS="$CPPFLAGS -I$NCURSESW_INCLUDEDIR"
fi
CPPFLAGS="$CPPFLAGS -I$NCURSESW_INCLUDEDIR"

AC_CHECK_HEADERS(curses.h ncurses.h)

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,7 @@ def detect_readline_curses(self):
panel_library = 'panel'
if curses_library == 'ncursesw':
curses_defines.append(('HAVE_NCURSESW', '1'))
if not CROSS_COMPILING:
curses_includes.append(sysconfig.get_config_var("NCURSESW_INCLUDEDIR"))
curses_includes.append(sysconfig.get_config_var("NCURSESW_INCLUDEDIR"))
# Bug 1464056: If _curses.so links with ncursesw,
# _curses_panel.so must link with panelw.
panel_library = 'panelw'
Expand Down

0 comments on commit 716cb91

Please sign in to comment.