[PATCH] curses support for qemu-2.8.1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] curses support for qemu-2.8.1

SASANO Takayoshi
Hello,

QEMU's -curses option is not enabled because configure script requires
the information of ncurses by pkg-config.

The diff specifies the place of ncurses library to enable QEMU's
curses support.

ok or comment?

--
SASANO Takayoshi (JG1UAA) <[hidden email]>

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.159
diff -u -p -r1.159 Makefile
--- Makefile 10 Apr 2017 13:13:02 -0000 1.159
+++ Makefile 14 Apr 2017 13:49:20 -0000
@@ -78,6 +78,7 @@ CONFIGURE_ARGS= --prefix=${PREFIX} \
  --host-cc="${CC}" \
  --extra-cflags="${EXTRA_CFLAGS}" \
  --extra-ldflags="${EXTRA_LDFLAGS}" \
+ --enable-curses \
  --disable-bsd-user \
  --disable-gcrypt \
  --disable-smartcard \
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-configure,v
retrieving revision 1.50
diff -u -p -r1.50 patch-configure
--- patches/patch-configure 22 Dec 2016 09:05:06 -0000 1.50
+++ patches/patch-configure 14 Apr 2017 13:49:20 -0000
@@ -1,7 +1,64 @@
 $OpenBSD: patch-configure,v 1.50 2016/12/22 09:05:06 ajacoutot Exp $
---- configure.orig Tue Dec  6 22:54:54 2016
-+++ configure Sat Dec 10 23:54:52 2016
-@@ -4740,10 +4740,6 @@ fi
+--- configure.orig Fri Mar 31 23:07:03 2017
++++ configure Fri Apr 14 06:19:09 2017
+@@ -2924,54 +2924,8 @@ fi
+ ##########################################
+ # curses probe
+ if test "$curses" != "no" ; then
+-  if test "$mingw32" = "yes" ; then
+-    curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
+-    curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
+-  else
+-    curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
+-    curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
+-  fi
+-  curses_found=no
+-  cat > $TMPC << EOF
+-#include <locale.h>
+-#include <curses.h>
+-#include <wchar.h>
+-int main(void) {
+-  const char *s = curses_version();
+-  wchar_t wch = L'w';
+-  setlocale(LC_ALL, "");
+-  resize_term(0, 0);
+-  addwstr(L"wide chars\n");
+-  addnwstr(&wch, 1);
+-  add_wch(WACS_DEGREE);
+-  return s != 0;
+-}
+-EOF
+-  IFS=:
+-  for curses_inc in $curses_inc_list; do
+-    IFS=:
+-    for curses_lib in $curses_lib_list; do
+-      unset IFS
+-      if compile_prog "$curses_inc" "$curses_lib" ; then
+-        curses_found=yes
+-        QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
+-        libs_softmmu="$curses_lib $libs_softmmu"
+-        break
+-      fi
+-    done
+-    if test "$curses_found" = yes ; then
+-      break
+-    fi
+-  done
+-  unset IFS
+-  if test "$curses_found" = "yes" ; then
+-    curses=yes
+-  else
+-    if test "$curses" = "yes" ; then
+-      feature_not_found "curses" "Install ncurses devel"
+-    fi
+-    curses=no
+-  fi
++  curses=yes
++  libs_softmmu="-lncurses $libs_softmmu"
+ fi
+
+ ##########################################
+@@ -4740,10 +4694,6 @@ fi
  if test "$gcov" = "yes" ; then
    CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
@@ -12,7 +69,7 @@ $OpenBSD: patch-configure,v 1.50 2016/12
  fi
 
  ##########################################
-@@ -4892,7 +4888,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a
+@@ -4892,7 +4842,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a
      # Different host OS linkers have different ideas about the name of the ELF
      # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
      # variant; and Windows uses i386pe.

Reply | Threaded
Open this post in threaded view
|

curses support for qemu-2.9.0

SASANO Takayoshi
Hello,

