pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/emulators/qemu emulators/qemu: check for posix_memalig...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7fe0f115d607
branches:  trunk
changeset: 373548:7fe0f115d607
user:      gson <gson%pkgsrc.org@localhost>
date:      Thu Jan 04 16:48:17 2018 +0000

description:
emulators/qemu: check for posix_memalign in configure script

qemu incorrectly checks for the presence of posix_memalign() by
testing whether the preprocessor symbol _POSIX_C_SOURCE is defined.
This causes qemu to use valloc() instead of posix_memalign() on NetBSD,
even on versions where posix_memalign() is supported, wasting
memory when the required alignment is smaller than a page.  Fix this
by checking for posix_memalign() support in the configure script.

diffstat:

 emulators/qemu/Makefile                         |   4 +-
 emulators/qemu/distinfo                         |   5 +-
 emulators/qemu/patches/patch-configure          |  63 +++++++++++++++++-------
 emulators/qemu/patches/patch-util_oslib-posix.c |  16 ++++++
 4 files changed, 66 insertions(+), 22 deletions(-)

diffs (127 lines):

diff -r f5a816ac53bf -r 7fe0f115d607 emulators/qemu/Makefile
--- a/emulators/qemu/Makefile   Thu Jan 04 16:38:10 2018 +0000
+++ b/emulators/qemu/Makefile   Thu Jan 04 16:48:17 2018 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.177 2018/01/01 21:18:23 adam Exp $
+# $NetBSD: Makefile,v 1.178 2018/01/04 16:48:17 gson Exp $
 
 DISTNAME=      qemu-2.11.0
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    emulators
 MASTER_SITES=  http://download.qemu-project.org/
 EXTRACT_SUFX=  .tar.xz
diff -r f5a816ac53bf -r 7fe0f115d607 emulators/qemu/distinfo
--- a/emulators/qemu/distinfo   Thu Jan 04 16:38:10 2018 +0000
+++ b/emulators/qemu/distinfo   Thu Jan 04 16:48:17 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.131 2017/12/14 08:01:10 adam Exp $
+$NetBSD: distinfo,v 1.132 2018/01/04 16:48:17 gson Exp $
 
 SHA1 (qemu-2.11.0.tar.xz) = 458f3382fe5028faa89174a7321d21a0a8058b63
 RMD160 (qemu-2.11.0.tar.xz) = 3e9094d77312ae762dae216d453871d26cfc7e3a
@@ -7,7 +7,7 @@
 SHA1 (patch-Makefile) = b3899fb8d0dd2f29bf3edd843836612e6e6c019c
 SHA1 (patch-audio_audio.c) = 98a1de2fd48638886b5d16f6a61dc72910e98b41
 SHA1 (patch-block.c) = 6f54da333696584067a7556b8cabfa8853758824
-SHA1 (patch-configure) = 179486600f69c2678bd8ffc62626d919e4688386
+SHA1 (patch-configure) = 6d0acd72edb8c602ffbc98fdbc161bc10aa968e2
 SHA1 (patch-contrib_ivshmem-client_ivshmem-client.c) = 40c8751607cbf66a37e4c4e08f2664b864e2e984
 SHA1 (patch-contrib_ivshmem-server_ivshmem-server.c) = d8f53432b5752f4263dc4ef96108a976a05147a3
 SHA1 (patch-hw_display_omap__dss.c) = 6b13242f28e32346bc70548c216c578d98fd3420
@@ -16,3 +16,4 @@
 SHA1 (patch-hw_usb_dev-mtp.c) = f5a446079d51b19eae6c2f5e0c9810c181e4f02d
 SHA1 (patch-slirp_tcp__subr.c) = f011c9dc58282e61b26017547a9884f30a6e6154
 SHA1 (patch-tests_Makefile.include) = 42345d697cb2e324dccf1d68bd8d61e8001c6162
