diff --git a/app-text/htmltidy/htmltidy-20092812.recipe b/app-text/htmltidy/htmltidy-20092812.recipe
deleted file mode 100644
index 2531292b1..000000000
--- a/app-text/htmltidy/htmltidy-20092812.recipe
+++ /dev/null
@@ -1,57 +0,0 @@
-SUMMARY="Tidy the layout and correct errors in HTML and XML documents"
-DESCRIPTION="htmltidy - Tidy the layout and correct errors in HTML and XML \
-documents."
-HOMEPAGE="http://tidy.sourceforge.net/"
-SOURCE_URI="cvs://:pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy/tidy#12/28/2009"
-REVISION="2"
-LICENSE="MIT"
-COPYRIGHT="1998-2008 World Wide Web Consortium"
-ARCHITECTURES="x86_gcc2 x86 x86_64"
-SECONDARY_ARCHITECTURES="x86_gcc2 x86"
-
-PROVIDES="
- htmltidy$secondaryArchSuffix = $portVersion
- cmd:tab2space$secondaryArchSuffix
- cmd:tidy$secondaryArchSuffix
- lib:libtidy_0.99$secondaryArchSuffix
- lib:libtidy$secondaryArchSuffix
- "
-REQUIRES="
- haiku$secondaryArchSuffix
- "
-PROVIDES_devel="
- devel:libtidy$secondaryArchSuffix
- "
-REQUIRES_devel="
- htmltidy$secondaryArchSuffix == $portVersion base
- "
-BUILD_REQUIRES="
- haiku${secondaryArchSuffix}_devel
- "
-BUILD_PREREQUIRES="
- cmd:gcc$secondaryArchSuffix
- cmd:as$secondaryArchSuffix
- cmd:make
- cmd:libtoolize
- cmd:autoconf
- "
-
-PATCHES="htmltidy-$portVersion.patchset"
-
-BUILD()
-{
- /bin/sh build/gnuauto/setup.sh
- runConfigure ./configure
- make
-}
-INSTALL()
-{
- make install
- prepareInstalledDevelLibs libtidy
- packageEntries devel $developDir
-}
-TEST()
-{
- cd test
- sh testall.sh
-}
diff --git a/app-text/htmltidy/patches/htmltidy-20092812.patchset b/app-text/htmltidy/patches/htmltidy-20092812.patchset
deleted file mode 100644
index ea11a2def..000000000
--- a/app-text/htmltidy/patches/htmltidy-20092812.patchset
+++ /dev/null
@@ -1,45 +0,0 @@
-From 1f39ac359161c8bb06a4f1d8e85465a70298bd5b Mon Sep 17 00:00:00 2001
-From: Adrien Destugues
-Date: Sun, 30 Mar 2014 12:30:32 +0200
-Subject: Fix path of generated binaries for tests.
-
-
-diff --git a/test/testone.sh b/test/testone.sh
-index 8abb3b9..b3dbd0f 100755
---- a/test/testone.sh
-+++ b/test/testone.sh
-@@ -24,7 +24,7 @@ set +f
-
- TESTNO=$1
- EXPECTED=$2
--TIDY=../bin/tidy
-+TIDY=../console/tidy
- INFILES=./input/in_${TESTNO}.*ml
- CFGFILE=./input/cfg_${TESTNO}.txt
-
---
-1.8.3.4
-
-
-From 2b3f8f044417309878612b135edff9726553fcad Mon Sep 17 00:00:00 2001
-From: Adrien Destugues
-Date: Sun, 30 Mar 2014 12:30:49 +0200
-Subject: Make file aware of Haiku.
-
-
-diff --git a/include/platform.h b/include/platform.h
-index c30946b..ae7843c 100644
---- a/include/platform.h
-+++ b/include/platform.h
-@@ -417,7 +417,7 @@ extern "C" {
- #if PRESERVE_FILE_TIMES
-
- #ifndef HAS_FUTIME
--#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__)
-+#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) || defined(__HAIKU__)
- #define HAS_FUTIME 0
- #else
- #define HAS_FUTIME 1
---
-1.8.3.4
-
diff --git a/app-text/htmltidy/patches/tidy-5.1.25.patchset b/app-text/htmltidy/patches/tidy-5.1.25.patchset
new file mode 100644
index 000000000..14aa95916
--- /dev/null
+++ b/app-text/htmltidy/patches/tidy-5.1.25.patchset
@@ -0,0 +1,44 @@
+From 3794d4db987bff122b942190999a789f6e9c641d Mon Sep 17 00:00:00 2001
+From: Adrien Destugues
+Date: Sun, 17 Jan 2016 10:47:10 +0100
+Subject: Port to Haiku.
+
+
+diff --git a/include/tidyplatform.h b/include/tidyplatform.h
+index a40e0a0..f1a68e7 100644
+--- a/include/tidyplatform.h
++++ b/include/tidyplatform.h
+@@ -411,7 +411,7 @@ extern "C" {
+ #if PRESERVE_FILE_TIMES
+
+ #ifndef HAS_FUTIME
+-#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__)
++#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) || defined(__HAIKU__)
+ #define HAS_FUTIME 0
+ #else
+ #define HAS_FUTIME 1
+@@ -460,6 +460,12 @@ extern "C" {
+
+ #endif /* PRESERVE_FILE_TIMES */
+
++#if defined(__HAIKU__)
++#ifndef va_copy
++#define va_copy(dest, src) (dest = src)
++#endif
++#endif
++
+ /*
+ MS Windows needs _ prefix for Unix file functions.
+ Not required by Metrowerks Standard Library (MSL).
+@@ -520,7 +526,7 @@ extern "C" {
+ #if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
+ #include
+ #endif
+-#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS)
++#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS) && !defined(__HAIKU__)
+ # undef uint
+ typedef unsigned int uint;
+ #endif
+--
+2.7.0
+
diff --git a/app-text/htmltidy/tidy-5.1.25.recipe b/app-text/htmltidy/tidy-5.1.25.recipe
new file mode 100644
index 000000000..d515b217d
--- /dev/null
+++ b/app-text/htmltidy/tidy-5.1.25.recipe
@@ -0,0 +1,57 @@
+# Haikuporter does not want the summary to start with "Tidy". How nice.
+SUMMARY="(stupid) Tidy the layout and correct errors in HTML and XML documents"
+DESCRIPTION="Tidy tidies HTML and XML. It can tidy your documents by itself, \
+and developers can easily integrate its features into even more powerful tools."
+HOMEPAGE="http://www.html-tidy.org/"
+SOURCE_URI="https://github.com/htacg/tidy-html5/archive/$portVersion.tar.gz"
+CHECKSUM_SHA256="be81e967537984fbd207b4b19d02e7be73cbf201f07bf55aa5560c9b1d19b106"
+SOURCE_DIR="tidy-html5-$portVersion"
+PATCHES="tidy-$portVersion.patchset"
+REVISION="1"
+LICENSE="MIT"
+COPYRIGHT="1998-2015 World Wide Web Consortium"
+ARCHITECTURES="x86_gcc2 x86 x86_64"
+SECONDARY_ARCHITECTURES="x86_gcc2 x86"
+
+PROVIDES="
+ tidy$secondaryArchSuffix = $portVersion
+ cmd:tidy$secondaryArchSuffix
+ lib:libtidy$secondaryArchSuffix = 5.1.25 compat >= 5
+ "
+REQUIRES="
+ haiku$secondaryArchSuffix
+ "
+PROVIDES_devel="
+ devel:libtidy$secondaryArchSuffix = 5.1.25 compat >= 5
+ devel:libtidys$secondaryArchSuffix
+ "
+REQUIRES_devel="
+ tidy$secondaryArchSuffix == $portVersion base
+ "
+BUILD_REQUIRES="
+ haiku${secondaryArchSuffix}_devel
+ "
+BUILD_PREREQUIRES="
+ cmd:gcc$secondaryArchSuffix
+ cmd:cmake
+ cmd:make
+ "
+
+BUILD()
+{
+ cd build/cmake
+ cmake ../.. $cmakeDirArgs -DINCLUDE_INSTALL_DIR=develop/headers
+ make $jobArgs
+}
+INSTALL()
+{
+ cd build/cmake
+ make install
+ prepareInstalledDevelLibs libtidy libtidys
+ packageEntries devel $developDir
+}
+TEST()
+{
+ cd test
+ sh testall.sh
+}