QEMU's -curses option is not enabled because configure script requires
the information of ncurses by pkg-config.

The diff specifies the place of ncurses library to enable QEMU's
curses support.

I sent the diff for qemu-2.8.1 ago, I re-write the patch for current
version.

ok or comment?

--
SASANO Takayoshi (JG1UAA) <[hidden email]>

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.160
diff -u -p -r1.160 Makefile
--- Makefile 23 Apr 2017 13:24:17 -0000 1.160
+++ Makefile 24 Apr 2017 12:03:31 -0000
@@ -7,6 +7,7 @@ ONLY_FOR_ARCHS= aarch64 amd64 arm i386 p
 COMMENT= multi system emulator
 
 DISTNAME= qemu-2.9.0
+REVISION= 1
 CATEGORIES= emulators
 MASTER_SITES= http://wiki.qemu.org/download/
 EXTRACT_SUFX= .tar.bz2
@@ -78,6 +79,7 @@ CONFIGURE_ARGS= --prefix=${PREFIX} \
  --host-cc="${CC}" \
  --extra-cflags="${EXTRA_CFLAGS}" \
  --extra-ldflags="${EXTRA_LDFLAGS}" \
+ --enable-curses \
  --disable-bsd-user \
  --disable-gcrypt \
  --disable-smartcard \
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-configure,v
retrieving revision 1.51
diff -u -p -r1.51 patch-configure
--- patches/patch-configure 23 Apr 2017 13:24:17 -0000 1.51
+++ patches/patch-configure 24 Apr 2017 12:03:31 -0000
@@ -1,7 +1,64 @@
 $OpenBSD: patch-configure,v 1.51 2017/04/23 13:24:17 ajacoutot Exp $
---- configure.orig Tue Apr 11 14:00:36 2017
-+++ configure Tue Apr 11 21:38:09 2017
-@@ -4787,10 +4787,6 @@ fi
+--- configure.orig Thu Apr 20 23:57:00 2017
++++ configure Mon Apr 24 20:13:06 2017
+@@ -2976,54 +2976,8 @@ fi
+ ##########################################
+ # curses probe
+ if test "$curses" != "no" ; then
+-  if test "$mingw32" = "yes" ; then
+-    curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
+-    curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
+-  else
+-    curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
+-    curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
+-  fi
+-  curses_found=no
+-  cat > $TMPC << EOF
+-#include <locale.h>
+-#include <curses.h>
+-#include <wchar.h>
+-int main(void) {
+-  const char *s = curses_version();
+-  wchar_t wch = L'w';
+-  setlocale(LC_ALL, "");
+-  resize_term(0, 0);
+-  addwstr(L"wide chars\n");
+-  addnwstr(&wch, 1);
+-  add_wch(WACS_DEGREE);
+-  return s != 0;
+-}
+-EOF
+-  IFS=:
+-  for curses_inc in $curses_inc_list; do
+-    IFS=:
+-    for curses_lib in $curses_lib_list; do
+-      unset IFS
+-      if compile_prog "$curses_inc" "$curses_lib" ; then
+-        curses_found=yes
+-        QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
+-        libs_softmmu="$curses_lib $libs_softmmu"
+-        break
+-      fi
+-    done
+-    if test "$curses_found" = yes ; then
+-      break
+-    fi
+-  done
+-  unset IFS
+-  if test "$curses_found" = "yes" ; then
+-    curses=yes
+-  else
+-    if test "$curses" = "yes" ; then
+-      feature_not_found "curses" "Install ncurses devel"
+-    fi
+-    curses=no
+-  fi
++  curses=yes
++  libs_softmmu="-lncurses $libs_softmmu"
+ fi
+
+ ##########################################
+@@ -4787,10 +4741,6 @@ fi
  if test "$gcov" = "yes" ; then
    CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
@@ -12,7 +69,7 @@ $OpenBSD: patch-configure,v 1.51 2017/04
  fi
 
  ##########################################