+SHA1 (patch-util_oslib-posix.c) = 319ad18de96860172c8d10920fe2c117e787403e
diff -r f5a816ac53bf -r 7fe0f115d607 emulators/qemu/patches/patch-configure
--- a/emulators/qemu/patches/patch-configure    Thu Jan 04 16:38:10 2018 +0000
+++ b/emulators/qemu/patches/patch-configure    Thu Jan 04 16:48:17 2018 +0000
@@ -1,22 +1,49 @@
-$NetBSD: patch-configure,v 1.21 2017/12/14 02:03:53 kamil Exp $
+$NetBSD: patch-configure,v 1.22 2018/01/04 16:48:17 gson Exp $
 
 Use ncursesw6-config; define NCURSES_WIDECHAR to fix building on Darwin (at least).
 
---- configure.orig     2017-12-13 17:27:20.000000000 +0000
+Check for posix_memalign in configure script instead of incorrectly
+testing _POSIX_C_SOURCE in util/oslib-posix.c
+
+--- configure.orig     2017-12-29 22:10:50.000000000 +0000
 +++ configure
-@@ -3165,12 +3165,13 @@ if test "$curses" != "no" ; 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"
-+    curses_inc_list="$(@PREFIX@/bin/ncursesw6-config --cflags 2>/dev/null):-I/usr/include/ncursesw:"
-+    curses_lib_list="$(@PREFIX@/bin/ncursesw6-config --libs 2>/dev/null):-lncursesw:-lcursesw"
-   fi
-   curses_found=no
-   cat > $TMPC << EOF
- #include <locale.h>
-+#define NCURSES_WIDECHAR 1
- #include <curses.h>
- #include <wchar.h>
- int main(void) {
+@@ -4542,6 +4542,21 @@ if compile_prog "" "" ; then
+ fi
+ 
+ ##########################################
++# check if we have posix_memalign()
++
++posix_memalign=no
++cat > $TMPC << EOF
++#include <stdlib.h>
++int main(void) {
++    void *p;
++    return posix_memalign(&p, 8, 8);
++}
++EOF
++if compile_prog "" "" ; then
++    posix_memalign=yes
++fi
++
++##########################################
+ # check if we have posix_syslog
+ 
+ posix_syslog=no
+@@ -5509,6 +5524,7 @@ echo "preadv support    $preadv"
+ echo "fdatasync         $fdatasync"
+ echo "madvise           $madvise"
+ echo "posix_madvise     $posix_madvise"
++echo "posix_memalign    $posix_memalign"
+ echo "libcap-ng support $cap_ng"
+ echo "vhost-net support $vhost_net"
+ echo "vhost-scsi support $vhost_scsi"
+@@ -5982,6 +5998,9 @@ fi
+ if test "$posix_madvise" = "yes" ; then
+   echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
+ fi
++if test "$posix_memalign" = "yes" ; then
++  echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
++fi
+ 
+ if test "$spice" = "yes" ; then
+   echo "CONFIG_SPICE=y" >> $config_host_mak
diff -r f5a816ac53bf -r 7fe0f115d607 emulators/qemu/patches/patch-util_oslib-posix.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-util_oslib-posix.c   Thu Jan 04 16:48:17 2018 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-util_oslib-posix.c,v 1.1 2018/01/04 16:48:17 gson Exp $
+
+Check for posix_memalign in configure script instead of incorrectly
+testing _POSIX_C_SOURCE in util/oslib-posix.c
+
+--- util/oslib-posix.c.orig    2017-12-13 17:27:20.000000000 +0000
++++ util/oslib-posix.c
+@@ -105,7 +105,7 @@ void *qemu_try_memalign(size_t alignment
+         alignment = sizeof(void*);
+     }
+ 
+-#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
++#if defined(CONFIG_POSIX_MEMALIGN)
+     int ret;
+     ret = posix_memalign(&ptr, alignment, size);
+     if (ret != 0) {



Home | Main Index | Thread Index | Old Index