diff options
author | Martin Gerhardy <martin.gerhardy@gmail.com> | 2013-08-06 17:37:41 (GMT) |
---|---|---|
committer | Martin Gerhardy <martin.gerhardy@gmail.com> | 2013-08-06 17:57:06 (GMT) |
commit | 853fdcc72cc08fe8bd96653bfe12579c4c826874 (patch) | |
tree | 117238f409f57d971af490edba3093adcfce8e3c | |
parent | 641c765f3147657b26f5a1998014486474200d8f (diff) | |
download | mxe-853fdcc72cc08fe8bd96653bfe12579c4c826874.zip mxe-853fdcc72cc08fe8bd96653bfe12579c4c826874.tar.gz mxe-853fdcc72cc08fe8bd96653bfe12579c4c826874.tar.bz2 |
new package sdl_rwhttp
the test is currently disabled - I still have to fix it
-rw-r--r-- | index.html | 4 | ||||
-rw-r--r-- | src/sdl_rwhttp-test.c | 46 | ||||
-rw-r--r-- | src/sdl_rwhttp.mk | 36 |
3 files changed, 86 insertions, 0 deletions
@@ -1968,6 +1968,10 @@ USE_OSGPLUGIN(<plugin2>) <td class="website"><a href="http://sdlpango.sourceforge.net/">SDL_Pango</a></td> </tr> <tr> + <td class="package">sdl_rwhttp</td> + <td class="website"><a href="http://github.com/mgerhardy/SDL_rwhttp/">SDL_rwhttp</a></td> + </tr> + <tr> <td class="package">sdl_sound</td> <td class="website"><a href="http://icculus.org/SDL_sound/">SDL_sound</a></td> </tr> diff --git a/src/sdl_rwhttp-test.c b/src/sdl_rwhttp-test.c new file mode 100644 index 0000000..29fa316 --- /dev/null +++ b/src/sdl_rwhttp-test.c @@ -0,0 +1,46 @@ +/* + * This file is part of MXE. + * See index.html for further information. + * + * This is a simple test program for SDL_rwhttp that tries to + * fetch something from the web. + * + * This file is in the Public Domain. + */ + +#include <stdio.h> +#include <SDL_rwhttp.h> + +int main(int argc, char *argv[]) +{ + int ret = EXIT_SUCCESS; + const char *url; + SDL_RWops* rwops; + + if (argc != 2) { + fprintf(stderr, "usage: %s <url>\n", argv[0]); + return EXIT_FAILURE; + } + + url = argv[1]; + + if (SDL_RWHttpInit() == -1) { + fprintf(stderr, "%s\n", SDL_GetError()); + return EXIT_FAILURE; + } + + rwops = SDL_RWFromHttpSync(url); + if (!rwops) { + fprintf(stderr, "%s\n", SDL_GetError()); + ret = EXIT_FAILURE; + } else { + printf("success with length: %i\n", (int) SDL_RWsize(rwops)); + SDL_RWclose(rwops); + } + + if (SDL_RWHttpShutdown() == -1) { + fprintf(stderr, "%s\n", SDL_GetError()); + return EXIT_FAILURE; + } + return ret; +} diff --git a/src/sdl_rwhttp.mk b/src/sdl_rwhttp.mk new file mode 100644 index 0000000..66aabbe --- /dev/null +++ b/src/sdl_rwhttp.mk @@ -0,0 +1,36 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := sdl_rwhttp +$(PKG)_IGNORE := +$(PKG)_VERSION := 0.1.0 +$(PKG)_CHECKSUM := de3b106833173752a4aea558047896d482f019b2 +$(PKG)_SUBDIR := SDL_rwhttp-$($(PKG)_VERSION) +$(PKG)_FILE := SDL_rwhttp-$($(PKG)_VERSION).tar.gz +$(PKG)_URL := https://github.com/mgerhardy/SDL_rwhttp/releases/download/$(call SHORT_PKG_VERSION,$(PKG))/$($(PKG)_FILE) +$(PKG)_DEPS := gcc curl + +$(PKG)_DEPS_i686-pc-mingw32 := sdl sdl_net +$(PKG)_DEPS_i686-w64-mingw32 := sdl2 sdl2_net +$(PKG)_DEPS_x86_64-w64-mingw32 := sdl2 sdl2_net + +define $(PKG)_UPDATE + $(WGET) -q -O- 'http://github.com/mgerhardy/SDL_rwhttp/tags' | \ + grep '<a href="/mgerhardy/SDL_rwhttp/archive/' | \ + $(SED) -n 's,.*href="/mgerhardy/SDL_rwhttp/archive/\([0-9][^"_]*\)\.tar.*,\1,p' | \ + head -1 +endef + +define $(PKG)_BUILD + cd '$(1)' && ./configure \ + --host='$(TARGET)' \ + --disable-shared \ + --prefix='$(PREFIX)/$(TARGET)' \ + WINDRES='$(TARGET)-windres' + $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + +# '$(TARGET)-gcc' \ +# -W -Wall -Werror -ansi -pedantic \ +# '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-sdl_rwhttp.exe' \ +# `'$(TARGET)-pkg-config' SDL_rwhttp --cflags --libs` +endef |