diff --git a/testing/heimdal/001_all_heimdal-no_libedit.patch b/testing/heimdal/001_all_heimdal-no_libedit.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a551bdce158cfae0d198152d19437c8afff4a6c6
--- /dev/null
+++ b/testing/heimdal/001_all_heimdal-no_libedit.patch
@@ -0,0 +1,10 @@
+--- cf/krb-readline.m4	2005-06-16 18:28:32.000000000 +0200
++++ cf/krb-readline.m4	2005-06-27 23:17:06.000000000 +0200
+@@ -6,7 +6,6 @@
+ dnl el_init
+ 
+ AC_DEFUN([KRB_READLINE],[
+-AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
+ if test "$ac_cv_func_el_init" = yes ; then
+ 	AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
+ 		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
diff --git a/testing/heimdal/002_all_heimdal-fPIC.patch b/testing/heimdal/002_all_heimdal-fPIC.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c67dbae764632cc3a909a10eaae2efe813551fde
--- /dev/null
+++ b/testing/heimdal/002_all_heimdal-fPIC.patch
@@ -0,0 +1,12 @@
+--- lib/editline/Makefile.am	2005-06-16 18:28:44.000000000 +0200
++++ lib/editline/Makefile.am	2005-06-27 23:21:02.000000000 +0200
+@@ -41,6 +41,9 @@
+ 
+ EXTRA_DIST = $(man_MANS)
+ 
++$(libeditline_la_OBJECTS): %.lo: %.c
++	$(LTCOMPILE) -fPIC -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
++
+ snprintf.c:
+ 	$(LN_S) $(srcdir)/../roken/snprintf.c .
+ strdup.c:
diff --git a/testing/heimdal/003_all_heimdal-rxapps.patch b/testing/heimdal/003_all_heimdal-rxapps.patch
new file mode 100644
index 0000000000000000000000000000000000000000..40fc05f083d3328a93fcb83c3c2ddfbc1551b60d
--- /dev/null
+++ b/testing/heimdal/003_all_heimdal-rxapps.patch
@@ -0,0 +1,22 @@
+--- appl/kx/rxtelnet.in	2005-06-16 18:29:10.000000000 +0200
++++ appl/kx/rxtelnet.in	2005-06-27 23:21:34.000000000 +0200
+@@ -2,7 +2,7 @@
+ # $Id: rxtelnet.in,v 1.31 2004/03/07 17:22:06 lha Exp $
+ #
+ usage="Usage: $0 [-l username] [-k] [-fF] [-t args_to_telnet] [-x args_to_xterm] [-K args_to_kx] [-w term_emulator] [-b telnet_binary] [-n] [-v] [-h | --help] [--version] host [port]"
+-binary=telnet
++binary=ktelnet
+ term=
+ kx_args=-P
+ while true
+--- appl/kx/rxterm.in	2005-06-16 18:29:10.000000000 +0200
++++ appl/kx/rxterm.in	2005-06-27 23:21:55.000000000 +0200
+@@ -2,7 +2,7 @@
+ # $Id: rxterm.in,v 1.23 2002/03/18 17:37:34 joda Exp $
+ #
+ usage="Usage: $0 [-l username] [-k] [-f] [-r rsh_args] [-x xterm_args] [-K kx_args] [-w term_emulator] [-b rsh_binary][-v] [-h | --help] [--version] host"
+-binary=rsh
++binary=krsh
+ term=xterm
+ while true
+ do
diff --git a/testing/heimdal/005_all_heimdal-suid_fix.patch b/testing/heimdal/005_all_heimdal-suid_fix.patch
new file mode 100644
index 0000000000000000000000000000000000000000..35a9ed9f6b47153b8eec2811d7159bf0f0213a3f
--- /dev/null
+++ b/testing/heimdal/005_all_heimdal-suid_fix.patch
@@ -0,0 +1,20 @@
+--- appl/su/Makefile.am	2005-06-16 18:27:46.000000000 +0200
++++ appl/su/Makefile.am	2005-06-27 23:25:21.000000000 +0200
+@@ -7,6 +7,7 @@
+ bin_PROGRAMS = su
+ bin_SUIDS = su
+ su_SOURCES = su.c supaths.h
++su_LDFLAGS = -Wl,-z,now
+ man_MANS = su.1
+ 
+ LDADD = $(LIB_kafs) \
+--- appl/otp/Makefile.am	2005-06-16 18:28:46.000000000 +0200
++++ appl/otp/Makefile.am	2005-06-27 23:25:40.000000000 +0200
+@@ -8,6 +8,7 @@
+ bin_SUIDS = otp
+ otp_SOURCES = otp.c otp_locl.h
+ otpprint_SOURCES = otpprint.c otp_locl.h
++otp_LDFLAGS = -Wl,-z,now
+ 
+ man_MANS = otp.1  otpprint.1
+ 
diff --git a/testing/heimdal/013_all_heimdal-pthread-lib.patch b/testing/heimdal/013_all_heimdal-pthread-lib.patch
new file mode 100644
index 0000000000000000000000000000000000000000..19f8794075f1d31182f1729d7cf2bb63b7bd9265
--- /dev/null
+++ b/testing/heimdal/013_all_heimdal-pthread-lib.patch
@@ -0,0 +1,11 @@
+--- heimdal-0.7.1/cf/pthreads.m4.old	2005-09-09 12:12:28.000000000 +0000
++++ heimdal-0.7.1/cf/pthreads.m4	2005-09-17 22:23:23.000000000 +0000
+@@ -32,7 +32,7 @@
+ 	2.*)
+ 		native_pthread_support=yes
+ 		PTHREADS_CFLAGS=-pthread
+-		PTHREADS_LIBS=-pthread
++		PTHREADS_LIBS=-lpthread
+ 		;;
+ 	esac
+ 	;;
diff --git a/testing/heimdal/014_all_heimdal-path.patch b/testing/heimdal/014_all_heimdal-path.patch
new file mode 100644
index 0000000000000000000000000000000000000000..36a86f1f93b5939d4351f331c38dc087ed420a46
--- /dev/null
+++ b/testing/heimdal/014_all_heimdal-path.patch
@@ -0,0 +1,50 @@
+--- appl/rcp/rcp.c.old	2006-05-03 13:31:59.398493625 +0200
++++ appl/rcp/rcp.c	2006-05-03 13:32:04.494485981 +0200
+@@ -34,7 +34,7 @@
+ #include "rcp_locl.h"
+ #include <getarg.h>
+ 
+-#define RSH_PROGRAM "rsh"
++#define RSH_PROGRAM "krsh"
+ 
+ struct  passwd *pwd;
+ uid_t	userid;
+--- appl/rcp/rcp_locl.h.old	2006-05-03 02:30:31.602025409 +0200
++++ appl/rcp/rcp_locl.h	2006-05-03 02:30:35.886018983 +0200
+@@ -64,4 +64,4 @@
+ #define	_PATH_CP	"/bin/cp"
+ #endif
+ #undef _PATH_RSH
+-#define	_PATH_RSH	BINDIR "/rsh"
++#define	_PATH_RSH	BINDIR "/krsh"
+--- appl/telnet/telnetd/telnetd.h.old	2006-05-03 02:23:14.582680939 +0200
++++ appl/telnet/telnetd/telnetd.h	2006-05-03 02:23:23.746667193 +0200
+@@ -192,7 +192,7 @@
+ #endif
+ 
+ #undef _PATH_LOGIN
+-#define _PATH_LOGIN	BINDIR "/login"
++#define _PATH_LOGIN	BINDIR "/klogin"
+ 
+ /* fallbacks */
+ 
+--- appl/login/shadow.c.old	2006-05-05 06:31:29.517138115 +0200
++++ appl/login/shadow.c	2006-05-05 06:32:26.433052741 +0200
+@@ -38,7 +38,7 @@
+ #ifdef HAVE_SHADOW_H
+ 
+ #ifndef _PATH_CHPASS
+-#define _PATH_CHPASS "/usr/bin/passwd"
++#define _PATH_CHPASS "/usr/bin/kpasswd"
+ #endif
+ 
+ static int
+@@ -52,7 +52,7 @@
+         printf("fork /bin/passwd");
+         exit(1);
+     case 0:
+-        execlp(_PATH_CHPASS, "passwd", who->pw_name, (char *) 0);
++        execlp(_PATH_CHPASS, "kpasswd", who->pw_name, (char *) 0);
+         exit(1);
+     default:
+         waitpid(pid, &status, 0);
diff --git a/testing/heimdal/022_all_heimdal-as-needed.patch b/testing/heimdal/022_all_heimdal-as-needed.patch
new file mode 100644
index 0000000000000000000000000000000000000000..69c791778a5482a808911f7ccff1f6561e8590b4
--- /dev/null
+++ b/testing/heimdal/022_all_heimdal-as-needed.patch
@@ -0,0 +1,22 @@
+--- lib/roken/Makefile.am.old	2007-11-05 19:42:53.000000000 +0100
++++ lib/roken/Makefile.am	2007-11-05 19:43:12.000000000 +0100
+@@ -107,7 +107,7 @@
+ 	ifaddrs.hin		\
+ 	vis.hin	
+ 
+-libroken_la_LIBADD = @LTLIBOBJS@
++libroken_la_LIBADD = @LTLIBOBJS@ $(LIB_crypt)
+ 
+ $(LTLIBOBJS) $(libroken_la_OBJECTS): roken.h $(XHEADERS)
+ 
+--- lib/editline/Makefile.am.old	2007-11-05 19:46:08.000000000 +0100
++++ lib/editline/Makefile.am	2007-11-05 20:06:54.000000000 +0100
+@@ -36,6 +36,8 @@
+ 	unix.h \
+ 	$(EXTRA_SOURCE)
+ 
++libeditline_la_LIBADD = $(LIB_tgetent)
++
+ EXTRA_SOURCE = $(ES) 
+ 
+ libel_compat_la_SOURCES = edit_compat.c edit_compat.h
diff --git a/testing/heimdal/APKBUILD b/testing/heimdal/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..c7de18727501b625bcb6d9822a506995e973b6f6
--- /dev/null
+++ b/testing/heimdal/APKBUILD
@@ -0,0 +1,74 @@
+# Contributor: Leonardo Arena <rnalrd@gmail.com>
+pkgname=heimdal
+pkgver=1.2.1
+pkgrel=0
+pkgdesc="An implementation of Kerberos 5"
+url="http://www.h5l.org/"
+license="BSD"
+depends="uclibc sqlite readline openssl"
+makedepends="gawk readline-dev"
+install=
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://www.h5l.org/dist/src/$pkgname-$pkgver.tar.gz
+001_all_heimdal-no_libedit.patch
+002_all_heimdal-fPIC.patch
+003_all_heimdal-rxapps.patch
+005_all_heimdal-suid_fix.patch
+013_all_heimdal-pthread-lib.patch
+014_all_heimdal-path.patch
+022_all_heimdal-as-needed.patch
+heimdal-system_sqlite.patch
+heimdal-r23235-kb5-libwind_la.patch
+heimdal-r23238-kb5_locl_h-wind_h.patch
+"
+
+build() {
+	[ -e /usr/lib/libasn1.so ] && echo "## remove old heimdal pkg first ##" && return 1
+
+	cd "$srcdir/$pkgname-$pkgver"
+	
+	patch -Np0 -i ../../001_all_heimdal-no_libedit.patch || return 1
+	patch -Np0 -i ../../002_all_heimdal-fPIC.patch || return 1
+	patch -Np0 -i ../../003_all_heimdal-rxapps.patch || return 1
+	patch -Np0 -i ../../005_all_heimdal-suid_fix.patch || return 1
+	patch -Np1 -i ../../013_all_heimdal-pthread-lib.patch || return 1
+	patch -Np0 -i ../../014_all_heimdal-path.patch || return 1
+	patch -Np0 -i ../../022_all_heimdal-as-needed.patch || return 1
+	patch -Np0 -i ../../heimdal-system_sqlite.patch || return 1
+	patch -Np2 -i ../../heimdal-r23235-kb5-libwind_la.patch || return 1
+	patch -Np2 -i ../../heimdal-r23238-kb5_locl_h-wind_h.patch || return 1
+
+	sed -i -e 's|var/heimdal|var/lib/heimdal|g' configure.in \
+	doc/setup.texi doc/heimdal.info kadmin/kadmind.8 kdc/kdc.8 \
+	lib/hdb/hdb.h lib/krb5/krb5.conf.5 lib/krb5/krb5.conf.cat5
+
+	export LDFLAGS="${LDFLAGS} -Wl,--as-needed"
+
+	./configure --prefix=/usr \
+		--enable-shared=yes --without-x \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info
+		--datadir=/var/lib/heimdal \
+		--localstatedir=/var/lib/heimdal \
+		--libexecdir=/usr/sbin \
+		--disable-berkeley-db \
+		--with-readline-lib=/usr/lib \
+		--with-readline-include=/usr/include/readline \
+		--with-openssl=/usr
+
+	make || return 1
+	make DESTDIR="$pkgdir" install
+}
+
+md5sums="6e5028077e2a6b101a4a72801ba71b9e  heimdal-1.2.1.tar.gz
+98e28f11f906c967aac22d6184102c9e  001_all_heimdal-no_libedit.patch
+6d5571bdedba2e2423b90bccdbac2c0a  002_all_heimdal-fPIC.patch
+2feec3924ee5230b54175b4d4000c872  003_all_heimdal-rxapps.patch
+45aeb207f360f9f4e9e0fabc8bfeecbc  005_all_heimdal-suid_fix.patch
+1b8665b771c4eb6b56ea8582c96e56e3  013_all_heimdal-pthread-lib.patch
+8208ae8c0b6ff5ab4f64af1693e9e396  014_all_heimdal-path.patch
+d7649e078c87d2ca997080f0deb527c0  022_all_heimdal-as-needed.patch
+949a389ebe7652861b2e178a7e0f1ed9  heimdal-system_sqlite.patch
+072f6b2550693adb30117394b1dd354e  heimdal-r23235-kb5-libwind_la.patch
+7b4537b0e8bde95214211091e55eacf5  heimdal-r23238-kb5_locl_h-wind_h.patch"
diff --git a/testing/heimdal/heimdal-r23235-kb5-libwind_la.patch b/testing/heimdal/heimdal-r23235-kb5-libwind_la.patch
new file mode 100644
index 0000000000000000000000000000000000000000..88c02e598c66766e990a0218784d90d586f7ec82
--- /dev/null
+++ b/testing/heimdal/heimdal-r23235-kb5-libwind_la.patch
@@ -0,0 +1,10 @@
+--- trunk/heimdal/lib/krb5/Makefile.am	2008-06-01 22:25:41 UTC (rev 23234)
++++ trunk/heimdal/lib/krb5/Makefile.am	2008-06-01 22:25:53 UTC (rev 23235)
+@@ -57,6 +57,7 @@
+ 	$(LIB_com_err) \
+ 	$(LIB_hcrypto) \
+ 	$(top_builddir)/lib/asn1/libasn1.la \
++	../wind/libwind.la \
+ 	$(LIBADD_roken) \
+ 	$(LIB_door_create) \
+ 	$(LIB_dlopen)
diff --git a/testing/heimdal/heimdal-r23238-kb5_locl_h-wind_h.patch b/testing/heimdal/heimdal-r23238-kb5_locl_h-wind_h.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5390b2cf69a7651fef30951a57fea119fe7161fa
--- /dev/null
+++ b/testing/heimdal/heimdal-r23238-kb5_locl_h-wind_h.patch
@@ -0,0 +1,11 @@
+--- trunk/heimdal/lib/krb5/krb5_locl.h	2008-06-01 22:26:24 UTC (rev 23237)
++++ trunk/heimdal/lib/krb5/krb5_locl.h	2008-06-01 22:26:43 UTC (rev 23238)
+@@ -131,6 +131,8 @@
+ #include <parse_time.h>
+ #include <base64.h>
+ 
++#include <wind.h>
++
+ #include "crypto-headers.h"
+
+
diff --git a/testing/heimdal/heimdal-system_sqlite.patch b/testing/heimdal/heimdal-system_sqlite.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2f8254e4d6b0c5c00a67747e085569cabf1c05e0
--- /dev/null
+++ b/testing/heimdal/heimdal-system_sqlite.patch
@@ -0,0 +1,56 @@
+diff -Naur tmp-old/configure.in tmp-new/configure.in
+--- configure.in	2008-06-08 08:06:38.000000000 +0000
++++ configure.in	2008-06-08 08:15:29.000000000 +0000
+@@ -104,6 +104,8 @@
+ 
+ KRB_PTHREADS
+ 
++PKG_CHECK_MODULES([sqlite], [sqlite3])
++
+ AC_ARG_ENABLE(dce, 
+ 	AS_HELP_STRING([--enable-dce],[if you want support for DCE/DFS PAG's]))
+ if test "$enable_dce" = yes; then
+diff -Naur tmp-old/lib/Makefile.am tmp-new/lib/Makefile.am
+--- lib/Makefile.am	2008-06-07 16:53:11.000000000 +0000
++++ lib/Makefile.am	2008-06-07 16:55:58.000000000 +0000
+@@ -18,6 +18,6 @@
+ dir_hcrypto = hcrypto
+ endif
+ 
+-SUBDIRS = roken vers editline $(dir_com_err) sl wind asn1 sqlite \
++SUBDIRS = roken vers editline $(dir_com_err) sl wind asn1 \
+ 	$(dir_hcrypto) hx509 krb5 ntlm kafs gssapi hdb kadm5 \
+ 	auth $(dir_45) $(dir_otp) $(dir_dce)
+diff -Naur tmp-old/lib/krb5/Makefile.am tmp-new/lib/krb5/Makefile.am
+--- lib/krb5/Makefile.am	2008-06-07 16:54:02.000000000 +0000
++++ lib/krb5/Makefile.am	2008-06-08 08:17:00.000000000 +0000
+@@ -2,7 +2,7 @@
+ 
+ include $(top_srcdir)/Makefile.am.common
+ 
+-AM_CPPFLAGS += $(INCLUDE_krb4) $(INCLUDE_hcrypto) -I../com_err -I$(srcdir)/../com_err -I$(srcdir)/../sqlite
++AM_CPPFLAGS += $(INCLUDE_krb4) $(INCLUDE_hcrypto) -I../com_err -I$(srcdir)/../com_err $(sqlite_CFLAGS)
+ 
+ bin_PROGRAMS = verify_krb5_conf
+ 
+@@ -53,7 +53,7 @@
+ 
+ libkrb5_la_LIBADD = \
+ 	$(LIB_pkinit) \
+-	../sqlite/libsqlite.la \
++	$(sqlite_LIBS) \
+ 	$(LIB_com_err) \
+ 	$(LIB_hcrypto) \
+ 	$(top_builddir)/lib/asn1/libasn1.la \
+diff -Naur tmp-old/lib/krb5/scache.c tmp-new/lib/krb5/scache.c
+--- lib/krb5/scache.c	2008-06-07 16:54:30.000000000 +0000
++++ lib/krb5/scache.c	2008-06-07 17:01:43.000000000 +0000
+@@ -32,7 +32,7 @@
+  */
+ 
+ #include "krb5_locl.h"
+-#include "sqlite3.h"
++#include <sqlite3.h>
+ 
+ RCSID("$Id: heimdal-system_sqlite.patch,v 1.1 2008/06/11 07:27:47 mueli Exp $");
+