add package libmicrohttpd

This commit is contained in:
Tony Theodore 2013-11-12 00:59:52 +11:00
parent 0660b6af84
commit a35fbb2a43
4 changed files with 117 additions and 0 deletions

View File

@ -1637,6 +1637,10 @@ local-pkg-list: $(LOCAL_PKG_LIST)</pre>
<td class="package">libmad</td>
<td class="website"><a href="http://www.underbit.com/products/mad/">libmad</a></td>
</tr>
<tr>
<td class="package">libmicrohttpd</td>
<td class="website"><a href="http://www.gnu.org/software/libmicrohttpd/">GNU Libmicrohttpd</a></td>
</tr>
<tr>
<td class="package">libmikmod</td>
<td class="website"><a href="http://mikmod.raphnet.net/">libMikMod</a></td>

View File

@ -0,0 +1,27 @@
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From e4d4a423ea51d159b7a214b2aa2f6f36ab49df70 Mon Sep 17 00:00:00 2001
From: MXE
Date: Tue, 12 Nov 2013 00:45:28 +1100
Subject: [PATCH] add requirements to pkg-config file
diff --git a/libmicrohttpd.pc.in b/libmicrohttpd.pc.in
index 54ce379..5cb9321 100644
--- a/libmicrohttpd.pc.in
+++ b/libmicrohttpd.pc.in
@@ -6,7 +6,7 @@ includedir=@includedir@
Name: libmicrohttpd
Description: A library for creating an embedded HTTP server
Version: @VERSION@
-Requires:
+Requires: pthreads plibc
Conflicts:
Libs: -L${libdir} -lmicrohttpd
Libs.private: @MHD_LIBDEPS@
--
1.8.4

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

@ -0,0 +1,46 @@
/*
* This file is part of MXE.
* See index.html for further information.
*/
#include <stdio.h>
#include <sys/types.h>
#include <microhttpd.h>
#define PORT 8888
int answer_to_connection (void *cls, struct MHD_Connection *connection,
const char *url,
const char *method, const char *version,
const char *upload_data,
size_t *upload_data_size, void **con_cls)
{
const char *page = "<html><body>Hello, browser!</body></html>";
struct MHD_Response *response;
int ret;
response = MHD_create_response_from_buffer (strlen (page),
(void*) page, MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
}
int main (int argc, char *const *argv)
{
(void)argc;
(void)argv;
struct MHD_Daemon *daemon;
daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION, PORT, NULL, NULL,
&answer_to_connection, NULL, MHD_OPTION_END);
if (NULL == daemon) return 1;
getchar ();
MHD_stop_daemon (daemon);
return 0;
}

40
src/libmicrohttpd.mk Normal file
View File

@ -0,0 +1,40 @@
# This file is part of MXE.
# See index.html for further information.
PKG := libmicrohttpd
$(PKG)_IGNORE :=
$(PKG)_VERSION := 0.9.31
$(PKG)_CHECKSUM := 45d79b0ae25a7fa40dbae90a4195fed9d52f5041
$(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := ftp://ftp.gnu.org/pub/gnu/libmicrohttpd/$($(PKG)_FILE)
$(PKG)_DEPS := gcc plibc pthreads
define $(PKG)_UPDATE
$(WGET) -q -O- 'http://ftp.gnu.org/gnu/libmicrohttpd/?C=M;O=D' | \
$(SED) -n 's,.*<a href="libmicrohttpd-\([0-9][^"]*\)\.tar.*,\1,p' | \
$(SORT) -V | \
tail -1
endef
define $(PKG)_BUILD
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
--prefix='$(PREFIX)/$(TARGET)' \
--build="`config.guess`" \
--host='$(TARGET)' \
--enable-static \
--disable-shared \
CFLAGS="`'$(TARGET)-pkg-config' --cflags plibc`" \
LIBS="`'$(TARGET)-pkg-config' --libs plibc`"
$(MAKE) -C '$(1).build' -j '$(JOBS)' PROGRAMS=
$(MAKE) -C '$(1).build' -j 1 install PROGRAMS=
'$(TARGET)-gcc' \
-W -Wall -Werror -std=c99 -pedantic -Wno-error=unused-parameter \
'$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libmicrohttpd.exe' \
`'$(TARGET)-pkg-config' --cflags --libs libmicrohttpd`
endef
$(PKG)_BUILD_i686-w64-mingw32 =
$(PKG)_BUILD_x86_64-w64-mingw32 =