Accepting request 424836 from home:susnux:branches:games
Some patches for preventing warnings. Already upstreamed OBS-URL: https://build.opensuse.org/request/show/424836 OBS-URL: https://build.opensuse.org/package/show/games/scummvm?expand=0&rev=44
This commit is contained in:
parent
c2a9f1092e
commit
426f6442c2
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Aug 21 18:36:00 UTC 2016 - rpm@fthiessen.de
|
||||||
|
|
||||||
|
- Using changes as source file for fixing the date-and-time issue,
|
||||||
|
so also list it as a source file.
|
||||||
|
- Added use-getaddrinfo.patch to get rid of gethostbyname,
|
||||||
|
this will bring full IPv6 support.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Aug 3 08:38:02 UTC 2016 - olaf@aepfle.de
|
Wed Aug 3 08:38:02 UTC 2016 - olaf@aepfle.de
|
||||||
|
|
||||||
|
19
scummvm.spec
19
scummvm.spec
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
%bcond_with faad
|
%bcond_with faad
|
||||||
%bcond_with mad
|
%bcond_with mad
|
||||||
|
|
||||||
Name: scummvm
|
Name: scummvm
|
||||||
Version: 1.8.1
|
Version: 1.8.1
|
||||||
Release: 0
|
Release: 0
|
||||||
@ -27,12 +26,16 @@ License: GPL-2.0+
|
|||||||
Group: Amusements/Games/Other
|
Group: Amusements/Games/Other
|
||||||
Url: http://www.scummvm.org/
|
Url: http://www.scummvm.org/
|
||||||
Source: http://www.scummvm.org/frs/scummvm/%{version}/scummvm-%{version}.tar.xz
|
Source: http://www.scummvm.org/frs/scummvm/%{version}/scummvm-%{version}.tar.xz
|
||||||
|
Source99: %{name}.changes
|
||||||
# PATCH-FEATURE-UPSTREAM https://github.com/scummvm/scummvm/pull/797
|
# PATCH-FEATURE-UPSTREAM https://github.com/scummvm/scummvm/pull/797
|
||||||
Patch0: appdata.xml.patch
|
Patch0: appdata.xml.patch
|
||||||
|
# PATCH-FEATURE-UPSTREAM use-getaddrinfo.patch -- https://github.com/scummvm/scummvm/pull/811
|
||||||
|
Patch1: use-getaddrinfo.patch
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: hicolor-icon-theme
|
BuildRequires: hicolor-icon-theme
|
||||||
BuildRequires: libjpeg-devel
|
BuildRequires: libjpeg-devel
|
||||||
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: pkgconfig(alsa) >= 0.9
|
BuildRequires: pkgconfig(alsa) >= 0.9
|
||||||
BuildRequires: pkgconfig(flac) >= 1.0.1
|
BuildRequires: pkgconfig(flac) >= 1.0.1
|
||||||
BuildRequires: pkgconfig(fluidsynth)
|
BuildRequires: pkgconfig(fluidsynth)
|
||||||
@ -44,6 +47,8 @@ BuildRequires: pkgconfig(theoradec) >= 1.0
|
|||||||
BuildRequires: pkgconfig(vorbis)
|
BuildRequires: pkgconfig(vorbis)
|
||||||
BuildRequires: pkgconfig(vorbisfile)
|
BuildRequires: pkgconfig(vorbisfile)
|
||||||
BuildRequires: pkgconfig(zlib)
|
BuildRequires: pkgconfig(zlib)
|
||||||
|
Suggests: %{name}-extra
|
||||||
|
Suggests: %{name}-tools
|
||||||
%if %{with faad}
|
%if %{with faad}
|
||||||
BuildRequires: libfaad-devel
|
BuildRequires: libfaad-devel
|
||||||
%endif
|
%endif
|
||||||
@ -53,8 +58,6 @@ BuildRequires: pkgconfig(mad)
|
|||||||
%ifarch %{ix86}
|
%ifarch %{ix86}
|
||||||
BuildRequires: nasm
|
BuildRequires: nasm
|
||||||
%endif
|
%endif
|
||||||
Suggests: %{name}-extra
|
|
||||||
Suggests: %{name}-tools
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
ScummVM is an interpreter that will play graphic adventure games written for
|
ScummVM is an interpreter that will play graphic adventure games written for
|
||||||
@ -78,10 +81,12 @@ These engines are in a worse state, but allow to play extra games.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
|
%patch1 -p1
|
||||||
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" base/version.cpp backends/plugins/elf/version.cpp
|
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{SOURCE99}")"
|
||||||
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S')
|
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
|
||||||
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/" base/version.cpp backends/plugins/elf/version.cpp
|
TIME="\"$(date -d "${modified}" "+%%R")\""
|
||||||
|
sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" \
|
||||||
|
base/version.cpp backends/plugins/elf/version.cpp
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# No rpm configure because scummvm's configure isn't a real configure and thus
|
# No rpm configure because scummvm's configure isn't a real configure and thus
|
||||||
|
197
use-getaddrinfo.patch
Normal file
197
use-getaddrinfo.patch
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
|
||||||
|
index 4971388..1ff4ed9 100644
|
||||||
|
--- a/backends/midi/timidity.cpp
|
||||||
|
+++ b/backends/midi/timidity.cpp
|
||||||
|
@@ -52,24 +52,18 @@
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
-#include <netdb.h> /* for gethostbyname */
|
||||||
|
+#include <netdb.h> /* for getaddrinfo */
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
-// WORKAROUND bug #1870304: Solaris does not provide INADDR_NONE.
|
||||||
|
-#ifndef INADDR_NONE
|
||||||
|
-#define INADDR_NONE 0xffffffff
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
// BeOS BONE uses snooze (x/1000) in place of usleep(x)
|
||||||
|
#ifdef __BEOS__
|
||||||
|
#define usleep(v) snooze(v/1000)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-
|
||||||
|
#define SEQ_MIDIPUTC 5
|
||||||
|
|
||||||
|
#define TIMIDITY_LOW_DELAY
|
||||||
|
@@ -84,7 +78,7 @@
|
||||||
|
|
||||||
|
/* default host & port */
|
||||||
|
#define DEFAULT_TIMIDITY_HOST "127.0.0.1"
|
||||||
|
-#define DEFAULT_TIMIDITY_PORT 7777
|
||||||
|
+#define DEFAULT_TIMIDITY_PORT "7777"
|
||||||
|
|
||||||
|
class MidiDriver_TIMIDITY : public MidiDriver_MPU401 {
|
||||||
|
public:
|
||||||
|
@@ -97,11 +91,8 @@ public:
|
||||||
|
void sysEx(const byte *msg, uint16 length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
- /* standart routine to extract ip address from a string */
|
||||||
|
- in_addr_t host_to_addr(const char* address);
|
||||||
|
-
|
||||||
|
/* creates a tcp connection to TiMidity server, returns filedesc (like open()) */
|
||||||
|
- int connect_to_server(const char* hostname, unsigned short tcp_port);
|
||||||
|
+ int connect_to_server(const char* hostname, const char* tcp_port);
|
||||||
|
|
||||||
|
/* send command to the server; printf-like; returns reply string */
|
||||||
|
char *timidity_ctl_command(const char *fmt, ...) GCC_PRINTF(2, 3);
|
||||||
|
@@ -150,7 +141,8 @@ MidiDriver_TIMIDITY::MidiDriver_TIMIDITY() {
|
||||||
|
int MidiDriver_TIMIDITY::open() {
|
||||||
|
char *res;
|
||||||
|
char timidity_host[NI_MAXHOST];
|
||||||
|
- int timidity_port, data_port, i;
|
||||||
|
+ char timidity_port[6], data_port[6];
|
||||||
|
+ int num;
|
||||||
|
|
||||||
|
/* count ourselves open */
|
||||||
|
if (_isOpen)
|
||||||
|
@@ -166,16 +158,16 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
|
/* extract control port */
|
||||||
|
if ((res = strrchr(timidity_host, ':')) != NULL) {
|
||||||
|
*res++ = '\0';
|
||||||
|
- timidity_port = atoi(res);
|
||||||
|
+ Common::strlcpy(timidity_port, res, sizeof(timidity_port));
|
||||||
|
} else {
|
||||||
|
- timidity_port = DEFAULT_TIMIDITY_PORT;
|
||||||
|
+ Common::strlcpy(timidity_port, DEFAULT_TIMIDITY_PORT, sizeof(timidity_port));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* create control connection to the server
|
||||||
|
*/
|
||||||
|
if ((_control_fd = connect_to_server(timidity_host, timidity_port)) < 0) {
|
||||||
|
- warning("TiMidity: can't open control connection (host=%s, port=%d)", timidity_host, timidity_port);
|
||||||
|
+ warning("TiMidity: can't open control connection (host=%s, port=%s)", timidity_host, timidity_port);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -183,7 +175,7 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
|
* "220 TiMidity++ v2.13.2 ready)" */
|
||||||
|
res = timidity_ctl_command(NULL);
|
||||||
|
if (atoi(res) != 220) {
|
||||||
|
- warning("TiMidity: bad response from server (host=%s, port=%d): %s", timidity_host, timidity_port, res);
|
||||||
|
+ warning("TiMidity: bad response from server (host=%s, port=%s): %s", timidity_host, timidity_port, res);
|
||||||
|
close_all();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -198,13 +190,11 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
|
|
||||||
|
/* should read something like "200 63017 is ready acceptable",
|
||||||
|
* where 63017 is port for data connection */
|
||||||
|
- // FIXME: The following looks like a cheap endian test. If this is true, then
|
||||||
|
- // it should be replaced by suitable #ifdef SCUMM_LITTLE_ENDIAN.
|
||||||
|
- i = 1;
|
||||||
|
- if (*(char *)&i == 1)
|
||||||
|
- res = timidity_ctl_command("OPEN lsb");
|
||||||
|
- else
|
||||||
|
- res = timidity_ctl_command("OPEN msb");
|
||||||
|
+#ifdef SCUMM_LITTLE_ENDIAN
|
||||||
|
+ res = timidity_ctl_command("OPEN lsb");
|
||||||
|
+#else
|
||||||
|
+ res = timidity_ctl_command("OPEN msb");
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (atoi(res) != 200) {
|
||||||
|
warning("TiMidity: bad reply for OPEN command: %s", res);
|
||||||
|
@@ -215,9 +205,15 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
|
/*
|
||||||
|
* open data connection
|
||||||
|
*/
|
||||||
|
- data_port = atoi(res + 4);
|
||||||
|
+ num = atoi(res + 4);
|
||||||
|
+ if (num > 65535) {
|
||||||
|
+ warning("TiMidity: Invalid port %d given.\n", num);
|
||||||
|
+ close_all();
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ snprintf(data_port, sizeof(data_port), "%d", num);
|
||||||
|
if ((_data_fd = connect_to_server(timidity_host, data_port)) < 0) {
|
||||||
|
- warning("TiMidity: can't open data connection (host=%s, port=%d)", timidity_host, data_port);
|
||||||
|
+ warning("TiMidity: can't open data connection (host=%s, port=%s)", timidity_host, data_port);
|
||||||
|
close_all();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -277,46 +273,33 @@ void MidiDriver_TIMIDITY::teardown() {
|
||||||
|
close_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
-in_addr_t MidiDriver_TIMIDITY::host_to_addr(const char* address) {
|
||||||
|
- in_addr_t addr;
|
||||||
|
- struct hostent *hp;
|
||||||
|
-
|
||||||
|
- /* first check if IP address is given (like 127.0.0.1)*/
|
||||||
|
- if ((addr = inet_addr(address)) != INADDR_NONE)
|
||||||
|
- return addr;
|
||||||
|
-
|
||||||
|
- /* if not, try to resolve a hostname */
|
||||||
|
- if ((hp = gethostbyname(address)) == NULL) {
|
||||||
|
- warning("TiMidity: unknown hostname: %s", address);
|
||||||
|
- return INADDR_NONE;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- memcpy(&addr, hp->h_addr, (int)sizeof(in_addr_t) <= hp->h_length ? sizeof(in_addr_t) : hp->h_length);
|
||||||
|
-
|
||||||
|
- return addr;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-int MidiDriver_TIMIDITY::connect_to_server(const char* hostname, unsigned short tcp_port) {
|
||||||
|
+int MidiDriver_TIMIDITY::connect_to_server(const char* hostname, const char* tcp_port) {
|
||||||
|
int fd;
|
||||||
|
- struct sockaddr_in in;
|
||||||
|
- unsigned int addr;
|
||||||
|
-
|
||||||
|
- /* create socket */
|
||||||
|
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
|
- warning("TiMidity: socket(): %s", strerror(errno));
|
||||||
|
+ struct addrinfo hints;
|
||||||
|
+ struct addrinfo *result, *rp;
|
||||||
|
+
|
||||||
|
+ /* get all address(es) matching host and port */
|
||||||
|
+ memset(&hints, 0, sizeof(struct addrinfo));
|
||||||
|
+ hints.ai_socktype = SOCK_STREAM;
|
||||||
|
+ hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
||||||
|
+ if (getaddrinfo(hostname, tcp_port, &hints, &result) != 0) {
|
||||||
|
+ warning("TiMidity: getaddrinfo: %s\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* connect */
|
||||||
|
- memset(&in, 0, sizeof(in));
|
||||||
|
- in.sin_family = AF_INET;
|
||||||
|
- in.sin_port = htons(tcp_port);
|
||||||
|
- addr = host_to_addr(hostname);
|
||||||
|
- memcpy(&in.sin_addr, &addr, 4);
|
||||||
|
-
|
||||||
|
- if (connect(fd, (struct sockaddr *)&in, sizeof(in)) < 0) {
|
||||||
|
- warning("TiMidity: connect(): %s", strerror(errno));
|
||||||
|
+ /* Try all address structures we have got previously */
|
||||||
|
+ for (rp = result; rp != NULL; rp = rp->ai_next) {
|
||||||
|
+ if ((fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) == -1)
|
||||||
|
+ continue;
|
||||||
|
+ if (connect(fd, rp->ai_addr, rp->ai_addrlen) != -1)
|
||||||
|
+ break;
|
||||||
|
::close(fd);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ freeaddrinfo(result);
|
||||||
|
+
|
||||||
|
+ if (rp == NULL) {
|
||||||
|
+ warning("TiMidity: Could not connect\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user