--- /dev/null
+diff -u -r ../checkinstall-1.6.2/Makefile ./Makefile
+--- ../checkinstall-1.6.2/Makefile 2008-11-11 21:43:53.000000000 -0500
++++ ./Makefile 2016-10-28 16:14:22.403691119 -0400
+@@ -1,7 +1,7 @@
+ # $Id: Makefile,v 1.6.2.1 2008/11/09 07:48:18 izto Exp $
+
+ # Where to install.
+-PREFIX=/usr/local
++PREFIX?=/usr/local
+ BINDIR=$(PREFIX)/sbin
+ LCDIR=$(PREFIX)/lib/checkinstall/locale
+ CONFDIR=$(PREFIX)/lib/checkinstall
--- /dev/null
+# NOTE: Currently segfaults when running.
+TERMUX_PKG_HOMEPAGE=http://checkinstall.izto.org/
+TERMUX_PKG_DESCRIPTION="Installation tracker creating a package from a local install"
+TERMUX_PKG_VERSION=1.6.2
+TERMUX_PKG_SRCURL=http://checkinstall.izto.org/files/source/checkinstall-${TERMUX_PKG_VERSION}.tar.gz
+TERMUX_PKG_BUILD_IN_SRC=yes
+TERMUX_PKG_DEPENDS="file, make"
+TERMUX_PKG_RM_AFTER_INSTALL="lib/checkinstall/locale/"
+
+termux_step_pre_configure() {
+ CFLAGS+=" -D__off64_t=off64_t"
+ CFLAGS+=" -D_STAT_VER=3"
+ CFLAGS+=" -D_MKNOD_VER=1"
+ CFLAGS+=" -DS_IREAD=S_IRUSR"
+}
+
+termux_step_post_make_install () {
+ mv $TERMUX_PREFIX/lib/checkinstall/checkinstallrc-dist \
+ $TERMUX_PREFIX/lib/checkinstall/checkinstallrc
+}
--- /dev/null
+diff -u -r ../checkinstall-1.6.2/checkinstall ./checkinstall
+--- ../checkinstall-1.6.2/checkinstall 2009-12-26 14:17:24.000000000 -0500
++++ ./checkinstall 2016-10-28 16:32:12.759574819 -0400
+@@ -492,7 +492,7 @@
+ ckversion
+ echo
+
+-CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/checkinstallrc}
++CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/lib/checkinstall/checkinstallrc}
+ if ! [ -f $CHECKINSTALLRC ]; then
+ echog "The checkinstallrc file was not found at:\n$CHECKINSTALLRC"
+ echo
+@@ -974,7 +974,7 @@
+ ! [ "$INSTALL" ] && INSTALL=0
+
+ # The place where we will be storing the temp files
+-! [ "$BASE_TMP_DIR" ] && BASE_TMP_DIR=/var/tmp
++! [ "$BASE_TMP_DIR" ] && BASE_TMP_DIR=/data/data/com.termux/files/usr/tmp
+
+ # Default RPM FLAGS
+ ! [ "$RPM_FLAGS" ] && RPM_FLAGS=" --force --nodeps --replacepkgs "
+@@ -1249,7 +1249,7 @@
+ # Fix the PowerPC & Amd64 architecture description if we're on Debian
+
+ if [ "$CK_DEBIAN" = "1" ] ; then
+- ARCHITECTURE=`dpkg-architecture -qDEB_HOST_ARCH`
++ ARCHITECTURE=`dpkg --print-architecture`
+ fi
+ fi
+
+@@ -1508,7 +1508,7 @@
+ TMP_SCRIPT=${TMP_DIR}/installscript.sh
+
+ cat << EOF > $TMP_SCRIPT
+-#!/bin/sh
++#!@TERMUX_PREFIX@/bin/sh
+
+ cd "$DIRECTORIO_FUENTE"
+ EOF
+@@ -1538,7 +1538,7 @@
+ # installwatch excludes itself some directories, but we put them all here,
+ # to be explicit.
+ #
+-IEXCLUDE="${DIRECTORIO_FUENTE},/dev,/proc,/tmp,/var/tmp"
++IEXCLUDE="${DIRECTORIO_FUENTE},/dev,/proc,/tmp,/var/tmp,/data/data/com.termux/files/usr/tmp"
+
+
+ # Run the install command, showing the results interactively if we were asked
--- /dev/null
+diff -u -r ../checkinstall-1.6.2/checkinstallrc-dist ./checkinstallrc-dist
+--- ../checkinstall-1.6.2/checkinstallrc-dist 2008-11-11 14:10:34.000000000 -0500
++++ ./checkinstallrc-dist 2016-10-28 16:28:56.558529656 -0400
+@@ -16,14 +16,14 @@
+ DEBUG=0
+
+ # Location of the "installwatch" program
+-INSTALLWATCH_PREFIX="/usr/local"
++INSTALLWATCH_PREFIX="/data/data/com.termux/files/usr"
+ INSTALLWATCH=${INSTALLWATCH_PREFIX}/bin/installwatch
+
+ # Location of the makepkg program. "makepak" is the default, and is
+ # included with checkinstall. If you want to use Slackware's native "makepkg"
+ # then set this to "makepkg"
+
+-MAKEPKG=/sbin/makepkg
++MAKEPKG=/data/data/com.termux/files/usr/bin/makepkg
+
+ # makepkg optional flags. These are recommended if running a newer Slackware
+ # version: "-l y -c n"
+@@ -36,7 +36,7 @@
+ SHOW_MAKEPKG=0
+
+ # Where will we keep our temp files?
+-BASE_TMP_DIR=/var/tmp ## Don't set this to /tmp or / !!
++BASE_TMP_DIR=@TERMUX_PREFIX@/tmp ## Don't set this to /tmp or / !!
+
+ # Where to place the installed document files
+ DOC_DIR=""
--- /dev/null
+diff -u -r ../checkinstall-1.6.2/installwatch/Makefile ./installwatch/Makefile
+--- ../checkinstall-1.6.2/installwatch/Makefile 2008-11-16 11:20:53.000000000 -0500
++++ ./installwatch/Makefile 2016-10-28 16:34:12.825762120 -0400
+@@ -4,7 +4,7 @@
+ # Well, the only configurable part is the following variable.
+ # Make sure the directory you specify exists.
+
+-PREFIX=/usr/local
++PREFIX?=/usr/local
+
+ # End of configurable part
+
+@@ -16,10 +16,10 @@
+ all: installwatch.so
+
+ installwatch.so: installwatch.o
+- ld -shared -o installwatch.so installwatch.o -ldl -lc
++ $(CC) $(LDFLAGS) -shared -o installwatch.so installwatch.o -ldl -lc -llog
+
+ installwatch.o: installwatch.c localdecls.h
+- gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"$(VERSION)\" installwatch.c
++ $(CC) $(CFLAGS) -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"$(VERSION)\" installwatch.c
+
+ localdecls.h: create-localdecls
+ ./create-localdecls
--- /dev/null
+diff -u -r ../checkinstall-1.6.2/installwatch/installwatch.c ./installwatch/installwatch.c
+--- ../checkinstall-1.6.2/installwatch/installwatch.c 2008-11-16 11:20:53.000000000 -0500
++++ ./installwatch/installwatch.c 2016-10-28 16:12:42.017221485 -0400
+@@ -2938,13 +2938,8 @@
+ return result;
+ }
+
+-#if (GLIBC_MINOR <= 4)
+-int readlink(const char *path,char *buf,size_t bufsiz) {
+- int result;
+-#else
+ ssize_t readlink(const char *path,char *buf,size_t bufsiz) {
+ ssize_t result;
+-#endif
+ instw_t instw;
+ int status;
+
+@@ -3079,7 +3074,7 @@
+
+ int scandir( const char *dir,struct dirent ***namelist,
+ int (*select)(const struct dirent *),
+- int (*compar)(const void *,const void *) ) {
++ int (*compar)(const struct dirent**,const struct dirent**) ) {
+ int result;
+
+ if (!libc_handle)
+@@ -3691,7 +3686,7 @@
+
+ int scandir64( const char *dir,struct dirent64 ***namelist,
+ int (*select)(const struct dirent64 *),
+- int (*compar)(const void *,const void *) ) {
++ int (*compar)(const struct dirent64**,const struct dirent64**) ) {
+ int result;
+
+ if (!libc_handle)