summaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorgson <gson@pkgsrc.org>2018-01-04 16:48:17 +0000
committergson <gson@pkgsrc.org>2018-01-04 16:48:17 +0000
commit2d9876a7a55532d2ba763f5745d17951f73fdd5e (patch)
tree406b3f1bc258e096d0717d12a3e67a888e9b696c /emulators
parentb3732da650631fdb377aa8e3404e0ccc5db8d7a9 (diff)
downloadpkgsrc-2d9876a7a55532d2ba763f5745d17951f73fdd5e.tar.gz
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 (limited to 'emulators')
-rw-r--r--emulators/qemu/Makefile4
-rw-r--r--emulators/qemu/distinfo5
-rw-r--r--emulators/qemu/patches/patch-configure63
-rw-r--r--emulators/qemu/patches/patch-util_oslib-posix.c16
4 files changed, 66 insertions, 22 deletions
diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile
index f6205b9027a..f23dd407218 100644
--- a/emulators/qemu/Makefile
+++ b/emulators/qemu/Makefile
@@ -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 --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo
index 595b2475aa2..175180a8675 100644
--- a/emulators/qemu/distinfo
+++ b/emulators/qemu/distinfo
@@ -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 @@ Size (qemu-2.11.0.tar.xz) = 28984736 bytes
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_net_xilinx__axienet.c) = ebcd2676d64ce6f31e4a8c976d4fdf530ad5e8b7
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 --git a/emulators/qemu/patches/patch-configure b/emulators/qemu/patches/patch-configure
index 68fef9699e9..be4dae0b297 100644
--- a/emulators/qemu/patches/patch-configure
+++ b/emulators/qemu/patches/patch-configure
@@ -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 --git a/emulators/qemu/patches/patch-util_oslib-posix.c b/emulators/qemu/patches/patch-util_oslib-posix.c
new file mode 100644
index 00000000000..cd00da5e016
--- /dev/null
+++ b/emulators/qemu/patches/patch-util_oslib-posix.c
@@ -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) {