+++ /dev/null
-diff -u -r ../upstream.git/Makefile ./Makefile
---- ../upstream.git/Makefile 2013-12-07 14:12:14.000000000 +0100
-+++ ./Makefile 2014-05-03 23:46:58.870093099 +0200
-@@ -21,7 +21,6 @@
- $(MAKE) -C dselect $@
- $(MAKE) -C doc $@
- $(MAKE) -C po $@
-- $(MAKE) -C test $@
-
- all headers library clean veryclean binary program doc manpages debiandoc test update-po: startup dirs
-
+++ /dev/null
-diff -u -r ../upstream.git/cmdline/apt-key.in ./cmdline/apt-key.in
---- ../upstream.git/cmdline/apt-key.in 2014-04-25 13:39:00.000000000 +0200
-+++ ./cmdline/apt-key.in 2014-06-03 11:55:07.623749140 +0200
-@@ -40,10 +40,7 @@
- TMP_KEYRING=${APT_DIR}/var/lib/apt/keyrings/maybe-import-keyring.gpg
-
- requires_root() {
-- if [ "$(id -u)" -ne 0 ]; then
-- echo >&1 "ERROR: This command can only be used by root."
-- exit 1
-- fi
-+ # We do not require root
- }
-
- # gpg defaults to mode 0600 for new keyrings. Create one with 0644 instead.
-@@ -216,11 +213,11 @@
- remove_key_from_keyring "$FORCED_KEYRING" "$1"
- else
- # otherwise all known keyrings are up for inspection
-- local TRUSTEDFILE="/etc/apt/trusted.gpg"
-+ local TRUSTEDFILE="@TERMUX_PREFIX@/etc/apt/trusted.gpg"
- eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
- eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
- remove_key_from_keyring "$TRUSTEDFILE" "$1"
-- TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
-+ TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d"
- eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
- if [ -d "$TRUSTEDPARTS" ]; then
- for trusted in $(run-parts --list "$TRUSTEDPARTS" --regex '^.*\.gpg$'); do
-@@ -278,14 +275,14 @@
- done
-
- if [ -z "$TRUSTEDFILE" ]; then
-- TRUSTEDFILE="/etc/apt/trusted.gpg"
-+ TRUSTEDFILE="@TERMUX_PREFIX@/etc/apt/trusted.gpg"
- eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
- eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
- if [ -r "$TRUSTEDFILE" ]; then
- GPG="$GPG --keyring $TRUSTEDFILE"
- fi
- GPG="$GPG --primary-keyring $TRUSTEDFILE"
-- TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
-+ TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d"
- eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
- if [ -d "$TRUSTEDPARTS" ]; then
- # strip / suffix as gpg will double-slash in that case (#665411)
-diff -u -r ../upstream.git/apt-pkg/aptconfiguration.cc ./apt-pkg/aptconfiguration.cc
---- ../upstream.git/apt-pkg/aptconfiguration.cc 2014-04-25 13:39:00.000000000 +0200
-+++ ./apt-pkg/aptconfiguration.cc 2014-06-03 11:39:43.931774391 +0200
-@@ -193,7 +193,7 @@
- // get the environment language codes: LC_MESSAGES (and later LANGUAGE)
- // we extract both, a long and a short code and then we will
- // check if we actually need both (rare) or if the short is enough
-- string const envMsg = string(Locale == 0 ? std::setlocale(LC_MESSAGES, NULL) : *Locale);
-+ string const envMsg = "en_US.UTF-8"; // string(Locale == 0 ? std::setlocale(LC_MESSAGES, NULL) : *Locale);
- size_t const lenShort = (envMsg.find('_') != string::npos) ? envMsg.find('_') : 2;
- size_t const lenLong = (envMsg.find_first_of(".@") != string::npos) ? envMsg.find_first_of(".@") : (lenShort + 3);
-
-@@ -405,8 +405,8 @@
+diff -u -r ../apt-1.1.3/apt-pkg/aptconfiguration.cc ./apt-pkg/aptconfiguration.cc
+--- ../apt-1.1.3/apt-pkg/aptconfiguration.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/aptconfiguration.cc 2015-12-03 18:16:35.167212811 -0500
+@@ -35,8 +35,8 @@
// setDefaultConfigurationForCompressors /*{{{*/
- void Configuration::setDefaultConfigurationForCompressors() {
+ static void setDefaultConfigurationForCompressors() {
// Set default application paths to check for optional compression types
- _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
- _config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
_config->Set("Dir::Bin::lzma", _config->FindFile("Dir::Bin::xz"));
_config->Set("APT::Compressor::lzma::Binary", "xz");
-@@ -419,7 +419,7 @@
+@@ -49,7 +49,7 @@
_config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
}
} else {
if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
_config->Set("APT::Compressor::lzma::CompressArg::", "--suffix=");
_config->Set("APT::Compressor::lzma::CompressArg::", "-9");
+@@ -218,7 +218,7 @@
+ // get the environment language codes: LC_MESSAGES (and later LANGUAGE)
+ // we extract both, a long and a short code and then we will
+ // check if we actually need both (rare) or if the short is enough
+- string const envMsg = string(Locale == 0 ? ::setlocale(LC_MESSAGES, NULL) : *Locale);
++ string const envMsg = "en_US.UTF-8"; // string(Locale == 0 ? ::setlocale(LC_MESSAGES, NULL) : *Locale);
+ size_t const lenShort = (envMsg.find('_') != string::npos) ? envMsg.find('_') : 2;
+ size_t const lenLong = (envMsg.find_first_of(".@") != string::npos) ? envMsg.find_first_of(".@") : (lenShort + 3);
+
--- /dev/null
+diff -u -r ../apt-1.1.3/apt-pkg/contrib/gpgv.cc ./apt-pkg/contrib/gpgv.cc
+--- ../apt-1.1.3/apt-pkg/contrib/gpgv.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/contrib/gpgv.cc 2015-12-03 16:57:57.183003187 -0500
+@@ -47,7 +47,7 @@
+ int const &statusfd, int fd[2], std::string const &key)
+ {
+ #define EINTERNAL 111
+- std::string const aptkey = _config->FindFile("Dir::Bin::apt-key", "/usr/bin/apt-key");
++ std::string const aptkey = _config->FindFile("Dir::Bin::apt-key", "@TERMUX_PREFIX@/bin/apt-key");
+
+ bool const Debug = _config->FindB("Debug::Acquire::gpgv", false);
+
--- /dev/null
+diff -u -r ../apt-1.1.3/apt-pkg/contrib/srvrec.cc ./apt-pkg/contrib/srvrec.cc
+--- ../apt-1.1.3/apt-pkg/contrib/srvrec.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/contrib/srvrec.cc 2015-12-03 16:21:54.397715576 -0500
+@@ -40,14 +40,27 @@
+ struct servent *s_ent = nullptr;
+ std::vector<char> buf(1024);
+
++#ifdef __ANDROID__
++ s_ent = getservbyport(htons(port), "tcp");
++ if (s_ent == nullptr) return false;
++#else
+ res = getservbyport_r(htons(port), "tcp", &s_ent_buf, buf.data(), buf.size(), &s_ent);
+ if (res != 0 || s_ent == nullptr)
+ return false;
++#endif
+
+ strprintf(target, "_%s._tcp.%s", s_ent->s_name, host.c_str());
+ return GetSrvRecords(target, Result);
+ }
+
++/* Bionic has res_init() but it's not in any header */
++#ifdef __ANDROID__
++extern "C" int res_init();
++extern "C" int res_query(const char* dname, int class_, int type_, unsigned char* answer, int anslen);
++extern "C" int __dn_skipname(const unsigned char* comp_dn, const unsigned char* eom);
++static inline int dn_skipname(const unsigned char* a, const unsigned char* b) { return __dn_skipname(a,b); }
++#endif
++
+ bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result)
+ {
+ unsigned char answer[PACKETSZ];
-diff -u -r ../upstream.git/apt-pkg/contrib/strutl.cc ./apt-pkg/contrib/strutl.cc
---- ../upstream.git/apt-pkg/contrib/strutl.cc 2014-06-18 13:17:17.000000000 +0200
-+++ ./apt-pkg/contrib/strutl.cc 2014-07-01 16:49:25.305832759 +0200
+diff -u -r ../apt-1.1.3/apt-pkg/contrib/strutl.cc ./apt-pkg/contrib/strutl.cc
+--- ../apt-1.1.3/apt-pkg/contrib/strutl.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/contrib/strutl.cc 2015-12-03 18:36:34.555425494 -0500
@@ -35,7 +35,9 @@
#include <regex.h>
#include <errno.h>
#include <apti18n.h>
/*}}}*/
-@@ -68,6 +70,7 @@
+@@ -87,6 +89,7 @@
// UTF8ToCodeset - Convert some UTF-8 string for some codeset /*{{{*/
// ---------------------------------------------------------------------
/* This is handy to use before display some information for enduser */
bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
{
iconv_t cd;
-@@ -134,6 +137,7 @@
+@@ -153,6 +156,7 @@
return true;
}
/*}}}*/
// strstrip - Remove white space from the front and back of a string /*{{{*/
// ---------------------------------------------------------------------
-@@ -375,13 +379,13 @@
- {
+@@ -392,14 +396,14 @@
if (ASize < 100 && I != 0)
{
-- sprintf(S,"%'.1f %c",ASize,Ext[I]);
-+ sprintf(S,"%.1f %c",ASize,Ext[I]);
- break;
+ std::string S;
+- strprintf(S, "%'.1f %c", ASize, Ext[I]);
++ strprintf(S, "%.1f %c", ASize, Ext[I]);
+ return S;
}
-
+
if (ASize < 10000)
{
-- sprintf(S,"%'.0f %c",ASize,Ext[I]);
-+ sprintf(S,"%.0f %c",ASize,Ext[I]);
- break;
+ std::string S;
+- strprintf(S, "%'.0f %c", ASize, Ext[I]);
++ strprintf(S, "%.0f %c", ASize, Ext[I]);
+ return S;
}
ASize /= 1000.0;
-@@ -909,14 +913,16 @@
+@@ -928,14 +932,16 @@
setlocale (LC_ALL,"C");
bool const invalid =
// Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
--- /dev/null
+diff -u -r ../apt-1.1.3/apt-pkg/deb/debrecords.cc ./apt-pkg/deb/debrecords.cc
+--- ../apt-1.1.3/apt-pkg/deb/debrecords.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/deb/debrecords.cc 2015-12-03 16:30:51.506746167 -0500
+@@ -25,7 +25,9 @@
+ #include <sstream>
+ #include <string>
+ #include <vector>
++#ifndef __ANDROID__
+ #include <langinfo.h>
++#endif
+
+ #include <apti18n.h>
+ /*}}}*/
+@@ -143,12 +145,14 @@
+ orig = Section.FindS("Description");
+ }
+
++#ifndef __ANDROID__
+ char const * const codeset = nl_langinfo(CODESET);
+ if (strcmp(codeset,"UTF-8") != 0) {
+ string dest;
+ UTF8ToCodeset(codeset, orig, &dest);
+ return dest;
+ }
++#endif
+
+ return orig;
+ }
--- /dev/null
+diff -u -r ../apt-1.1.3/apt-pkg/edsp/edspsystem.cc ./apt-pkg/edsp/edspsystem.cc
+--- ../apt-1.1.3/apt-pkg/edsp/edspsystem.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/edsp/edspsystem.cc 2015-12-03 16:33:49.052450163 -0500
+@@ -21,6 +21,7 @@
+
+ #include <stddef.h>
+ #include <unistd.h>
++#include <stdlib.h> /* For mkdtemp */
+
+ #include <string>
+ #include <vector>
+++ /dev/null
-diff -u -r ../apt-0.9.16.1/apt-pkg/makefile ./apt-pkg/makefile
---- ../apt-0.9.16.1/apt-pkg/makefile 2014-03-15 17:59:06.000000000 +0100
-+++ ./apt-pkg/makefile 2014-03-25 01:26:00.600685588 +0100
-@@ -14,7 +14,7 @@
- LIBRARY=apt-pkg
- MAJOR=$(LIBAPTPKG_MAJOR)
- MINOR=$(LIBAPTPKG_RELEASE)
--SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl
-+SLIBS=$(PTHREADLIB) $(INTLLIBS) -ldl
- ifeq ($(HAVE_ZLIB),yes)
- SLIBS+= -lz
- endif
--- /dev/null
+diff -u -r ../apt-1.1.3/apt-pkg/makefile ./apt-pkg/makefile
+--- ../apt-1.1.3/apt-pkg/makefile 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/makefile 2015-12-03 16:37:32.041569392 -0500
+@@ -15,7 +15,7 @@
+ LIBRARY=apt-pkg
+ MAJOR=$(LIBAPTPKG_MAJOR)
+ MINOR=$(LIBAPTPKG_RELEASE)
+-SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl -lresolv
++SLIBS=$(PTHREADLIB) $(INTLLIBS) -ldl
+ ifeq ($(HAVE_ZLIB),yes)
+ SLIBS+= -lz
+ endif
TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt
TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager"
TERMUX_PKG_DEPENDS="libbz2, liblzma, libgnustl, dpkg, gnupg"
-TERMUX_PKG_VERSION=1.0.10.2
+TERMUX_PKG_VERSION=1.1.3
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--host=${TERMUX_ARCH}-linux --disable-rpath acl_cv_rpath=$TERMUX_PREFIX/lib gt_cv_func_CFPreferencesCopyAppValue=no gt_cv_func_CFLocaleCopyCurrent=no ac_cv_c_bigendian=no --no-create"
+# When ready to drop bz2 support:
+# TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_lib_bz2_BZ2_bzopen=no"
TERMUX_PKG_FOLDERNAME=apt-${TERMUX_PKG_VERSION}
TERMUX_PKG_ESSENTIAL=yes
# $NDK/docs/STANDALONE-TOOLCHAIN.html: "If you use the GNU libstdc++, you will need to explicitly link with libsupc++ if you use these features"
export LDFLAGS="$LDFLAGS -lgnustl_shared" # -lsupc++"
+# Some files use STD*_FILENO without including <unistd.h> where they are declared.
+# Define them here to avoid having to patch files:
+CXXFLAGS+=" -DSTDIN_FILENO=0 -DSTDOUT_FILENO=1 -DSTDERR_FILENO=2 -DAI_IDN=0"
+
termux_step_pre_configure () {
cp $TERMUX_COMMON_CACHEDIR/config.{guess,sub} $TERMUX_PKG_SRCDIR/buildlib
perl -p -i -e "s/TERMUX_ARCH/$TERMUX_ARCH/" $TERMUX_PKG_SRCDIR/configure
termux_step_make_install () {
cp $TERMUX_PKG_BUILDDIR/bin/apt{,-get,-cache,-config,-key} $TERMUX_PREFIX/bin/
- cp $TERMUX_PKG_BUILDDIR/bin/libapt-{pkg.so.4.16,private.so.0.0} $TERMUX_PREFIX/lib/
- (cd $TERMUX_PREFIX/lib; rm -f libapt-pkg.so; ln -s libapt-pkg.so.4.16 libapt-pkg.so) # used by python-apt
+ cp $TERMUX_PKG_BUILDDIR/bin/libapt-{pkg.so.5.0.0,private.so.0.0} $TERMUX_PREFIX/lib/
+ (cd $TERMUX_PREFIX/lib; ln -s -f libapt-pkg.so.5.0.0 libapt-pkg.so.5.0; ln -s -f libapt-pkg.so )
mkdir -p $TERMUX_PREFIX/lib/apt/methods $TERMUX_PREFIX/share/man/man{5,8}
cp $TERMUX_PKG_BUILDDIR/docs/apt{,-cache,-get}.8 $TERMUX_PREFIX/share/man/man8/
cp $TERMUX_PKG_BUILDDIR/docs/{apt.conf,sources.list}.5 $TERMUX_PREFIX/share/man/man5/
cp $TERMUX_PKG_BUILDDIR/bin/methods/{copy,file,gpgv,gzip,http,https} $TERMUX_PREFIX/lib/apt/methods
(cd $TERMUX_PREFIX/lib/apt/methods; ln -f -s gzip bzip2)
+ (cd $TERMUX_PREFIX/lib/apt/methods; ln -f -s gzip xz)
mkdir -p $TERMUX_PREFIX/etc/apt
printf "# The main termux repository:\ndeb [arch=all,${TERMUX_ARCH}] http://apt.termux.com stable main\n" > $TERMUX_PREFIX/etc/apt/sources.list
--- /dev/null
+diff -u -r ../apt-1.1.3/cmdline/apt-helper.cc ./cmdline/apt-helper.cc
+--- ../apt-1.1.3/cmdline/apt-helper.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./cmdline/apt-helper.cc 2015-12-03 16:49:25.049283100 -0500
+@@ -28,6 +28,7 @@
+ #include <iostream>
+ #include <string>
+ #include <vector>
++#include <stdlib.h> // For atoi
+
+ #include <apti18n.h>
+ /*}}}*/
--- /dev/null
+diff -u -r ../apt-1.1.3/cmdline/apt-key.in ./cmdline/apt-key.in
+--- ../apt-1.1.3/cmdline/apt-key.in 2015-11-30 03:08:24.000000000 -0500
++++ ./cmdline/apt-key.in 2015-12-03 16:55:22.860914040 -0500
+@@ -19,10 +19,7 @@
+ aptkey_echo() { echo "$@"; }
+
+ requires_root() {
+- if [ "$(id -u)" -ne 0 ]; then
+- echo >&2 "ERROR: This command can only be used by root."
+- exit 1
+- fi
++ continue
+ }
+
+ get_fingerprints_of_keyring() {
+@@ -212,7 +209,7 @@
+ if [ -s "$TRUSTEDFILE" ]; then
+ $ACTION "$TRUSTEDFILE" "$@"
+ fi
+- local TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
++ local TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d"
+ eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
+ if [ -d "$TRUSTEDPARTS" ]; then
+ # strip / suffix as gpg will double-slash in that case (#665411)
+@@ -286,7 +283,7 @@
+ fi
+ else
+ # otherwise all known keyrings are merged
+- local TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
++ local TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d"
+ eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
+ if [ -d "$TRUSTEDPARTS" ]; then
+ # ignore errors mostly for non-existing $TRUSTEDFILE
+@@ -441,7 +438,7 @@
+ done
+
+ if [ -z "$TRUSTEDFILE" ]; then
+- TRUSTEDFILE="/etc/apt/trusted.gpg"
++ TRUSTEDFILE="@TERMUX_PREFIX@/etc/apt/trusted.gpg"
+ eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
+ eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
+ fi
--- /dev/null
+diff -u -r ../apt-1.1.3/cmdline/makefile ./cmdline/makefile
+--- ../apt-1.1.3/cmdline/makefile 2015-11-30 03:08:24.000000000 -0500
++++ ./cmdline/makefile 2015-12-03 16:50:46.792294882 -0500
+@@ -49,7 +49,7 @@
+
+ # The apt-helper
+ PROGRAM=apt-helper
+-SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -lresolv
++SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
+ LIB_MAKES = apt-pkg/makefile apt-private/makefile
+ SOURCE = apt-helper.cc
+ include $(PROGRAM_H)
+++ /dev/null
-diff -u -r ../upstream.git/configure.ac ./configure.ac
---- ../upstream.git/configure.ac 2014-06-18 14:12:32.000000000 +0200
-+++ ./configure.ac 2014-06-18 23:18:51.219899072 +0200
-@@ -89,11 +89,6 @@
- AC_MSG_ERROR([failed: I need CURL due https support]),
- )
-
--AC_LANG_PUSH([C++])
--AC_CHECK_HEADER(gtest/gtest.h,,
-- AC_MSG_ERROR([failed: I need gtest to build tests]),
--)
--AC_LANG_POP([C++])
-
-
- AC_SUBST(BDBLIB)
-diff -u -r ../upstream.git/configure ./configure
---- ../upstream.git/configure 2014-06-18 14:12:34.000000000 +0200
-+++ ./configure 2014-06-18 23:09:25.315914542 +0200
-@@ -4807,11 +4807,6 @@
+diff -u -r ../apt-1.1.3/configure ./configure
+--- ../apt-1.1.3/configure 2015-11-30 03:09:08.000000000 -0500
++++ ./configure 2015-12-03 18:24:35.580920131 -0500
+@@ -4822,13 +4822,7 @@
+ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
- ac_fn_cxx_check_header_mongrel "$LINENO" "gtest/gtest.h" "ac_cv_header_gtest_gtest_h" "$ac_includes_default"
+-ac_fn_cxx_check_header_mongrel "$LINENO" "gtest/gtest.h" "ac_cv_header_gtest_gtest_h" "$ac_includes_default"
-if test "x$ac_cv_header_gtest_gtest_h" = xyes; then :
-
-else
-- as_fn_error $? "failed: I need gtest to build tests" "$LINENO" 5
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: failed: I need gtest (packaged as libgtest-dev) for unit testing" >&5
+-$as_echo "$as_me: WARNING: failed: I need gtest (packaged as libgtest-dev) for unit testing" >&2;}
-fi
++ac_cv_header_gtest_gtest_h=yes
ac_ext=c
-@@ -4986,7 +4981,7 @@
+@@ -5003,7 +4997,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking debian architecture" >&5
$as_echo_n "checking debian architecture... " >&6; }
--- /dev/null
+diff -u -r ../apt-1.1.3/apt-pkg/contrib/fileutl.cc ./apt-pkg/contrib/fileutl.cc
+--- ../apt-1.1.3/apt-pkg/contrib/fileutl.cc 2015-11-30 03:08:24.000000000 -0500
++++ ./apt-pkg/contrib/fileutl.cc 2015-12-03 17:43:23.360831115 -0500
+@@ -100,7 +100,7 @@
+ _exit(100);
+ }
+
+- if (chdir("/tmp/") != 0)
++ if (chdir("@TERMUX_PREFIX@/tmp/") != 0)
+ _exit(100);
+
+ unsigned int Count = 1;
+@@ -2102,6 +2102,7 @@
+ std::vector<std::string> Glob(std::string const &pattern, int flags)
+ {
+ std::vector<std::string> result;
++#ifndef __ANDROID__
+ glob_t globbuf;
+ int glob_res;
+ unsigned int i;
+@@ -2121,6 +2122,7 @@
+ result.push_back(string(globbuf.gl_pathv[i]));
+
+ globfree(&globbuf);
++#endif
+ return result;
+ }
+ /*}}}*/
+@@ -2136,10 +2138,10 @@
+ struct stat st;
+ if (!tmpdir || strlen(tmpdir) == 0 || // tmpdir is set
+ stat(tmpdir, &st) != 0 || (st.st_mode & S_IFDIR) == 0) // exists and is directory
+- tmpdir = "/tmp";
++ tmpdir = "@TERMUX_PREFIX@/tmp";
+ else if (geteuid() != 0 && // root can do everything anyway
+ faccessat(-1, tmpdir, R_OK | W_OK | X_OK, AT_EACCESS | AT_SYMLINK_NOFOLLOW) != 0) // current user has rwx access to directory
+- tmpdir = "/tmp";
++ tmpdir = "@TERMUX_PREFIX@/tmp";
+
+ return string(tmpdir);
+ }
+++ /dev/null
-diff -u -r ../upstream.git/apt-pkg/deb/debrecords.cc ./apt-pkg/deb/debrecords.cc
---- ../upstream.git/apt-pkg/deb/debrecords.cc 2014-04-25 13:39:00.000000000 +0200
-+++ ./apt-pkg/deb/debrecords.cc 2014-07-01 16:47:41.913835586 +0200
-@@ -22,7 +22,9 @@
- #include <algorithm>
- #include <string>
- #include <vector>
-+#ifndef __ANDROID__
- #include <langinfo.h>
-+#endif
- /*}}}*/
-
- using std::string;
-@@ -151,11 +153,13 @@
- orig = Section.FindS(string("Description-").append(*l).c_str());
- }
-
-+#ifndef __ANDROID__
- char const * const codeset = nl_langinfo(CODESET);
- if (strcmp(codeset,"UTF-8") != 0) {
- UTF8ToCodeset(codeset, orig, &dest);
- orig = dest;
- }
-+#endif
-
- return orig;
- }
+++ /dev/null
-diff -u -r ../apt-1.0.9.4/apt-pkg/deb/dpkgpm.cc ./apt-pkg/deb/dpkgpm.cc
---- ../apt-1.0.9.4/apt-pkg/deb/dpkgpm.cc 2014-12-03 10:06:58.000000000 -0500
-+++ ./apt-pkg/deb/dpkgpm.cc 2014-12-07 07:17:09.210804305 -0500
-@@ -27,7 +27,9 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <grp.h>
--#include <pty.h>
-+#ifndef __ANDROID__
-+# include <pty.h>
-+#endif
- #include <pwd.h>
- #include <signal.h>
- #include <stddef.h>
-@@ -1075,7 +1077,11 @@
-
- _error->PushToStack();
-
-+#ifdef __ANDROID__
-+ d->master = open("/dev/ptmx", O_RDWR | O_NOCTTY);
-+# else
- d->master = posix_openpt(O_RDWR | O_NOCTTY);
-+#endif
- if (d->master == -1)
- _error->Errno("posix_openpt", _("Can not write log (%s)"), _("Is /dev/pts mounted?"));
- else if (unlockpt(d->master) == -1)
+++ /dev/null
-diff -u -r ../upstream.git/apt-pkg/contrib/fileutl.cc ./apt-pkg/contrib/fileutl.cc
---- ../upstream.git/apt-pkg/contrib/fileutl.cc 2014-05-05 14:01:59.000000000 +0200
-+++ ./apt-pkg/contrib/fileutl.cc 2014-06-06 00:09:17.233239376 +0200
-@@ -46,7 +46,9 @@
- #include <dirent.h>
- #include <signal.h>
- #include <errno.h>
-+#ifndef __ANDROID__
- #include <glob.h>
-+#endif
-
- #include <set>
- #include <algorithm>
-@@ -93,7 +95,7 @@
- _exit(100);
- }
-
-- if (chdir("/tmp/") != 0)
-+ if (chdir("@TERMUX_PREFIX@/tmp/") != 0)
- _exit(100);
-
- unsigned int Count = 1;
-@@ -1883,7 +1885,11 @@
- FileFdErrno("read","Unable to read original size of gzipped file");
- return 0;
- }
-+#ifdef __ANDROID__
-+ size = letoh32(size);
-+#else
- size = le32toh(size);
-+#endif
-
- if (lseek(iFd, oldPos, SEEK_SET) < 0)
- {
-@@ -1998,6 +2004,7 @@
- std::vector<std::string> Glob(std::string const &pattern, int flags)
- {
- std::vector<std::string> result;
-+#ifndef __ANDROID__
- glob_t globbuf;
- int glob_res;
- unsigned int i;
-@@ -2017,6 +2024,7 @@
- result.push_back(string(globbuf.gl_pathv[i]));
-
- globfree(&globbuf);
-+#endif
- return result;
- }
- /*}}}*/
-@@ -2025,15 +2033,10 @@
- {
- const char *tmpdir = getenv("TMPDIR");
-
--#ifdef P_tmpdir
-- if (!tmpdir)
-- tmpdir = P_tmpdir;
--#endif
--
- // check that tmpdir is set and exists
- struct stat st;
- if (!tmpdir || strlen(tmpdir) == 0 || stat(tmpdir, &st) != 0)
-- tmpdir = "/tmp";
-+ tmpdir = "@TERMUX_PREFIX@/tmp";
-
- return string(tmpdir);
- }
+++ /dev/null
-diff -u -r ../upstream.git/apt-pkg/contrib/gpgv.cc ./apt-pkg/contrib/gpgv.cc
---- ../upstream.git/apt-pkg/contrib/gpgv.cc 2014-04-25 13:39:00.000000000 +0200
-+++ ./apt-pkg/contrib/gpgv.cc 2014-06-06 00:18:13.209224724 +0200
-@@ -43,7 +84,7 @@
- int const &statusfd, int fd[2])
- {
- #define EINTERNAL 111
-- std::string const gpgvpath = _config->Find("Dir::Bin::gpg", "/usr/bin/gpgv");
-+ std::string const gpgvpath = _config->Find("Dir::Bin::gpg", "@TERMUX_PREFIX@/bin/gpgv");
- // FIXME: remove support for deprecated APT::GPGV setting
- std::string const trustedFile = _config->Find("APT::GPGV::TrustedKeyring", _config->FindFile("Dir::Etc::Trusted"));
- std::string const trustedPath = _config->FindDir("Dir::Etc::TrustedParts");
+++ /dev/null
-diff -u -r ../apt-0.9.16.1/apt-pkg/install-progress.cc ./apt-pkg/install-progress.cc
---- ../apt-0.9.16.1/apt-pkg/install-progress.cc 2014-03-15 17:23:45.000000000 +0100
-+++ ./apt-pkg/install-progress.cc 2014-03-25 01:16:03.436701913 +0100
-@@ -15,6 +15,7 @@
- #include <fcntl.h>
- #include <algorithm>
- #include <stdio.h>
-+#include <termios.h>
-
- #include <apti18n.h>
-
--- /dev/null
+diff -u -r ../apt-1.1.3/methods/makefile ./methods/makefile
+--- ../apt-1.1.3/methods/makefile 2015-11-30 03:08:24.000000000 -0500
++++ ./methods/makefile 2015-12-03 16:45:46.819879625 -0500
+@@ -46,21 +46,21 @@
+
+ # The http method
+ PROGRAM=http
+-SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS) -lresolv
++SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS)
+ LIB_MAKES = apt-pkg/makefile
+ SOURCE = http.cc http_main.cc rfc2553emu.cc connect.cc server.cc
+ include $(PROGRAM_H)
+
+ # The https method
+ PROGRAM=https
+-SLIBS = -lapt-pkg -lcurl $(INTLLIBS) -lresolv
++SLIBS = -lapt-pkg -lcurl $(INTLLIBS)
+ LIB_MAKES = apt-pkg/makefile
+ SOURCE = https.cc server.cc
+ include $(PROGRAM_H)
+
+ # The ftp method
+ PROGRAM=ftp
+-SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS) -lresolv
++SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS)
+ LIB_MAKES = apt-pkg/makefile
+ SOURCE = ftp.cc rfc2553emu.cc connect.cc
+ include $(PROGRAM_H)
+@@ -81,7 +81,7 @@
+
+ # The mirror method
+ PROGRAM=mirror
+-SLIBS = -lapt-pkg $(SOCKETLIBS) -lresolv
++SLIBS = -lapt-pkg $(SOCKETLIBS)
+ LIB_MAKES = apt-pkg/makefile
+ SOURCE = mirror.cc http.cc rfc2553emu.cc connect.cc server.cc
+ include $(PROGRAM_H)
+++ /dev/null
-diff -u -r ../upstream.git/buildlib/configure.mak ./buildlib/configure.mak
---- ../upstream.git/buildlib/configure.mak 2013-12-07 14:12:14.000000000 +0100
-+++ ./buildlib/configure.mak 2014-03-11 15:33:01.000000000 +0100
-@@ -55,7 +55,7 @@
- aclocal -I buildlib
-
- $(BUILDDIR)/config.status: configure
-- /usr/bin/test -e $(BUILDDIR) || mkdir $(BUILDDIR)
-+ test -e $(BUILDDIR) || mkdir $(BUILDDIR)
- (HERE=`pwd`; cd $(BUILDDIR) && $$HERE/configure)
-
- $(addprefix $(BUILDDIR)/,$(CONVERTED)): $(BUILDDIR)/config.status