new package sdl_rwhttp

the test is currently disabled - I still have to fix it
This commit is contained in:
Martin Gerhardy 2013-08-06 19:37:41 +02:00
parent 641c765f31
commit 853fdcc72c
3 changed files with 86 additions and 0 deletions

View File

@ -1967,6 +1967,10 @@ USE_OSGPLUGIN(<plugin2>)
<td class="package">sdl_pango</td>
<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>

46
src/sdl_rwhttp-test.c Normal file
View File

@ -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;
}

36
src/sdl_rwhttp.mk Normal file
View File

@ -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