pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/emulators/libretro-mgba emulators/libretro-mgba: Handl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1155967044aa
branches:  trunk
changeset: 384979:1155967044aa
user:      nia <nia%pkgsrc.org@localhost>
date:      Fri Sep 07 18:54:02 2018 +0000

description:
emulators/libretro-mgba: Handle _POSIX_C_SOURCE and extensions properly.

A _POSIX_C_SOURCE definition is needed for some locale definitions, but
some non-standard functions are also used (notably futimes). Avoid using
a global definition for _POSIX_C_SOURCE and define it where necessary,
while also defining _BSD_SOURCE and _NETBSD_SOURCE to get the right
prototype for futimes where necessary.

diffstat:

 emulators/libretro-mgba/Makefile                                 |   4 +-
 emulators/libretro-mgba/distinfo                                 |   7 +-
 emulators/libretro-mgba/patches/patch-include_mgba-util_common.h |  20 +++++
 emulators/libretro-mgba/patches/patch-include_mgba-util_vfs.h    |  15 +++
 emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-fd.c      |  39 ++++++++++
 emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-fifo.c    |  24 ++++++
 emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-mem.c     |  24 ++++++
 7 files changed, 129 insertions(+), 4 deletions(-)

diffs (179 lines):

diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/Makefile
--- a/emulators/libretro-mgba/Makefile  Fri Sep 07 14:24:54 2018 +0000
+++ b/emulators/libretro-mgba/Makefile  Fri Sep 07 18:54:02 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2018/08/12 14:25:09 nia Exp $
+# $NetBSD: Makefile,v 1.2 2018/09/07 18:54:02 nia Exp $
 
 DISTNAME=      libretro-mgba-0.6.3
 CATEGORIES=    emulators
@@ -38,8 +38,6 @@
 CMAKE_ARGS+=   -DSKIP_LIBRARY=ON
 CMAKE_ARGS+=   -DLIBRETRO_LIBDIR=${PREFIX}/lib/libretro
 
-CFLAGS+=       -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600
-
 INSTALLATION_DIRS+=    ${PREFIX}/lib/libretro
 
 .include "../../mk/pthread.buildlink3.mk"
diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/distinfo
--- a/emulators/libretro-mgba/distinfo  Fri Sep 07 14:24:54 2018 +0000
+++ b/emulators/libretro-mgba/distinfo  Fri Sep 07 18:54:02 2018 +0000
@@ -1,9 +1,14 @@
-$NetBSD: distinfo,v 1.1 2018/08/12 14:25:09 nia Exp $
+$NetBSD: distinfo,v 1.2 2018/09/07 18:54:02 nia Exp $
 
 SHA1 (libretro-mgba-0.6.3.tar.gz) = b90d59af4ef43d0faf98f48f66514a51aa677296
 RMD160 (libretro-mgba-0.6.3.tar.gz) = a9d5cbc4f77a6ca1883707bef92313d77cf2a824
 SHA512 (libretro-mgba-0.6.3.tar.gz) = d646af7869dbcf8df671a75ecfd8c270950c013b826b23b94bacae43a77243786f198725e1b9bf17827d1ffcf6a8eef70091d53ea878bfb2450472485f42f233
 Size (libretro-mgba-0.6.3.tar.gz) = 7442154 bytes
 SHA1 (patch-CMakeLists.txt) = ec56af8fed90cd6486d797fd18fd69ac6eb00d3d
+SHA1 (patch-include_mgba-util_common.h) = 4d1ff026d759ede6341c1195b60903ce566145d5
 SHA1 (patch-include_mgba-util_math.h) = 448ca1bb3bbe2812e7d9482917c488ddcf3b48f0
+SHA1 (patch-include_mgba-util_vfs.h) = 5e02a5d53623dfa5f1531d2d3269cc4e88e4530c
+SHA1 (patch-src_util_vfs_vfs-fd.c) = f544787d17d95fb234f9844f0c3eef17805a798d
+SHA1 (patch-src_util_vfs_vfs-fifo.c) = 94240338a440e3da9b41e37e8c934113aacd5904
+SHA1 (patch-src_util_vfs_vfs-mem.c) = 7b55448fa616b078eac62e80867ef6894d3be8ed
 SHA1 (patch-version.cmake) = 973e3b397b807be1c228e96d559f98a4d1091bae
diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/patches/patch-include_mgba-util_common.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/libretro-mgba/patches/patch-include_mgba-util_common.h  Fri Sep 07 18:54:02 2018 +0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-include_mgba-util_common.h,v 1.1 2018/09/07 18:54:02 nia Exp $
+
+Make sure the locale definitions are defined properly.
+
+--- include/mgba-util/common.h.orig    2018-04-14 20:49:19.000000000 +0000
++++ include/mgba-util/common.h
+@@ -16,6 +16,13 @@
+ 
+ CXX_GUARD_START
+ 
++#ifndef _POSIX_C_SOURCE
++#define _POSIX_C_SOURCE 200112L
++#endif
++#ifndef _XOPEN_SOURCE
++#define _XOPEN_SOURCE 600
++#endif
++
+ #include <ctype.h>
+ #include <fcntl.h>
+ #include <inttypes.h>
diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/patches/patch-include_mgba-util_vfs.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/libretro-mgba/patches/patch-include_mgba-util_vfs.h     Fri Sep 07 18:54:02 2018 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-include_mgba-util_vfs.h,v 1.1 2018/09/07 18:54:02 nia Exp $
+
+vfs-fd's sync implementation uses msync, which uses a non-const pointer.
+
+--- include/mgba-util/vfs.h.orig       2018-04-14 20:49:19.000000000 +0000
++++ include/mgba-util/vfs.h
+@@ -47,7 +47,7 @@ struct VFile {
+       void (*unmap)(struct VFile* vf, void* memory, size_t size);
+       void (*truncate)(struct VFile* vf, size_t size);
+       ssize_t (*size)(struct VFile* vf);
+-      bool (*sync)(struct VFile* vf, const void* buffer, size_t size);
++      bool (*sync)(struct VFile* vf, void *buffer, size_t size);
+ };
+ 
+ struct VDirEntry {
diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-fd.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-fd.c       Fri Sep 07 18:54:02 2018 +0000
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_util_vfs_vfs-fd.c,v 1.1 2018/09/07 18:54:02 nia Exp $
+
+Define _BSD_SOURCE for futimes().
+
+msync's argument is a non-const void pointer, so don't needlessly
+convert to const then discard it.
+
+--- src/util/vfs/vfs-fd.c.orig 2018-04-14 20:49:19.000000000 +0000
++++ src/util/vfs/vfs-fd.c
+@@ -3,6 +3,11 @@
+  * This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++#define _BSD_SOURCE /* futimes */
++#ifdef __NetBSD__
++#define _NETBSD_SOURCE /* futimes */
++#endif
++
+ #include <mgba-util/vfs.h>
+ 
+ #include <fcntl.h>
+@@ -30,7 +35,7 @@ static void* _vfdMap(struct VFile* vf, s
+ static void _vfdUnmap(struct VFile* vf, void* memory, size_t size);
+ static void _vfdTruncate(struct VFile* vf, size_t size);
+ static ssize_t _vfdSize(struct VFile* vf);
+-static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size);
++static bool _vfdSync(struct VFile* vf, void* buffer, size_t size);
+ 
+ struct VFile* VFileOpenFD(const char* path, int flags) {
+       if (!path) {
+@@ -161,7 +166,7 @@ static ssize_t _vfdSize(struct VFile* vf
+       return stat.st_size;
+ }
+ 
+-static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size) {
++static bool _vfdSync(struct VFile* vf, void* buffer, size_t size) {
+       UNUSED(buffer);
+       UNUSED(size);
+       struct VFileFD* vfd = (struct VFileFD*) vf;
diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-fifo.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-fifo.c     Fri Sep 07 18:54:02 2018 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_util_vfs_vfs-fifo.c,v 1.1 2018/09/07 18:54:02 nia Exp $
+
+vfs.sync's buffer pointer isn't const.
+
+--- src/util/vfs/vfs-fifo.c.orig       2018-04-14 20:49:19.000000000 +0000
++++ src/util/vfs/vfs-fifo.c
+@@ -19,7 +19,7 @@ static void* _vffMap(struct VFile* vf, s
+ static void _vffUnmap(struct VFile* vf, void* memory, size_t size);
+ static void _vffTruncate(struct VFile* vf, size_t size);
+ static ssize_t _vffSize(struct VFile* vf);
+-static bool _vffSync(struct VFile* vf, const void* buffer, size_t size);
++static bool _vffSync(struct VFile* vf, void* buffer, size_t size);
+ 
+ struct VFile* VFileFIFO(struct CircleBuffer* backing) {
+       if (!backing) {
+@@ -94,7 +94,7 @@ static ssize_t _vffSize(struct VFile* vf
+       return CircleBufferSize(vff->backing);
+ }
+ 
+-static bool _vffSync(struct VFile* vf, const void* buffer, size_t size) {
++static bool _vffSync(struct VFile* vf, void* buffer, size_t size) {
+       UNUSED(vf);
+       UNUSED(buffer);
+       UNUSED(size);
diff -r d856f1111205 -r 1155967044aa emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-mem.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/libretro-mgba/patches/patch-src_util_vfs_vfs-mem.c      Fri Sep 07 18:54:02 2018 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_util_vfs_vfs-mem.c,v 1.1 2018/09/07 18:54:02 nia Exp $
+
+vfs.sync's buffer pointer isn't const.
+
+--- src/util/vfs/vfs-mem.c.orig        2018-04-14 20:49:19.000000000 +0000
++++ src/util/vfs/vfs-mem.c
+@@ -28,7 +28,7 @@ static void _vfmUnmap(struct VFile* vf, 
+ static void _vfmTruncate(struct VFile* vf, size_t size);
+ static void _vfmTruncateNoop(struct VFile* vf, size_t size);
+ static ssize_t _vfmSize(struct VFile* vf);
+-static bool _vfmSync(struct VFile* vf, const void* buffer, size_t size);
++static bool _vfmSync(struct VFile* vf, void* buffer, size_t size);
+ 
+ struct VFile* VFileFromMemory(void* mem, size_t size) {
+       if (!mem || !size) {
+@@ -297,7 +297,7 @@ ssize_t _vfmSize(struct VFile* vf) {
+       return vfm->size;
+ }
+ 
+-bool _vfmSync(struct VFile* vf, const void* buffer, size_t size) {
++bool _vfmSync(struct VFile* vf, void* buffer, size_t size) {
+       UNUSED(vf);
+       UNUSED(buffer);
+       UNUSED(size);



Home | Main Index | Thread Index | Old Index