Ports: Add port for SDL2_net

This commit is contained in:
Gunnar Beutner 2021-06-16 11:08:32 +02:00 committed by Andreas Kling
parent f589acaac9
commit dd35bd158e
5 changed files with 50 additions and 0 deletions

View file

@ -123,6 +123,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`SDL2_gfx`](SDL2_gfx/) | SDL2\_gfx (Graphics primitives add-on for SDL2) | 1.0.4 | https://sourceforge.net/projects/sdl2gfx/ |
| [`SDL2_image`](SDL2_image/) | SDL2\_image (Image loading add-on for SDL2) | 2.0.5 | https://www.libsdl.org/projects/SDL_image/ |
| [`SDL2_mixer`](SDL2_mixer/) | SDL2\_mixer (audio mixer add-on for SDL2) | 2.0.4 | https://www.libsdl.org/projects/SDL_mixer/ |
| [`SDL2_net`](SDL2_net/) | SDL2\_net (network add-on for SDL2) | 2.0.1 | https://www.libsdl.org/projects/SDL_net/ |
| [`SDL2_ttf`](SDL2_ttf/) | SDL2\_ttf (TrueType Font add-on for SDL2) | 2.0.15 | https://www.libsdl.org/projects/SDL_ttf/ |
| [`sed`](sed/) | GNU sed | 4.2.1 | https://www.gnu.org/software/sed/ |
| [`sl`](sl/) | Steam Locomotive (SL) | | https://github.com/mtoyoda/sl |

12
Ports/SDL2_net/package.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=SDL2_net
version=2.0.1
useconfigure=true
configopts=--with-sdl-prefix="${SERENITY_INSTALL_ROOT}/usr/local"
files="https://www.libsdl.org/projects/SDL_net/release/SDL2_net-${version}.tar.gz SDL2_net-${version}.tar.gz 15ce8a7e5a23dafe8177c8df6e6c79b6749a03fff1e8196742d3571657609d21"
auth_type=sha256
depends="SDL2"
post_install() {
run ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_net.so -Wl,-soname,libSDL2_net.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_net.a -Wl,--no-whole-archive
}

View file

@ -0,0 +1,12 @@
diff -Naur SDL2_net-2.0.1/config.sub SDL2_net-2.0.1.serenity/config.sub
--- SDL2_net-2.0.1/config.sub 2016-01-03 08:57:09.000000000 +0100
+++ SDL2_net-2.0.1.serenity/config.sub 2021-06-16 10:40:58.771380293 +0200
@@ -1364,7 +1364,7 @@
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* | -serenity* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \

View file

@ -0,0 +1,14 @@
diff -Naur SDL2_net-2.0.1/SDLnet.c SDL2_net-2.0.1.serenity/SDLnet.c
--- SDL2_net-2.0.1/SDLnet.c 2016-01-03 08:57:09.000000000 +0100
+++ SDL2_net-2.0.1.serenity/SDLnet.c 2021-06-16 10:48:32.073734588 +0200
@@ -184,6 +184,10 @@
return inet_ntoa(in);
}
+#ifdef __serenity__
+#undef SIOCGIFCONF
+#endif
+
int SDLNet_GetLocalAddresses(IPaddress *addresses, int maxcount)
{
int count = 0;

View file

@ -0,0 +1,11 @@
diff -Naur SDL2_net-2.0.1/SDLnetsys.h SDL2_net-2.0.1.serenity/SDLnetsys.h
--- SDL2_net-2.0.1/SDLnetsys.h 2021-06-16 10:42:24.609750625 +0200
+++ SDL2_net-2.0.1.serenity/SDLnetsys.h 2016-01-03 08:57:09.000000000 +0100
@@ -46,6 +46,7 @@
#include <iphlpapi.h>
#else /* UNIX */
#include <sys/types.h>
+#include <sys/select.h>
#ifdef __FreeBSD__
#include <sys/socket.h>
#endif