Skip to content

Instantly share code, notes, and snippets.

@Efreak
Last active December 13, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Efreak/0525033c73e2f721de82dcd6994f46c8 to your computer and use it in GitHub Desktop.
Save Efreak/0525033c73e2f721de82dcd6994f46c8 to your computer and use it in GitHub Desktop.
Termux libtidy Deb file

so to get this file, i used the instructions linked from [here](https://github.com/termux/termux-packages/issues/2227/

you can try running build.sh to automate it, but I o ly spent ~5min actually writing that script, and it's untested. alternatively, just run the commands yourself; the necessary files are included as well

feel free to fork the gist and/or comment with fixes

# install deps. remove xsltproc if you don't want manpages...
pkg install termux-create-package xsltproc cmake git make
# clone tidy
git clone https://github.com/htacg/tidy-html5
# enter dir
cd tidy-html5
# create patch
cat <<EOF>ulong.patch
diff --git a/include/tidyplatform.h b/include/tidyplatform.h
index ca169dc..bf11edb 100644
--- a/include/tidyplatform.h
+++ b/include/tidyplatform.h
@@ -569,10 +569,8 @@ extern "C" {
typedef unsigned int uint;
#endif
-#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
# undef ulong
typedef unsigned long ulong;
-#endif
/*=============================================================================
EOF
# apply patch & remove
git apply ulong.patch
rm ulong.patch
# start build process
cd build/cmake
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=output/
make -j4 install
# get manifest ready for building deb file.
# get tidy version by running it
# i haven't actually tested this command...it may break
echo <<EOF | sed -E 's/5.7.17/$(output/bin/tidy -v | sed -E 's/^(.+\s)+//g')//g' > tidy.manifest
{
"name": "tidy-html5",
"version": "5.7.17",
"arch": "arm",
"maintainer": "@whoknows",
"description": "tidy - check, correct, and pretty-print HTML(5) files",
"homepage": "https://html-tidy.org",
"provides": ["tidy"],
"files" : {
EOF
# list files into manifest
# i didn't test this command either...
find output -type f -o -type s|sed -E 's/^\./output/(.+)$/\ "\1": "\1",/g'|sed '$ s/,$//'>>tidy.manifest
echo <<EOF>>tidy.manifest
}
}
EOF
termux-create-package tidy.manifest
{
"name": "tidy-html5",
"version": "5.7.17",
"arch": "arm",
"maintainer": "@efreak",
"description": "tidy - check, correct, and pretty-print HTML(5) files",
"homepage": "https://html-tidy.org",
"provides": ["tidy"],
"files" : {
"lib/libtidys.a": "lib/libtidys.a",
"lib/libtidy.so.5.7.17": "lib/libtidy.so.5.7.17",
"lib/libtidy.so.5": "lib/libtidy.so.5",
"lib/libtidy.so": "lib/libtidy.so",
"lib/pkgconfig/tidy.pc": "lib/pkgconfig/tidy.pc",
"include/tidyplatform.h": "include/tidyplatform.h",
"include/tidy.h": "include/tidy.h",
"include/tidyenum.h": "include/tidyenum.h",
"include/tidybuffio.h": "include/tidybuffio.h",
"bin/tidy": "bin/tidy",
"bin/tab2space": "bin/tab2space",
"share/man/man1/tidy.1": "share/man/man1/tidy.1"
}
}
diff --git a/include/tidyplatform.h b/include/tidyplatform.h
index ca169dc..bf11edb 100644
--- a/include/tidyplatform.h
+++ b/include/tidyplatform.h
@@ -569,10 +569,8 @@ extern "C" {
typedef unsigned int uint;
#endif
-#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
# undef ulong
typedef unsigned long ulong;
-#endif
/*=============================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment