Browse files

gnutls

  • Loading branch information...
1 parent 73ab6c9 commit 7f9c89ee0b6f8808e464162a2dc6c6131f71caa6 @jyio committed Feb 1, 2012
Showing with 106 additions and 0 deletions.
  1. +41 −0 cookbook/gnutls/patch/gnutls-3.0.12-android.patch
  2. +65 −0 cookbook/gnutls/recipe.mk
View
41 cookbook/gnutls/patch/gnutls-3.0.12-android.patch
@@ -0,0 +1,41 @@
+--- gl/gettimeofday.c
++++ gl/gettimeofday.c
+@@ -99,9 +99,15 @@
+ that lack this function, or whose implementation of this function
+ causes problems. */
+
++#ifdef ANDROID
++int
++gettimeofday (struct timeval *restrict tv, struct timezone *restrict tz)
++{
++#else
+ int
+ gettimeofday (struct timeval *restrict tv, void *restrict tz)
+ {
++#endif
+ #undef gettimeofday
+ #if HAVE_GETTIMEOFDAY
+ # if GETTIMEOFDAY_CLOBBERS_LOCALTIME
+--- gl/read-file.c
++++ gl/read-file.c
+@@ -27,7 +27,7 @@
+ #include <stdio.h>
+
+ /* Get SIZE_MAX. */
+-#include <stdint.h>
++#include <limits.h>
+
+ /* Get malloc, realloc, free. */
+ #include <stdlib.h>
+--- src/benchmark.h
++++ src/benchmark.h
+@@ -6,7 +6,9 @@
+ #endif
+ #include "timespec.h" /* gnulib gettime */
+
++#ifndef ANDROID
+ typedef void (*sighandler_t)(int);
++#endif
+
+ void benchmark_cipher (int init, int debug_level);
+ void benchmark_tls (int debug_level);
View
65 cookbook/gnutls/recipe.mk
@@ -0,0 +1,65 @@
+NAME := gnutls
+VERSION := 3.0.12
+ARCHIVE := ${NAME}-${VERSION}.tar.xz
+
+# exports
+
+EXPORT_MAKE += $~/install $~/package/*.yml
+EXPORT_INSTALL += $~/install
+EXPORT_PACKAGE += $~/package/*.yml
+EXPORT_CLEAN += $~/clean
+EXPORT_CLOBBER += $~/clobber
+
+define RECIPE
+
+# common targets
+
+.PHONY: $~/install $~/package/*.yml $~/clean $~/clobber
+$~/install: $~/build/.d
+ cp -rlf $~/build/* ${TOP_INSTALL}/
+$~/package/*.yml: $~/build/.d
+ cd ${DIR_REPO}; cat ${TOP}/$$@ | opkg-buildyaml ${TOP}/$~/build
+$~/clean:
+ ${MAKE} -C $~/source clean
+$~/clobber:
+ rm -rf $~/source $~/build
+
+# build
+
+$~/${ARCHIVE}:
+ rm -rf $$@
+ wget http://ftp.gnu.org/gnu/${NAME}/${ARCHIVE} -O $$@
+
+$~/source/configure: | $~/${ARCHIVE} ${DIR_COOKBOOK}/nettle/install ${DIR_COOKBOOK}/libtasn1/install ${DIR_COOKBOOK}/libiconv/install
+ if [ ! -d $${@D} ]; then \
+ tar Jxf $~/${ARCHIVE} -C $~/; \
+ mv $~/${NAME}-${VERSION} $${@D}; \
+ cd $${@D}; \
+ patch -p0 < ../patch/gnutls-3.0.12-android.patch; \
+ fi
+
+$~/source/Makefile: $~/source/configure
+ cd $${@D}; CC="agcc.bash" CFLAGS="${CFLAGS}" CXX="agcc-bash-g++" CXXFLAGS="-I${NDKPATH}/sources/cxx-stl/stlport/stlport -Duint64_t='unsigned long long'" LD="agcc.bash" LDFLAGS="${LDFLAGS}" LIBS="${NDKPATH}/sources/cxx-stl/stlport/libs/armeabi/libstlport_static.a" AR="${AR}" STRIP="${STRIP} --strip-unneeded" ./configure --host=arm-android-eabi \
+ --with-nettle-prefix=${TOP_INSTALL}/system \
+ --with-libtasn1-prefix=${TOP_INSTALL}/system \
+ --with-libiconv-prefix=${TOP_INSTALL}/system \
+ --prefix=/system \
+ --sbindir=/system/xbin \
+ --sharedstatedir=/data/local/com \
+ --localstatedir=/data/local/var \
+ --oldincludedir=/system/include
+ sed -E 's/(install-exec-am\:) install-defexecDATA/\1/g' $${@D}/lib/Makefile > temp
+ mv temp $${@D}/lib/Makefile
+ sed -E 's/(install-exec-am\:) install-defexecDATA/\1/g' $${@D}/extra/Makefile > temp
+ mv temp $${@D}/extra/Makefile
+
+$~/build/.d: $~/source/Makefile
+ ${MAKE} -C $~/source
+ ${MAKE} -C $~/source install DESTDIR=${TOP}/$~/build
+ rm -rf $${@D}/system/lib/*.la $${@D}/system/lib/pkgconfig
+ -${STRIP} --strip-unneeded $${@D}/system/bin/*
+ touch $$@
+
+endef
+
+$(eval ${RECIPE})

0 comments on commit 7f9c89e

Please sign in to comment.