-@@ -4939,7 +4935,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a
+@@ -4939,7 +4889,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a
      # Different host OS linkers have different ideas about the name of the ELF
      # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
      # variant; and Windows uses i386pe.

Reply | Threaded
Open this post in threaded view
|

Re: curses support for qemu-2.9.0

Stuart Henderson
On 2017/05/04 05:31, SASANO Takayoshi wrote:

> Hello,
>
> QEMU's -curses option is not enabled because configure script requires
> the information of ncurses by pkg-config.
>
> The diff specifies the place of ncurses library to enable QEMU's
> curses support.
>
> I sent the diff for qemu-2.8.1 ago, I re-write the patch for current
> version.
>
> ok or comment?

The pkg-config files don't matter, there is a fallback. Here is the
problem:

: #include <locale.h>
: #include <curses.h>
: #include <wchar.h>
: int main(void) {
:   const char *s = curses_version();
:   wchar_t wch = L'w';
:   setlocale(LC_ALL, "");
:   resize_term(0, 0);
:   addwstr(L"wide chars\n");
:   addnwstr(&wch, 1);
>   add_wch(WACS_DEGREE);
:   return s != 0;
: }

Look in ncurses.h and you'll see that WACS_DEGREE is only defined if
_XOPEN_SOURCE_EXTENDED is set.

The simplest fix is probably to add "#define _XOPEN_SOURCE_EXTENDED"
to the test code, somewhere before curses.h is included. This would
be better than removing a whole bunch of lines from configure
because it reduces the chance of merge conflicts when the port
is updated.

Reply | Threaded
Open this post in threaded view
|

Re: curses support for qemu-2.9.0

SASANO Takayoshi
Hi, I added simply #define _XOPEN_SOURCE_EXTENDED to the top of probe code
like this.

--
SASANO Takayoshi (JG1UAA) <[hidden email]>

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.160
diff -u -r1.160 Makefile
--- Makefile 23 Apr 2017 13:24:17 -0000 1.160
+++ Makefile 4 May 2017 21:45:34 -0000
@@ -7,6 +7,7 @@
 COMMENT= multi system emulator
 
 DISTNAME= qemu-2.9.0
+REVISION= 1
 CATEGORIES= emulators
 MASTER_SITES= http://wiki.qemu.org/download/
 EXTRACT_SUFX= .tar.bz2
@@ -78,6 +79,7 @@
  --host-cc="${CC}" \
  --extra-cflags="${EXTRA_CFLAGS}" \
  --extra-ldflags="${EXTRA_LDFLAGS}" \
+ --enable-curses \
  --disable-bsd-user \
  --disable-gcrypt \
  --disable-smartcard \
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-configure,v
retrieving revision 1.51
diff -u -r1.51 patch-configure
--- patches/patch-configure 23 Apr 2017 13:24:17 -0000 1.51
+++ patches/patch-configure 4 May 2017 21:45:34 -0000
@@ -1,7 +1,15 @@
 $OpenBSD: patch-configure,v 1.51 2017/04/23 13:24:17 ajacoutot Exp $
---- configure.orig Tue Apr 11 14:00:36 2017
-+++ configure Tue Apr 11 21:38:09 2017
-@@ -4787,10 +4787,6 @@ fi
+--- configure.orig Thu Apr 20 23:57:00 2017
++++ configure Fri May  5 05:51:39 2017
+@@ -2985,6 +2985,7 @@ if test "$curses" != "no" ; then
+   fi
+   curses_found=no
+   cat > $TMPC << EOF
++#define _XOPEN_SOURCE_EXTENDED
+ #include <locale.h>
+ #include <curses.h>
+ #include <wchar.h>
+@@ -4787,10 +4788,6 @@ fi
  if test "$gcov" = "yes" ; then
    CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
@@ -12,7 +20,7 @@
  fi
 
  ##########################################
-@@ -4939,7 +4935,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a
+@@ -4939,7 +4936,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a
      # Different host OS linkers have different ideas about the name of the ELF
      # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
      # variant; and Windows uses i386pe.