summaryrefslogtreecommitdiff
path: root/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'standalone')
-rw-r--r--standalone/android/Makefile167
-rw-r--r--standalone/android/abiversion1
-rwxr-xr-xstandalone/android/buildchroot27
-rwxr-xr-xstandalone/android/buildchroot-inchroot25
-rwxr-xr-xstandalone/android/buildchroot-inchroot-asuser38
-rw-r--r--standalone/android/busybox_config997
-rwxr-xr-xstandalone/android/clean-haskell-packages6
-rw-r--r--standalone/android/dropbear.patch55
-rw-r--r--standalone/android/evilsplicer-headers.hs32
-rw-r--r--standalone/android/haskell-patches/DAV_build-without-TH.patch377
-rw-r--r--standalone/android/haskell-patches/HTTP_4000.2.8-0001-build-with-base-4.8.patch25
-rw-r--r--standalone/android/haskell-patches/MissingH_1.2.0.0_0001-fix-build-not-Android-specific.patch34
-rw-r--r--standalone/android/haskell-patches/MonadCatchIO-transformers_hack-to-get-to-build-with-new-ghc.patch56
-rw-r--r--standalone/android/haskell-patches/SafeSemaphore_fix-build-with-new-base.patch36
-rw-r--r--standalone/android/haskell-patches/async_fix-build-with-new-ghc.patch25
-rw-r--r--standalone/android/haskell-patches/bloomfilter_fix-build-with-newer-base.patch26
-rw-r--r--standalone/android/haskell-patches/comonad_cross-build.patch25
-rw-r--r--standalone/android/haskell-patches/crypto-numbers_build-fix.patch235
-rw-r--r--standalone/android/haskell-patches/distributive_0.3-0001-fixes-for-cross-build.patch25
-rw-r--r--standalone/android/haskell-patches/entropy_cross-build.patch25
-rw-r--r--standalone/android/haskell-patches/gnuidn_fix-build-with-new-base.patch50
-rw-r--r--standalone/android/haskell-patches/gnutls_0.1.4-0001-statically-link-with-gnutls.patch37
-rw-r--r--standalone/android/haskell-patches/gsasl_0.3.5-0001-link-with-libgsasl.patch25
-rw-r--r--standalone/android/haskell-patches/iproute_1.2.11_0001-build-without-IPv6-stuff.patch47
-rw-r--r--standalone/android/haskell-patches/language-javascript_fix-build-with-new-ghc.patch25
-rw-r--r--standalone/android/haskell-patches/lens_various-hacking-to-cross-build.patch385
-rw-r--r--standalone/android/haskell-patches/lifted-base_crossbuild.patch25
-rw-r--r--standalone/android/haskell-patches/network_2.4.1.0_0001-android-port-fixes.patch1960
-rw-r--r--standalone/android/haskell-patches/network_2.4.1.0_0002-remove-Network.BSD-symbols-not-available-in-bionic.patch157
-rw-r--r--standalone/android/haskell-patches/network_2.4.1.0_0003-configure-misdetects-accept4.patch34
-rw-r--r--standalone/android/haskell-patches/network_2.4.1.0_0004-getprotobyname-hack-for-tcp-and-udp.patch28
-rw-r--r--standalone/android/haskell-patches/persistent-template_stub-out.patch25
-rw-r--r--standalone/android/haskell-patches/persistent_1.1.5.1_0001-disable-TH.patch32
-rw-r--r--standalone/android/haskell-patches/primitive_0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch24
-rw-r--r--standalone/android/haskell-patches/process_fix-build-with-new-ghc.patch24
-rw-r--r--standalone/android/haskell-patches/profunctors_3.3-0001-fix-cross-build.patch26
-rw-r--r--standalone/android/haskell-patches/shakespeare-css_1.0.2_0001-remove-TH.patch148
-rw-r--r--standalone/android/haskell-patches/shakespeare-css_1.0.2_0002-expose-modules-used-by-TH.patch26
-rw-r--r--standalone/android/haskell-patches/shakespeare_1.0.3_0001-export-symbol-used-by-TH-splices.patch26
-rw-r--r--standalone/android/haskell-patches/skein_hardcode_little-endian.patch24
-rw-r--r--standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch135
-rw-r--r--standalone/android/haskell-patches/stm-chans_cross-build.patch25
-rw-r--r--standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch56
-rw-r--r--standalone/android/haskell-patches/uuid_build-without-v1-uuid-which-needs-network-info.patch79
-rw-r--r--standalone/android/haskell-patches/vector_hack-to-build-with-new-ghc.patch24
-rw-r--r--standalone/android/haskell-patches/wai-app-static_deal-with-TH.patch54
-rw-r--r--standalone/android/haskell-patches/yesod-auth_don-t-really-build.patch34
-rw-r--r--standalone/android/haskell-patches/yesod-core_expand_TH.patch411
-rw-r--r--standalone/android/haskell-patches/yesod-form_spliced-TH.patch1783
-rw-r--r--standalone/android/haskell-patches/yesod-persistent_do-not-really-build.patch26
-rw-r--r--standalone/android/haskell-patches/yesod-routes_export-module-referenced-by-TH-splices.patch29
-rw-r--r--standalone/android/haskell-patches/yesod_001_hacked-up-for-Android.patch74
-rw-r--r--standalone/android/haskell-patches/yesod_002_hack-around-missing-symbols.patch41
-rw-r--r--standalone/android/haskell-patches/zlib_0.5.4.0_0001-hack-to-build-on-Android.patch35
-rw-r--r--standalone/android/icons/drawable-hdpi/ic_launcher.pngbin0 -> 2612 bytes
-rw-r--r--standalone/android/icons/drawable-hdpi/ic_stat_service_notification_icon.pngbin0 -> 1310 bytes
-rw-r--r--standalone/android/icons/drawable-ldpi/ic_launcher.pngbin0 -> 1279 bytes
-rw-r--r--standalone/android/icons/drawable-ldpi/ic_stat_service_notification_icon.pngbin0 -> 682 bytes
-rw-r--r--standalone/android/icons/drawable-mdpi/ic_launcher.pngbin0 -> 1768 bytes
-rw-r--r--standalone/android/icons/drawable-mdpi/ic_stat_service_notification_icon.pngbin0 -> 946 bytes
-rw-r--r--standalone/android/icons/drawable-xhdpi/ic_launcher.pngbin0 -> 3396 bytes
-rw-r--r--standalone/android/icons/drawable-xhdpi/ic_stat_service_notification_icon.pngbin0 -> 1837 bytes
l---------standalone/android/icons/drawable/ic_launcher.png1
l---------standalone/android/icons/drawable/ic_stat_service_notification_icon.png1
-rwxr-xr-xstandalone/android/install-haskell-packages120
-rw-r--r--standalone/android/openssh.config.h249
-rw-r--r--standalone/android/openssh.patch205
-rw-r--r--standalone/android/rsync.patch40
-rwxr-xr-xstandalone/android/runshell132
-rwxr-xr-xstandalone/android/startbin0 -> 6492 bytes
-rw-r--r--standalone/android/start.c64
-rw-r--r--standalone/android/term.patch598
-rw-r--r--standalone/licences.gzbin0 -> 60519 bytes
-rw-r--r--standalone/linux/README25
-rwxr-xr-xstandalone/linux/git-annex25
-rwxr-xr-xstandalone/linux/git-annex-shell25
-rwxr-xr-xstandalone/linux/git-annex-webapp25
-rw-r--r--standalone/linux/glibc-libs43
-rwxr-xr-xstandalone/linux/runshell76
-rw-r--r--standalone/osx/git-annex.app/Contents/Info.plist41
-rw-r--r--standalone/osx/git-annex.app/Contents/MacOS/README9
-rwxr-xr-xstandalone/osx/git-annex.app/Contents/MacOS/git-annex25
-rwxr-xr-xstandalone/osx/git-annex.app/Contents/MacOS/git-annex-shell25
-rwxr-xr-xstandalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp26
-rwxr-xr-xstandalone/osx/git-annex.app/Contents/MacOS/runshell71
-rw-r--r--standalone/osx/git-annex.app/Contents/Resources/git-annex.icnsbin0 -> 77548 bytes
-rw-r--r--standalone/windows/build.sh56
87 files changed, 10053 insertions, 0 deletions
diff --git a/standalone/android/Makefile b/standalone/android/Makefile
new file mode 100644
index 000000000..f5cd67b26
--- /dev/null
+++ b/standalone/android/Makefile
@@ -0,0 +1,167 @@
+# Cross-compiles utilities needed for git-annex on Android,
+# and builds the Android app.
+
+# Add Android cross-compiler to PATH (as installed by ghc-android)
+ANDROID_CROSS_COMPILER?=$(HOME)/.ghc/$(shell cat abiversion)/bin
+PATH:=$(ANDROID_CROSS_COMPILER):$(PATH)
+
+# Paths to the Android SDK and NDK.
+export ANDROID_SDK_ROOT?=$(HOME)/.android/adt-bundle-linux-x86/sdk
+export ANDROID_NDK_ROOT?=$(HOME)/.android/android-ndk
+
+# Where to store the source tree used to build utilities. This
+# directory will be created by `make source`.
+GIT_ANNEX_ANDROID_SOURCETREE?=$(HOME)/.android/git-annex-sourcetree
+
+GITTREE=$(GIT_ANNEX_ANDROID_SOURCETREE)/git/installed-tree
+
+VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<../../CHANGELOG)
+
+build: start
+ if [ ! -e "$(GIT_ANNEX_ANDROID_SOURCETREE)" ]; then $(MAKE) source; fi
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl/build-stamp
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/build-stamp
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/build-stamp
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/build-stamp
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg/build-stamp
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/git/build-stamp
+ $(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/term/build-stamp
+
+ perl -i -pe 's/(android:versionName=)"[^"]+"/$$1"'$(VER)'"/' $(GIT_ANNEX_ANDROID_SOURCETREE)/term/AndroidManifest.xml
+
+ # Debug build because it does not need signing keys.
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && tools/build-debug
+
+ # Install executables as pseudo-libraries so they will be
+ # unpacked from the .apk.
+ mkdir -p $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/busybox $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.busybox.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/ssh $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.ssh.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/ssh-keygen $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.ssh-keygen.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/rsync $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.rsync.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg/g10/gpg $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.gpg.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git-shell $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-shell.so
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git-upload-pack $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-upload-pack.so
+ arm-linux-androideabi-strip --strip-unneeded --remove-section=.comment --remove-section=.note $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/*
+ cp runshell $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.runshell.so
+ cp start $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.start.so
+
+ # remove git stuff we don't need to save space
+ rm -rf $(GITTREE)/bin/git-cvsserver \
+ $(GITTREE)/libexec/git-core/git-daemon \
+ $(GITTREE)/libexec/git-core/git-show-index \
+ $(GITTREE)/libexec/git-core/mergetools \
+ $(GITTREE)/libexec/git-core/git-credential-* \
+ $(GITTREE)/libexec/git-core/git-cvsserver \
+ $(GITTREE)/libexec/git-core/git-cvsimport \
+ $(GITTREE)/libexec/git-core/git-fast-import \
+ $(GITTREE)/libexec/git-core/git-http-backend \
+ $(GITTREE)/libexec/git-core/git-imap-send \
+ $(GITTREE)/libexec/git-core/git-instaweb \
+ $(GITTREE)/libexec/git-core/git-p4 \
+ $(GITTREE)/libexec/git-core/git-remote-test* \
+ $(GITTREE)/libexec/git-core/git-submodule \
+ $(GITTREE)/libexec/git-core/git-svn \
+ $(GITTREE)/libexec/git-core/git-web--browse
+ # Most of git is in one multicall binary, but a few important
+ # commands are still shell scripts. Those are put into
+ # a tarball, along with a list of all the links that should be
+ # set up.
+ cd $(GITTREE) && mkdir -p links
+ cd $(GITTREE) && find -samefile bin/git -not -wholename ./bin/git > links/git
+ cd $(GITTREE) && find -samefile bin/git-shell -not -wholename ./bin/git-shell > links/git-shell
+ cd $(GITTREE) && find -samefile bin/git-upload-pack -not -wholename ./bin/git-upload-pack > links/git-upload-pack
+ cd $(GITTREE) && find -type f -not -samefile bin/git -not -samefile bin/git-shell -not -samefile bin/git-upload-pack|tar czf ../git.tar.gz -T -
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git.tar.gz $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git.tar.gz.so
+
+ git rev-parse HEAD > $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.version.so
+
+ mkdir -p ../../tmp/4.0 ../../tmp/4.3
+
+ cp ../../tmp/androidtree/dist/build/git-annex/4.3/git-annex $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
+ arm-linux-androideabi-strip --strip-unneeded --remove-section=.comment --remove-section=.note $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && ant debug
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/4.3/git-annex.apk
+
+ cp ../../tmp/androidtree/dist/build/git-annex/4.0/git-annex $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
+ arm-linux-androideabi-strip --strip-unneeded --remove-section=.comment --remove-section=.note $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && ant debug
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/4.0/git-annex.apk
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/openssl/build-stamp:
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl && CC=$$(which cc) ./Configure android
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl && $(MAKE)
+ touch $@
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/build-stamp: openssh.patch openssh.config.h
+ # This is a known-good version that the patch works with.
+ # TODO: Upgrade
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && git reset --hard 0a8617ed5af2f0248d0e9648e26b224e16ada742
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && ./configure --host=arm-linux-androideabi --with-ssl-dir=../openssl --without-openssl-header-check
+ cat openssh.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && patch -p1)
+ cp openssh.config.h $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/config.h
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && sed -i -e 's/getrrsetbyname.o //' openbsd-compat/Makefile
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && sed -i -e 's/auth-passwd.o //' Makefile
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && $(MAKE) ssh ssh-keygen
+ touch $@
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/build-stamp: busybox_config
+ cp busybox_config $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/.config
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox && yes '' | $(MAKE) oldconfig
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox && $(MAKE)
+ touch $@
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/git/build-stamp:
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/git && $(MAKE) install NO_OPENSSL=1 NO_GETTEXT=1 NO_GECOS_IN_PWENT=1 NO_GETPASS=1 NO_NSEC=1 NO_MKDTEMP=1 NO_PTHREADS=1 NO_PERL=1 NO_CURL=1 NO_EXPAT=1 NO_TCLTK=1 NO_ICONV=1 prefix= DESTDIR=installed-tree
+ touch $@
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/build-stamp: rsync.patch
+ # This is a known-good version that the patch works with.
+ cat rsync.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync && git reset --hard eec26089b1c7bdbb260674480ffe6ece257bca63 && git am)
+ cp $(GIT_ANNEX_ANDROID_SOURCETREE)/automake/lib/config.sub $(GIT_ANNEX_ANDROID_SOURCETREE)/automake/lib/config.guess $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync && ./configure --host=arm-linux-androideabi --disable-locale --disable-iconv-open --disable-iconv --disable-acl-support --disable-xattr-support
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync && $(MAKE)
+ touch $@
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg/build-stamp:
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg && git checkout gnupg-1.4.15
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg && ./autogen.sh
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg && ./configure --host=arm-linux-androideabi --disable-gnupg-iconv --disable-card-support --disable-agent-support --disable-photo-viewers --disable-keyserver-helpers --disable-nls
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg; $(MAKE) || true # expected failure in doc build
+ touch $@
+
+$(GIT_ANNEX_ANDROID_SOURCETREE)/term/build-stamp: term.patch icons
+ # This is a known-good version that the patch works with.
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && git reset --hard 3d34b3c42295c215b62e70f3ee696dd664ba08ce
+ cat term.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && patch -p1)
+ (cd icons && tar c .) | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term/res && tar x)
+ # This renaming has a purpose. It makes the path to the app's
+ # /data directory shorter, which makes ssh connection caching
+ # sockets placed there have more space for their filenames.
+ # Also, it avoids overlap with the Android Terminal Emulator
+ # app, if it's also installed.
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && find -name .git -prune -o -type f -print0 | xargs -0 perl -pi -e 's/jackpal/ga/g'
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && perl -pi -e 's/Terminal Emulator/Git Annex/g' res/*/strings.xml
+ cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && echo y | tools/update.sh
+ touch $@
+
+source: $(GIT_ANNEX_ANDROID_SOURCETREE)
+
+$(GIT_ANNEX_ANDROID_SOURCETREE):
+ mkdir -p $(GIT_ANNEX_ANDROID_SOURCETREE)
+ git clone git://git.savannah.gnu.org/automake.git $(GIT_ANNEX_ANDROID_SOURCETREE)/automake
+ git clone git://git.debian.org/git/d-i/busybox $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox
+ git clone git://git.kernel.org/pub/scm/git/git.git $(GIT_ANNEX_ANDROID_SOURCETREE)/git
+ git clone git://git.samba.org/rsync.git $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync
+ git clone git://git.gnupg.org/gnupg.git $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg
+ git clone git://git.openssl.org/openssl $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl
+ git clone git://github.com/CyanogenMod/android_external_openssh.git $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh
+ git clone git://github.com/jackpal/Android-Terminal-Emulator.git $(GIT_ANNEX_ANDROID_SOURCETREE)/term
+
+clean:
+ rm -rf $(GITTREE)
+ rm -f start
+
+reallyclean: clean
+ rm -rf $(GIT_ANNEX_ANDROID_SOURCETREE)
diff --git a/standalone/android/abiversion b/standalone/android/abiversion
new file mode 100644
index 000000000..4cc4c14cd
--- /dev/null
+++ b/standalone/android/abiversion
@@ -0,0 +1 @@
+android-14/arm-linux-androideabi-4.8
diff --git a/standalone/android/buildchroot b/standalone/android/buildchroot
new file mode 100755
index 000000000..44337eb0c
--- /dev/null
+++ b/standalone/android/buildchroot
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+if [ "$(whoami)" != root ]; then
+ echo "Must run this as root!" >&2
+ exit 1
+fi
+
+debootstrap --arch=i386 stable debian-stable-android
+cp $0-inchroot debian-stable-android/tmp
+cp $0-inchroot-asuser debian-stable-android/tmp
+cp $(dirname $0)/abiversion debian-stable-android/tmp
+
+# Don't use these vars in the chroot.
+unset TMP
+unset TEMP
+unset TMPDIR
+unset TEMPDIR
+
+chroot debian-stable-android "tmp/$(basename $0)-inchroot"
+
+echo
+echo
+echo "debian-stable-android is set up, with a user androidbuilder"
+echo "your next step is probably to check out git-annex in this chroot"
+echo "and run standalone/android/install-haskell-packages"
+echo
+echo
diff --git a/standalone/android/buildchroot-inchroot b/standalone/android/buildchroot-inchroot
new file mode 100755
index 000000000..70deea0ab
--- /dev/null
+++ b/standalone/android/buildchroot-inchroot
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Runs inside the chroot set up by buildchroot
+set -e
+if [ "$(whoami)" != root ]; then
+ echo "Must run this as root!" >&2
+ exit 1
+fi
+
+# java needs this mounted to work
+mount -t proc proc /proc
+
+echo "deb-src http://ftp.us.debian.org/debian stable main" >> /etc/apt/sources.list
+apt-get update
+apt-get -y install build-essential ghc git libncurses5-dev cabal-install
+apt-get -y install llvm-3.0 # not 3.1; buggy on arm. 3.2 is ok too
+apt-get -y install ca-certificates curl file m4 autoconf zlib1g-dev
+apt-get -y install libgnutls-dev libxml2-dev libgsasl7-dev pkg-config c2hs
+apt-get -y install ant default-jdk rsync wget gnupg lsof
+apt-get -y install gettext unzip python
+apt-get clean
+wget http://snapshot.debian.org/archive/debian/20130903T155330Z/pool/main/a/automake-1.14/automake_1.14-1_all.deb
+dpkg -i automake*.deb
+rm *.deb
+useradd androidbuilder --create-home
+su androidbuilder -c $0-asuser
diff --git a/standalone/android/buildchroot-inchroot-asuser b/standalone/android/buildchroot-inchroot-asuser
new file mode 100755
index 000000000..710e76e46
--- /dev/null
+++ b/standalone/android/buildchroot-inchroot-asuser
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Runs inside the chroot set up by buildchroot, as the user it creates
+set -e
+
+cd
+rm -rf .ghc .cabal
+cabal update
+cabal install happy alex --bindir=$HOME/bin
+PATH=$HOME/bin:$PATH
+export PATH
+mkdir -p .android
+cd .android
+git clone https://github.com/joeyh/ghc-android
+cd ghc-android
+git checkout stable-ghc-snapshot
+./build
+
+# This saves 2 gb, and the same sources are in build-*/ghc
+rm -rf stage0
+
+# Set up android SDK where the git-annex android Makefile
+# expects to find it.
+cd ..
+ln -s ghc-android/android-ndk-* android-ndk
+wget http://dl.google.com/android/adt/adt-bundle-linux-x86-20130917.zip
+unzip adt*.zip
+rm adt*.zip
+mv adt-bundle-linux-x86-* adt-bundle-linux-x86
+rm -rf adt-bundle-linux-x86/eclipse
+
+# The git-annex android Makefile needs this cc symlink.
+ln -s arm-linux-androideabi-gcc $HOME/.ghc/$(cat /tmp/abiversion)/bin/cc
+
+cd
+git clone git://git-annex.branchable.com/ git-annex
+
+git config --global user.email androidbuilder@example.com
+git config --global user.name androidbuilder
diff --git a/standalone/android/busybox_config b/standalone/android/busybox_config
new file mode 100644
index 000000000..28ea880d9
--- /dev/null
+++ b/standalone/android/busybox_config
@@ -0,0 +1,997 @@
+# Run "make android2_defconfig", then "make".
+#
+# Tested with the standalone toolchain from ndk r6:
+# android-ndk-r6/build/tools/make-standalone-toolchain.sh --platform=android-8
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Busybox Settings
+#
+
+#
+# General Configuration
+#
+# CONFIG_DESKTOP is not set
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_INCLUDE_SUSv2 is not set
+# CONFIG_USE_PORTABLE_CODE is not set
+CONFIG_PLATFORM_LINUX=y
+CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
+# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+# CONFIG_SHOW_USAGE is not set
+# CONFIG_FEATURE_VERBOSE_USAGE is not set
+# CONFIG_FEATURE_COMPRESS_USAGE is not set
+CONFIG_FEATURE_INSTALLER=y
+# CONFIG_INSTALL_NO_USR is not set
+# CONFIG_LOCALE_SUPPORT is not set
+# CONFIG_UNICODE_SUPPORT is not set
+# CONFIG_UNICODE_USING_LOCALE is not set
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_SUBST_WCHAR=0
+CONFIG_LAST_SUPPORTED_WCHAR=0
+# CONFIG_UNICODE_COMBINING_WCHARS is not set
+# CONFIG_UNICODE_WIDE_WCHARS is not set
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
+# CONFIG_LONG_OPTS is not set
+# CONFIG_FEATURE_DEVPTS is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_UTMP is not set
+# CONFIG_FEATURE_WTMP is not set
+# CONFIG_FEATURE_PIDFILE is not set
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_PREFER_APPLETS is not set
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+CONFIG_FEATURE_SYSLOG=y
+# CONFIG_FEATURE_HAVE_RPC is not set
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+# CONFIG_PIE is not set
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+# CONFIG_LFS is not set
+CONFIG_CROSS_COMPILER_PREFIX="arm-linux-androideabi-"
+CONFIG_EXTRA_CFLAGS=""
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_WERROR is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Installation Options ("make install" behavior)
+#
+CONFIG_INSTALL_APPLET_SYMLINKS=y
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+# CONFIG_INSTALL_APPLET_DONT is not set
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="./_install"
+
+#
+# Busybox Library Tuning
+#
+# CONFIG_FEATURE_SYSTEMD is not set
+# CONFIG_FEATURE_RTMINMAX is not set
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SMALL=1
+# CONFIG_FEATURE_FAST_TOP is not set
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+CONFIG_FEATURE_USE_TERMIOS=y
+# CONFIG_FEATURE_EDITING is not set
+CONFIG_FEATURE_EDITING_MAX_LEN=0
+# CONFIG_FEATURE_EDITING_VI is not set
+CONFIG_FEATURE_EDITING_HISTORY=0
+# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
+# CONFIG_FEATURE_TAB_COMPLETION is not set
+# CONFIG_FEATURE_USERNAME_COMPLETION is not set
+# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set
+# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
+# CONFIG_FEATURE_NON_POSIX_CP is not set
+# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
+CONFIG_FEATURE_COPYBUF_KB=4
+# CONFIG_FEATURE_SKIP_ROOTFS is not set
+# CONFIG_MONOTONIC_SYSCALL is not set
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+# CONFIG_FEATURE_HWIB is not set
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+CONFIG_FEATURE_SEAMLESS_XZ=y
+CONFIG_FEATURE_SEAMLESS_LZMA=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+CONFIG_FEATURE_SEAMLESS_Z=y
+CONFIG_AR=y
+CONFIG_FEATURE_AR_LONG_FILENAMES=y
+CONFIG_FEATURE_AR_CREATE=y
+CONFIG_BUNZIP2=y
+CONFIG_BZIP2=y
+CONFIG_CPIO=y
+CONFIG_FEATURE_CPIO_O=y
+CONFIG_FEATURE_CPIO_P=y
+CONFIG_DPKG=y
+CONFIG_DPKG_DEB=y
+# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
+CONFIG_GUNZIP=y
+CONFIG_GZIP=y
+# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
+CONFIG_LZOP=y
+CONFIG_LZOP_COMPR_HIGH=y
+CONFIG_RPM2CPIO=y
+CONFIG_RPM=y
+CONFIG_TAR=y
+CONFIG_FEATURE_TAR_CREATE=y
+CONFIG_FEATURE_TAR_AUTODETECT=y
+CONFIG_FEATURE_TAR_FROM=y
+CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
+CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_FEATURE_TAR_TO_COMMAND is not set
+CONFIG_FEATURE_TAR_UNAME_GNAME=y
+CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
+# CONFIG_FEATURE_TAR_SELINUX is not set
+CONFIG_UNCOMPRESS=y
+CONFIG_UNLZMA=y
+CONFIG_FEATURE_LZMA_FAST=y
+CONFIG_LZMA=y
+CONFIG_UNXZ=y
+CONFIG_XZ=y
+CONFIG_UNZIP=y
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+CONFIG_CAT=y
+# CONFIG_DATE is not set
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+# CONFIG_FEATURE_DATE_NANO is not set
+# CONFIG_FEATURE_DATE_COMPAT is not set
+# CONFIG_ID is not set
+# CONFIG_GROUPS is not set
+CONFIG_TEST=y
+CONFIG_FEATURE_TEST_64=y
+CONFIG_TOUCH=y
+CONFIG_TR=y
+CONFIG_FEATURE_TR_CLASSES=y
+CONFIG_FEATURE_TR_EQUIV=y
+CONFIG_BASE64=y
+CONFIG_CAL=y
+CONFIG_CATV=y
+CONFIG_CHGRP=y
+CONFIG_CHMOD=y
+CONFIG_CHOWN=y
+# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
+CONFIG_CHROOT=y
+CONFIG_CKSUM=y
+CONFIG_COMM=y
+CONFIG_CP=y
+# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
+CONFIG_CUT=y
+CONFIG_DD=y
+CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
+CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
+CONFIG_FEATURE_DD_IBS_OBS=y
+# CONFIG_DF is not set
+# CONFIG_FEATURE_DF_FANCY is not set
+CONFIG_DIRNAME=y
+CONFIG_DOS2UNIX=y
+CONFIG_UNIX2DOS=y
+CONFIG_DU=y
+CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
+CONFIG_ECHO=y
+CONFIG_FEATURE_FANCY_ECHO=y
+# CONFIG_ENV is not set
+# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
+CONFIG_EXPAND=y
+# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
+# CONFIG_EXPR is not set
+# CONFIG_EXPR_MATH_SUPPORT_64 is not set
+CONFIG_FALSE=y
+CONFIG_FOLD=y
+# CONFIG_FSYNC is not set
+CONFIG_HEAD=y
+CONFIG_FEATURE_FANCY_HEAD=y
+# CONFIG_HOSTID is not set
+CONFIG_INSTALL=y
+# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+CONFIG_LN=y
+# CONFIG_LOGNAME is not set
+CONFIG_LS=y
+CONFIG_FEATURE_LS_FILETYPES=y
+CONFIG_FEATURE_LS_FOLLOWLINKS=y
+CONFIG_FEATURE_LS_RECURSIVE=y
+CONFIG_FEATURE_LS_SORTFILES=y
+CONFIG_FEATURE_LS_TIMESTAMPS=y
+CONFIG_FEATURE_LS_USERNAME=y
+# CONFIG_FEATURE_LS_COLOR is not set
+# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
+CONFIG_MD5SUM=y
+CONFIG_MKDIR=y
+# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
+CONFIG_MKFIFO=y
+CONFIG_MKNOD=y
+CONFIG_MV=y
+# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
+CONFIG_NICE=y
+CONFIG_NOHUP=y
+CONFIG_OD=y
+CONFIG_PRINTENV=y
+CONFIG_PRINTF=y
+CONFIG_PWD=y
+CONFIG_READLINK=y
+CONFIG_FEATURE_READLINK_FOLLOW=y
+CONFIG_REALPATH=y
+CONFIG_RM=y
+CONFIG_RMDIR=y
+# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
+CONFIG_SEQ=y
+CONFIG_SHA1SUM=y
+CONFIG_SHA256SUM=y
+CONFIG_SHA512SUM=y
+CONFIG_SLEEP=y
+CONFIG_FEATURE_FANCY_SLEEP=y
+CONFIG_FEATURE_FLOAT_SLEEP=y
+CONFIG_SORT=y
+CONFIG_FEATURE_SORT_BIG=y
+CONFIG_SPLIT=y
+CONFIG_FEATURE_SPLIT_FANCY=y
+# CONFIG_STAT is not set
+# CONFIG_FEATURE_STAT_FORMAT is not set
+CONFIG_STTY=y
+CONFIG_SUM=y
+CONFIG_SYNC=y
+CONFIG_TAC=y
+CONFIG_TAIL=y
+CONFIG_FEATURE_FANCY_TAIL=y
+CONFIG_TEE=y
+CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
+CONFIG_TRUE=y
+# CONFIG_TTY is not set
+CONFIG_UNAME=y
+CONFIG_UNEXPAND=y
+# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
+CONFIG_UNIQ=y
+# CONFIG_USLEEP is not set
+CONFIG_UUDECODE=y
+CONFIG_UUENCODE=y
+CONFIG_WC=y
+CONFIG_FEATURE_WC_LARGE=y
+# CONFIG_WHO is not set
+CONFIG_WHOAMI=y
+CONFIG_YES=y
+
+#
+# Common options for cp and mv
+#
+CONFIG_FEATURE_PRESERVE_HARDLINKS=y
+
+#
+# Common options for ls, more and telnet
+#
+CONFIG_FEATURE_AUTOWIDTH=y
+
+#
+# Common options for df, du, ls
+#
+CONFIG_FEATURE_HUMAN_READABLE=y
+
+#
+# Common options for md5sum, sha1sum, sha256sum, sha512sum
+#
+CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
+
+#
+# Console Utilities
+#
+CONFIG_CHVT=y
+CONFIG_FGCONSOLE=y
+CONFIG_CLEAR=y
+CONFIG_DEALLOCVT=y
+CONFIG_DUMPKMAP=y
+# CONFIG_KBD_MODE is not set
+# CONFIG_LOADFONT is not set
+CONFIG_LOADKMAP=y
+CONFIG_OPENVT=y
+CONFIG_RESET=y
+CONFIG_RESIZE=y
+CONFIG_FEATURE_RESIZE_PRINT=y
+CONFIG_SETCONSOLE=y
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+# CONFIG_SETFONT is not set
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
+CONFIG_DEFAULT_SETFONT_DIR=""
+CONFIG_SETKEYCODES=y
+CONFIG_SETLOGCONS=y
+CONFIG_SHOWKEY=y
+# CONFIG_FEATURE_LOADFONT_PSF2 is not set
+# CONFIG_FEATURE_LOADFONT_RAW is not set
+
+#
+# Debian Utilities
+#
+CONFIG_MKTEMP=y
+CONFIG_PIPE_PROGRESS=y
+CONFIG_RUN_PARTS=y
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
+CONFIG_FEATURE_RUN_PARTS_FANCY=y
+CONFIG_START_STOP_DAEMON=y
+CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+CONFIG_WHICH=y
+
+#
+# Editors
+#
+CONFIG_PATCH=y
+CONFIG_VI=y
+CONFIG_FEATURE_VI_MAX_LEN=0
+# CONFIG_FEATURE_VI_8BIT is not set
+# CONFIG_FEATURE_VI_COLON is not set
+# CONFIG_FEATURE_VI_YANKMARK is not set
+CONFIG_FEATURE_VI_SEARCH=y
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+CONFIG_FEATURE_VI_USE_SIGNALS=y
+# CONFIG_FEATURE_VI_DOT_CMD is not set
+# CONFIG_FEATURE_VI_READONLY is not set
+# CONFIG_FEATURE_VI_SETOPTS is not set
+# CONFIG_FEATURE_VI_SET is not set
+CONFIG_FEATURE_VI_WIN_RESIZE=y
+# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
+# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set
+# CONFIG_AWK is not set
+# CONFIG_FEATURE_AWK_LIBM is not set
+CONFIG_CMP=y
+CONFIG_DIFF=y
+# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
+CONFIG_FEATURE_DIFF_DIR=y
+# CONFIG_ED is not set
+CONFIG_SED=y
+# CONFIG_FEATURE_ALLOW_EXEC is not set
+
+#
+# Finding Utilities
+#
+CONFIG_FIND=y
+CONFIG_FEATURE_FIND_PRINT0=y
+CONFIG_FEATURE_FIND_MTIME=y
+# CONFIG_FEATURE_FIND_MMIN is not set
+CONFIG_FEATURE_FIND_PERM=y
+CONFIG_FEATURE_FIND_TYPE=y
+# CONFIG_FEATURE_FIND_XDEV is not set
+# CONFIG_FEATURE_FIND_MAXDEPTH is not set
+# CONFIG_FEATURE_FIND_NEWER is not set
+# CONFIG_FEATURE_FIND_INUM is not set
+# CONFIG_FEATURE_FIND_EXEC is not set
+# CONFIG_FEATURE_FIND_USER is not set
+# CONFIG_FEATURE_FIND_GROUP is not set
+# CONFIG_FEATURE_FIND_NOT is not set
+# CONFIG_FEATURE_FIND_DEPTH is not set
+# CONFIG_FEATURE_FIND_PAREN is not set
+# CONFIG_FEATURE_FIND_SIZE is not set
+# CONFIG_FEATURE_FIND_PRUNE is not set
+# CONFIG_FEATURE_FIND_DELETE is not set
+# CONFIG_FEATURE_FIND_PATH is not set
+# CONFIG_FEATURE_FIND_REGEX is not set
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+# CONFIG_FEATURE_FIND_LINKS is not set
+CONFIG_GREP=y
+# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
+# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
+# CONFIG_FEATURE_GREP_CONTEXT is not set
+CONFIG_XARGS=y
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
+
+#
+# Init Utilities
+#
+# CONFIG_BOOTCHARTD is not set
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
+# CONFIG_HALT is not set
+# CONFIG_FEATURE_CALL_TELINIT is not set
+# CONFIG_TELINIT_PATH=""
+# CONFIG_INIT is not set
+# CONFIG_FEATURE_USE_INITTAB is not set
+# CONFIG_FEATURE_KILL_REMOVED is not set
+# CONFIG_FEATURE_KILL_DELAY=0
+# CONFIG_FEATURE_INIT_SCTTY is not set
+# CONFIG_FEATURE_INIT_SYSLOG is not set
+# CONFIG_FEATURE_EXTRA_QUIET is not set
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+# CONFIG_FEATURE_INITRD is not set
+# CONFIG_INIT_TERMINAL_TYPE="linux"
+# CONFIG_MESG is not set
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_ADD_SHELL is not set
+# CONFIG_REMOVE_SHELL is not set
+# CONFIG_FEATURE_SHADOWPASSWDS is not set
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+# CONFIG_USE_BB_CRYPT is not set
+# CONFIG_USE_BB_CRYPT_SHA is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
+# CONFIG_FEATURE_CHECK_NAMES is not set
+CONFIG_FIRST_SYSTEM_ID=0
+CONFIG_LAST_SYSTEM_ID=0
+# CONFIG_ADDGROUP is not set
+# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+# CONFIG_DELUSER is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
+# CONFIG_GETTY is not set
+# CONFIG_LOGIN is not set
+# CONFIG_PAM is not set
+# CONFIG_LOGIN_SCRIPTS is not set
+# CONFIG_FEATURE_NOLOGIN is not set
+# CONFIG_FEATURE_SECURETTY is not set
+# CONFIG_PASSWD is not set
+# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
+# CONFIG_CRYPTPW is not set
+# CONFIG_CHPASSWD is not set
+# CONFIG_SU is not set
+# CONFIG_FEATURE_SU_SYSLOG is not set
+# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Linux Ext2 FS Progs
+#
+CONFIG_CHATTR=y
+# CONFIG_FSCK is not set
+CONFIG_LSATTR=y
+CONFIG_TUNE2FS=y
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODINFO is not set
+# CONFIG_MODPROBE_SMALL is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
+# CONFIG_INSMOD is not set
+# CONFIG_RMMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
+# CONFIG_DEPMOD is not set
+
+#
+# Options common to multiple modutils
+#
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
+# CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
+# CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
+
+#
+# Linux System Utilities
+#
+CONFIG_BLOCKDEV=y
+CONFIG_REV=y
+# CONFIG_ACPID is not set
+# CONFIG_FEATURE_ACPID_COMPAT is not set
+CONFIG_BLKID=y
+# CONFIG_FEATURE_BLKID_TYPE is not set
+CONFIG_DMESG=y
+CONFIG_FEATURE_DMESG_PRETTY=y
+CONFIG_FBSET=y
+CONFIG_FEATURE_FBSET_FANCY=y
+CONFIG_FEATURE_FBSET_READMODE=y
+CONFIG_FDFLUSH=y
+CONFIG_FDFORMAT=y
+CONFIG_FDISK=y
+CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
+CONFIG_FEATURE_FDISK_WRITABLE=y
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_GPT_LABEL is not set
+CONFIG_FEATURE_FDISK_ADVANCED=y
+CONFIG_FINDFS=y
+CONFIG_FLOCK=y
+CONFIG_FREERAMDISK=y
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKFS_VFAT is not set
+CONFIG_GETOPT=y
+CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_HEXDUMP=y
+CONFIG_FEATURE_HEXDUMP_REVERSE=y
+CONFIG_HD=y
+# CONFIG_HWCLOCK is not set
+# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
+# CONFIG_IPCRM is not set
+# CONFIG_IPCS is not set
+CONFIG_LOSETUP=y
+CONFIG_LSPCI=y
+CONFIG_LSUSB=y
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+CONFIG_MKSWAP=y
+CONFIG_FEATURE_MKSWAP_UUID=y
+CONFIG_MORE=y
+# CONFIG_MOUNT is not set
+# CONFIG_FEATURE_MOUNT_FAKE is not set
+# CONFIG_FEATURE_MOUNT_VERBOSE is not set
+# CONFIG_FEATURE_MOUNT_HELPERS is not set
+# CONFIG_FEATURE_MOUNT_LABEL is not set
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_MOUNT_CIFS is not set
+# CONFIG_FEATURE_MOUNT_FLAGS is not set
+# CONFIG_FEATURE_MOUNT_FSTAB is not set
+# CONFIG_PIVOT_ROOT is not set
+# CONFIG_RDATE is not set
+CONFIG_RDEV=y
+CONFIG_READPROFILE=y
+CONFIG_RTCWAKE=y
+CONFIG_SCRIPT=y
+CONFIG_SCRIPTREPLAY=y
+# CONFIG_SETARCH is not set
+# CONFIG_SWAPONOFF is not set
+# CONFIG_FEATURE_SWAPON_PRI is not set
+# CONFIG_SWITCH_ROOT is not set
+# CONFIG_UMOUNT is not set
+# CONFIG_FEATURE_UMOUNT_ALL is not set
+# CONFIG_FEATURE_MOUNT_LOOP is not set
+# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+CONFIG_VOLUMEID=y
+
+#
+# Filesystem/Volume identification
+#
+CONFIG_FEATURE_VOLUMEID_EXT=y
+CONFIG_FEATURE_VOLUMEID_BTRFS=y
+CONFIG_FEATURE_VOLUMEID_REISERFS=y
+CONFIG_FEATURE_VOLUMEID_FAT=y
+CONFIG_FEATURE_VOLUMEID_HFS=y
+CONFIG_FEATURE_VOLUMEID_JFS=y
+CONFIG_FEATURE_VOLUMEID_XFS=y
+CONFIG_FEATURE_VOLUMEID_NTFS=y
+CONFIG_FEATURE_VOLUMEID_ISO9660=y
+CONFIG_FEATURE_VOLUMEID_UDF=y
+CONFIG_FEATURE_VOLUMEID_LUKS=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
+CONFIG_FEATURE_VOLUMEID_CRAMFS=y
+CONFIG_FEATURE_VOLUMEID_ROMFS=y
+CONFIG_FEATURE_VOLUMEID_SYSV=y
+CONFIG_FEATURE_VOLUMEID_OCFS2=y
+CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_CONSPY is not set
+# CONFIG_NANDWRITE is not set
+CONFIG_NANDDUMP=y
+CONFIG_SETSERIAL=y
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_ADJTIMEX is not set
+# CONFIG_BBCONFIG is not set
+# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
+CONFIG_BEEP=y
+CONFIG_FEATURE_BEEP_FREQ=4000
+CONFIG_FEATURE_BEEP_LENGTH_MS=30
+CONFIG_CHAT=y
+CONFIG_FEATURE_CHAT_NOFAIL=y
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+CONFIG_FEATURE_CHAT_IMPLICIT_CR=y
+CONFIG_FEATURE_CHAT_SWALLOW_OPTS=y
+CONFIG_FEATURE_CHAT_SEND_ESCAPES=y
+CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y
+CONFIG_FEATURE_CHAT_CLR_ABORT=y
+CONFIG_CHRT=y
+# CONFIG_CROND is not set
+# CONFIG_FEATURE_CROND_D is not set
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+CONFIG_FEATURE_CROND_DIR=""
+# CONFIG_CRONTAB is not set
+CONFIG_DC=y
+CONFIG_FEATURE_DC_LIBM=y
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+CONFIG_DEVMEM=y
+# CONFIG_EJECT is not set
+# CONFIG_FEATURE_EJECT_SCSI is not set
+CONFIG_FBSPLASH=y
+CONFIG_FLASHCP=y
+CONFIG_FLASH_LOCK=y
+CONFIG_FLASH_UNLOCK=y
+# CONFIG_FLASH_ERASEALL is not set
+# CONFIG_IONICE is not set
+CONFIG_INOTIFYD=y
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_SMALL is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+# CONFIG_LESS is not set
+CONFIG_FEATURE_LESS_MAXLINES=0
+# CONFIG_FEATURE_LESS_BRACKETS is not set
+# CONFIG_FEATURE_LESS_FLAGS is not set
+# CONFIG_FEATURE_LESS_MARKS is not set
+# CONFIG_FEATURE_LESS_REGEXP is not set
+# CONFIG_FEATURE_LESS_WINCH is not set
+# CONFIG_FEATURE_LESS_DASHCMD is not set
+# CONFIG_FEATURE_LESS_LINENUMS is not set
+CONFIG_HDPARM=y
+CONFIG_FEATURE_HDPARM_GET_IDENTITY=y
+CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y
+CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y
+CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y
+CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y
+CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y
+CONFIG_MAKEDEVS=y
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+CONFIG_FEATURE_MAKEDEVS_TABLE=y
+CONFIG_MAN=y
+# CONFIG_MICROCOM is not set
+# CONFIG_MOUNTPOINT is not set
+# CONFIG_MT is not set
+CONFIG_RAIDAUTORUN=y
+# CONFIG_READAHEAD is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RUNLEVEL is not set
+CONFIG_RX=y
+CONFIG_SETSID=y
+CONFIG_STRINGS=y
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+CONFIG_TIME=y
+CONFIG_TIMEOUT=y
+CONFIG_TTYSIZE=y
+CONFIG_VOLNAME=y
+# CONFIG_WALL is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Networking Utilities
+#
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+CONFIG_NBDCLIENT=y
+CONFIG_NC=y
+CONFIG_NC_SERVER=y
+CONFIG_NC_EXTRA=y
+# CONFIG_NC_110_COMPAT is not set
+# CONFIG_PING is not set
+# CONFIG_PING6 is not set
+# CONFIG_FEATURE_FANCY_PING is not set
+CONFIG_WHOIS=y
+# CONFIG_FEATURE_IPV6 is not set
+# CONFIG_FEATURE_UNIX_LOCAL is not set
+# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+CONFIG_ARP=y
+# CONFIG_ARPING is not set
+# CONFIG_BRCTL is not set
+# CONFIG_FEATURE_BRCTL_FANCY is not set
+# CONFIG_FEATURE_BRCTL_SHOW is not set
+CONFIG_DNSD=y
+# CONFIG_ETHER_WAKE is not set
+CONFIG_FAKEIDENTD=y
+CONFIG_FTPD=y
+CONFIG_FEATURE_FTP_WRITE=y
+CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y
+CONFIG_FTPGET=y
+CONFIG_FTPPUT=y
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
+# CONFIG_HOSTNAME is not set
+CONFIG_HTTPD=y
+CONFIG_FEATURE_HTTPD_RANGES=y
+CONFIG_FEATURE_HTTPD_USE_SENDFILE=y
+CONFIG_FEATURE_HTTPD_SETUID=y
+CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
+CONFIG_FEATURE_HTTPD_CGI=y
+CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
+CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
+CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y
+CONFIG_FEATURE_HTTPD_ERROR_PAGES=y
+CONFIG_FEATURE_HTTPD_PROXY=y
+CONFIG_FEATURE_HTTPD_GZIP=y
+CONFIG_IFCONFIG=y
+CONFIG_FEATURE_IFCONFIG_STATUS=y
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
+CONFIG_FEATURE_IFCONFIG_HW=y
+CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
+# CONFIG_IFENSLAVE is not set
+# CONFIG_IFPLUGD is not set
+CONFIG_IFUPDOWN=y
+CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
+CONFIG_FEATURE_IFUPDOWN_IP=y
+CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
+# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
+CONFIG_FEATURE_IFUPDOWN_IPV4=y
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
+CONFIG_FEATURE_IFUPDOWN_MAPPING=y
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+# CONFIG_INETD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+CONFIG_IP=y
+CONFIG_FEATURE_IP_ADDRESS=y
+CONFIG_FEATURE_IP_LINK=y
+CONFIG_FEATURE_IP_ROUTE=y
+CONFIG_FEATURE_IP_TUNNEL=y
+CONFIG_FEATURE_IP_RULE=y
+CONFIG_FEATURE_IP_SHORT_FORMS=y
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
+CONFIG_IPADDR=y
+CONFIG_IPLINK=y
+CONFIG_IPROUTE=y
+CONFIG_IPTUNNEL=y
+CONFIG_IPRULE=y
+CONFIG_IPCALC=y
+CONFIG_FEATURE_IPCALC_FANCY=y
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+CONFIG_NETSTAT=y
+CONFIG_FEATURE_NETSTAT_WIDE=y
+CONFIG_FEATURE_NETSTAT_PRG=y
+# CONFIG_NSLOOKUP is not set
+# CONFIG_NTPD is not set
+# CONFIG_FEATURE_NTPD_SERVER is not set
+CONFIG_PSCAN=y
+CONFIG_ROUTE=y
+# CONFIG_SLATTACH is not set
+CONFIG_TCPSVD=y
+# CONFIG_TELNET is not set
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
+# CONFIG_TELNETD is not set
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
+# CONFIG_TFTP is not set
+# CONFIG_TFTPD is not set
+# CONFIG_FEATURE_TFTP_GET is not set
+# CONFIG_FEATURE_TFTP_PUT is not set
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+# CONFIG_TFTP_DEBUG is not set
+# CONFIG_TRACEROUTE is not set
+# CONFIG_TRACEROUTE6 is not set
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
+CONFIG_TUNCTL=y
+CONFIG_FEATURE_TUNCTL_UG=y
+# CONFIG_UDHCPD is not set
+# CONFIG_DHCPRELAY is not set
+# CONFIG_DUMPLEASES is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
+# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+CONFIG_DHCPD_LEASES_FILE=""
+CONFIG_UDHCPC=y
+CONFIG_FEATURE_UDHCPC_ARPING=y
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=9
+CONFIG_FEATURE_UDHCP_RFC3397=y
+CONFIG_FEATURE_UDHCP_8021Q=y
+CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
+# CONFIG_UDPSVD is not set
+# CONFIG_VCONFIG is not set
+CONFIG_WGET=y
+CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
+# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
+CONFIG_FEATURE_WGET_TIMEOUT=y
+# CONFIG_ZCIP is not set
+
+#
+# Print Utilities
+#
+CONFIG_LPD=y
+CONFIG_LPR=y
+CONFIG_LPQ=y
+
+#
+# Mail Utilities
+#
+CONFIG_MAKEMIME=y
+CONFIG_FEATURE_MIME_CHARSET="us-ascii"
+CONFIG_POPMAILDIR=y
+CONFIG_FEATURE_POPMAILDIR_DELIVERY=y
+CONFIG_REFORMIME=y
+CONFIG_FEATURE_REFORMIME_COMPAT=y
+CONFIG_SENDMAIL=y
+
+#
+# Process Utilities
+#
+CONFIG_IOSTAT=y
+CONFIG_MPSTAT=y
+CONFIG_NMETER=y
+CONFIG_PMAP=y
+# CONFIG_POWERTOP is not set
+CONFIG_PSTREE=y
+CONFIG_PWDX=y
+CONFIG_SMEMCAP=y
+# CONFIG_FREE is not set
+CONFIG_FUSER=y
+# CONFIG_KILL is not set
+# CONFIG_KILLALL is not set
+# CONFIG_KILLALL5 is not set
+# CONFIG_PGREP is not set
+CONFIG_PIDOF=y
+CONFIG_FEATURE_PIDOF_SINGLE=y
+CONFIG_FEATURE_PIDOF_OMIT=y
+# CONFIG_PKILL is not set
+# CONFIG_PS is not set
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_TIME is not set
+# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+CONFIG_RENICE=y
+CONFIG_BB_SYSCTL=y
+CONFIG_TOP=y
+CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
+CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
+CONFIG_FEATURE_TOP_SMP_CPU=y
+CONFIG_FEATURE_TOP_DECIMALS=y
+CONFIG_FEATURE_TOP_SMP_PROCESS=y
+CONFIG_FEATURE_TOPMEM=y
+CONFIG_FEATURE_SHOW_THREADS=y
+# CONFIG_UPTIME is not set
+CONFIG_WATCH=y
+
+#
+# Runit Utilities
+#
+CONFIG_RUNSV=y
+CONFIG_RUNSVDIR=y
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+CONFIG_SV=y
+CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
+CONFIG_SVLOGD=y
+CONFIG_CHPST=y
+CONFIG_SETUIDGID=y
+CONFIG_ENVUIDGID=y
+CONFIG_ENVDIR=y
+CONFIG_SOFTLIMIT=y
+# CONFIG_CHCON is not set
+# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_SETSEBOOL is not set
+# CONFIG_SESTATUS is not set
+
+#
+# Shells
+#
+CONFIG_ASH=y
+# CONFIG_ASH_BASH_COMPAT is not set
+# CONFIG_ASH_IDLE_TIMEOUT is not set
+CONFIG_ASH_JOB_CONTROL=y
+# CONFIG_ASH_ALIAS is not set
+CONFIG_ASH_GETOPTS=y
+# CONFIG_ASH_BUILTIN_ECHO is not set
+# CONFIG_ASH_BUILTIN_PRINTF is not set
+# CONFIG_ASH_BUILTIN_TEST is not set
+# CONFIG_ASH_CMDCMD is not set
+# CONFIG_ASH_MAIL is not set
+# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_ASH_EXPAND_PRMT is not set
+CONFIG_CTTYHACK=y
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_BRACE_EXPANSION is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_SAVEHISTORY is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_MODE_X is not set
+# CONFIG_MSH is not set
+CONFIG_FEATURE_SH_IS_ASH=y
+# CONFIG_FEATURE_SH_IS_HUSH is not set
+# CONFIG_FEATURE_SH_IS_NONE is not set
+# CONFIG_FEATURE_BASH_IS_ASH is not set
+# CONFIG_FEATURE_BASH_IS_HUSH is not set
+CONFIG_FEATURE_BASH_IS_NONE=y
+# CONFIG_SH_MATH_SUPPORT is not set
+# CONFIG_SH_MATH_SUPPORT_64 is not set
+# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
+CONFIG_FEATURE_SH_STANDALONE=y
+# CONFIG_FEATURE_SH_NOFORK is not set
+# CONFIG_FEATURE_SH_HISTFILESIZE is not set
+
+#
+# System Logging Utilities
+#
+# CONFIG_SYSLOGD is not set
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+# CONFIG_FEATURE_REMOTE_LOG is not set
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
+# CONFIG_FEATURE_SYSLOGD_CFG is not set
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
+# CONFIG_FEATURE_IPC_SYSLOG is not set
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
+# CONFIG_LOGREAD is not set
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+CONFIG_KLOGD=y
+CONFIG_FEATURE_KLOGD_KLOGCTL=y
+# CONFIG_LOGGER is not set
diff --git a/standalone/android/clean-haskell-packages b/standalone/android/clean-haskell-packages
new file mode 100755
index 000000000..b8c6132d6
--- /dev/null
+++ b/standalone/android/clean-haskell-packages
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Removes all currently installed cross-compiled haskell packages
+# except those part of ghc.
+# Useful if the build failed.
+rm -f $(grep -l $HOME/.ghc/$(cat abiversion)/.cabal/lib/ $HOME/.ghc/android-14/arm-linux-androideabi-4.8/lib/*-ghc-*/package.conf.d/*.conf)
+$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin/ghc-pkg recache
diff --git a/standalone/android/dropbear.patch b/standalone/android/dropbear.patch
new file mode 100644
index 000000000..84c7dfb6d
--- /dev/null
+++ b/standalone/android/dropbear.patch
@@ -0,0 +1,55 @@
+From 014dadb02fd984828a6232534c47dba8e2f7818a Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Wed, 13 Feb 2013 15:29:52 -0400
+Subject: [PATCH] android patch for dropbear
+
+* Disable HOME override
+* Use urandom to avoid blocking on every ssh connection.
+* Enable use of netbsd_getpass.c
+---
+ cli-auth.c | 1 +
+ cli-main.c | 2 --
+ options.h | 2 +-
+ 3 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/cli-auth.c b/cli-auth.c
+index 4c17a21..91dfdf8 100644
+--- a/cli-auth.c
++++ b/cli-auth.c
+@@ -31,6 +31,7 @@
+ #include "ssh.h"
+ #include "packet.h"
+ #include "runopts.h"
++#include "netbsd_getpass.c"
+
+ void cli_authinitialise() {
+
+diff --git a/cli-main.c b/cli-main.c
+index 106006b..68cf023 100644
+--- a/cli-main.c
++++ b/cli-main.c
+@@ -47,8 +47,6 @@ int main(int argc, char ** argv) {
+ _dropbear_exit = cli_dropbear_exit;
+ _dropbear_log = cli_dropbear_log;
+
+- putenv("HOME=/data/local");
+-
+ disallow_core();
+
+ cli_getopts(argc, argv);
+diff --git a/options.h b/options.h
+index 7625151..48e404d 100644
+--- a/options.h
++++ b/options.h
+@@ -159,7 +159,7 @@ etc) slower (perhaps by 50%). Recommended for most small systems. */
+ * however significantly reduce the security of your ssh connections
+ * if the PRNG state becomes guessable - make sure you know what you are
+ * doing if you change this. */
+-#define DROPBEAR_RANDOM_DEV "/dev/random"
++#define DROPBEAR_RANDOM_DEV "/dev/urandom"
+
+ /* prngd must be manually set up to produce output */
+ /*#define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng"*/
+--
+1.7.10.4
+
diff --git a/standalone/android/evilsplicer-headers.hs b/standalone/android/evilsplicer-headers.hs
new file mode 100644
index 000000000..ee4d6f1a3
--- /dev/null
+++ b/standalone/android/evilsplicer-headers.hs
@@ -0,0 +1,32 @@
+
+
+{- This file was modified by the EvilSplicer, adding these headers,
+ - and expanding Template Haskell.
+ -
+ - ** DO NOT COMMIT **
+ -}
+import qualified Data.Monoid
+import qualified Data.Set
+import qualified Data.Map
+import qualified Data.Map as Data.Map.Base
+import qualified Data.Foldable
+import qualified Data.Text
+import qualified Data.Text.Lazy.Builder
+import qualified Text.Shakespeare
+import qualified Text.Hamlet
+import qualified Text.Julius
+import qualified Text.Css
+import qualified "blaze-markup" Text.Blaze.Internal
+import qualified Yesod.Core.Widget
+import qualified Yesod.Routes.TH.Types
+import qualified Yesod.Routes.Dispatch
+import qualified WaiAppStatic.Storage.Embedded
+import qualified WaiAppStatic.Storage.Embedded.Runtime
+import qualified Data.FileEmbed
+import qualified Data.ByteString.Internal
+import qualified Data.Text.Encoding
+import qualified Network.Wai
+import qualified Yesod.Core.Types
+{- End EvilSplicer headers. -}
+
+
diff --git a/standalone/android/haskell-patches/DAV_build-without-TH.patch b/standalone/android/haskell-patches/DAV_build-without-TH.patch
new file mode 100644
index 000000000..b871fa9ef
--- /dev/null
+++ b/standalone/android/haskell-patches/DAV_build-without-TH.patch
@@ -0,0 +1,377 @@
+From 2b5fc33607720d0cccd7d8f9cb7232042ead73e6 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 00:36:56 +0000
+Subject: [PATCH] expand TH
+
+used the EvilSplicer
++ manual fix ups
+---
+ DAV.cabal | 20 +--
+ Network/Protocol/HTTP/DAV.hs | 73 ++++++-----
+ Network/Protocol/HTTP/DAV/TH.hs | 196 +++++++++++++++++++++++++++-
+ dist/build/HSDAV-0.4.1.o | Bin 140080 -> 0 bytes
+ dist/build/Network/Protocol/HTTP/DAV.hi | Bin 34549 -> 57657 bytes
+ dist/build/Network/Protocol/HTTP/DAV.o | Bin 160248 -> 201932 bytes
+ dist/build/Network/Protocol/HTTP/DAV/TH.hi | Bin 17056 -> 18733 bytes
+ dist/build/Network/Protocol/HTTP/DAV/TH.o | Bin 19672 -> 28120 bytes
+ dist/build/autogen/Paths_DAV.hs | 18 ++-
+ dist/build/autogen/cabal_macros.h | 45 +++----
+ dist/build/libHSDAV-0.4.1.a | Bin 200082 -> 260188 bytes
+ dist/package.conf.inplace | 2 -
+ dist/setup-config | 2 -
+ 13 files changed, 266 insertions(+), 90 deletions(-)
+ delete mode 100644 dist/build/HSDAV-0.4.1.o
+ delete mode 100644 dist/package.conf.inplace
+ delete mode 100644 dist/setup-config
+
+diff --git a/DAV.cabal b/DAV.cabal
+index 06b3a8b..90368c6 100644
+--- a/DAV.cabal
++++ b/DAV.cabal
+@@ -38,25 +38,7 @@ library
+ , transformers >= 0.3
+ , xml-conduit >= 1.0 && <= 1.2
+ , xml-hamlet >= 0.4 && <= 0.5
+-executable hdav
+- main-is: hdav.hs
+- ghc-options: -Wall
+- build-depends: base >= 4.5 && <= 5
+- , bytestring
+- , bytestring
+- , case-insensitive >= 0.4
+- , containers
+- , http-conduit >= 1.9.0
+- , http-types >= 0.7
+- , lens >= 3.0
+- , lifted-base >= 0.1
+- , mtl >= 2.1
+- , network >= 2.3
+- , optparse-applicative
+- , resourcet >= 0.3
+- , transformers >= 0.3
+- , xml-conduit >= 1.0 && <= 1.2
+- , xml-hamlet >= 0.4 && <= 0.5
++ , text
+
+ source-repository head
+ type: git
+diff --git a/Network/Protocol/HTTP/DAV.hs b/Network/Protocol/HTTP/DAV.hs
+index 8ffc270..d064a8f 100644
+--- a/Network/Protocol/HTTP/DAV.hs
++++ b/Network/Protocol/HTTP/DAV.hs
+@@ -28,12 +28,12 @@ module Network.Protocol.HTTP.DAV (
+ , deleteContent
+ , moveContent
+ , makeCollection
+- , caldavReport
+ , module Network.Protocol.HTTP.DAV.TH
+ ) where
+
+ import Network.Protocol.HTTP.DAV.TH
+
++import qualified Data.Text
+ import Control.Applicative (liftA2)
+ import Control.Exception.Lifted (catchJust, finally, bracketOnError)
+ import Control.Lens ((.~), (^.))
+@@ -200,11 +200,6 @@ props2patch = XML.renderLBS XML.def . patch . props . fromDocument
+ , "{DAV:}supportedlock"
+ ]
+
+-caldavReportM :: MonadResourceBase m => DAVState m XML.Document
+-caldavReportM = do
+- let ahs = [(hContentType, "application/xml; charset=\"utf-8\"")]
+- calrresp <- davRequest "REPORT" ahs (xmlBody calendarquery)
+- return $ (XML.parseLBS_ def . responseBody) calrresp
+
+ getProps :: String -> B.ByteString -> B.ByteString -> Maybe Depth -> IO XML.Document
+ getProps url username password md = withDS url username password md getPropsM
+@@ -246,9 +241,6 @@ moveContent :: String -> B.ByteString -> B.ByteString -> B.ByteString -> IO ()
+ moveContent url newurl username password = withDS url username password Nothing $
+ moveContentM newurl
+
+-caldavReport :: String -> B.ByteString -> B.ByteString -> IO XML.Document
+-caldavReport url username password = withDS url username password (Just Depth1) $ caldavReportM
+-
+ -- | Creates a WebDAV collection, which is similar to a directory.
+ --
+ -- Returns False if the collection could not be made due to an intermediate
+@@ -264,28 +256,45 @@ makeCollection url username password = withDS url username password Nothing $
+ propname :: XML.Document
+ propname = XML.Document (XML.Prologue [] Nothing []) root []
+ where
+- root = XML.Element "D:propfind" (Map.fromList [("xmlns:D", "DAV:")]) [xml|
+-<D:allprop>
+-|]
+-
++ root = XML.Element "D:propfind" (Map.fromList [("xmlns:D", "DAV:")]) $ concat
++ [[XML.NodeElement
++ (XML.Element
++ (XML.Name
++ (Data.Text.pack "D:allprop") Nothing Nothing)
++ Map.empty
++ (concat []))]]
+ locky :: XML.Document
+ locky = XML.Document (XML.Prologue [] Nothing []) root []
+- where
+- root = XML.Element "D:lockinfo" (Map.fromList [("xmlns:D", "DAV:")]) [xml|
+-<D:lockscope>
+- <D:exclusive>
+-<D:locktype>
+- <D:write>
+-<D:owner>Haskell DAV user
+-|]
+-
+-calendarquery :: XML.Document
+-calendarquery = XML.Document (XML.Prologue [] Nothing []) root []
+- where
+- root = XML.Element "C:calendar-query" (Map.fromList [("xmlns:D", "DAV:"),("xmlns:C", "urn:ietf:params:xml:ns:caldav")]) [xml|
+-<D:prop>
+- <D:getetag>
+- <C:calendar-data>
+-<C:filter>
+- <C:comp-filter name="VCALENDAR">
+-|]
++ where
++ root = XML.Element "D:lockinfo" (Map.fromList [("xmlns:D", "DAV:")]) $ concat
++ [[XML.NodeElement
++ (XML.Element
++ (XML.Name
++ (Data.Text.pack "D:lockscope") Nothing Nothing)
++ Map.empty
++ (concat
++ [[XML.NodeElement
++ (XML.Element
++ (XML.Name
++ (Data.Text.pack "D:exclusive") Nothing Nothing)
++ Map.empty
++ (concat []))]]))],
++ [XML.NodeElement
++ (XML.Element
++ (XML.Name
++ (Data.Text.pack "D:locktype") Nothing Nothing)
++ Map.empty
++ (concat
++ [[XML.NodeElement
++ (XML.Element
++ (XML.Name (Data.Text.pack "D:write") Nothing Nothing)
++ Map.empty
++ (concat []))]]))],
++ [XML.NodeElement
++ (XML.Element
++ (XML.Name (Data.Text.pack "D:owner") Nothing Nothing)
++ Map.empty
++ (concat
++ [[XML.NodeContent
++ (Data.Text.pack "Haskell DAV user")]]))]]
++
+diff --git a/Network/Protocol/HTTP/DAV/TH.hs b/Network/Protocol/HTTP/DAV/TH.hs
+index 9fb3495..18b8df7 100644
+--- a/Network/Protocol/HTTP/DAV/TH.hs
++++ b/Network/Protocol/HTTP/DAV/TH.hs
+@@ -20,7 +20,8 @@
+
+ module Network.Protocol.HTTP.DAV.TH where
+
+-import Control.Lens (makeLenses)
++import qualified Control.Lens.Type
++import qualified Data.Functor
+ import qualified Data.ByteString as B
+ import Network.HTTP.Conduit (Manager, Request)
+
+@@ -46,4 +47,195 @@ data DAVContext a = DAVContext {
+ , _basicpassword :: B.ByteString
+ , _depth :: Maybe Depth
+ }
+-makeLenses ''DAVContext
++allowedMethods ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) [B.ByteString]
++allowedMethods
++ _f_a5GM
++ (DAVContext __allowedMethods'_a5GN
++ __baseRequest_a5GP
++ __complianceClasses_a5GQ
++ __httpManager_a5GR
++ __lockToken_a5GS
++ __basicusername_a5GT
++ __basicpassword_a5GU
++ __depth_a5GV)
++ = ((\ __allowedMethods_a5GO
++ -> DAVContext
++ __allowedMethods_a5GO
++ __baseRequest_a5GP
++ __complianceClasses_a5GQ
++ __httpManager_a5GR
++ __lockToken_a5GS
++ __basicusername_a5GT
++ __basicpassword_a5GU
++ __depth_a5GV)
++ Data.Functor.<$> (_f_a5GM __allowedMethods'_a5GN))
++{-# INLINE allowedMethods #-}
++baseRequest ::
++ Control.Lens.Type.Lens (DAVContext a_a4I4) (DAVContext a_a5GW) (Request a_a4I4) (Request a_a5GW)
++baseRequest
++ _f_a5GX
++ (DAVContext __allowedMethods_a5GY
++ __baseRequest'_a5GZ
++ __complianceClasses_a5H1
++ __httpManager_a5H2
++ __lockToken_a5H3
++ __basicusername_a5H4
++ __basicpassword_a5H5
++ __depth_a5H6)
++ = ((\ __baseRequest_a5H0
++ -> DAVContext
++ __allowedMethods_a5GY
++ __baseRequest_a5H0
++ __complianceClasses_a5H1
++ __httpManager_a5H2
++ __lockToken_a5H3
++ __basicusername_a5H4
++ __basicpassword_a5H5
++ __depth_a5H6)
++ Data.Functor.<$> (_f_a5GX __baseRequest'_a5GZ))
++{-# INLINE baseRequest #-}
++basicpassword ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) B.ByteString
++basicpassword
++ _f_a5H7
++ (DAVContext __allowedMethods_a5H8
++ __baseRequest_a5H9
++ __complianceClasses_a5Ha
++ __httpManager_a5Hb
++ __lockToken_a5Hc
++ __basicusername_a5Hd
++ __basicpassword'_a5He
++ __depth_a5Hg)
++ = ((\ __basicpassword_a5Hf
++ -> DAVContext
++ __allowedMethods_a5H8
++ __baseRequest_a5H9
++ __complianceClasses_a5Ha
++ __httpManager_a5Hb
++ __lockToken_a5Hc
++ __basicusername_a5Hd
++ __basicpassword_a5Hf
++ __depth_a5Hg)
++ Data.Functor.<$> (_f_a5H7 __basicpassword'_a5He))
++{-# INLINE basicpassword #-}
++basicusername ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) B.ByteString
++basicusername
++ _f_a5Hh
++ (DAVContext __allowedMethods_a5Hi
++ __baseRequest_a5Hj
++ __complianceClasses_a5Hk
++ __httpManager_a5Hl
++ __lockToken_a5Hm
++ __basicusername'_a5Hn
++ __basicpassword_a5Hp
++ __depth_a5Hq)
++ = ((\ __basicusername_a5Ho
++ -> DAVContext
++ __allowedMethods_a5Hi
++ __baseRequest_a5Hj
++ __complianceClasses_a5Hk
++ __httpManager_a5Hl
++ __lockToken_a5Hm
++ __basicusername_a5Ho
++ __basicpassword_a5Hp
++ __depth_a5Hq)
++ Data.Functor.<$> (_f_a5Hh __basicusername'_a5Hn))
++{-# INLINE basicusername #-}
++complianceClasses ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) [B.ByteString]
++complianceClasses
++ _f_a5Hr
++ (DAVContext __allowedMethods_a5Hs
++ __baseRequest_a5Ht
++ __complianceClasses'_a5Hu
++ __httpManager_a5Hw
++ __lockToken_a5Hx
++ __basicusername_a5Hy
++ __basicpassword_a5Hz
++ __depth_a5HA)
++ = ((\ __complianceClasses_a5Hv
++ -> DAVContext
++ __allowedMethods_a5Hs
++ __baseRequest_a5Ht
++ __complianceClasses_a5Hv
++ __httpManager_a5Hw
++ __lockToken_a5Hx
++ __basicusername_a5Hy
++ __basicpassword_a5Hz
++ __depth_a5HA)
++ Data.Functor.<$> (_f_a5Hr __complianceClasses'_a5Hu))
++{-# INLINE complianceClasses #-}
++depth ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) (Maybe Depth)
++depth
++ _f_a5HB
++ (DAVContext __allowedMethods_a5HC
++ __baseRequest_a5HD
++ __complianceClasses_a5HE
++ __httpManager_a5HF
++ __lockToken_a5HG
++ __basicusername_a5HH
++ __basicpassword_a5HI
++ __depth'_a5HJ)
++ = ((\ __depth_a5HK
++ -> DAVContext
++ __allowedMethods_a5HC
++ __baseRequest_a5HD
++ __complianceClasses_a5HE
++ __httpManager_a5HF
++ __lockToken_a5HG
++ __basicusername_a5HH
++ __basicpassword_a5HI
++ __depth_a5HK)
++ Data.Functor.<$> (_f_a5HB __depth'_a5HJ))
++{-# INLINE depth #-}
++httpManager ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) Manager
++httpManager
++ _f_a5HL
++ (DAVContext __allowedMethods_a5HM
++ __baseRequest_a5HN
++ __complianceClasses_a5HO
++ __httpManager'_a5HP
++ __lockToken_a5HR
++ __basicusername_a5HS
++ __basicpassword_a5HT
++ __depth_a5HU)
++ = ((\ __httpManager_a5HQ
++ -> DAVContext
++ __allowedMethods_a5HM
++ __baseRequest_a5HN
++ __complianceClasses_a5HO
++ __httpManager_a5HQ
++ __lockToken_a5HR
++ __basicusername_a5HS
++ __basicpassword_a5HT
++ __depth_a5HU)
++ Data.Functor.<$> (_f_a5HL __httpManager'_a5HP))
++{-# INLINE httpManager #-}
++lockToken ::
++ Control.Lens.Type.Lens' (DAVContext a_a4I4) (Maybe B.ByteString)
++lockToken
++ _f_a5HV
++ (DAVContext __allowedMethods_a5HW
++ __baseRequest_a5HX
++ __complianceClasses_a5HY
++ __httpManager_a5HZ
++ __lockToken'_a5I0
++ __basicusername_a5I2
++ __basicpassword_a5I3
++ __depth_a5I4)
++ = ((\ __lockToken_a5I1
++ -> DAVContext
++ __allowedMethods_a5HW
++ __baseRequest_a5HX
++ __complianceClasses_a5HY
++ __httpManager_a5HZ
++ __lockToken_a5I1
++ __basicusername_a5I2
++ __basicpassword_a5I3
++ __depth_a5I4)
++ Data.Functor.<$> (_f_a5HV __lockToken'_a5I0))
++{-# INLINE lockToken #-}
diff --git a/standalone/android/haskell-patches/HTTP_4000.2.8-0001-build-with-base-4.8.patch b/standalone/android/haskell-patches/HTTP_4000.2.8-0001-build-with-base-4.8.patch
new file mode 100644
index 000000000..dfcdc387f
--- /dev/null
+++ b/standalone/android/haskell-patches/HTTP_4000.2.8-0001-build-with-base-4.8.patch
@@ -0,0 +1,25 @@
+From 5c57c4ae7dac0c1aa940005f5ea55fdcd4fcd1f5 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 22:46:42 +0000
+Subject: [PATCH] fix build with new base
+
+---
+ HTTP.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/HTTP.cabal b/HTTP.cabal
+index 76cb5d6..bb38f24 100644
+--- a/HTTP.cabal
++++ b/HTTP.cabal
+@@ -85,7 +85,7 @@ Library
+ Network.HTTP.Utils
+ Paths_HTTP
+ GHC-options: -fwarn-missing-signatures -Wall
+- Build-depends: base >= 2 && < 4.7, network < 2.5, parsec
++ Build-depends: base >= 2 && < 4.9, network < 2.5, parsec
+ Extensions: FlexibleInstances
+ if flag(old-base)
+ Build-depends: base < 3
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/MissingH_1.2.0.0_0001-fix-build-not-Android-specific.patch b/standalone/android/haskell-patches/MissingH_1.2.0.0_0001-fix-build-not-Android-specific.patch
new file mode 100644
index 000000000..50f641da7
--- /dev/null
+++ b/standalone/android/haskell-patches/MissingH_1.2.0.0_0001-fix-build-not-Android-specific.patch
@@ -0,0 +1,34 @@
+From 8c4220e4dd48ad197aa0ad49214e6e7bd768044e Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Thu, 28 Feb 2013 23:28:57 -0400
+Subject: [PATCH] fix build (not Android specific)
+
+---
+ src/System/Cmd/Utils.hs | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/System/Cmd/Utils.hs b/src/System/Cmd/Utils.hs
+index a9fa46f..6c6aba2 100644
+--- a/src/System/Cmd/Utils.hs
++++ b/src/System/Cmd/Utils.hs
+@@ -325,7 +325,7 @@ forceSuccess (PipeHandle pid fp args funcname) =
+ Just (Exited (ExitSuccess)) -> return ()
+ Just (Exited (ExitFailure fc)) ->
+ cmdfailed funcname fp args fc
+- Just (Terminated sig) ->
++ Just (Terminated sig _) ->
+ warnfail fp args $ "Terminated by signal " ++ show sig
+ Just (Stopped sig) ->
+ warnfail fp args $ "Stopped by signal " ++ show sig
+@@ -351,7 +351,7 @@ safeSystem command args =
+ case ec of
+ Exited ExitSuccess -> return ()
+ Exited (ExitFailure fc) -> cmdfailed "safeSystem" command args fc
+- Terminated s -> cmdsignalled "safeSystem" command args s
++ Terminated s _ -> cmdsignalled "safeSystem" command args s
+ Stopped s -> cmdsignalled "safeSystem" command args s
+ #endif
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/MonadCatchIO-transformers_hack-to-get-to-build-with-new-ghc.patch b/standalone/android/haskell-patches/MonadCatchIO-transformers_hack-to-get-to-build-with-new-ghc.patch
new file mode 100644
index 000000000..9881d35d6
--- /dev/null
+++ b/standalone/android/haskell-patches/MonadCatchIO-transformers_hack-to-get-to-build-with-new-ghc.patch
@@ -0,0 +1,56 @@
+From 083c9d135ec68316db173235994c63603ad76444 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 23:01:35 +0000
+Subject: [PATCH] hack to get to build with new ghc
+
+Copied the old implemenations of block and unblock from old Control.Exception
+since these deprecated functions have now been removed.
+---
+ MonadCatchIO-transformers.cabal | 2 +-
+ src/Control/Monad/CatchIO.hs | 13 +++++++++++--
+ 2 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/MonadCatchIO-transformers.cabal b/MonadCatchIO-transformers.cabal
+index fe6674d..b9f559f 100644
+--- a/MonadCatchIO-transformers.cabal
++++ b/MonadCatchIO-transformers.cabal
+@@ -26,4 +26,4 @@ Library
+ Exposed-Modules:
+ Control.Monad.CatchIO
+ Hs-Source-Dirs: src
+- Ghc-options: -Wall
++ Ghc-options: -Wall -fglasgow-exts
+diff --git a/src/Control/Monad/CatchIO.hs b/src/Control/Monad/CatchIO.hs
+index 62afb83..853996b 100644
+--- a/src/Control/Monad/CatchIO.hs
++++ b/src/Control/Monad/CatchIO.hs
+@@ -19,6 +19,9 @@ where
+ import Prelude hiding ( catch )
+ import Control.Applicative ((<$>))
+ import qualified Control.Exception.Extensible as E
++import qualified Control.Exception.Base as E
++import GHC.Base (maskAsyncExceptions#)
++import GHC.IO (unsafeUnmask, IO(..))
+
+ import Control.Monad.IO.Class (MonadIO,liftIO)
+
+@@ -51,8 +54,14 @@ class MonadIO m => MonadCatchIO m where
+
+ instance MonadCatchIO IO where
+ catch = E.catch
+- block = E.block
+- unblock = E.unblock
++ block = oldblock
++ unblock = oldunblock
++
++oldblock :: IO a -> IO a
++oldblock (IO io) = IO $ maskAsyncExceptions# io
++
++oldunblock :: IO a -> IO a
++oldunblock = unsafeUnmask
+
+ -- | Warning: this instance is somewhat contentious.
+ --
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/SafeSemaphore_fix-build-with-new-base.patch b/standalone/android/haskell-patches/SafeSemaphore_fix-build-with-new-base.patch
new file mode 100644
index 000000000..a79ca519a
--- /dev/null
+++ b/standalone/android/haskell-patches/SafeSemaphore_fix-build-with-new-base.patch
@@ -0,0 +1,36 @@
+From 010db89634eb0f64e7961581e65da3acbb2b9f3d Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 22:05:41 +0000
+Subject: [PATCH] fix build with new base
+
+---
+ src/Control/Concurrent/MSampleVar.hs | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/src/Control/Concurrent/MSampleVar.hs b/src/Control/Concurrent/MSampleVar.hs
+index d029c64..16ad6c5 100644
+--- a/src/Control/Concurrent/MSampleVar.hs
++++ b/src/Control/Concurrent/MSampleVar.hs
+@@ -30,7 +30,7 @@ module Control.Concurrent.MSampleVar
+ import Control.Monad(void,join)
+ import Control.Concurrent.MVar(MVar,newMVar,newEmptyMVar,tryTakeMVar,takeMVar,putMVar,withMVar,isEmptyMVar)
+ import Control.Exception(mask_)
+-import Data.Typeable(Typeable1(typeOf1),mkTyCon,mkTyConApp)
++import Data.Typeable(mkTyConApp)
+
+ -- |
+ -- Sample variables are slightly different from a normal 'MVar':
+@@ -62,10 +62,6 @@ data MSampleVar a = MSampleVar { readQueue :: MVar ()
+ , lockedStore :: MVar (MVar a) }
+ deriving (Eq)
+
+-instance Typeable1 MSampleVar where
+- typeOf1 _ = mkTyConApp tc []
+- where tc = mkTyCon "MSampleVar"
+-
+
+ -- | 'newEmptySV' allocates a new MSampleVar in an empty state. No futher
+ -- allocation is done when using the 'MSampleVar'.
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/async_fix-build-with-new-ghc.patch b/standalone/android/haskell-patches/async_fix-build-with-new-ghc.patch
new file mode 100644
index 000000000..727720ad4
--- /dev/null
+++ b/standalone/android/haskell-patches/async_fix-build-with-new-ghc.patch
@@ -0,0 +1,25 @@
+From 0035f0366e426af213244b2eb25ffb63cb9e74d0 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 06:14:50 +0000
+Subject: [PATCH] fix build with new ghc
+
+---
+ async.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/async.cabal b/async.cabal
+index 8e47d9d..98e6312 100644
+--- a/async.cabal
++++ b/async.cabal
+@@ -70,7 +70,7 @@ source-repository head
+
+ library
+ exposed-modules: Control.Concurrent.Async
+- build-depends: base >= 4.3 && < 4.7, stm >= 2.2 && < 2.5
++ build-depends: base >= 4.3 && < 4.9, stm >= 2.2 && < 2.5
+
+ test-suite test-async
+ type: exitcode-stdio-1.0
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/bloomfilter_fix-build-with-newer-base.patch b/standalone/android/haskell-patches/bloomfilter_fix-build-with-newer-base.patch
new file mode 100644
index 000000000..d2f783a7f
--- /dev/null
+++ b/standalone/android/haskell-patches/bloomfilter_fix-build-with-newer-base.patch
@@ -0,0 +1,26 @@
+From 09bcaf4f203c39c967a6951d56fd015347bb5dae Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 21:57:21 +0000
+Subject: [PATCH] fix build with newer base
+
+---
+ Data/BloomFilter/Array.hs | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Data/BloomFilter/Array.hs b/Data/BloomFilter/Array.hs
+index e085bbe..d94757a 100644
+--- a/Data/BloomFilter/Array.hs
++++ b/Data/BloomFilter/Array.hs
+@@ -3,7 +3,8 @@
+
+ module Data.BloomFilter.Array (newArray) where
+
+-import Control.Monad.ST (ST, unsafeIOToST)
++import Control.Monad.ST (ST)
++import Control.Monad.ST.Unsafe (unsafeIOToST)
+ import Data.Array.Base (MArray, STUArray(..), unsafeNewArray_)
+ #if __GLASGOW_HASKELL__ >= 704
+ import Foreign.C.Types (CInt(..), CSize(..))
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/comonad_cross-build.patch b/standalone/android/haskell-patches/comonad_cross-build.patch
new file mode 100644
index 000000000..ee8ae4268
--- /dev/null
+++ b/standalone/android/haskell-patches/comonad_cross-build.patch
@@ -0,0 +1,25 @@
+From 589c6a87ec62e35942c9a86ea8d91b443c80da99 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Fri, 18 Oct 2013 23:07:02 +0000
+Subject: [PATCH] cross build
+
+---
+ comonad.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/comonad.cabal b/comonad.cabal
+index 5d34b13..756ed92 100644
+--- a/comonad.cabal
++++ b/comonad.cabal
+@@ -13,7 +13,7 @@ copyright: Copyright (C) 2008-2013 Edward A. Kmett,
+ Copyright (C) 2004-2008 Dave Menendez
+ synopsis: Comonads
+ description: Comonads
+-build-type: Custom
++build-type: Simple
+ extra-source-files:
+ .ghci
+ .gitignore
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/crypto-numbers_build-fix.patch b/standalone/android/haskell-patches/crypto-numbers_build-fix.patch
new file mode 100644
index 000000000..f8bdd1c39
--- /dev/null
+++ b/standalone/android/haskell-patches/crypto-numbers_build-fix.patch
@@ -0,0 +1,235 @@
+From f6ed5c3093111ffe0276f5b5bb6241783611ab1c Mon Sep 17 00:00:00 2001
+From: androidbuilder <androidbuilder@example.com>
+Date: Mon, 11 Nov 2013 01:54:25 +0000
+Subject: [PATCH] hack to build
+
+---
+ Crypto/Number/Basic.hs | 17 -----------------
+ Crypto/Number/ModArithmetic.hs | 29 -----------------------------
+ Crypto/Number/Prime.hs | 18 ------------------
+ crypto-numbers.cabal | 2 +-
+ 4 files changed, 1 insertion(+), 65 deletions(-)
+
+diff --git a/Crypto/Number/Basic.hs b/Crypto/Number/Basic.hs
+index af03052..5de8518 100644
+--- a/Crypto/Number/Basic.hs
++++ b/Crypto/Number/Basic.hs
+@@ -1,8 +1,5 @@
+ {-# LANGUAGE BangPatterns #-}
+ {-# LANGUAGE CPP #-}
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-{-# LANGUAGE UnboxedTuples #-}
+-#endif
+ -- |
+ -- Module : Crypto.Number.Basic
+ -- License : BSD-style
+@@ -17,11 +14,7 @@ module Crypto.Number.Basic
+ , areEven
+ ) where
+
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-import GHC.Integer.GMP.Internals
+-#else
+ import Data.Bits
+-#endif
+
+ -- | sqrti returns two integer (l,b) so that l <= sqrt i <= b
+ -- the implementation is quite naive, use an approximation for the first number
+@@ -60,25 +53,16 @@ sqrti i
+ -- gcde 'a' 'b' find (x,y,gcd(a,b)) where ax + by = d
+ --
+ gcde :: Integer -> Integer -> (Integer, Integer, Integer)
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-gcde a b = (s, t, g)
+- where (# g, s #) = gcdExtInteger a b
+- t = (g - s * a) `div` b
+-#else
+ gcde a b = if d < 0 then (-x,-y,-d) else (x,y,d) where
+ (d, x, y) = f (a,1,0) (b,0,1)
+ f t (0, _, _) = t
+ f (a', sa, ta) t@(b', sb, tb) =
+ let (q, r) = a' `divMod` b' in
+ f t (r, sa - (q * sb), ta - (q * tb))
+-#endif
+
+ -- | get the extended GCD of two integer using the extended binary algorithm (HAC 14.61)
+ -- get (x,y,d) where d = gcd(a,b) and x,y satisfying ax + by = d
+ gcde_binary :: Integer -> Integer -> (Integer, Integer, Integer)
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-gcde_binary = gcde
+-#else
+ gcde_binary a' b'
+ | b' == 0 = (1,0,a')
+ | a' >= b' = compute a' b'
+@@ -102,7 +86,6 @@ gcde_binary a' b'
+ in if u2 >= v2
+ then loop g x y (u2 - v2) v2 (a2 - c2) (b2 - d2) c2 d2
+ else loop g x y u2 (v2 - u2) a2 b2 (c2 - a2) (d2 - b2)
+-#endif
+
+ -- | check if a list of integer are all even
+ areEven :: [Integer] -> Bool
+diff --git a/Crypto/Number/ModArithmetic.hs b/Crypto/Number/ModArithmetic.hs
+index 031f477..38b22b7 100644
+--- a/Crypto/Number/ModArithmetic.hs
++++ b/Crypto/Number/ModArithmetic.hs
+@@ -26,12 +26,8 @@ module Crypto.Number.ModArithmetic
+ import Control.Exception (throw, Exception)
+ import Data.Typeable
+
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-import GHC.Integer.GMP.Internals
+-#else
+ import Crypto.Number.Basic (gcde_binary)
+ import Data.Bits
+-#endif
+
+ -- | Raised when two numbers are supposed to be coprimes but are not.
+ data CoprimesAssertionError = CoprimesAssertionError
+@@ -52,13 +48,7 @@ expSafe :: Integer -- ^ base
+ -> Integer -- ^ exponant
+ -> Integer -- ^ modulo
+ -> Integer -- ^ result
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-expSafe b e m
+- | odd m = powModSecInteger b e m
+- | otherwise = powModInteger b e m
+-#else
+ expSafe = exponentiation
+-#endif
+
+ -- | Compute the modular exponentiation of base^exponant using
+ -- the fastest algorithm without any consideration for
+@@ -71,11 +61,7 @@ expFast :: Integer -- ^ base
+ -> Integer -- ^ modulo
+ -> Integer -- ^ result
+ expFast =
+-#if MIN_VERSION_integer_gmp(0,5,1)
+- powModInteger
+-#else
+ exponentiation
+-#endif
+
+ -- note on exponentiation: 0^0 is treated as 1 for mimicking the standard library;
+ -- the mathematic debate is still open on whether or not this is true, but pratically
+@@ -84,22 +70,15 @@ expFast =
+ -- | exponentiation_rtl_binary computes modular exponentiation as b^e mod m
+ -- using the right-to-left binary exponentiation algorithm (HAC 14.79)
+ exponentiation_rtl_binary :: Integer -> Integer -> Integer -> Integer
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-exponentiation_rtl_binary = expSafe
+-#else
+ exponentiation_rtl_binary 0 0 m = 1 `mod` m
+ exponentiation_rtl_binary b e m = loop e b 1
+ where sq x = (x * x) `mod` m
+ loop !0 _ !a = a `mod` m
+ loop !i !s !a = loop (i `shiftR` 1) (sq s) (if odd i then a * s else a)
+-#endif
+
+ -- | exponentiation computes modular exponentiation as b^e mod m
+ -- using repetitive squaring.
+ exponentiation :: Integer -> Integer -> Integer -> Integer
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-exponentiation = expSafe
+-#else
+ exponentiation b e m
+ | b == 1 = b
+ | e == 0 = 1
+@@ -107,7 +86,6 @@ exponentiation b e m
+ | even e = let p = (exponentiation b (e `div` 2) m) `mod` m
+ in (p^(2::Integer)) `mod` m
+ | otherwise = (b * exponentiation b (e-1) m) `mod` m
+-#endif
+
+ --{-# DEPRECATED exponantiation_rtl_binary "typo in API name it's called exponentiation_rtl_binary #-}
+ exponantiation_rtl_binary :: Integer -> Integer -> Integer -> Integer
+@@ -119,17 +97,10 @@ exponantiation = exponentiation
+
+ -- | inverse computes the modular inverse as in g^(-1) mod m
+ inverse :: Integer -> Integer -> Maybe Integer
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-inverse g m
+- | r == 0 = Nothing
+- | otherwise = Just r
+- where r = recipModInteger g m
+-#else
+ inverse g m
+ | d > 1 = Nothing
+ | otherwise = Just (x `mod` m)
+ where (x,_,d) = gcde_binary g m
+-#endif
+
+ -- | Compute the modular inverse of 2 coprime numbers.
+ -- This is equivalent to inverse except that the result
+diff --git a/Crypto/Number/Prime.hs b/Crypto/Number/Prime.hs
+index 2060f4d..61d37c0 100644
+--- a/Crypto/Number/Prime.hs
++++ b/Crypto/Number/Prime.hs
+@@ -1,8 +1,6 @@
+ {-# LANGUAGE CPP #-}
+ {-# LANGUAGE BangPatterns #-}
+-#if MIN_VERSION_integer_gmp(0,5,1)
+ {-# LANGUAGE MagicHash #-}
+-#endif
+ -- |
+ -- Module : Crypto.Number.Prime
+ -- License : BSD-style
+@@ -27,12 +25,7 @@ import Crypto.Number.Generate
+ import Crypto.Number.Basic (sqrti, gcde_binary)
+ import Crypto.Number.ModArithmetic (exponantiation)
+
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-import GHC.Integer.GMP.Internals
+-import GHC.Base
+-#else
+ import Data.Bits
+-#endif
+
+ -- | returns if the number is probably prime.
+ -- first a list of small primes are implicitely tested for divisibility,
+@@ -75,21 +68,11 @@ findPrimeFromWith rng prop !n
+ -- | find a prime from a starting point with no specific property.
+ findPrimeFrom :: CPRG g => g -> Integer -> (Integer, g)
+ findPrimeFrom rng n =
+-#if MIN_VERSION_integer_gmp(0,5,1)
+- (nextPrimeInteger n, rng)
+-#else
+ findPrimeFromWith rng (\g _ -> (True, g)) n
+-#endif
+
+ -- | Miller Rabin algorithm return if the number is probably prime or composite.
+ -- the tries parameter is the number of recursion, that determines the accuracy of the test.
+ primalityTestMillerRabin :: CPRG g => g -> Int -> Integer -> (Bool, g)
+-#if MIN_VERSION_integer_gmp(0,5,1)
+-primalityTestMillerRabin rng (I# tries) !n =
+- case testPrimeInteger n tries of
+- 0# -> (False, rng)
+- _ -> (True, rng)
+-#else
+ primalityTestMillerRabin rng tries !n
+ | n <= 3 = error "Miller-Rabin requires tested value to be > 3"
+ | even n = (False, rng)
+@@ -126,7 +109,6 @@ primalityTestMillerRabin rng tries !n
+ | x2 == 1 = False
+ | x2 /= nm1 = loop' ws ((x2*x2) `mod` n) (r+1)
+ | otherwise = loop ws
+-#endif
+
+ {-
+ n < z -> witness to test
+diff --git a/crypto-numbers.cabal b/crypto-numbers.cabal
+index 05c00c1..8da5e2a 100644
+--- a/crypto-numbers.cabal
++++ b/crypto-numbers.cabal
+@@ -15,7 +15,7 @@ Extra-Source-Files: Tests/*.hs
+
+ Flag integer-gmp
+ Description: Are we using integer-gmp?
+- Default: True
++ Default: False
+
+ Library
+ Build-Depends: base >= 4 && < 5
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/distributive_0.3-0001-fixes-for-cross-build.patch b/standalone/android/haskell-patches/distributive_0.3-0001-fixes-for-cross-build.patch
new file mode 100644
index 000000000..4859be9a4
--- /dev/null
+++ b/standalone/android/haskell-patches/distributive_0.3-0001-fixes-for-cross-build.patch
@@ -0,0 +1,25 @@
+From 6cd7b7d3a8e38ada9b1e3989770525c63f9f1d7d Mon Sep 17 00:00:00 2001
+From: androidbuilder <androidbuilder@example.com>
+Date: Fri, 18 Oct 2013 23:10:16 +0000
+Subject: [PATCH] cross build
+
+---
+ distributive.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/distributive.cabal b/distributive.cabal
+index 5d4ac69..82d7593 100644
+--- a/distributive.cabal
++++ b/distributive.cabal
+@@ -12,7 +12,7 @@ bug-reports: http://github.com/ekmett/distributive/issues
+ copyright: Copyright (C) 2011-2013 Edward A. Kmett
+ synopsis: Haskell 98 Distributive functors -- Dual to Traversable
+ description: Haskell 98 Distributive functors -- Dual to Traversable
+-build-type: Custom
++build-type: Simple
+ extra-source-files:
+ .ghci
+ .travis.yml
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/entropy_cross-build.patch b/standalone/android/haskell-patches/entropy_cross-build.patch
new file mode 100644
index 000000000..5e09fdc8f
--- /dev/null
+++ b/standalone/android/haskell-patches/entropy_cross-build.patch
@@ -0,0 +1,25 @@
+From 10da50b5eea1e615af1d3b242f422ad278c9f268 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Fri, 18 Oct 2013 23:16:41 +0000
+Subject: [PATCH] cross build
+
+---
+ entropy.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/entropy.cabal b/entropy.cabal
+index e69dec4..4fa3774 100644
+--- a/entropy.cabal
++++ b/entropy.cabal
+@@ -14,7 +14,7 @@ category: Data, Cryptography
+ homepage: https://github.com/TomMD/entropy
+ bug-reports: https://github.com/TomMD/entropy/issues
+ stability: stable
+-build-type: Custom
++build-type: Simple
+ cabal-version: >=1.10
+ tested-with: GHC == 7.6.3
+ -- data-files:
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/gnuidn_fix-build-with-new-base.patch b/standalone/android/haskell-patches/gnuidn_fix-build-with-new-base.patch
new file mode 100644
index 000000000..ff9d8f245
--- /dev/null
+++ b/standalone/android/haskell-patches/gnuidn_fix-build-with-new-base.patch
@@ -0,0 +1,50 @@
+From afdec6c9e66211a0ac8419fffe191b059d1fd00c Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 17:24:33 +0000
+Subject: [PATCH] fix build with new base
+
+---
+ Data/Text/IDN/IDNA.chs | 1 +
+ Data/Text/IDN/Punycode.chs | 1 +
+ Data/Text/IDN/StringPrep.chs | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/Data/Text/IDN/IDNA.chs b/Data/Text/IDN/IDNA.chs
+index ed29ee4..dbb4ba5 100644
+--- a/Data/Text/IDN/IDNA.chs
++++ b/Data/Text/IDN/IDNA.chs
+@@ -31,6 +31,7 @@ import Foreign
+ import Foreign.C
+
+ import Data.Text.IDN.Internal
++import System.IO.Unsafe
+
+ #include <idna.h>
+ #include <idn-free.h>
+diff --git a/Data/Text/IDN/Punycode.chs b/Data/Text/IDN/Punycode.chs
+index 24b5fa6..4e62555 100644
+--- a/Data/Text/IDN/Punycode.chs
++++ b/Data/Text/IDN/Punycode.chs
+@@ -32,6 +32,7 @@ import Data.List (unfoldr)
+ import qualified Data.ByteString as B
+ import qualified Data.Text as T
+
++import System.IO.Unsafe
+ import Foreign
+ import Foreign.C
+
+diff --git a/Data/Text/IDN/StringPrep.chs b/Data/Text/IDN/StringPrep.chs
+index 752dc9e..5e9fd84 100644
+--- a/Data/Text/IDN/StringPrep.chs
++++ b/Data/Text/IDN/StringPrep.chs
+@@ -39,6 +39,7 @@ import qualified Data.ByteString as B
+ import qualified Data.Text as T
+ import qualified Data.Text.Encoding as TE
+
++import System.IO.Unsafe
+ import Foreign
+ import Foreign.C
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/gnutls_0.1.4-0001-statically-link-with-gnutls.patch b/standalone/android/haskell-patches/gnutls_0.1.4-0001-statically-link-with-gnutls.patch
new file mode 100644
index 000000000..24f17cc6f
--- /dev/null
+++ b/standalone/android/haskell-patches/gnutls_0.1.4-0001-statically-link-with-gnutls.patch
@@ -0,0 +1,37 @@
+From 67435289745b2f96fc9d1cd8e0263ef0565e4789 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Tue, 26 Nov 2013 19:18:28 +0000
+Subject: [PATCH] hack gnutls to statically link
+
+This uses a hardcoded path to the library, which includes the
+arm-linux-androideabi-4.8 part. Will need to be changed when that changes..
+---
+ gnutls.cabal | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/gnutls.cabal b/gnutls.cabal
+index 5bfe687..ff1d08c 100644
+--- a/gnutls.cabal
++++ b/gnutls.cabal
+@@ -31,16 +31,14 @@ source-repository this
+ library
+ hs-source-dirs: lib
+ ghc-options: -Wall -O2
++ LD-Options: -L /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/sysroot/usr/lib/ -l:libgnutls.a -l:libnettle.a -l:libhogweed.a -l:libgmp.a
+
+ build-depends:
+ base >= 4.0 && < 5.0
+- , bytestring >= 0.9
++ , bytestring >= 0.10.3.0
+ , transformers >= 0.2
+ , monads-tf >= 0.1 && < 0.2
+
+- extra-libraries: gnutls
+- pkgconfig-depends: gnutls
+-
+ exposed-modules:
+ Network.Protocol.TLS.GNU
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/gsasl_0.3.5-0001-link-with-libgsasl.patch b/standalone/android/haskell-patches/gsasl_0.3.5-0001-link-with-libgsasl.patch
new file mode 100644
index 000000000..42206a1cf
--- /dev/null
+++ b/standalone/android/haskell-patches/gsasl_0.3.5-0001-link-with-libgsasl.patch
@@ -0,0 +1,25 @@
+From df0f41f92d003f7d59ef927737ffec3a9bd61827 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Tue, 7 May 2013 18:41:01 -0400
+Subject: [PATCH] avoid cabal hell
+
+---
+ gsasl.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gsasl.cabal b/gsasl.cabal
+index d991873..c5c2b19 100644
+--- a/gsasl.cabal
++++ b/gsasl.cabal
+@@ -31,7 +31,7 @@ library
+ build-depends:
+ base >= 4.0 && < 5.0
+ , transformers >= 0.2
+- , bytestring >= 0.9
++ , bytestring >= 0.10.3.0
+
+ pkgconfig-depends: libgsasl >= 1.1
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/iproute_1.2.11_0001-build-without-IPv6-stuff.patch b/standalone/android/haskell-patches/iproute_1.2.11_0001-build-without-IPv6-stuff.patch
new file mode 100644
index 000000000..bb9caec77
--- /dev/null
+++ b/standalone/android/haskell-patches/iproute_1.2.11_0001-build-without-IPv6-stuff.patch
@@ -0,0 +1,47 @@
+From 7beec2e707d59f9573aa2dc7c57bd2a62f16b480 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Wed, 15 May 2013 19:06:03 -0400
+Subject: [PATCH] build without IPv6 stuff
+
+---
+ Data/IP.hs | 2 +-
+ Data/IP/Addr.hs | 3 +++
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/Data/IP.hs b/Data/IP.hs
+index cffef93..ea486c9 100644
+--- a/Data/IP.hs
++++ b/Data/IP.hs
+@@ -6,7 +6,7 @@ module Data.IP (
+ -- ** IP data
+ IP (..)
+ , IPv4, toIPv4, fromIPv4, fromHostAddress, toHostAddress
+- , IPv6, toIPv6, fromIPv6, fromHostAddress6, toHostAddress6
++ , IPv6, toIPv6, fromIPv6 -- , fromHostAddress6, toHostAddress6
+ -- ** IP range data
+ , IPRange (..)
+ , AddrRange (addr, mask, mlen)
+diff --git a/Data/IP/Addr.hs b/Data/IP/Addr.hs
+index faaf0c7..5b556fb 100644
+--- a/Data/IP/Addr.hs
++++ b/Data/IP/Addr.hs
+@@ -312,6 +312,7 @@ toHostAddress (IP4 addr4)
+ | byteOrder == LittleEndian = fixByteOrder addr4
+ | otherwise = addr4
+
++{-
+ -- | The 'fromHostAddress6' function converts 'HostAddress6' to 'IPv6'.
+ fromHostAddress6 :: HostAddress6 -> IPv6
+ fromHostAddress6 = IP6
+@@ -320,6 +321,8 @@ fromHostAddress6 = IP6
+ toHostAddress6 :: IPv6 -> HostAddress6
+ toHostAddress6 (IP6 addr6) = addr6
+
++-}
++
+ fixByteOrder :: Word32 -> Word32
+ fixByteOrder s = d1 .|. d2 .|. d3 .|. d4
+ where
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/language-javascript_fix-build-with-new-ghc.patch b/standalone/android/haskell-patches/language-javascript_fix-build-with-new-ghc.patch
new file mode 100644
index 000000000..6182cba44
--- /dev/null
+++ b/standalone/android/haskell-patches/language-javascript_fix-build-with-new-ghc.patch
@@ -0,0 +1,25 @@
+From cb5252db1a0d515da69d9167a8b2facd839940b2 Mon Sep 17 00:00:00 2001
+From: androidbuilder <androidbuilder@example.com>
+Date: Mon, 11 Nov 2013 02:29:06 +0000
+Subject: [PATCH] fix build with new ghc
+
+---
+ src/Language/JavaScript/Parser/Lexer.hs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Language/JavaScript/Parser/Lexer.hs b/src/Language/JavaScript/Parser/Lexer.hs
+index 79fa9c5..fa96e29 100644
+--- a/src/Language/JavaScript/Parser/Lexer.hs
++++ b/src/Language/JavaScript/Parser/Lexer.hs
+@@ -712,7 +712,7 @@ alex_scan_tkn user orig_input len input s last_acc =
+ (offset) = (base +# ord_c)
+ (check) = alexIndexInt16OffAddr alex_check offset
+
+- (new_s) = if (offset >=# 0#) && (check ==# ord_c)
++ (new_s) = if (tagToEnum# (offset >=# 0#)) && (tagToEnum# (check ==# ord_c))
+ then alexIndexInt16OffAddr alex_table offset
+ else alexIndexInt16OffAddr alex_deflt s
+ in
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/lens_various-hacking-to-cross-build.patch b/standalone/android/haskell-patches/lens_various-hacking-to-cross-build.patch
new file mode 100644
index 000000000..274efc71e
--- /dev/null
+++ b/standalone/android/haskell-patches/lens_various-hacking-to-cross-build.patch
@@ -0,0 +1,385 @@
+From 41706061810410cc38f602ccc9a4c9560502251f Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Sat, 19 Oct 2013 01:44:52 +0000
+Subject: [PATCH] hackity
+
+---
+ lens.cabal | 12 +-----------
+ src/Control/Exception/Lens.hs | 2 +-
+ src/Control/Lens.hs | 6 +++---
+ src/Control/Lens/Equality.hs | 4 ++--
+ src/Control/Lens/Fold.hs | 6 +++---
+ src/Control/Lens/Internal.hs | 2 +-
+ src/Control/Lens/Internal/Exception.hs | 26 +-------------------------
+ src/Control/Lens/Internal/Instances.hs | 14 --------------
+ src/Control/Lens/Internal/Zipper.hs | 2 +-
+ src/Control/Lens/Iso.hs | 2 --
+ src/Control/Lens/Lens.hs | 2 +-
+ src/Control/Lens/Operators.hs | 2 +-
+ src/Control/Lens/Plated.hs | 2 +-
+ src/Control/Lens/Prism.hs | 2 --
+ src/Control/Lens/Setter.hs | 2 --
+ src/Control/Lens/TH.hs | 2 +-
+ src/Data/Data/Lens.hs | 6 +++---
+ 17 files changed, 20 insertions(+), 74 deletions(-)
+
+diff --git a/lens.cabal b/lens.cabal
+index b25adf4..3e5c30c 100644
+--- a/lens.cabal
++++ b/lens.cabal
+@@ -10,7 +10,7 @@ stability: provisional
+ homepage: http://github.com/ekmett/lens/
+ bug-reports: http://github.com/ekmett/lens/issues
+ copyright: Copyright (C) 2012-2013 Edward A. Kmett
+-build-type: Custom
++build-type: Simple
+ tested-with: GHC == 7.6.3
+ synopsis: Lenses, Folds and Traversals
+ description:
+@@ -235,14 +235,12 @@ library
+ Control.Lens.Review
+ Control.Lens.Setter
+ Control.Lens.Simple
+- Control.Lens.TH
+ Control.Lens.Traversal
+ Control.Lens.Tuple
+ Control.Lens.Type
+ Control.Lens.Wrapped
+ Control.Lens.Zipper
+ Control.Lens.Zoom
+- Control.Monad.Error.Lens
+ Control.Parallel.Strategies.Lens
+ Control.Seq.Lens
+ Data.Array.Lens
+@@ -266,12 +264,8 @@ library
+ Data.Typeable.Lens
+ Data.Vector.Lens
+ Data.Vector.Generic.Lens
+- Generics.Deriving.Lens
+- GHC.Generics.Lens
+ System.Exit.Lens
+ System.FilePath.Lens
+- System.IO.Error.Lens
+- Language.Haskell.TH.Lens
+ Numeric.Lens
+
+ if flag(safe)
+@@ -370,7 +364,6 @@ test-suite doctests
+ deepseq,
+ doctest >= 0.9.1,
+ filepath,
+- generic-deriving,
+ mtl,
+ nats,
+ parallel,
+@@ -396,7 +389,6 @@ benchmark plated
+ comonad,
+ criterion,
+ deepseq,
+- generic-deriving,
+ lens,
+ transformers
+
+@@ -431,7 +423,6 @@ benchmark unsafe
+ comonads-fd,
+ criterion,
+ deepseq,
+- generic-deriving,
+ lens,
+ transformers
+
+@@ -448,6 +439,5 @@ benchmark zipper
+ comonads-fd,
+ criterion,
+ deepseq,
+- generic-deriving,
+ lens,
+ transformers
+diff --git a/src/Control/Exception/Lens.hs b/src/Control/Exception/Lens.hs
+index 0619335..c97ad9b 100644
+--- a/src/Control/Exception/Lens.hs
++++ b/src/Control/Exception/Lens.hs
+@@ -112,7 +112,7 @@ import Prelude
+ , Maybe(..), Either(..), Functor(..), String, IO
+ )
+
+-{-# ANN module "HLint: ignore Use Control.Exception.catch" #-}
++
+
+ -- $setup
+ -- >>> :set -XNoOverloadedStrings
+diff --git a/src/Control/Lens.hs b/src/Control/Lens.hs
+index 242c3c1..2ab9cdb 100644
+--- a/src/Control/Lens.hs
++++ b/src/Control/Lens.hs
+@@ -59,7 +59,7 @@ module Control.Lens
+ , module Control.Lens.Review
+ , module Control.Lens.Setter
+ , module Control.Lens.Simple
+-#ifndef DISABLE_TEMPLATE_HASKELL
++#if 0
+ , module Control.Lens.TH
+ #endif
+ , module Control.Lens.Traversal
+@@ -89,7 +89,7 @@ import Control.Lens.Reified
+ import Control.Lens.Review
+ import Control.Lens.Setter
+ import Control.Lens.Simple
+-#ifndef DISABLE_TEMPLATE_HASKELL
++#if 0
+ import Control.Lens.TH
+ #endif
+ import Control.Lens.Traversal
+@@ -99,4 +99,4 @@ import Control.Lens.Wrapped
+ import Control.Lens.Zipper
+ import Control.Lens.Zoom
+
+-{-# ANN module "HLint: ignore Use import/export shortcut" #-}
++
+diff --git a/src/Control/Lens/Equality.hs b/src/Control/Lens/Equality.hs
+index 982c2d7..3a3fe1a 100644
+--- a/src/Control/Lens/Equality.hs
++++ b/src/Control/Lens/Equality.hs
+@@ -28,8 +28,8 @@ module Control.Lens.Equality
+ import Control.Lens.Internal.Setter
+ import Control.Lens.Type
+
+-{-# ANN module "HLint: ignore Use id" #-}
+-{-# ANN module "HLint: ignore Eta reduce" #-}
++
++
+
+ -- $setup
+ -- >>> import Control.Lens
+diff --git a/src/Control/Lens/Fold.hs b/src/Control/Lens/Fold.hs
+index 32a4073..cc7da1e 100644
+--- a/src/Control/Lens/Fold.hs
++++ b/src/Control/Lens/Fold.hs
+@@ -163,9 +163,9 @@ import Data.Traversable
+ -- >>> let g :: Expr -> Expr; g = Debug.SimpleReflect.Vars.g
+ -- >>> let timingOut :: NFData a => a -> IO a; timingOut = fmap (fromMaybe (error "timeout")) . timeout (5*10^6) . evaluate . force
+
+-{-# ANN module "HLint: ignore Eta reduce" #-}
+-{-# ANN module "HLint: ignore Use camelCase" #-}
+-{-# ANN module "HLint: ignore Use curry" #-}
++
++
++
+
+ infixl 8 ^.., ^?, ^?!, ^@.., ^@?, ^@?!
+
+diff --git a/src/Control/Lens/Internal.hs b/src/Control/Lens/Internal.hs
+index 295662e..539642d 100644
+--- a/src/Control/Lens/Internal.hs
++++ b/src/Control/Lens/Internal.hs
+@@ -43,4 +43,4 @@ import Control.Lens.Internal.Review
+ import Control.Lens.Internal.Setter
+ import Control.Lens.Internal.Zoom
+
+-{-# ANN module "HLint: ignore Use import/export shortcut" #-}
++
+diff --git a/src/Control/Lens/Internal/Exception.hs b/src/Control/Lens/Internal/Exception.hs
+index 387203e..8bea89b 100644
+--- a/src/Control/Lens/Internal/Exception.hs
++++ b/src/Control/Lens/Internal/Exception.hs
+@@ -36,6 +36,7 @@ import Data.Monoid
+ import Data.Proxy
+ import Data.Reflection
+ import Data.Typeable
++import Data.Typeable
+ import System.IO.Unsafe
+
+ ------------------------------------------------------------------------------
+@@ -128,18 +129,6 @@ class Handleable e (m :: * -> *) (h :: * -> *) | h -> e m where
+ handler_ l = handler l . const
+ {-# INLINE handler_ #-}
+
+-instance Handleable SomeException IO Exception.Handler where
+- handler = handlerIO
+-
+-instance Handleable SomeException m (CatchIO.Handler m) where
+- handler = handlerCatchIO
+-
+-handlerIO :: forall a r. Getting (First a) SomeException a -> (a -> IO r) -> Exception.Handler r
+-handlerIO l f = reify (preview l) $ \ (_ :: Proxy s) -> Exception.Handler (\(Handling a :: Handling a s IO) -> f a)
+-
+-handlerCatchIO :: forall m a r. Getting (First a) SomeException a -> (a -> m r) -> CatchIO.Handler m r
+-handlerCatchIO l f = reify (preview l) $ \ (_ :: Proxy s) -> CatchIO.Handler (\(Handling a :: Handling a s m) -> f a)
+-
+ ------------------------------------------------------------------------------
+ -- Helpers
+ ------------------------------------------------------------------------------
+@@ -159,21 +148,8 @@ supply = unsafePerformIO $ newIORef 0
+ -- | This permits the construction of an \"impossible\" 'Control.Exception.Handler' that matches only if some function does.
+ newtype Handling a s (m :: * -> *) = Handling a
+
+--- the m parameter exists simply to break the Typeable1 pattern, so we can provide this without overlap.
+--- here we simply generate a fresh TypeRep so we'll fail to compare as equal to any other TypeRep.
+-instance Typeable (Handling a s m) where
+- typeOf _ = unsafePerformIO $ do
+- i <- atomicModifyIORef supply $ \a -> let a' = a + 1 in a' `seq` (a', a)
+- return $ mkTyConApp (mkTyCon3 "lens" "Control.Lens.Internal.Exception" ("Handling" ++ show i)) []
+- {-# INLINE typeOf #-}
+-
+ -- The @Handling@ wrapper is uninteresting, and should never be thrown, so you won't get much benefit here.
+ instance Show (Handling a s m) where
+ showsPrec d _ = showParen (d > 10) $ showString "Handling ..."
+ {-# INLINE showsPrec #-}
+
+-instance Reifies s (SomeException -> Maybe a) => Exception (Handling a s m) where
+- toException _ = SomeException HandlingException
+- {-# INLINE toException #-}
+- fromException = fmap Handling . reflect (Proxy :: Proxy s)
+- {-# INLINE fromException #-}
+diff --git a/src/Control/Lens/Internal/Instances.hs b/src/Control/Lens/Internal/Instances.hs
+index 6783f33..17715ce 100644
+--- a/src/Control/Lens/Internal/Instances.hs
++++ b/src/Control/Lens/Internal/Instances.hs
+@@ -24,26 +24,12 @@ import Data.Traversable
+ -- Orphan Instances
+ -------------------------------------------------------------------------------
+
+-instance Foldable ((,) b) where
+- foldMap f (_, a) = f a
+-
+ instance Foldable1 ((,) b) where
+ foldMap1 f (_, a) = f a
+
+-instance Traversable ((,) b) where
+- traverse f (b, a) = (,) b <$> f a
+-
+ instance Traversable1 ((,) b) where
+ traverse1 f (b, a) = (,) b <$> f a
+
+-instance Foldable (Either a) where
+- foldMap _ (Left _) = mempty
+- foldMap f (Right a) = f a
+-
+-instance Traversable (Either a) where
+- traverse _ (Left b) = pure (Left b)
+- traverse f (Right a) = Right <$> f a
+-
+ instance Foldable (Const m) where
+ foldMap _ _ = mempty
+
+diff --git a/src/Control/Lens/Internal/Zipper.hs b/src/Control/Lens/Internal/Zipper.hs
+index 95875b7..76060be 100644
+--- a/src/Control/Lens/Internal/Zipper.hs
++++ b/src/Control/Lens/Internal/Zipper.hs
+@@ -53,7 +53,7 @@ import Data.Profunctor.Unsafe
+ -- >>> import Control.Lens
+ -- >>> import Data.Char
+
+-{-# ANN module "HLint: ignore Use foldl" #-}
++
+
+ ------------------------------------------------------------------------------
+ -- * Jacket
+diff --git a/src/Control/Lens/Iso.hs b/src/Control/Lens/Iso.hs
+index 1152af4..80c3175 100644
+--- a/src/Control/Lens/Iso.hs
++++ b/src/Control/Lens/Iso.hs
+@@ -82,8 +82,6 @@ import Data.Maybe
+ import Data.Profunctor
+ import Data.Profunctor.Unsafe
+
+-{-# ANN module "HLint: ignore Use on" #-}
+-
+ -- $setup
+ -- >>> :set -XNoOverloadedStrings
+ -- >>> import Control.Lens
+diff --git a/src/Control/Lens/Lens.hs b/src/Control/Lens/Lens.hs
+index b26cc06..6f84943 100644
+--- a/src/Control/Lens/Lens.hs
++++ b/src/Control/Lens/Lens.hs
+@@ -126,7 +126,7 @@ import Data.Profunctor.Rep
+ import Data.Profunctor.Unsafe
+ import Data.Void
+
+-{-# ANN module "HLint: ignore Use ***" #-}
++
+
+ -- $setup
+ -- >>> :set -XNoOverloadedStrings
+diff --git a/src/Control/Lens/Operators.hs b/src/Control/Lens/Operators.hs
+index 11868e0..475c945 100644
+--- a/src/Control/Lens/Operators.hs
++++ b/src/Control/Lens/Operators.hs
+@@ -108,4 +108,4 @@ import Control.Lens.Review
+ import Control.Lens.Setter
+ import Control.Lens.Zipper
+
+-{-# ANN module "HLint: ignore Use import/export shortcut" #-}
++
+diff --git a/src/Control/Lens/Plated.hs b/src/Control/Lens/Plated.hs
+index a8c4d20..cef574e 100644
+--- a/src/Control/Lens/Plated.hs
++++ b/src/Control/Lens/Plated.hs
+@@ -95,7 +95,7 @@ import Data.Data.Lens
+ import Data.Monoid
+ import Data.Tree
+
+-{-# ANN module "HLint: ignore Reduce duplication" #-}
++
+
+ -- | A 'Plated' type is one where we know how to extract its immediate self-similar children.
+ --
+diff --git a/src/Control/Lens/Prism.hs b/src/Control/Lens/Prism.hs
+index 45b5cfe..88c7ff9 100644
+--- a/src/Control/Lens/Prism.hs
++++ b/src/Control/Lens/Prism.hs
+@@ -53,8 +53,6 @@ import Unsafe.Coerce
+ import Data.Profunctor.Unsafe
+ #endif
+
+-{-# ANN module "HLint: ignore Use camelCase" #-}
+-
+ -- $setup
+ -- >>> :set -XNoOverloadedStrings
+ -- >>> import Control.Lens
+diff --git a/src/Control/Lens/Setter.hs b/src/Control/Lens/Setter.hs
+index 2acbfa6..4a12c6b 100644
+--- a/src/Control/Lens/Setter.hs
++++ b/src/Control/Lens/Setter.hs
+@@ -87,8 +87,6 @@ import Data.Profunctor
+ import Data.Profunctor.Rep
+ import Data.Profunctor.Unsafe
+
+-{-# ANN module "HLint: ignore Avoid lambda" #-}
+-
+ -- $setup
+ -- >>> import Control.Lens
+ -- >>> import Control.Monad.State
+diff --git a/src/Control/Lens/TH.hs b/src/Control/Lens/TH.hs
+index a05eb07..49218b5 100644
+--- a/src/Control/Lens/TH.hs
++++ b/src/Control/Lens/TH.hs
+@@ -87,7 +87,7 @@ import Language.Haskell.TH
+ import Language.Haskell.TH.Syntax
+ import Language.Haskell.TH.Lens
+
+-{-# ANN module "HLint: ignore Use foldl" #-}
++
+
+ -- | Flags for 'Lens' construction
+ data LensFlag
+diff --git a/src/Data/Data/Lens.hs b/src/Data/Data/Lens.hs
+index cf1e7c9..b39dacf 100644
+--- a/src/Data/Data/Lens.hs
++++ b/src/Data/Data/Lens.hs
+@@ -65,9 +65,9 @@ import Data.Monoid
+ import GHC.Exts (realWorld#)
+ #endif
+
+-{-# ANN module "HLint: ignore Eta reduce" #-}
+-{-# ANN module "HLint: ignore Use foldl" #-}
+-{-# ANN module "HLint: ignore Reduce duplication" #-}
++
++
++
+
+ -- $setup
+ -- >>> :set -XNoOverloadedStrings
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/lifted-base_crossbuild.patch b/standalone/android/haskell-patches/lifted-base_crossbuild.patch
new file mode 100644
index 000000000..945aee491
--- /dev/null
+++ b/standalone/android/haskell-patches/lifted-base_crossbuild.patch
@@ -0,0 +1,25 @@
+From 8a98fa29048b508c64d5bb1e03ef89bfad8adc01 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 21:34:17 +0000
+Subject: [PATCH] crossbuild
+
+---
+ lifted-base.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lifted-base.cabal b/lifted-base.cabal
+index 24f2860..3bef225 100644
+--- a/lifted-base.cabal
++++ b/lifted-base.cabal
+@@ -9,7 +9,7 @@ Copyright: (c) 2011-2012 Bas van Dijk, Anders Kaseorg
+ Homepage: https://github.com/basvandijk/lifted-base
+ Bug-reports: https://github.com/basvandijk/lifted-base/issues
+ Category: Control
+-Build-type: Custom
++Build-type: Simple
+ Cabal-version: >= 1.8
+ Description: @lifted-base@ exports IO operations from the base library lifted to
+ any instance of 'MonadBase' or 'MonadBaseControl'.
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/network_2.4.1.0_0001-android-port-fixes.patch b/standalone/android/haskell-patches/network_2.4.1.0_0001-android-port-fixes.patch
new file mode 100644
index 000000000..d7d0608d2
--- /dev/null
+++ b/standalone/android/haskell-patches/network_2.4.1.0_0001-android-port-fixes.patch
@@ -0,0 +1,1960 @@
+From 9750532bd6200353fe09dda65ee6fb59702c4ac1 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Thu, 28 Feb 2013 23:32:15 -0400
+Subject: [PATCH] android port fixes
+
+Build note: Ensure a hsc2hs in PATH is modified to pass -x to the real
+one, to enable cross-compiling.
+---
+ Network/Socket.hsc | 22 +-
+ Network/Socket/ByteString.hsc | 2 +-
+ Network/Socket/Internal.hsc | 2 +-
+ Network/Socket/Types.hsc | 4 +-
+ cbits/HsNet.c | 14 +
+ config.guess | 562 ++++++++++++++++++++++-------------------
+ config.sub | 384 ++++++++++++++++++++--------
+ configure | 1 +
+ include/HsNetworkConfig.h | 8 +-
+ 9 files changed, 612 insertions(+), 387 deletions(-)
+
+diff --git a/Network/Socket.hsc b/Network/Socket.hsc
+index 259e843..e6c0feb 100644
+--- a/Network/Socket.hsc
++++ b/Network/Socket.hsc
+@@ -38,7 +38,7 @@ module Network.Socket
+ , SockAddr(..)
+ , SocketStatus(..)
+ , HostAddress
+-#if defined(IPV6_SOCKET_SUPPORT)
++#if defined(IPV6_SOCKET_SUPPORTNO)
+ , HostAddress6
+ , FlowInfo
+ , ScopeID
+@@ -55,7 +55,7 @@ module Network.Socket
+ , HostName
+ , ServiceName
+
+-#if defined(IPV6_SOCKET_SUPPORT)
++#if defined(IPV6_SOCKET_SUPPORT) || 1
+ , AddrInfo(..)
+
+ , AddrInfoFlag(..)
+@@ -134,7 +134,7 @@ module Network.Socket
+ -- * Special constants
+ , aNY_PORT
+ , iNADDR_ANY
+-#if defined(IPV6_SOCKET_SUPPORT)
++#if defined(IPV6_SOCKET_SUPPORTNO)
+ , iN6ADDR_ANY
+ #endif
+ , sOMAXCONN
+@@ -330,16 +330,6 @@ socket family stype protocol = do
+ setNonBlockIfNeeded fd
+ socket_status <- newMVar NotConnected
+ let sock = MkSocket fd family stype protocol socket_status
+-#if HAVE_DECL_IPV6_V6ONLY
+-# if defined(mingw32_HOST_OS)
+- -- the IPv6Only option is only supported on Windows Vista and later,
+- -- so trying to change it might throw an error
+- when (family == AF_INET6) $
+- E.catch (setSocketOption sock IPv6Only 0) $ (\(_ :: E.IOException) -> return ())
+-# else
+- when (family == AF_INET6) $ setSocketOption sock IPv6Only 0
+-# endif
+-#endif
+ return sock
+
+ -- | Build a pair of connected socket objects using the given address
+@@ -1043,9 +1033,9 @@ aNY_PORT = 0
+ iNADDR_ANY :: HostAddress
+ iNADDR_ANY = htonl (#const INADDR_ANY)
+
+-foreign import CALLCONV unsafe "htonl" htonl :: Word32 -> Word32
++foreign import CALLCONV unsafe "my_htonl" htonl :: Word32 -> Word32
+
+-#if defined(IPV6_SOCKET_SUPPORT)
++#if defined(IPV6_SOCKET_SUPPORTNO)
+ -- | The IPv6 wild card address.
+
+ iN6ADDR_ANY :: HostAddress6
+@@ -1219,7 +1209,7 @@ unpackBits ((k,v):xs) r
+ -----------------------------------------------------------------------------
+ -- Address and service lookups
+
+-#if defined(IPV6_SOCKET_SUPPORT)
++#if defined(IPV6_SOCKET_SUPPORT) || 1
+
+ -- | Flags that control the querying behaviour of 'getAddrInfo'.
+ data AddrInfoFlag
+diff --git a/Network/Socket/ByteString.hsc b/Network/Socket/ByteString.hsc
+index bec2eb9..cb8ed8c 100644
+--- a/Network/Socket/ByteString.hsc
++++ b/Network/Socket/ByteString.hsc
+@@ -201,7 +201,7 @@ sendMany sock@(MkSocket fd _ _ _ _) cs = do
+ liftM fromIntegral . withIOVec cs $ \(iovsPtr, iovsLen) ->
+ throwSocketErrorWaitWrite sock "writev" $
+ c_writev (fromIntegral fd) iovsPtr
+- (fromIntegral (min iovsLen (#const IOV_MAX)))
++ (fromIntegral (min iovsLen (0x0026)))
+ #else
+ sendMany sock = sendAll sock . B.concat
+ #endif
+diff --git a/Network/Socket/Internal.hsc b/Network/Socket/Internal.hsc
+index 96fe9c6..df5ce64 100644
+--- a/Network/Socket/Internal.hsc
++++ b/Network/Socket/Internal.hsc
+@@ -24,7 +24,7 @@ module Network.Socket.Internal
+ (
+ -- * Socket addresses
+ HostAddress
+-#if defined(IPV6_SOCKET_SUPPORT)
++#if defined(IPV6_SOCKET_SUPPORTNO)
+ , HostAddress6
+ , FlowInfo
+ , ScopeID
+diff --git a/Network/Socket/Types.hsc b/Network/Socket/Types.hsc
+index 7ad24f1..dad1d1d 100644
+--- a/Network/Socket/Types.hsc
++++ b/Network/Socket/Types.hsc
+@@ -705,8 +705,8 @@ intToPortNumber v = PortNum (htons (fromIntegral v))
+ portNumberToInt :: PortNumber -> Int
+ portNumberToInt (PortNum po) = fromIntegral (ntohs po)
+
+-foreign import CALLCONV unsafe "ntohs" ntohs :: Word16 -> Word16
+-foreign import CALLCONV unsafe "htons" htons :: Word16 -> Word16
++foreign import CALLCONV unsafe "my_ntohs" ntohs :: Word16 -> Word16
++foreign import CALLCONV unsafe "my_htons" htons :: Word16 -> Word16
+ --foreign import CALLCONV unsafe "ntohl" ntohl :: Word32 -> Word32
+
+ instance Enum PortNumber where
+diff --git a/cbits/HsNet.c b/cbits/HsNet.c
+index 86b55dc..5ea1199 100644
+--- a/cbits/HsNet.c
++++ b/cbits/HsNet.c
+@@ -6,3 +6,17 @@
+
+ #define INLINE
+ #include "HsNet.h"
++
++#include <sys/endian.h>
++uint16_t my_htons(uint16_t v)
++{
++ htons(v);
++}
++uint32_t my_htonl(uint32_t v)
++{
++ htonl(v);
++}
++uint16_t my_ntohs(uint16_t v)
++{
++ ntohs(v);
++}
+diff --git a/config.guess b/config.guess
+index c38553d..1804e9f 100644
+--- a/config.guess
++++ b/config.guess
+@@ -1,13 +1,14 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
++# 2011, 2012, 2013 Free Software Foundation, Inc.
+
+-timestamp='2006-02-23'
++timestamp='2012-12-29'
+
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2 of the License, or
++# the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful, but
+@@ -16,26 +17,22 @@ timestamp='2006-02-23'
+ # General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+-# 02110-1301, USA.
++# along with this program; if not, see <http://www.gnu.org/licenses/>.
+ #
+ # As a special exception to the GNU General Public License, if you
+ # distribute this file as part of a program that contains a
+ # configuration script generated by Autoconf, you may include it under
+-# the same distribution terms that you use for the rest of that program.
+-
+-
+-# Originally written by Per Bothner <per@bothner.com>.
+-# Please send patches to <config-patches@gnu.org>. Submit a context
+-# diff and a properly formatted ChangeLog entry.
++# the same distribution terms that you use for the rest of that
++# program. This Exception is an additional permission under section 7
++# of the GNU General Public License, version 3 ("GPLv3").
++#
++# Originally written by Per Bothner.
+ #
+-# This script attempts to guess a canonical system name similar to
+-# config.sub. If it succeeds, it prints the system name on stdout, and
+-# exits with 0. Otherwise, it exits with 1.
++# You can get the latest version of this script from:
++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+ #
+-# The plan is that this can be called by configure scripts if you
+-# don't specify an explicit build system type.
++# Please send patches with a ChangeLog entry to config-patches@gnu.org.
++
+
+ me=`echo "$0" | sed -e 's,.*/,,'`
+
+@@ -55,8 +52,9 @@ version="\
+ GNU config.guess ($timestamp)
+
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
++2012, 2013 Free Software Foundation, Inc.
+
+ This is free software; see the source for copying conditions. There is NO
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+@@ -143,7 +141,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
++ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+@@ -160,6 +158,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
++ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+@@ -168,7 +167,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+- | grep __ELF__ >/dev/null
++ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+@@ -178,7 +177,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ fi
+ ;;
+ *)
+- os=netbsd
++ os=netbsd
+ ;;
+ esac
+ # The OS release
+@@ -199,6 +198,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
++ *:Bitrig:*:*)
++ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
++ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
++ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+@@ -210,7 +213,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+@@ -221,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+@@ -267,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+- exit ;;
++ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
++ exitcode=$?
++ trap '' 0
++ exit $exitcode ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+@@ -293,12 +299,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+- echo powerpc-ibm-os400
++ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+- arm:riscos:*:*|arm:RISCOS:*:*)
++ arm*:riscos:*:*|arm*:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+@@ -322,14 +328,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
++ s390x:SunOS:*:*)
++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+- i86pc:SunOS:5.*:*)
+- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
++ echo i386-pc-auroraux${UNAME_RELEASE}
++ exit ;;
++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
++ eval $set_cc_for_build
++ SUN_ARCH="i386"
++ # If there is a compiler, see if it is configured for 64-bit objects.
++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
++ # This test works for both compilers.
++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
++ grep IS_64BIT_ARCH >/dev/null
++ then
++ SUN_ARCH="x86_64"
++ fi
++ fi
++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+@@ -373,23 +398,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+- echo m68k-atari-mint${UNAME_RELEASE}
++ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit ;;
++ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+- echo m68k-atari-mint${UNAME_RELEASE}
++ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+- echo m68k-milan-mint${UNAME_RELEASE}
+- exit ;;
++ echo m68k-milan-mint${UNAME_RELEASE}
++ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+- echo m68k-hades-mint${UNAME_RELEASE}
+- exit ;;
++ echo m68k-hades-mint${UNAME_RELEASE}
++ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+- echo m68k-unknown-mint${UNAME_RELEASE}
+- exit ;;
++ echo m68k-unknown-mint${UNAME_RELEASE}
++ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+@@ -459,8 +484,8 @@ EOF
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+- # DG/UX returns AViiON for all architectures
+- UNAME_PROCESSOR=`/usr/bin/uname -p`
++ # DG/UX returns AViiON for all architectures
++ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+@@ -473,7 +498,7 @@ EOF
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+- exit ;;
++ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+@@ -530,7 +555,7 @@ EOF
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+- *:AIX:*:[45])
++ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+@@ -573,52 +598,52 @@ EOF
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+- case "${sc_cpu_version}" in
+- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+- 532) # CPU_PA_RISC2_0
+- case "${sc_kernel_bits}" in
+- 32) HP_ARCH="hppa2.0n" ;;
+- 64) HP_ARCH="hppa2.0w" ;;
++ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
++ case "${sc_cpu_version}" in
++ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
++ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
++ 532) # CPU_PA_RISC2_0
++ case "${sc_kernel_bits}" in
++ 32) HP_ARCH="hppa2.0n" ;;
++ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+- esac ;;
+- esac
++ esac ;;
++ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+- sed 's/^ //' << EOF >$dummy.c
++ sed 's/^ //' << EOF >$dummy.c
+
+- #define _HPUX_SOURCE
+- #include <stdlib.h>
+- #include <unistd.h>
++ #define _HPUX_SOURCE
++ #include <stdlib.h>
++ #include <unistd.h>
+
+- int main ()
+- {
+- #if defined(_SC_KERNEL_BITS)
+- long bits = sysconf(_SC_KERNEL_BITS);
+- #endif
+- long cpu = sysconf (_SC_CPU_VERSION);
++ int main ()
++ {
++ #if defined(_SC_KERNEL_BITS)
++ long bits = sysconf(_SC_KERNEL_BITS);
++ #endif
++ long cpu = sysconf (_SC_CPU_VERSION);
+
+- switch (cpu)
+- {
+- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+- case CPU_PA_RISC2_0:
+- #if defined(_SC_KERNEL_BITS)
+- switch (bits)
+- {
+- case 64: puts ("hppa2.0w"); break;
+- case 32: puts ("hppa2.0n"); break;
+- default: puts ("hppa2.0"); break;
+- } break;
+- #else /* !defined(_SC_KERNEL_BITS) */
+- puts ("hppa2.0"); break;
+- #endif
+- default: puts ("hppa1.0"); break;
+- }
+- exit (0);
+- }
++ switch (cpu)
++ {
++ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
++ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
++ case CPU_PA_RISC2_0:
++ #if defined(_SC_KERNEL_BITS)
++ switch (bits)
++ {
++ case 64: puts ("hppa2.0w"); break;
++ case 32: puts ("hppa2.0n"); break;
++ default: puts ("hppa2.0"); break;
++ } break;
++ #else /* !defined(_SC_KERNEL_BITS) */
++ puts ("hppa2.0"); break;
++ #endif
++ default: puts ("hppa1.0"); break;
++ }
++ exit (0);
++ }
+ EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+@@ -638,7 +663,7 @@ EOF
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+- grep __LP64__ >/dev/null
++ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+@@ -709,22 +734,22 @@ EOF
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+- exit ;;
++ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+- exit ;;
++ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+- exit ;;
++ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+- exit ;;
++ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+- exit ;;
++ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+@@ -748,14 +773,14 @@ EOF
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+- exit ;;
++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
++ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+@@ -767,38 +792,51 @@ EOF
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+- case ${UNAME_MACHINE} in
+- pc98)
+- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ UNAME_PROCESSOR=`/usr/bin/uname -p`
++ case ${UNAME_PROCESSOR} in
++ amd64)
++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+- i*:MINGW*:*)
+- echo ${UNAME_MACHINE}-pc-mingw32
++ *:MINGW64*:*)
++ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
+- i*:MSYS_NT-*:*:*)
++ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
++ i*:MSYS*:*)
++ echo ${UNAME_MACHINE}-pc-msys
++ exit ;;
+ i*:windows32*:*)
+- # uname -m includes "-pc" on this system.
+- echo ${UNAME_MACHINE}-mingw32
++ # uname -m includes "-pc" on this system.
++ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+- x86:Interix*:[345]*)
+- echo i586-pc-interix${UNAME_RELEASE}
+- exit ;;
+- EM64T:Interix*:[345]*)
+- echo x86_64-unknown-interix${UNAME_RELEASE}
+- exit ;;
++ *:Interix*:*)
++ case ${UNAME_MACHINE} in
++ x86)
++ echo i586-pc-interix${UNAME_RELEASE}
++ exit ;;
++ authenticamd | genuineintel | EM64T)
++ echo x86_64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ IA64)
++ echo ia64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
++ 8664:Windows_NT:*)
++ echo x86_64-pc-mks
++ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+@@ -828,17 +866,68 @@ EOF
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
++ aarch64:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
++ aarch64_be:Linux:*:*)
++ UNAME_MACHINE=aarch64_be
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
++ alpha:Linux:*:*)
++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
++ EV5) UNAME_MACHINE=alphaev5 ;;
++ EV56) UNAME_MACHINE=alphaev56 ;;
++ PCA56) UNAME_MACHINE=alphapca56 ;;
++ PCA57) UNAME_MACHINE=alphapca56 ;;
++ EV6) UNAME_MACHINE=alphaev6 ;;
++ EV67) UNAME_MACHINE=alphaev67 ;;
++ EV68*) UNAME_MACHINE=alphaev68 ;;
++ esac
++ objdump --private-headers /bin/sh | grep -q ld.so.1
++ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
++ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
++ exit ;;
+ arm*:Linux:*:*)
++ eval $set_cc_for_build
++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
++ | grep -q __ARM_EABI__
++ then
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ else
++ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
++ | grep -q __ARM_PCS_VFP
++ then
++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
++ else
++ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
++ fi
++ fi
++ exit ;;
++ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+- echo cris-axis-linux-gnu
++ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+- echo crisv32-axis-linux-gnu
++ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+- echo frv-unknown-linux-gnu
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
++ hexagon:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
++ i*86:Linux:*:*)
++ LIBC=gnu
++ eval $set_cc_for_build
++ sed 's/^ //' << EOF >$dummy.c
++ #ifdef __dietlibc__
++ LIBC=dietlibc
++ #endif
++EOF
++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+@@ -849,74 +938,33 @@ EOF
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+- mips:Linux:*:*)
+- eval $set_cc_for_build
+- sed 's/^ //' << EOF >$dummy.c
+- #undef CPU
+- #undef mips
+- #undef mipsel
+- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+- CPU=mipsel
+- #else
+- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+- CPU=mips
+- #else
+- CPU=
+- #endif
+- #endif
+-EOF
+- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+- /^CPU/{
+- s: ::g
+- p
+- }'`"
+- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+- ;;
+- mips64:Linux:*:*)
++ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+- #undef mips64
+- #undef mips64el
++ #undef ${UNAME_MACHINE}
++ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+- CPU=mips64el
++ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+- CPU=mips64
++ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+ EOF
+- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+- /^CPU/{
+- s: ::g
+- p
+- }'`"
++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+- echo or32-unknown-linux-gnu
+- exit ;;
+- ppc:Linux:*:*)
+- echo powerpc-unknown-linux-gnu
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+- ppc64:Linux:*:*)
+- echo powerpc64-unknown-linux-gnu
++ padre:Linux:*:*)
++ echo sparc-unknown-linux-gnu
+ exit ;;
+- alpha:Linux:*:*)
+- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+- EV5) UNAME_MACHINE=alphaev5 ;;
+- EV56) UNAME_MACHINE=alphaev56 ;;
+- PCA56) UNAME_MACHINE=alphapca56 ;;
+- PCA57) UNAME_MACHINE=alphapca56 ;;
+- EV6) UNAME_MACHINE=alphaev6 ;;
+- EV67) UNAME_MACHINE=alphaev67 ;;
+- EV68*) UNAME_MACHINE=alphaev68 ;;
+- esac
+- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
++ parisc64:Linux:*:* | hppa64:Linux:*:*)
++ echo hppa64-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+@@ -926,14 +974,17 @@ EOF
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+- parisc64:Linux:*:* | hppa64:Linux:*:*)
+- echo hppa64-unknown-linux-gnu
++ ppc64:Linux:*:*)
++ echo powerpc64-unknown-linux-gnu
++ exit ;;
++ ppc:Linux:*:*)
++ echo powerpc-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+- echo ${UNAME_MACHINE}-unknown-linux-gnu
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+@@ -941,75 +992,18 @@ EOF
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
++ tile*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+- echo x86_64-unknown-linux-gnu
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
++ xtensa*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+- i*86:Linux:*:*)
+- # The BFD linker knows what the default object file format is, so
+- # first see if it will tell us. cd to the root directory to prevent
+- # problems with other programs or directories called `ld' in the path.
+- # Set LC_ALL=C to ensure ld outputs messages in English.
+- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+- | sed -ne '/supported targets:/!d
+- s/[ ][ ]*/ /g
+- s/.*supported targets: *//
+- s/ .*//
+- p'`
+- case "$ld_supported_targets" in
+- elf32-i386)
+- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+- ;;
+- a.out-i386-linux)
+- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+- exit ;;
+- coff-i386)
+- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+- exit ;;
+- "")
+- # Either a pre-BFD a.out linker (linux-gnuoldld) or
+- # one that does not give us useful --help.
+- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+- exit ;;
+- esac
+- # Determine whether the default compiler is a.out or elf
+- eval $set_cc_for_build
+- sed 's/^ //' << EOF >$dummy.c
+- #include <features.h>
+- #ifdef __ELF__
+- # ifdef __GLIBC__
+- # if __GLIBC__ >= 2
+- LIBC=gnu
+- # else
+- LIBC=gnulibc1
+- # endif
+- # else
+- LIBC=gnulibc1
+- # endif
+- #else
+- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
+- LIBC=gnu
+- #else
+- LIBC=gnuaout
+- #endif
+- #endif
+- #ifdef __dietlibc__
+- LIBC=dietlibc
+- #endif
+-EOF
+- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+- /^LIBC/{
+- s: ::g
+- p
+- }'`"
+- test x"${LIBC}" != x && {
+- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+- exit
+- }
+- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+- ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+@@ -1017,11 +1011,11 @@ EOF
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+- # Unixware is an offshoot of SVR4, but it has its own version
+- # number series starting with 2...
+- # I am not positive that other SVR4 systems won't match this,
++ # Unixware is an offshoot of SVR4, but it has its own version
++ # number series starting with 2...
++ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+- # Use sysv4.2uw... so that sysv4* matches it.
++ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+@@ -1038,7 +1032,7 @@ EOF
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+@@ -1053,7 +1047,7 @@ EOF
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+- # UnixWare 7.x, OpenUNIX and OpenServer 6.
++ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+@@ -1081,10 +1075,13 @@ EOF
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+- # uname -m prints for DJGPP always 'pc', but it prints nothing about
+- # the processor, so we play safe by assuming i386.
+- echo i386-pc-msdosdjgpp
+- exit ;;
++ # uname -m prints for DJGPP always 'pc', but it prints nothing about
++ # the processor, so we play safe by assuming i586.
++ # Note: whatever this is, it MUST be the same as what config.sub
++ # prints for the "djgpp" host, or else GDB configury will decide that
++ # this is a cross-build.
++ echo i586-pc-msdosdjgpp
++ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+@@ -1119,8 +1116,18 @@ EOF
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+- && { echo i486-ncr-sysv4; exit; } ;;
++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
++ && { echo i486-ncr-sysv4; exit; } ;;
++ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
++ OS_REL='.3'
++ test -r /etc/.relid \
++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+@@ -1133,7 +1140,7 @@ EOF
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
++ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+@@ -1153,10 +1160,10 @@ EOF
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+- # says <Richard.M.Bartel@ccMail.Census.GOV>
+- echo i586-unisys-sysv4
+- exit ;;
++ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
++ # says <Richard.M.Bartel@ccMail.Census.GOV>
++ echo i586-unisys-sysv4
++ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+@@ -1182,11 +1189,11 @@ EOF
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+- echo mips-nec-sysv${UNAME_RELEASE}
++ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+- echo mips-unknown-sysv${UNAME_RELEASE}
++ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+- exit ;;
++ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+@@ -1196,6 +1203,12 @@ EOF
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
++ echo i586-pc-haiku
++ exit ;;
++ x86_64:Haiku:*:*)
++ echo x86_64-unknown-haiku
++ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+@@ -1205,6 +1218,15 @@ EOF
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
++ SX-7:SUPER-UX:*:*)
++ echo sx7-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8:SUPER-UX:*:*)
++ echo sx8-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8R:SUPER-UX:*:*)
++ echo sx8r-nec-superux${UNAME_RELEASE}
++ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+@@ -1214,6 +1236,16 @@ EOF
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
++ i386)
++ eval $set_cc_for_build
++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
++ grep IS_64BIT_ARCH >/dev/null
++ then
++ UNAME_PROCESSOR="x86_64"
++ fi
++ fi ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+@@ -1229,7 +1261,10 @@ EOF
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+- NSE-?:NONSTOP_KERNEL:*:*)
++ NEO-?:NONSTOP_KERNEL:*:*)
++ echo neo-tandem-nsk${UNAME_RELEASE}
++ exit ;;
++ NSE-*:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+@@ -1274,13 +1309,13 @@ EOF
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+- echo mips-sei-seiux${UNAME_RELEASE}
++ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+- UNAME_MACHINE=`(uname -p) 2>/dev/null`
++ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+@@ -1295,11 +1330,14 @@ EOF
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
++ i*86:AROS:*:*)
++ echo ${UNAME_MACHINE}-pc-aros
++ exit ;;
++ x86_64:VMkernel:*:*)
++ echo ${UNAME_MACHINE}-unknown-esx
++ exit ;;
+ esac
+
+-#echo '(No uname command or uname output not recognized.)' 1>&2
+-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+-
+ eval $set_cc_for_build
+ cat >$dummy.c <<EOF
+ #ifdef _SEQUENT_
+@@ -1317,11 +1355,11 @@ main ()
+ #include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+ #ifdef NEWSOS4
+- "4"
++ "4"
+ #else
+- ""
++ ""
+ #endif
+- ); exit (0);
++ ); exit (0);
+ #endif
+ #endif
+
+@@ -1455,9 +1493,9 @@ This script, last modified $timestamp, has failed to recognize
+ the operating system you are using. It is advised that you
+ download the most up to date version of the config scripts from
+
+- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+ and
+- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+ If the version you run ($0) is already up to date, please
+ send the following data and any information you think might be
+diff --git a/config.sub b/config.sub
+index ad9f395..802a224 100644
+--- a/config.sub
++++ b/config.sub
+@@ -1,43 +1,42 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
++# 2011, 2012, 2013 Free Software Foundation, Inc.
+
+-timestamp='2006-02-23'
++timestamp='2012-12-29'
+
+-# This file is (in principle) common to ALL GNU software.
+-# The presence of a machine in this file suggests that SOME GNU software
+-# can handle that machine. It does not imply ALL GNU software can.
+-#
+-# This file is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2 of the License, or
++# This file is free software; you can redistribute it and/or modify it
++# under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-# GNU General Public License for more details.
++# This program is distributed in the hope that it will be useful, but
++# WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+-# 02110-1301, USA.
++# along with this program; if not, see <http://www.gnu.org/licenses/>.
+ #
+ # As a special exception to the GNU General Public License, if you
+ # distribute this file as part of a program that contains a
+ # configuration script generated by Autoconf, you may include it under
+-# the same distribution terms that you use for the rest of that program.
++# the same distribution terms that you use for the rest of that
++# program. This Exception is an additional permission under section 7
++# of the GNU General Public License, version 3 ("GPLv3").
+
+
+-# Please send patches to <config-patches@gnu.org>. Submit a context
+-# diff and a properly formatted ChangeLog entry.
++# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+ #
+ # Configuration subroutine to validate and canonicalize a configuration type.
+ # Supply the specified configuration type as an argument.
+ # If it is invalid, we print an error message on stderr and exit with code 1.
+ # Otherwise, we print the canonical config type on stdout and succeed.
+
++# You can get the latest version of this script from:
++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
++
+ # This file is supposed to be the same for all GNU packages
+ # and recognize all the CPU types, system types and aliases
+ # that are meaningful with *any* GNU software.
+@@ -71,8 +70,9 @@ Report bugs and patches to <config-patches@gnu.org>."
+ version="\
+ GNU config.sub ($timestamp)
+
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
++2012, 2013 Free Software Foundation, Inc.
+
+ This is free software; see the source for copying conditions. There is NO
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+@@ -119,12 +119,18 @@ esac
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
++ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
++ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
++ knetbsd*-gnu* | netbsd*-gnu* | \
++ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
++ android-linux)
++ os=-linux-android
++ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
++ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+@@ -147,10 +153,13 @@ case $os in
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+- -apple | -axis | -knuth | -cray)
++ -apple | -axis | -knuth | -cray | -microblaze*)
+ os=
+ basic_machine=$1
+ ;;
++ -bluegene*)
++ os=-cnk
++ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+@@ -165,10 +174,10 @@ case $os in
+ os=-chorusos
+ basic_machine=$1
+ ;;
+- -chorusrdb)
+- os=-chorusrdb
++ -chorusrdb)
++ os=-chorusrdb
+ basic_machine=$1
+- ;;
++ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+@@ -213,6 +222,12 @@ case $os in
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
++ -lynx*178)
++ os=-lynxos178
++ ;;
++ -lynx*5)
++ os=-lynxos5
++ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+@@ -237,23 +252,34 @@ case $basic_machine in
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
++ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++ | arc \
++ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
++ | avr | avr32 \
++ | be32 | be64 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+- | fr30 | frv \
++ | epiphany \
++ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
++ | hexagon \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+- | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
++ | le32 | le64 \
++ | lm32 \
++ | m32c | m32r | m32rle | m68000 | m68k | m88k \
++ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+- | mips64vr | mips64vrel \
++ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
++ | mips64r5900 | mips64r5900el \
++ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+@@ -266,31 +292,42 @@ case $basic_machine in
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
++ | moxie \
+ | mt \
+ | msp430 \
++ | nds32 | nds32le | nds32be \
+ | nios | nios2 \
+ | ns16k | ns32k \
++ | open8 \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
++ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pyramid \
+- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++ | rl78 | rx \
++ | score \
++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+- | sparcv8 | sparcv9 | sparcv9b \
+- | strongarm \
+- | tahoe | thumb | tic4x | tic80 | tron \
+- | v850 | v850e \
++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
++ | spu \
++ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
++ | ubicom32 \
++ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | we32k \
+- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+- | z8k)
++ | x86 | xc16x | xstormy16 | xtensa \
++ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+- m32c)
+- basic_machine=$basic_machine-unknown
++ c54x)
++ basic_machine=tic54x-unknown
++ ;;
++ c55x)
++ basic_machine=tic55x-unknown
+ ;;
+- m6811 | m68hc11 | m6812 | m68hc12)
+- # Motorola 68HC11/12.
++ c6x)
++ basic_machine=tic6x-unknown
++ ;;
++ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+@@ -300,6 +337,21 @@ case $basic_machine in
+ basic_machine=mt-unknown
+ ;;
+
++ strongarm | thumb | xscale)
++ basic_machine=arm-unknown
++ ;;
++ xgate)
++ basic_machine=$basic_machine-unknown
++ os=-none
++ ;;
++ xscaleeb)
++ basic_machine=armeb-unknown
++ ;;
++
++ xscaleel)
++ basic_machine=armel-unknown
++ ;;
++
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+@@ -314,29 +366,37 @@ case $basic_machine in
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
++ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+- | avr-* \
++ | avr-* | avr32-* \
++ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
++ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
++ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+- | m32r-* | m32rle-* \
++ | le32-* | le64-* \
++ | lm32-* \
++ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+- | m88110-* | m88k-* | maxq-* | mcore-* \
++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
++ | microblaze-* | microblazeel-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+- | mips64vr-* | mips64vrel-* \
++ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
++ | mips64r5900-* | mips64r5900el-* \
++ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+@@ -351,29 +411,36 @@ case $basic_machine in
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
++ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
++ | open8-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pyramid-* \
+- | romp-* | rs6000-* \
+- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++ | rl78-* | romp-* | rs6000-* | rx-* \
++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+- | tahoe-* | thumb-* \
++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
++ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++ | tile*-* \
+ | tron-* \
+- | v850-* | v850e-* | vax-* \
++ | ubicom32-* \
++ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
++ | vax-* \
+ | we32k-* \
+- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+- | xstormy16-* | xtensa-* \
++ | x86-* | x86_64-* | xc16x-* | xps100-* \
++ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+- | z8k-*)
++ | z8k-* | z80-*)
+ ;;
+- m32c-*)
++ # Recognize the basic CPU types without company name, with glob match.
++ xtensa*)
++ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+@@ -391,7 +458,7 @@ case $basic_machine in
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+- abacus)
++ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+@@ -437,6 +504,10 @@ case $basic_machine in
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
++ aros)
++ basic_machine=i386-pc
++ os=-aros
++ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+@@ -445,10 +516,35 @@ case $basic_machine in
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
++ blackfin)
++ basic_machine=bfin-unknown
++ os=-linux
++ ;;
++ blackfin-*)
++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
++ bluegene*)
++ basic_machine=powerpc-ibm
++ os=-cnk
++ ;;
++ c54x-*)
++ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
++ c55x-*)
++ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
++ c6x-*)
++ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
++ cegcc)
++ basic_machine=arm-unknown
++ os=-cegcc
++ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+@@ -477,8 +573,8 @@ case $basic_machine in
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+- cr16c)
+- basic_machine=cr16c-unknown
++ cr16 | cr16-*)
++ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+@@ -516,6 +612,10 @@ case $basic_machine in
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
++ dicos)
++ basic_machine=i686-pc
++ os=-dicos
++ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+@@ -631,7 +731,6 @@ case $basic_machine in
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+@@ -670,6 +769,14 @@ case $basic_machine in
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
++ m68knommu)
++ basic_machine=m68k-unknown
++ os=-linux
++ ;;
++ m68knommu-*)
++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+@@ -681,10 +788,21 @@ case $basic_machine in
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
++ microblaze*)
++ basic_machine=microblaze-xilinx
++ ;;
++ mingw64)
++ basic_machine=x86_64-pc
++ os=-mingw64
++ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
++ mingw32ce)
++ basic_machine=arm-unknown
++ os=-mingw32ce
++ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+@@ -713,10 +831,18 @@ case $basic_machine in
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
++ msys)
++ basic_machine=i386-pc
++ os=-msys
++ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
++ nacl)
++ basic_machine=le32-unknown
++ os=-nacl
++ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+@@ -781,6 +907,12 @@ case $basic_machine in
+ np1)
+ basic_machine=np1-gould
+ ;;
++ neo-tandem)
++ basic_machine=neo-tandem
++ ;;
++ nse-tandem)
++ basic_machine=nse-tandem
++ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+@@ -811,6 +943,14 @@ case $basic_machine in
+ basic_machine=i860-intel
+ os=-osf
+ ;;
++ parisc)
++ basic_machine=hppa-unknown
++ os=-linux
++ ;;
++ parisc-*)
++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+@@ -855,9 +995,10 @@ case $basic_machine in
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+- ppc) basic_machine=powerpc-unknown
++ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ppc-* | ppcbe-*)
++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+@@ -882,7 +1023,11 @@ case $basic_machine in
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+- rdos)
++ rdos | rdos64)
++ basic_machine=x86_64-pc
++ os=-rdos
++ ;;
++ rdos32)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+@@ -912,6 +1057,10 @@ case $basic_machine in
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
++ sde)
++ basic_machine=mipsisa32-sde
++ os=-elf
++ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+@@ -923,6 +1072,9 @@ case $basic_machine in
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
++ sh5el)
++ basic_machine=sh5le-unknown
++ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+@@ -944,6 +1096,9 @@ case $basic_machine in
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
++ strongarm-* | thumb-*)
++ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+@@ -1000,17 +1155,9 @@ case $basic_machine in
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+- tic54x | c54x*)
+- basic_machine=tic54x-unknown
+- os=-coff
+- ;;
+- tic55x | c55x*)
+- basic_machine=tic55x-unknown
+- os=-coff
+- ;;
+- tic6x | c6x*)
+- basic_machine=tic6x-unknown
+- os=-coff
++ tile*)
++ basic_machine=$basic_machine-unknown
++ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+@@ -1079,6 +1226,9 @@ case $basic_machine in
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
++ xscale-* | xscalee[bl]-*)
++ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
++ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+@@ -1087,6 +1237,10 @@ case $basic_machine in
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
++ z80-*-coff)
++ basic_machine=z80-unknown
++ os=-sim
++ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+@@ -1125,10 +1279,10 @@ case $basic_machine in
+ we32k)
+ basic_machine=we32k-att
+ ;;
+- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+- sparc | sparcv8 | sparcv9 | sparcv9b)
++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+@@ -1172,9 +1326,12 @@ esac
+ if [ x"$os" != x"" ]
+ then
+ case $os in
+- # First match some system type aliases
+- # that might get confused with valid system types.
++ # First match some system type aliases
++ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
++ -auroraux)
++ os=-auroraux
++ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+@@ -1195,21 +1352,23 @@ case $os in
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
++ | -sym* | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+- | -aos* \
++ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+- | -openbsd* | -solidbsd* \
++ | -bitrig* | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+- | -chorusos* | -chorusrdb* \
+- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
++ | -chorusos* | -chorusrdb* | -cegcc* \
++ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
++ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
++ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+@@ -1217,7 +1376,7 @@ case $os in
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+- | -skyos* | -haiku* | -rdos*)
++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+@@ -1256,7 +1415,7 @@ case $os in
+ -opened*)
+ os=-openedition
+ ;;
+- -os400*)
++ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+@@ -1305,7 +1464,7 @@ case $os in
+ -sinix*)
+ os=-sysv4
+ ;;
+- -tpf*)
++ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+@@ -1347,6 +1506,11 @@ case $os in
+ -zvmoe)
+ os=-zvmoe
+ ;;
++ -dicos*)
++ os=-dicos
++ ;;
++ -nacl*)
++ ;;
+ -none)
+ ;;
+ *)
+@@ -1369,6 +1533,12 @@ else
+ # system, and we'll never get to this point.
+
+ case $basic_machine in
++ score-*)
++ os=-elf
++ ;;
++ spu-*)
++ os=-elf
++ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+@@ -1378,9 +1548,21 @@ case $basic_machine in
+ arm*-semi)
+ os=-aout
+ ;;
+- c4x-* | tic4x-*)
+- os=-coff
+- ;;
++ c4x-* | tic4x-*)
++ os=-coff
++ ;;
++ hexagon-*)
++ os=-elf
++ ;;
++ tic54x-*)
++ os=-coff
++ ;;
++ tic55x-*)
++ os=-coff
++ ;;
++ tic6x-*)
++ os=-coff
++ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+@@ -1399,13 +1581,13 @@ case $basic_machine in
+ ;;
+ m68000-sun)
+ os=-sunos3
+- # This also exists in the configure program, but was not the
+- # default.
+- # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
++ mep-*)
++ os=-elf
++ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+@@ -1430,7 +1612,7 @@ case $basic_machine in
+ *-ibm)
+ os=-aix
+ ;;
+- *-knuth)
++ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+@@ -1535,7 +1717,7 @@ case $basic_machine in
+ -sunos*)
+ vendor=sun
+ ;;
+- -aix*)
++ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+diff --git a/configure b/configure
+index a9e9814..7fd6318 100755
+--- a/configure
++++ b/configure
+@@ -1,4 +1,5 @@
+ #! /bin/sh
++set -- --host=arm-linux-androideabi
+ # Guess values for system-dependent variables and create Makefiles.
+ # Generated by GNU Autoconf 2.69 for Haskell network package 2.3.0.14.
+ #
+diff --git a/include/HsNetworkConfig.h b/include/HsNetworkConfig.h
+index c6e704d..4edc892 100644
+--- a/include/HsNetworkConfig.h
++++ b/include/HsNetworkConfig.h
+@@ -8,7 +8,7 @@
+ #define HAVE_ARPA_INET_H 1
+
+ /* Define to 1 if you have a BSDish sendfile(2) implementation. */
+-#define HAVE_BSD_SENDFILE 1
++/* #undef HAVE_BSD_SENDFILE */
+
+ /* Define to 1 if you have the declaration of `AI_ADDRCONFIG', and to 0 if you
+ don't. */
+@@ -55,7 +55,7 @@
+ #define HAVE_LIMITS_H 1
+
+ /* Define to 1 if you have a Linux sendfile(2) implementation. */
+-/* #undef HAVE_LINUX_SENDFILE */
++#define HAVE_LINUX_SENDFILE 1
+
+ /* Define to 1 if you have the <memory.h> header file. */
+ #define HAVE_MEMORY_H 1
+@@ -91,10 +91,10 @@
+ #define HAVE_STRUCT_MSGHDR_MSG_CONTROL 1
+
+ /* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
+-#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
++/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
+
+ /* Define to 1 if you have both SO_PEERCRED and struct ucred. */
+-/* #undef HAVE_STRUCT_UCRED */
++#define HAVE_STRUCT_UCRED 1
+
+ /* Define to 1 if you have the `symlink' function. */
+ #define HAVE_SYMLINK 1
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/network_2.4.1.0_0002-remove-Network.BSD-symbols-not-available-in-bionic.patch b/standalone/android/haskell-patches/network_2.4.1.0_0002-remove-Network.BSD-symbols-not-available-in-bionic.patch
new file mode 100644
index 000000000..324809ad9
--- /dev/null
+++ b/standalone/android/haskell-patches/network_2.4.1.0_0002-remove-Network.BSD-symbols-not-available-in-bionic.patch
@@ -0,0 +1,157 @@
+From 8456a3b26261212052bad4d1de207504a3f85995 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Fri, 19 Apr 2013 15:14:10 -0400
+Subject: [PATCH] remove Network.BSD symbols not available in bionic
+
+---
+ Network/BSD.hsc | 98 ---------------------------------------------------------
+ 1 file changed, 98 deletions(-)
+
+diff --git a/Network/BSD.hsc b/Network/BSD.hsc
+index c199036..f0c9f5b 100644
+--- a/Network/BSD.hsc
++++ b/Network/BSD.hsc
+@@ -30,15 +30,6 @@ module Network.BSD
+ , getHostByAddr
+ , hostAddress
+
+-#if defined(HAVE_GETHOSTENT) && !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)
+- , getHostEntries
+-
+- -- ** Low level functionality
+- , setHostEntry
+- , getHostEntry
+- , endHostEntry
+-#endif
+-
+ -- * Service names
+ , ServiceEntry(..)
+ , ServiceName
+@@ -64,14 +55,6 @@ module Network.BSD
+ , getProtocolNumber
+ , defaultProtocol
+
+-#if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)
+- , getProtocolEntries
+- -- ** Low level functionality
+- , setProtocolEntry
+- , getProtocolEntry
+- , endProtocolEntry
+-#endif
+-
+ -- * Port numbers
+ , PortNumber
+
+@@ -83,11 +66,7 @@ module Network.BSD
+ #if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)
+ , getNetworkByName
+ , getNetworkByAddr
+- , getNetworkEntries
+ -- ** Low level functionality
+- , setNetworkEntry
+- , getNetworkEntry
+- , endNetworkEntry
+ #endif
+ ) where
+
+@@ -305,31 +284,6 @@ getProtocolNumber proto = do
+ (ProtocolEntry _ _ num) <- getProtocolByName proto
+ return num
+
+-#if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)
+-getProtocolEntry :: IO ProtocolEntry -- Next Protocol Entry from DB
+-getProtocolEntry = withLock $ do
+- ent <- throwNoSuchThingIfNull "getProtocolEntry" "no such protocol entry"
+- $ trySysCall c_getprotoent
+- peek ent
+-
+-foreign import ccall unsafe "getprotoent" c_getprotoent :: IO (Ptr ProtocolEntry)
+-
+-setProtocolEntry :: Bool -> IO () -- Keep DB Open ?
+-setProtocolEntry flg = withLock $ trySysCall $ c_setprotoent (fromBool flg)
+-
+-foreign import ccall unsafe "setprotoent" c_setprotoent :: CInt -> IO ()
+-
+-endProtocolEntry :: IO ()
+-endProtocolEntry = withLock $ trySysCall $ c_endprotoent
+-
+-foreign import ccall unsafe "endprotoent" c_endprotoent :: IO ()
+-
+-getProtocolEntries :: Bool -> IO [ProtocolEntry]
+-getProtocolEntries stayOpen = withLock $ do
+- setProtocolEntry stayOpen
+- getEntries (getProtocolEntry) (endProtocolEntry)
+-#endif
+-
+ -- ---------------------------------------------------------------------------
+ -- Host lookups
+
+@@ -404,31 +358,6 @@ getHostByAddr family addr = do
+ foreign import CALLCONV safe "gethostbyaddr"
+ c_gethostbyaddr :: Ptr HostAddress -> CInt -> CInt -> IO (Ptr HostEntry)
+
+-#if defined(HAVE_GETHOSTENT) && !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)
+-getHostEntry :: IO HostEntry
+-getHostEntry = withLock $ do
+- throwNoSuchThingIfNull "getHostEntry" "unable to retrieve host entry"
+- $ trySysCall $ c_gethostent
+- >>= peek
+-
+-foreign import ccall unsafe "gethostent" c_gethostent :: IO (Ptr HostEntry)
+-
+-setHostEntry :: Bool -> IO ()
+-setHostEntry flg = withLock $ trySysCall $ c_sethostent (fromBool flg)
+-
+-foreign import ccall unsafe "sethostent" c_sethostent :: CInt -> IO ()
+-
+-endHostEntry :: IO ()
+-endHostEntry = withLock $ c_endhostent
+-
+-foreign import ccall unsafe "endhostent" c_endhostent :: IO ()
+-
+-getHostEntries :: Bool -> IO [HostEntry]
+-getHostEntries stayOpen = do
+- setHostEntry stayOpen
+- getEntries (getHostEntry) (endHostEntry)
+-#endif
+-
+ -- ---------------------------------------------------------------------------
+ -- Accessing network information
+
+@@ -490,33 +419,6 @@ getNetworkByAddr addr family = withLock $ do
+ foreign import ccall unsafe "getnetbyaddr"
+ c_getnetbyaddr :: NetworkAddr -> CInt -> IO (Ptr NetworkEntry)
+
+-getNetworkEntry :: IO NetworkEntry
+-getNetworkEntry = withLock $ do
+- throwNoSuchThingIfNull "getNetworkEntry" "no more network entries"
+- $ trySysCall $ c_getnetent
+- >>= peek
+-
+-foreign import ccall unsafe "getnetent" c_getnetent :: IO (Ptr NetworkEntry)
+-
+--- | Open the network name database. The parameter specifies
+--- whether a connection is maintained open between various
+--- networkEntry calls
+-setNetworkEntry :: Bool -> IO ()
+-setNetworkEntry flg = withLock $ trySysCall $ c_setnetent (fromBool flg)
+-
+-foreign import ccall unsafe "setnetent" c_setnetent :: CInt -> IO ()
+-
+--- | Close the connection to the network name database.
+-endNetworkEntry :: IO ()
+-endNetworkEntry = withLock $ trySysCall $ c_endnetent
+-
+-foreign import ccall unsafe "endnetent" c_endnetent :: IO ()
+-
+--- | Get the list of network entries.
+-getNetworkEntries :: Bool -> IO [NetworkEntry]
+-getNetworkEntries stayOpen = do
+- setNetworkEntry stayOpen
+- getEntries (getNetworkEntry) (endNetworkEntry)
+ #endif
+
+ -- Mutex for name service lockdown
+--
+1.8.2.rc3
+
diff --git a/standalone/android/haskell-patches/network_2.4.1.0_0003-configure-misdetects-accept4.patch b/standalone/android/haskell-patches/network_2.4.1.0_0003-configure-misdetects-accept4.patch
new file mode 100644
index 000000000..116fa320e
--- /dev/null
+++ b/standalone/android/haskell-patches/network_2.4.1.0_0003-configure-misdetects-accept4.patch
@@ -0,0 +1,34 @@
+From 63a7a97511266c1a9d2414d3314ee17fc88bb8f2 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Fri, 18 Oct 2013 15:58:35 +0000
+Subject: [PATCH] configure misdetects accept4
+
+---
+ Network/Socket.hsc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Network/Socket.hsc b/Network/Socket.hsc
+index 9af31f8..6c21209 100644
+--- a/Network/Socket.hsc
++++ b/Network/Socket.hsc
+@@ -503,7 +503,7 @@ accept sock@(MkSocket s family stype protocol status) = do
+ return new_sock
+ #else
+ with (fromIntegral sz) $ \ ptr_len -> do
+-# ifdef HAVE_ACCEPT4
++#if 0
+ new_sock <- throwSocketErrorIfMinus1RetryMayBlock "accept"
+ (threadWaitRead (fromIntegral s))
+ (c_accept4 s sockaddr ptr_len (#const SOCK_NONBLOCK))
+@@ -1615,7 +1615,7 @@ foreign import CALLCONV SAFE_ON_WIN "connect"
+ c_connect :: CInt -> Ptr SockAddr -> CInt{-CSockLen???-} -> IO CInt
+ foreign import CALLCONV unsafe "accept"
+ c_accept :: CInt -> Ptr SockAddr -> Ptr CInt{-CSockLen???-} -> IO CInt
+-#ifdef HAVE_ACCEPT4
++#if 0
+ foreign import CALLCONV unsafe "accept4"
+ c_accept4 :: CInt -> Ptr SockAddr -> Ptr CInt{-CSockLen???-} -> CInt -> IO CInt
+ #endif
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/network_2.4.1.0_0004-getprotobyname-hack-for-tcp-and-udp.patch b/standalone/android/haskell-patches/network_2.4.1.0_0004-getprotobyname-hack-for-tcp-and-udp.patch
new file mode 100644
index 000000000..4cc22cbca
--- /dev/null
+++ b/standalone/android/haskell-patches/network_2.4.1.0_0004-getprotobyname-hack-for-tcp-and-udp.patch
@@ -0,0 +1,28 @@
+From b1a581007759e2d9e53ef776e4f10d1de87b8377 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Tue, 7 May 2013 14:51:09 -0400
+Subject: [PATCH] getprotobyname hack for tcp and udp
+
+Otherwise, core network stuff fails to get the numbers for these protocols.
+---
+ Network/BSD.hsc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/Network/BSD.hsc b/Network/BSD.hsc
+index f0c9f5b..a289143 100644
+--- a/Network/BSD.hsc
++++ b/Network/BSD.hsc
+@@ -259,6 +259,10 @@ instance Storable ProtocolEntry where
+ poke _p = error "Storable.poke(BSD.ProtocolEntry) not implemented"
+
+ getProtocolByName :: ProtocolName -> IO ProtocolEntry
++getProtocolByName "tcp" = return $
++ ProtocolEntry {protoName = "tcp", protoAliases = ["TCP"], protoNumber = 6}
++getProtocolByName "udp" = return $
++ ProtocolEntry {protoName = "udp", protoAliases = ["UDP"], protoNumber = 17}
+ getProtocolByName name = withLock $ do
+ withCString name $ \ name_cstr -> do
+ throwNoSuchThingIfNull "getProtocolByName" ("no such protocol name: " ++ name)
+--
+1.8.2.rc3
+
diff --git a/standalone/android/haskell-patches/persistent-template_stub-out.patch b/standalone/android/haskell-patches/persistent-template_stub-out.patch
new file mode 100644
index 000000000..6b7b62bd4
--- /dev/null
+++ b/standalone/android/haskell-patches/persistent-template_stub-out.patch
@@ -0,0 +1,25 @@
+From 0b9df0de3aa45918a2a9226a2da6be4680276419 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 03:31:55 +0000
+Subject: [PATCH] stub out
+
+---
+ persistent-template.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/persistent-template.cabal b/persistent-template.cabal
+index 8216ce7..f23234b 100644
+--- a/persistent-template.cabal
++++ b/persistent-template.cabal
+@@ -23,7 +23,7 @@ library
+ , containers
+ , aeson
+ , monad-logger
+- exposed-modules: Database.Persist.TH
++ exposed-modules:
+ ghc-options: -Wall
+ if impl(ghc >= 7.4)
+ cpp-options: -DGHC_7_4
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/persistent_1.1.5.1_0001-disable-TH.patch b/standalone/android/haskell-patches/persistent_1.1.5.1_0001-disable-TH.patch
new file mode 100644
index 000000000..300975b83
--- /dev/null
+++ b/standalone/android/haskell-patches/persistent_1.1.5.1_0001-disable-TH.patch
@@ -0,0 +1,32 @@
+From 760fa2c5044ae38bee8114ff84c625ac59f35c6f Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 00:03:55 +0000
+Subject: [PATCH] disable TH
+
+---
+ Database/Persist/Sql/Raw.hs | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/Database/Persist/Sql/Raw.hs b/Database/Persist/Sql/Raw.hs
+index 73189dd..6efebea 100644
+--- a/Database/Persist/Sql/Raw.hs
++++ b/Database/Persist/Sql/Raw.hs
+@@ -22,7 +22,6 @@ rawQuery :: (MonadSqlPersist m, MonadResource m)
+ -> [PersistValue]
+ -> Source m [PersistValue]
+ rawQuery sql vals = do
+- lift $ $logDebugS (pack "SQL") $ pack $ show sql ++ " " ++ show vals
+ conn <- lift askSqlConn
+ bracketP
+ (getStmtConn conn sql)
+@@ -34,7 +33,6 @@ rawExecute x y = liftM (const ()) $ rawExecuteCount x y
+
+ rawExecuteCount :: MonadSqlPersist m => Text -> [PersistValue] -> m Int64
+ rawExecuteCount sql vals = do
+- $logDebugS (pack "SQL") $ pack $ show sql ++ " " ++ show vals
+ stmt <- getStmt sql
+ res <- liftIO $ stmtExecute stmt vals
+ liftIO $ stmtReset stmt
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/primitive_0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch b/standalone/android/haskell-patches/primitive_0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch
new file mode 100644
index 000000000..1bd926871
--- /dev/null
+++ b/standalone/android/haskell-patches/primitive_0.5.0.1_0001-disable-i386-opt-stuff-to-allow-cross-compilation.patch
@@ -0,0 +1,24 @@
+From 5cb5c3dabb213f809b8328b0b4049f7c754e9c77 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Thu, 28 Feb 2013 23:34:32 -0400
+Subject: [PATCH] disable i386 opt stuff to allow cross-compilation
+
+---
+ primitive.cabal | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/primitive.cabal b/primitive.cabal
+index 8c4328a..9a6093f 100644
+--- a/primitive.cabal
++++ b/primitive.cabal
+@@ -51,7 +51,4 @@ Library
+ includes: primitive-memops.h
+ c-sources: cbits/primitive-memops.c
+ cc-options: -O3 -ftree-vectorize -fomit-frame-pointer
+- if arch(i386) || arch(x86_64) {
+- cc-options: -msse2
+- }
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/process_fix-build-with-new-ghc.patch b/standalone/android/haskell-patches/process_fix-build-with-new-ghc.patch
new file mode 100644
index 000000000..a790a316d
--- /dev/null
+++ b/standalone/android/haskell-patches/process_fix-build-with-new-ghc.patch
@@ -0,0 +1,24 @@
+From 0b0d4250cfce44b1a03b50458b4122370ab349ce Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 21:50:51 +0000
+Subject: [PATCH] fix build with new ghc
+
+---
+ System/Process/Internals.hs | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs
+index a73c6fc..6676a72 100644
+--- a/System/Process/Internals.hs
++++ b/System/Process/Internals.hs
+@@ -61,6 +61,7 @@ import Control.Concurrent
+ import Control.Exception
+ import Foreign.C
+ import Foreign
++import System.IO.Unsafe
+
+ # ifdef __GLASGOW_HASKELL__
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/profunctors_3.3-0001-fix-cross-build.patch b/standalone/android/haskell-patches/profunctors_3.3-0001-fix-cross-build.patch
new file mode 100644
index 000000000..45397f3e5
--- /dev/null
+++ b/standalone/android/haskell-patches/profunctors_3.3-0001-fix-cross-build.patch
@@ -0,0 +1,26 @@
+From 392602f5ff14c0b5a801397d075ddcbcd890aa83 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Thu, 18 Apr 2013 17:50:59 -0400
+Subject: [PATCH] fix cross build
+
+---
+ src/Data/Profunctor/Unsafe.hs | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/Data/Profunctor/Unsafe.hs b/src/Data/Profunctor/Unsafe.hs
+index 025c7c4..0249274 100644
+--- a/src/Data/Profunctor/Unsafe.hs
++++ b/src/Data/Profunctor/Unsafe.hs
+@@ -40,9 +40,6 @@ import Data.Tagged
+ import Prelude hiding (id,(.),sequence)
+ import Unsafe.Coerce
+
+-{-# ANN module "Hlint: ignore Redundant lambda" #-}
+-{-# ANN module "Hlint: ignore Collapse lambdas" #-}
+-
+ infixr 9 #.
+ infixl 8 .#
+
+--
+1.8.2.rc3
+
diff --git a/standalone/android/haskell-patches/shakespeare-css_1.0.2_0001-remove-TH.patch b/standalone/android/haskell-patches/shakespeare-css_1.0.2_0001-remove-TH.patch
new file mode 100644
index 000000000..1c82eaead
--- /dev/null
+++ b/standalone/android/haskell-patches/shakespeare-css_1.0.2_0001-remove-TH.patch
@@ -0,0 +1,148 @@
+From 05d0b6e6d2f84cd8ff53b8ee3e42021fa02fe8e4 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 23:21:52 +0000
+Subject: [PATCH] remove TH
+
+---
+ Text/Cassius.hs | 23 -----------------------
+ Text/CssCommon.hs | 4 ----
+ Text/Lucius.hs | 30 +-----------------------------
+ 3 files changed, 1 insertion(+), 56 deletions(-)
+
+diff --git a/Text/Cassius.hs b/Text/Cassius.hs
+index ce05374..ae56b0a 100644
+--- a/Text/Cassius.hs
++++ b/Text/Cassius.hs
+@@ -13,10 +13,6 @@ module Text.Cassius
+ , renderCss
+ , renderCssUrl
+ -- * Parsing
+- , cassius
+- , cassiusFile
+- , cassiusFileDebug
+- , cassiusFileReload
+ -- * ToCss instances
+ -- ** Color
+ , Color (..)
+@@ -27,11 +23,8 @@ module Text.Cassius
+ , AbsoluteUnit (..)
+ , AbsoluteSize (..)
+ , absoluteSize
+- , EmSize (..)
+- , ExSize (..)
+ , PercentageSize (..)
+ , percentageSize
+- , PixelSize (..)
+ -- * Internal
+ , cassiusUsedIdentifiers
+ ) where
+@@ -42,25 +35,9 @@ import Language.Haskell.TH.Quote (QuasiQuoter (..))
+ import Language.Haskell.TH.Syntax
+ import qualified Data.Text.Lazy as TL
+ import Text.CssCommon
+-import Text.Lucius (lucius)
+ import qualified Text.Lucius
+ import Text.IndentToBrace (i2b)
+
+-cassius :: QuasiQuoter
+-cassius = QuasiQuoter { quoteExp = quoteExp lucius . i2b }
+-
+-cassiusFile :: FilePath -> Q Exp
+-cassiusFile fp = do
+-#ifdef GHC_7_4
+- qAddDependentFile fp
+-#endif
+- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp
+- quoteExp cassius contents
+-
+-cassiusFileDebug, cassiusFileReload :: FilePath -> Q Exp
+-cassiusFileDebug = cssFileDebug True [|Text.Lucius.parseTopLevels|] Text.Lucius.parseTopLevels
+-cassiusFileReload = cassiusFileDebug
+-
+ -- | Determine which identifiers are used by the given template, useful for
+ -- creating systems like yesod devel.
+ cassiusUsedIdentifiers :: String -> [(Deref, VarType)]
+diff --git a/Text/CssCommon.hs b/Text/CssCommon.hs
+index 719e0a8..8c40e8c 100644
+--- a/Text/CssCommon.hs
++++ b/Text/CssCommon.hs
+@@ -1,4 +1,3 @@
+-{-# LANGUAGE TemplateHaskell #-}
+ {-# LANGUAGE GeneralizedNewtypeDeriving #-}
+ {-# LANGUAGE FlexibleInstances #-}
+ {-# LANGUAGE CPP #-}
+@@ -156,6 +155,3 @@ showSize :: Rational -> String -> String
+ showSize value' unit = printf "%f" value ++ unit
+ where value = fromRational value' :: Double
+
+-mkSizeType "EmSize" "em"
+-mkSizeType "ExSize" "ex"
+-mkSizeType "PixelSize" "px"
+diff --git a/Text/Lucius.hs b/Text/Lucius.hs
+index 89328bd..0a1cf5e 100644
+--- a/Text/Lucius.hs
++++ b/Text/Lucius.hs
+@@ -8,12 +8,8 @@
+ {-# OPTIONS_GHC -fno-warn-missing-fields #-}
+ module Text.Lucius
+ ( -- * Parsing
+- lucius
+- , luciusFile
+- , luciusFileDebug
+- , luciusFileReload
+ -- ** Mixins
+- , luciusMixin
++ luciusMixin
+ , Mixin
+ -- ** Runtime
+ , luciusRT
+@@ -40,11 +36,8 @@ module Text.Lucius
+ , AbsoluteUnit (..)
+ , AbsoluteSize (..)
+ , absoluteSize
+- , EmSize (..)
+- , ExSize (..)
+ , PercentageSize (..)
+ , percentageSize
+- , PixelSize (..)
+ -- * Internal
+ , parseTopLevels
+ , luciusUsedIdentifiers
+@@ -66,18 +59,6 @@ import Data.Monoid (mconcat)
+ import Data.List (isSuffixOf)
+ import Control.Arrow (second)
+
+--- |
+---
+--- >>> renderCss ([lucius|foo{bar:baz}|] undefined)
+--- "foo{bar:baz}"
+-lucius :: QuasiQuoter
+-lucius = QuasiQuoter { quoteExp = luciusFromString }
+-
+-luciusFromString :: String -> Q Exp
+-luciusFromString s =
+- topLevelsToCassius
+- $ either (error . show) id $ parse parseTopLevels s s
+-
+ whiteSpace :: Parser ()
+ whiteSpace = many whiteSpace1 >> return ()
+
+@@ -217,15 +198,6 @@ parseComment = do
+ _ <- manyTill anyChar $ try $ string "*/"
+ return $ ContentRaw ""
+
+-luciusFile :: FilePath -> Q Exp
+-luciusFile fp = do
+- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp
+- luciusFromString contents
+-
+-luciusFileDebug, luciusFileReload :: FilePath -> Q Exp
+-luciusFileDebug = cssFileDebug False [|parseTopLevels|] parseTopLevels
+-luciusFileReload = luciusFileDebug
+-
+ parseTopLevels :: Parser [TopLevel Unresolved]
+ parseTopLevels =
+ go id
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/shakespeare-css_1.0.2_0002-expose-modules-used-by-TH.patch b/standalone/android/haskell-patches/shakespeare-css_1.0.2_0002-expose-modules-used-by-TH.patch
new file mode 100644
index 000000000..5bf57d527
--- /dev/null
+++ b/standalone/android/haskell-patches/shakespeare-css_1.0.2_0002-expose-modules-used-by-TH.patch
@@ -0,0 +1,26 @@
+From 23e96f0d948e7a26febf1745a4c373faf579c8ee Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Mon, 15 Apr 2013 16:32:31 -0400
+Subject: [PATCH] expose modules used by TH
+
+---
+ shakespeare-css.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/shakespeare-css.cabal b/shakespeare-css.cabal
+index de2497b..468353a 100644
+--- a/shakespeare-css.cabal
++++ b/shakespeare-css.cabal
+@@ -39,8 +39,8 @@ library
+
+ exposed-modules: Text.Cassius
+ Text.Lucius
+- other-modules: Text.MkSizeType
+ Text.Css
++ other-modules: Text.MkSizeType
+ Text.IndentToBrace
+ Text.CssCommon
+ ghc-options: -Wall
+--
+1.8.2.rc3
+
diff --git a/standalone/android/haskell-patches/shakespeare_1.0.3_0001-export-symbol-used-by-TH-splices.patch b/standalone/android/haskell-patches/shakespeare_1.0.3_0001-export-symbol-used-by-TH-splices.patch
new file mode 100644
index 000000000..51443b5d4
--- /dev/null
+++ b/standalone/android/haskell-patches/shakespeare_1.0.3_0001-export-symbol-used-by-TH-splices.patch
@@ -0,0 +1,26 @@
+From 4a75a2f0d77168aa3115b991284a5120484e18f0 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 04:59:21 +0000
+Subject: [PATCH] TH exports
+
+---
+ Text/Shakespeare.hs | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/Text/Shakespeare.hs b/Text/Shakespeare.hs
+index 9eb06a2..1290ab1 100644
+--- a/Text/Shakespeare.hs
++++ b/Text/Shakespeare.hs
+@@ -23,6 +23,9 @@ module Text.Shakespeare
+ , Deref
+ , Parser
+
++ -- used by TH
++ , pack'
++
+ #ifdef TEST_EXPORT
+ , preFilter
+ #endif
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/skein_hardcode_little-endian.patch b/standalone/android/haskell-patches/skein_hardcode_little-endian.patch
new file mode 100644
index 000000000..788d8e521
--- /dev/null
+++ b/standalone/android/haskell-patches/skein_hardcode_little-endian.patch
@@ -0,0 +1,24 @@
+From 3a04b41ffce4e4e87b0fedd3a1e3434a3f06cc76 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 00:18:12 +0000
+Subject: [PATCH] hardcode little endian
+
+---
+ c_impl/optimized/skein_port.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/c_impl/optimized/skein_port.h b/c_impl/optimized/skein_port.h
+index a2d0fc2..6929bb0 100644
+--- a/c_impl/optimized/skein_port.h
++++ b/c_impl/optimized/skein_port.h
+@@ -45,6 +45,7 @@ typedef uint64_t u64b_t; /* 64-bit unsigned integer */
+ * platform-specific code instead (e.g., for big-endian CPUs).
+ *
+ */
++#define SKEIN_NEED_SWAP (0)
+ #ifndef SKEIN_NEED_SWAP /* compile-time "override" for endianness? */
+
+ #include "brg_endian.h" /* get endianness selection */
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch b/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch
new file mode 100644
index 000000000..c9723f3f7
--- /dev/null
+++ b/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch
@@ -0,0 +1,135 @@
+From e1a2f80f6bec25921ab645a0aaf1c6422a8917ab Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Mon, 11 Nov 2013 01:06:58 +0000
+Subject: [PATCH] fix
+
+---
+ Network/Socks5/Command.hs | 8 +-------
+ Network/Socks5/Conf.hs | 1 -
+ Network/Socks5/Lowlevel.hs | 1 -
+ Network/Socks5/Types.hs | 18 +-----------------
+ Network/Socks5/Wire.hs | 2 --
+ 5 files changed, 2 insertions(+), 28 deletions(-)
+
+diff --git a/Network/Socks5/Command.hs b/Network/Socks5/Command.hs
+index db95fbd..fdba5ec 100644
+--- a/Network/Socks5/Command.hs
++++ b/Network/Socks5/Command.hs
+@@ -13,7 +13,6 @@ module Network.Socks5.Command
+ , Connect(..)
+ , Command(..)
+ , connectIPV4
+- , connectIPV6
+ , connectDomainName
+ -- * lowlevel interface
+ , rpc
+@@ -29,7 +28,7 @@ import qualified Data.ByteString as B
+ import qualified Data.ByteString.Char8 as BC
+ import Data.Serialize
+
+-import Network.Socket (Socket, PortNumber, HostAddress, HostAddress6)
++import Network.Socket (Socket, PortNumber, HostAddress)
+ import Network.Socket.ByteString
+
+ import Network.Socks5.Types
+@@ -65,11 +64,6 @@ connectIPV4 socket hostaddr port = onReply <$> rpc_ socket (Connect $ SocksAddre
+ where onReply (SocksAddrIPV4 h, p) = (h, p)
+ onReply _ = error "ipv4 requested, got something different"
+
+-connectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber)
+-connectIPV6 socket hostaddr6 port = onReply <$> rpc_ socket (Connect $ SocksAddress (SocksAddrIPV6 hostaddr6) port)
+- where onReply (SocksAddrIPV6 h, p) = (h, p)
+- onReply _ = error "ipv6 requested, got something different"
+-
+ -- TODO: FQDN should only be ascii, maybe putting a "fqdn" data type
+ -- in front to make sure and make the BC.pack safe.
+ connectDomainName :: Socket -> String -> PortNumber -> IO (SocksHostAddress, PortNumber)
+diff --git a/Network/Socks5/Conf.hs b/Network/Socks5/Conf.hs
+index c29ff7b..007d382 100644
+--- a/Network/Socks5/Conf.hs
++++ b/Network/Socks5/Conf.hs
+@@ -47,5 +47,4 @@ defaultSocksConfFromSockAddr sockaddr = SocksConf server SocksVer5
+ where server = SocksAddress haddr port
+ (haddr,port) = case sockaddr of
+ SockAddrInet p h -> (SocksAddrIPV4 h, p)
+- SockAddrInet6 p _ h _ -> (SocksAddrIPV6 h, p)
+ _ -> error "unsupported unix sockaddr type"
+diff --git a/Network/Socks5/Lowlevel.hs b/Network/Socks5/Lowlevel.hs
+index c10d9b9..2c3d59c 100644
+--- a/Network/Socks5/Lowlevel.hs
++++ b/Network/Socks5/Lowlevel.hs
+@@ -17,7 +17,6 @@ resolveToSockAddr :: SocksAddress -> IO SockAddr
+ resolveToSockAddr (SocksAddress sockHostAddr port) =
+ case sockHostAddr of
+ SocksAddrIPV4 ha -> return $ SockAddrInet port ha
+- SocksAddrIPV6 ha6 -> return $ SockAddrInet6 port 0 ha6 0
+ SocksAddrDomainName bs -> do he <- getHostByName (BC.unpack bs)
+ return $ SockAddrInet port (hostAddress he)
+
+diff --git a/Network/Socks5/Types.hs b/Network/Socks5/Types.hs
+index 7fbec25..17c7c83 100644
+--- a/Network/Socks5/Types.hs
++++ b/Network/Socks5/Types.hs
+@@ -19,7 +19,7 @@ module Network.Socks5.Types
+ import Data.ByteString (ByteString)
+ import Data.Word
+ import Data.Data
+-import Network.Socket (HostAddress, HostAddress6, PortNumber)
++import Network.Socket (HostAddress, PortNumber)
+ import Control.Exception
+ import qualified Data.ByteString.Char8 as BC
+ import Numeric (showHex)
+@@ -53,12 +53,10 @@ data SocksMethod =
+ data SocksHostAddress =
+ SocksAddrIPV4 !HostAddress
+ | SocksAddrDomainName !ByteString
+- | SocksAddrIPV6 !HostAddress6
+ deriving (Eq,Ord)
+
+ instance Show SocksHostAddress where
+ show (SocksAddrIPV4 ha) = "SocksAddrIPV4(" ++ showHostAddress ha ++ ")"
+- show (SocksAddrIPV6 ha6) = "SocksAddrIPV6(" ++ showHostAddress6 ha6 ++ ")"
+ show (SocksAddrDomainName dn) = "SocksAddrDomainName(" ++ BC.unpack dn ++ ")"
+
+ -- | Converts a HostAddress to a String in dot-decimal notation
+@@ -69,20 +67,6 @@ showHostAddress num = concat [show q1, ".", show q2, ".", show q3, ".", show q4]
+ (num''',q3) = num'' `quotRem` 256
+ (_,q4) = num''' `quotRem` 256
+
+--- | Converts a IPv6 HostAddress6 to standard hex notation
+-showHostAddress6 :: HostAddress6 -> String
+-showHostAddress6 (a,b,c,d) =
+- (concat . intersperse ":" . map (flip showHex ""))
+- [p1,p2,p3,p4,p5,p6,p7,p8]
+- where (a',p2) = a `quotRem` 65536
+- (_,p1) = a' `quotRem` 65536
+- (b',p4) = b `quotRem` 65536
+- (_,p3) = b' `quotRem` 65536
+- (c',p6) = c `quotRem` 65536
+- (_,p5) = c' `quotRem` 65536
+- (d',p8) = d `quotRem` 65536
+- (_,p7) = d' `quotRem` 65536
+-
+ -- | Describe a Socket address on the SOCKS protocol
+ data SocksAddress = SocksAddress !SocksHostAddress !PortNumber
+ deriving (Show,Eq,Ord)
+diff --git a/Network/Socks5/Wire.hs b/Network/Socks5/Wire.hs
+index 10bd262..a30f32e 100644
+--- a/Network/Socks5/Wire.hs
++++ b/Network/Socks5/Wire.hs
+@@ -46,12 +46,10 @@ data SocksResponse = SocksResponse
+
+ getAddr 1 = SocksAddrIPV4 <$> getWord32host
+ getAddr 3 = SocksAddrDomainName <$> (getWord8 >>= getByteString . fromIntegral)
+-getAddr 4 = SocksAddrIPV6 <$> (liftM4 (,,,) getWord32host getWord32host getWord32host getWord32host)
+ getAddr n = error ("cannot get unknown socket address type: " ++ show n)
+
+ putAddr (SocksAddrIPV4 h) = putWord8 1 >> putWord32host h
+ putAddr (SocksAddrDomainName b) = putWord8 3 >> putWord8 (fromIntegral $ B.length b) >> putByteString b
+-putAddr (SocksAddrIPV6 (a,b,c,d)) = putWord8 4 >> mapM_ putWord32host [a,b,c,d]
+
+ getSocksRequest 5 = do
+ cmd <- toEnum . fromIntegral <$> getWord8
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/stm-chans_cross-build.patch b/standalone/android/haskell-patches/stm-chans_cross-build.patch
new file mode 100644
index 000000000..f0964d693
--- /dev/null
+++ b/standalone/android/haskell-patches/stm-chans_cross-build.patch
@@ -0,0 +1,25 @@
+From c1b166ad1dbed80f7eed7b9c1b2dc5c668eeb8fc Mon Sep 17 00:00:00 2001
+From: androidbuilder <androidbuilder@example.com>
+Date: Fri, 18 Oct 2013 23:28:56 +0000
+Subject: [PATCH] cross build
+
+---
+ stm-chans.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/stm-chans.cabal b/stm-chans.cabal
+index 89d4780..2119a74 100644
+--- a/stm-chans.cabal
++++ b/stm-chans.cabal
+@@ -6,7 +6,7 @@
+ -- and source-repository:.
+ Cabal-Version: >= 1.6
+ -- We need a custom build in order to define __HADDOCK__
+-Build-Type: Custom
++Build-Type: Simple
+
+ Name: stm-chans
+ Version: 3.0.0
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch b/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch
new file mode 100644
index 000000000..be7956bea
--- /dev/null
+++ b/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch
@@ -0,0 +1,56 @@
+From e6d5c141186dbdbe97c698294485ffc4dcd3a843 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Fri, 18 Oct 2013 16:45:50 +0000
+Subject: [PATCH] hack for bionic + cross build
+
+---
+ Data/UnixTime/Types.hsc | 12 ------------
+ cbits/conv.c | 2 +-
+ 2 files changed, 1 insertion(+), 13 deletions(-)
+
+diff --git a/Data/UnixTime/Types.hsc b/Data/UnixTime/Types.hsc
+index d30f39b..ec7ca4c 100644
+--- a/Data/UnixTime/Types.hsc
++++ b/Data/UnixTime/Types.hsc
+@@ -9,8 +9,6 @@ import Foreign.Storable
+
+ #include <sys/time.h>
+
+-#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
+-
+ -- |
+ -- Data structure for Unix time.
+ data UnixTime = UnixTime {
+@@ -20,16 +18,6 @@ data UnixTime = UnixTime {
+ , utMicroSeconds :: {-# UNPACK #-} !Int32
+ } deriving (Eq,Ord,Show)
+
+-instance Storable UnixTime where
+- sizeOf _ = (#size struct timeval)
+- alignment _ = (#alignment struct timeval)
+- peek ptr = UnixTime
+- <$> (#peek struct timeval, tv_sec) ptr
+- <*> (#peek struct timeval, tv_usec) ptr
+- poke ptr ut = do
+- (#poke struct timeval, tv_sec) ptr (utSeconds ut)
+- (#poke struct timeval, tv_usec) ptr (utMicroSeconds ut)
+-
+ -- |
+ -- Format of the strptime()/strftime() style.
+ type Format = ByteString
+diff --git a/cbits/conv.c b/cbits/conv.c
+index 7ff7b87..2e4c870 100644
+--- a/cbits/conv.c
++++ b/cbits/conv.c
+@@ -55,7 +55,7 @@ time_t c_parse_unix_time_gmt(char *fmt, char *src) {
+ #else
+ strptime(src, fmt, &dst);
+ #endif
+- return timegm(&dst);
++ return NULL; /* timegm(&dst); (not in Bionic) */
+ }
+
+ size_t c_format_unix_time(char *fmt, time_t src, char* dst, int siz) {
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/uuid_build-without-v1-uuid-which-needs-network-info.patch b/standalone/android/haskell-patches/uuid_build-without-v1-uuid-which-needs-network-info.patch
new file mode 100644
index 000000000..12cb2a922
--- /dev/null
+++ b/standalone/android/haskell-patches/uuid_build-without-v1-uuid-which-needs-network-info.patch
@@ -0,0 +1,79 @@
+From 87283f9b6f992a7f0e36c7b1bafc288bf2bf106a Mon Sep 17 00:00:00 2001
+From: androidbuilder <androidbuilder@example.com>
+Date: Mon, 11 Nov 2013 02:46:27 +0000
+Subject: [PATCH] build without v1 uuid which needs network-ino
+
+---
+ Data/UUID/Util.hs | 11 -----------
+ Data/UUID/V1.hs | 2 --
+ uuid.cabal | 2 --
+ 3 files changed, 15 deletions(-)
+
+diff --git a/Data/UUID/Util.hs b/Data/UUID/Util.hs
+index 581391a..399e508 100644
+--- a/Data/UUID/Util.hs
++++ b/Data/UUID/Util.hs
+@@ -3,7 +3,6 @@ module Data.UUID.Util (
+ UnpackedUUID(..)
+ , unpack, pack
+ , version
+- , extractMac
+ , extractTime
+ , setTime
+ ) where
+@@ -13,7 +12,6 @@ import Data.Word
+ import Data.Word.Util
+ import Data.Bits
+ import Data.UUID.Internal
+-import Network.Info
+ import Data.Int (Int64)
+
+ version :: UUID -> Int
+@@ -43,12 +41,3 @@ extractTime uuid =
+ timeAndVersionToTime :: Word16 -> Word16
+ timeAndVersionToTime tv = tv .&. 0x0FFF
+
+-extractMac :: UUID -> Maybe MAC
+-extractMac uuid =
+- if version uuid == 1
+- then Just $
+- MAC (node_0 unpacked) (node_1 unpacked) (node_2 unpacked) (node_3 unpacked) (node_4 unpacked) (node_5 unpacked)
+- else Nothing
+- where
+- unpacked = unpack uuid
+-
+diff --git a/Data/UUID/V1.hs b/Data/UUID/V1.hs
+index 067e729..ca4c235 100644
+--- a/Data/UUID/V1.hs
++++ b/Data/UUID/V1.hs
+@@ -37,8 +37,6 @@ import System.IO.Unsafe
+
+ import qualified System.Random as R
+
+-import Network.Info
+-
+ import Data.UUID.Builder
+ import Data.UUID.Internal
+
+diff --git a/uuid.cabal b/uuid.cabal
+index 0a53059..57b1b86 100644
+--- a/uuid.cabal
++++ b/uuid.cabal
+@@ -32,14 +32,12 @@ Library
+ cryptohash >= 0.7 && < 0.12,
+ deepseq == 1.3.*,
+ hashable (>= 1.1.1.0 && < 1.2.0) || (>= 1.2.1 && < 1.3),
+- network-info == 0.2.*,
+ random >= 1.0.1 && < 1.1,
+ time >= 1.1 && < 1.5
+
+ Exposed-Modules:
+ Data.UUID
+ Data.UUID.Util
+- Data.UUID.V1
+ Data.UUID.V3
+ Data.UUID.V4
+ Data.UUID.V5
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/vector_hack-to-build-with-new-ghc.patch b/standalone/android/haskell-patches/vector_hack-to-build-with-new-ghc.patch
new file mode 100644
index 000000000..4d39e91cf
--- /dev/null
+++ b/standalone/android/haskell-patches/vector_hack-to-build-with-new-ghc.patch
@@ -0,0 +1,24 @@
+From b0a79f4f98188ba5d43b7e3912b36d34d099ab65 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Fri, 18 Oct 2013 23:20:35 +0000
+Subject: [PATCH] cross build
+
+---
+ Data/Vector/Fusion/Stream/Monadic.hs | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/Data/Vector/Fusion/Stream/Monadic.hs b/Data/Vector/Fusion/Stream/Monadic.hs
+index 51fec75..b089b3d 100644
+--- a/Data/Vector/Fusion/Stream/Monadic.hs
++++ b/Data/Vector/Fusion/Stream/Monadic.hs
+@@ -101,7 +101,6 @@ import GHC.Exts ( SpecConstrAnnotation(..) )
+
+ data SPEC = SPEC | SPEC2
+ #if __GLASGOW_HASKELL__ >= 700
+-{-# ANN type SPEC ForceSpecConstr #-}
+ #endif
+
+ emptyStream :: String
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/wai-app-static_deal-with-TH.patch b/standalone/android/haskell-patches/wai-app-static_deal-with-TH.patch
new file mode 100644
index 000000000..d9860f922
--- /dev/null
+++ b/standalone/android/haskell-patches/wai-app-static_deal-with-TH.patch
@@ -0,0 +1,54 @@
+From 432a8fc47bb11cf8fd0a832e033cfb94a6332dbe Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 07:29:39 +0000
+Subject: [PATCH] deal with TH
+
+Export modules referenced by it.
+
+Should not need these icons in git-annex, so not worth using the Evil
+Splicer.
+---
+ Network/Wai/Application/Static.hs | 4 ----
+ wai-app-static.cabal | 2 +-
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/Network/Wai/Application/Static.hs b/Network/Wai/Application/Static.hs
+index 3f07391..75709b7 100644
+--- a/Network/Wai/Application/Static.hs
++++ b/Network/Wai/Application/Static.hs
+@@ -33,8 +33,6 @@ import Control.Monad.IO.Class (liftIO)
+
+ import Blaze.ByteString.Builder (toByteString)
+
+-import Data.FileEmbed (embedFile)
+-
+ import Data.Text (Text)
+ import qualified Data.Text as T
+
+@@ -198,8 +196,6 @@ staticAppPieces _ _ req
+ H.status405
+ [("Content-Type", "text/plain")]
+ "Only GET is supported"
+-staticAppPieces _ [".hidden", "folder.png"] _ = return $ W.responseLBS H.status200 [("Content-Type", "image/png")] $ L.fromChunks [$(embedFile "images/folder.png")]
+-staticAppPieces _ [".hidden", "haskell.png"] _ = return $ W.responseLBS H.status200 [("Content-Type", "image/png")] $ L.fromChunks [$(embedFile "images/haskell.png")]
+ staticAppPieces ss rawPieces req = liftIO $ do
+ case toPieces rawPieces of
+ Just pieces -> checkPieces ss pieces req >>= response
+diff --git a/wai-app-static.cabal b/wai-app-static.cabal
+index ec22813..e944caa 100644
+--- a/wai-app-static.cabal
++++ b/wai-app-static.cabal
+@@ -56,9 +56,9 @@ library
+ WaiAppStatic.Storage.Embedded
+ WaiAppStatic.Listing
+ WaiAppStatic.Types
+- other-modules: Util
+ WaiAppStatic.Storage.Embedded.Runtime
+ WaiAppStatic.Storage.Embedded.TH
++ other-modules: Util
+ ghc-options: -Wall
+ extensions: CPP
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod-auth_don-t-really-build.patch b/standalone/android/haskell-patches/yesod-auth_don-t-really-build.patch
new file mode 100644
index 000000000..7016e001c
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod-auth_don-t-really-build.patch
@@ -0,0 +1,34 @@
+From 3eb7b0a42099721dc19363ac41319efeed4ac5f9 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 05:19:53 +0000
+Subject: [PATCH] don't really build
+
+---
+ yesod-auth.cabal | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/yesod-auth.cabal b/yesod-auth.cabal
+index 591ced5..11217be 100644
+--- a/yesod-auth.cabal
++++ b/yesod-auth.cabal
+@@ -52,16 +52,7 @@ library
+ , safe
+ , time
+
+- exposed-modules: Yesod.Auth
+- Yesod.Auth.BrowserId
+- Yesod.Auth.Dummy
+- Yesod.Auth.Email
+- Yesod.Auth.OpenId
+- Yesod.Auth.Rpxnow
+- Yesod.Auth.HashDB
+- Yesod.Auth.Message
+- Yesod.Auth.GoogleEmail
+- other-modules: Yesod.Auth.Routes
++ exposed-modules:
+ ghc-options: -Wall
+
+ source-repository head
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod-core_expand_TH.patch b/standalone/android/haskell-patches/yesod-core_expand_TH.patch
new file mode 100644
index 000000000..1687ff0e4
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod-core_expand_TH.patch
@@ -0,0 +1,411 @@
+From 7583457fb410d07f480a2aa7d6c2f174324b3592 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Sat, 19 Oct 2013 02:03:18 +0000
+Subject: [PATCH] hackity
+
+---
+ Yesod/Core.hs | 2 -
+ Yesod/Core/Class/Yesod.hs | 247 ++++++++++++++++++++++++++++++--------------
+ Yesod/Core/Dispatch.hs | 7 --
+ Yesod/Core/Handler.hs | 24 ++---
+ Yesod/Core/Internal/Run.hs | 2 -
+ 5 files changed, 179 insertions(+), 103 deletions(-)
+
+diff --git a/Yesod/Core.hs b/Yesod/Core.hs
+index 12e59d5..f1ff21c 100644
+--- a/Yesod/Core.hs
++++ b/Yesod/Core.hs
+@@ -94,8 +94,6 @@ module Yesod.Core
+ , JavascriptUrl
+ , renderJavascriptUrl
+ -- ** Cassius/Lucius
+- , cassius
+- , lucius
+ , CssUrl
+ , renderCssUrl
+ ) where
+diff --git a/Yesod/Core/Class/Yesod.hs b/Yesod/Core/Class/Yesod.hs
+index cf02a1a..3f1e88e 100644
+--- a/Yesod/Core/Class/Yesod.hs
++++ b/Yesod/Core/Class/Yesod.hs
+@@ -9,6 +9,10 @@ import Yesod.Core.Content
+ import Yesod.Core.Handler
+
+ import Yesod.Routes.Class
++import qualified Text.Blaze.Internal
++import qualified Control.Monad.Logger
++import qualified Text.Hamlet
++import qualified Data.Foldable
+
+ import Blaze.ByteString.Builder (Builder)
+ import Blaze.ByteString.Builder.Char.Utf8 (fromText)
+@@ -87,18 +91,27 @@ class RenderRoute site => Yesod site where
+ defaultLayout w = do
+ p <- widgetToPageContent w
+ mmsg <- getMessage
+- giveUrlRenderer [hamlet|
+- $newline never
+- $doctype 5
+- <html>
+- <head>
+- <title>#{pageTitle p}
+- ^{pageHead p}
+- <body>
+- $maybe msg <- mmsg
+- <p .message>#{msg}
+- ^{pageBody p}
+- |]
++ giveUrlRenderer $ \ _render_aHra
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<!DOCTYPE html>\n<html><head><title>");
++ id (TBH.toHtml (pageTitle p));
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</title>");
++ Text.Hamlet.asHtmlUrl (pageHead p) _render_aHra;
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</head><body>");
++ Text.Hamlet.maybeH
++ mmsg
++ (\ msg_aHrb
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<p class=\"message\">");
++ id (TBH.toHtml msg_aHrb);
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</p>") })
++ Nothing;
++ Text.Hamlet.asHtmlUrl (pageBody p) _render_aHra;
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack) "</body></html>") }
++
+
+ -- | Override the rendering function for a particular URL. One use case for
+ -- this is to offload static hosting to a different domain name to avoid
+@@ -356,45 +369,103 @@ widgetToPageContent w = do
+ -- modernizr should be at the end of the <head> http://www.modernizr.com/docs/#installing
+ -- the asynchronous loader means your page doesn't have to wait for all the js to load
+ let (mcomplete, asyncScripts) = asyncHelper render scripts jscript jsLoc
+- regularScriptLoad = [hamlet|
+- $newline never
+- $forall s <- scripts
+- ^{mkScriptTag s}
+- $maybe j <- jscript
+- $maybe s <- jsLoc
+- <script src="#{s}">
+- $nothing
+- <script>^{jelper j}
+- |]
+-
+- headAll = [hamlet|
+- $newline never
+- \^{head'}
+- $forall s <- stylesheets
+- ^{mkLinkTag s}
+- $forall s <- css
+- $maybe t <- right $ snd s
+- $maybe media <- fst s
+- <link rel=stylesheet media=#{media} href=#{t}>
+- $nothing
+- <link rel=stylesheet href=#{t}>
+- $maybe content <- left $ snd s
+- $maybe media <- fst s
+- <style media=#{media}>#{content}
+- $nothing
+- <style>#{content}
+- $case jsLoader master
+- $of BottomOfBody
+- $of BottomOfHeadAsync asyncJsLoader
+- ^{asyncJsLoader asyncScripts mcomplete}
+- $of BottomOfHeadBlocking
+- ^{regularScriptLoad}
+- |]
+- let bodyScript = [hamlet|
+- $newline never
+- ^{body}
+- ^{regularScriptLoad}
+- |]
++ regularScriptLoad = \ _render_aHsO
++ -> do { Data.Foldable.mapM_
++ (\ s_aHsP
++ -> Text.Hamlet.asHtmlUrl (mkScriptTag s_aHsP) _render_aHsO)
++ scripts;
++ Text.Hamlet.maybeH
++ jscript
++ (\ j_aHsQ
++ -> Text.Hamlet.maybeH
++ jsLoc
++ (\ s_aHsR
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<script src=\"");
++ id (TBH.toHtml s_aHsR);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "\"></script>") })
++ (Just
++ (do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack) "<script>");
++ Text.Hamlet.asHtmlUrl (jelper j_aHsQ) _render_aHsO;
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</script>") })))
++ Nothing }
++
++
++ headAll = \ _render_aHsW
++ -> do { Text.Hamlet.asHtmlUrl head' _render_aHsW;
++ Data.Foldable.mapM_
++ (\ s_aHsX -> Text.Hamlet.asHtmlUrl (mkLinkTag s_aHsX) _render_aHsW)
++ stylesheets;
++ Data.Foldable.mapM_
++ (\ s_aHsY
++ -> do { Text.Hamlet.maybeH
++ (right (snd s_aHsY))
++ (\ t_aHsZ
++ -> Text.Hamlet.maybeH
++ (fst s_aHsY)
++ (\ media_aHt0
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<link rel=\"stylesheet\" media=\"");
++ id (TBH.toHtml media_aHt0);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "\" href=\"");
++ id (TBH.toHtml t_aHsZ);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "\">") })
++ (Just
++ (do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<link rel=\"stylesheet\" href=\"");
++ id (TBH.toHtml t_aHsZ);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "\">") })))
++ Nothing;
++ Text.Hamlet.maybeH
++ (left (snd s_aHsY))
++ (\ content_aHt1
++ -> Text.Hamlet.maybeH
++ (fst s_aHsY)
++ (\ media_aHt2
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<style media=\"");
++ id (TBH.toHtml media_aHt2);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "\">");
++ id (TBH.toHtml content_aHt1);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "</style>") })
++ (Just
++ (do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<style>");
++ id (TBH.toHtml content_aHt1);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "</style>") })))
++ Nothing })
++ css;
++ case jsLoader master of {
++ BottomOfBody -> return ()
++ ; BottomOfHeadAsync asyncJsLoader_aHt3
++ -> Text.Hamlet.asHtmlUrl
++ (asyncJsLoader_aHt3 asyncScripts mcomplete) _render_aHsW
++ ; BottomOfHeadBlocking
++ -> Text.Hamlet.asHtmlUrl regularScriptLoad _render_aHsW } }
++
++ let bodyScript = \ _render_aHt8 -> do { Text.Hamlet.asHtmlUrl body _render_aHt8;
++ Text.Hamlet.asHtmlUrl regularScriptLoad _render_aHt8 }
++
+
+ return $ PageContent title headAll $
+ case jsLoader master of
+@@ -424,10 +495,13 @@ defaultErrorHandler NotFound = selectRep $ do
+ r <- waiRequest
+ let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
+ setTitle "Not Found"
+- toWidget [hamlet|
+- <h1>Not Found
+- <p>#{path'}
+- |]
++ toWidget $ \ _render_aHte
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<h1>Not Found</h1>\n<p>");
++ id (TBH.toHtml path');
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</p>") }
++
+ provideRep $ return $ object ["message" .= ("Not Found" :: Text)]
+
+ -- For API requests.
+@@ -437,10 +511,11 @@ defaultErrorHandler NotFound = selectRep $ do
+ defaultErrorHandler NotAuthenticated = selectRep $ do
+ provideRep $ defaultLayout $ do
+ setTitle "Not logged in"
+- toWidget [hamlet|
+- <h1>Not logged in
+- <p style="display:none;">Set the authRoute and the user will be redirected there.
+- |]
++ toWidget $ \ _render_aHti
++ -> id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<h1>Not logged in</h1>\n<p style=\"none;\">Set the authRoute and the user will be redirected there.</p>")
++
+
+ provideRep $ do
+ -- 401 *MUST* include a WWW-Authenticate header
+@@ -462,10 +537,13 @@ defaultErrorHandler NotAuthenticated = selectRep $ do
+ defaultErrorHandler (PermissionDenied msg) = selectRep $ do
+ provideRep $ defaultLayout $ do
+ setTitle "Permission Denied"
+- toWidget [hamlet|
+- <h1>Permission denied
+- <p>#{msg}
+- |]
++ toWidget $ \ _render_aHtq
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<h1>Permission denied</h1>\n<p>");
++ id (TBH.toHtml msg);
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</p>") }
++
+ provideRep $
+ return $ object $ [
+ "message" .= ("Permission Denied. " <> msg)
+@@ -474,30 +552,43 @@ defaultErrorHandler (PermissionDenied msg) = selectRep $ do
+ defaultErrorHandler (InvalidArgs ia) = selectRep $ do
+ provideRep $ defaultLayout $ do
+ setTitle "Invalid Arguments"
+- toWidget [hamlet|
+- <h1>Invalid Arguments
+- <ul>
+- $forall msg <- ia
+- <li>#{msg}
+- |]
++ toWidget $ \ _render_aHtv
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<h1>Invalid Arguments</h1>\n<ul>");
++ Data.Foldable.mapM_
++ (\ msg_aHtw
++ -> do { id ((Text.Blaze.Internal.preEscapedText . T.pack) "<li>");
++ id (TBH.toHtml msg_aHtw);
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</li>") })
++ ia;
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</ul>") }
++
+ provideRep $ return $ object ["message" .= ("Invalid Arguments" :: Text), "errors" .= ia]
+ defaultErrorHandler (InternalError e) = do
+- $logErrorS "yesod-core" e
+ selectRep $ do
+ provideRep $ defaultLayout $ do
+ setTitle "Internal Server Error"
+- toWidget [hamlet|
+- <h1>Internal Server Error
+- <pre>#{e}
+- |]
++ toWidget $ \ _render_aHtC
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<h1>Internal Server Error</h1>\n<pre>");
++ id (TBH.toHtml e);
++ id ((Text.Blaze.Internal.preEscapedText . T.pack) "</pre>") }
++
+ provideRep $ return $ object ["message" .= ("Internal Server Error" :: Text), "error" .= e]
+ defaultErrorHandler (BadMethod m) = selectRep $ do
+ provideRep $ defaultLayout $ do
+ setTitle"Bad Method"
+- toWidget [hamlet|
+- <h1>Method Not Supported
+- <p>Method <code>#{S8.unpack m}</code> not supported
+- |]
++ toWidget $ \ _render_aHtH
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<h1>Method Not Supported</h1>\n<p>Method <code>");
++ id (TBH.toHtml (S8.unpack m));
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "</code> not supported</p>") }
++
+ provideRep $ return $ object ["message" .= ("Bad method" :: Text), "method" .= m]
+
+ asyncHelper :: (url -> [x] -> Text)
+diff --git a/Yesod/Core/Dispatch.hs b/Yesod/Core/Dispatch.hs
+index 335a15c..4ca05da 100644
+--- a/Yesod/Core/Dispatch.hs
++++ b/Yesod/Core/Dispatch.hs
+@@ -123,13 +123,6 @@ toWaiApp site = do
+ , yreSite = site
+ , yreSessionBackend = sb
+ }
+- messageLoggerSource
+- site
+- logger
+- $(qLocation >>= liftLoc)
+- "yesod-core"
+- LevelInfo
+- (toLogStr ("Application launched" :: S.ByteString))
+ middleware <- mkDefaultMiddlewares logger
+ return $ middleware $ toWaiAppYre yre
+
+diff --git a/Yesod/Core/Handler.hs b/Yesod/Core/Handler.hs
+index f3b1799..d819b04 100644
+--- a/Yesod/Core/Handler.hs
++++ b/Yesod/Core/Handler.hs
+@@ -152,7 +152,7 @@ import qualified Control.Monad.Trans.Writer as Writer
+
+ import Control.Monad.IO.Class (MonadIO, liftIO)
+ import Control.Monad.Trans.Resource (MonadResource, liftResourceT)
+-
++import qualified Text.Blaze.Internal
+ import qualified Network.HTTP.Types as H
+ import qualified Network.Wai as W
+ import Control.Monad.Trans.Class (lift)
+@@ -710,19 +710,15 @@ redirectToPost :: (MonadHandler m, RedirectUrl (HandlerSite m) url)
+ -> m a
+ redirectToPost url = do
+ urlText <- toTextUrl url
+- giveUrlRenderer [hamlet|
+-$newline never
+-$doctype 5
+-
+-<html>
+- <head>
+- <title>Redirecting...
+- <body onload="document.getElementById('form').submit()">
+- <form id="form" method="post" action=#{urlText}>
+- <noscript>
+- <p>Javascript has been disabled; please click on the button below to be redirected.
+- <input type="submit" value="Continue">
+-|] >>= sendResponse
++ giveUrlRenderer $ \ _render_awps
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "<!DOCTYPE html>\n<html><head><title>Redirecting...</title></head><body onload=\"document.getElementById('form').submit()\"><form id=\"form\" method=\"post\" action=\"");
++ id (toHtml urlText);
++ id
++ ((Text.Blaze.Internal.preEscapedText . T.pack)
++ "\"><noscript><p>Javascript has been disabled; please click on the button below to be redirected.</p></noscript><input type=\"submit\" value=\"Continue\"></form></body></html>") }
++ >>= sendResponse
+
+ -- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
+ hamletToRepHtml :: MonadHandler m => HtmlUrl (Route (HandlerSite m)) -> m Html
+diff --git a/Yesod/Core/Internal/Run.hs b/Yesod/Core/Internal/Run.hs
+index 35f1d3f..8b92e99 100644
+--- a/Yesod/Core/Internal/Run.hs
++++ b/Yesod/Core/Internal/Run.hs
+@@ -122,8 +122,6 @@ safeEh :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ())
+ -> ErrorResponse
+ -> YesodApp
+ safeEh log' er req = do
+- liftIO $ log' $(qLocation >>= liftLoc) "yesod-core" LevelError
+- $ toLogStr $ "Error handler errored out: " ++ show er
+ return $ YRPlain
+ H.status500
+ []
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod-form_spliced-TH.patch b/standalone/android/haskell-patches/yesod-form_spliced-TH.patch
new file mode 100644
index 000000000..486d2aaee
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod-form_spliced-TH.patch
@@ -0,0 +1,1783 @@
+From f645acc0efbfcba7715cd2b6734f0e9df98f7020 Mon Sep 17 00:00:00 2001
+From: dummy <dummy@example.com>
+Date: Mon, 11 Nov 2013 01:26:56 +0000
+Subject: [PATCH] update
+
+---
+ Yesod/Form/Fields.hs | 771 +++++++++++++++++++++++++++++++++++------------
+ Yesod/Form/Functions.hs | 237 ++++++++++++---
+ Yesod/Form/Jquery.hs | 125 ++++++--
+ Yesod/Form/MassInput.hs | 233 +++++++++++---
+ Yesod/Form/Nic.hs | 61 +++-
+ yesod-form.cabal | 1 +
+ 6 files changed, 1122 insertions(+), 306 deletions(-)
+
+diff --git a/Yesod/Form/Fields.hs b/Yesod/Form/Fields.hs
+index 0689859..1e9d49b 100644
+--- a/Yesod/Form/Fields.hs
++++ b/Yesod/Form/Fields.hs
+@@ -1,4 +1,3 @@
+-{-# LANGUAGE QuasiQuotes #-}
+ {-# LANGUAGE TypeFamilies #-}
+ {-# LANGUAGE OverloadedStrings #-}
+ {-# LANGUAGE GeneralizedNewtypeDeriving #-}
+@@ -36,15 +35,11 @@ module Yesod.Form.Fields
+ , selectFieldList
+ , radioField
+ , radioFieldList
+- , checkboxesFieldList
+- , checkboxesField
+ , multiSelectField
+ , multiSelectFieldList
+ , Option (..)
+ , OptionList (..)
+ , mkOptionList
+- , optionsPersist
+- , optionsPersistKey
+ , optionsPairs
+ , optionsEnum
+ ) where
+@@ -70,6 +65,15 @@ import Text.HTML.SanitizeXSS (sanitizeBalance)
+ import Control.Monad (when, unless)
+ import Data.Maybe (listToMaybe, fromMaybe)
+
++import qualified Text.Blaze as Text.Blaze.Internal
++import qualified Text.Blaze.Internal
++import qualified Text.Hamlet
++import qualified Yesod.Core.Widget
++import qualified Text.Css
++import qualified Data.Monoid
++import qualified Data.Foldable
++import qualified Control.Monad
++
+ import qualified Blaze.ByteString.Builder.Html.Utf8 as B
+ import Blaze.ByteString.Builder (writeByteString, toLazyByteString)
+ import Blaze.ByteString.Builder.Internal.Write (fromWriteList)
+@@ -82,14 +86,12 @@ import Data.Text (Text, unpack, pack)
+ import qualified Data.Text.Read
+
+ import qualified Data.Map as Map
+-import Yesod.Persist (selectList, runDB, Filter, SelectOpt, Key, YesodPersist, PersistEntity, PersistQuery, YesodDB)
+ import Control.Arrow ((&&&))
+
+ import Control.Applicative ((<$>), (<|>))
+
+ import Data.Attoparsec.Text (Parser, char, string, digit, skipSpace, endOfInput, parseOnly)
+
+-import Yesod.Persist.Core
+
+ defaultFormMessage :: FormMessage -> Text
+ defaultFormMessage = englishFormMessage
+@@ -102,10 +104,24 @@ intField = Field
+ Right (a, "") -> Right a
+ _ -> Left $ MsgInvalidInteger s
+
+- , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="number" :isReq:required="" value="#{showVal val}">
+-|]
++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_arOn
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"number\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+ where
+@@ -119,10 +135,24 @@ doubleField = Field
+ Right (a, "") -> Right a
+ _ -> Left $ MsgInvalidNumber s
+
+- , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required="" value="#{showVal val}">
+-|]
++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_arOz
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"text\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+ where showVal = either id (pack . show)
+@@ -130,10 +160,24 @@ $newline never
+ dayField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Day
+ dayField = Field
+ { fieldParse = parseHelper $ parseDate . unpack
+- , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="date" :isReq:required="" value="#{showVal val}">
+-|]
++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_arOJ
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"date\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+ where showVal = either id (pack . show)
+@@ -141,10 +185,23 @@ $newline never
+ timeField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m TimeOfDay
+ timeField = Field
+ { fieldParse = parseHelper parseTime
+- , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} :isReq:required="" value="#{showVal val}">
+-|]
++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_arOW
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+ where
+@@ -157,10 +214,18 @@ $newline never
+ htmlField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Html
+ htmlField = Field
+ { fieldParse = parseHelper $ Right . preEscapedText . sanitizeBalance
+- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet|
+-$newline never
+-<textarea id="#{theId}" name="#{name}" *{attrs}>#{showVal val}
+-|]
++ , fieldView = \theId name attrs val _isReq -> toWidget $ \ _render_arP6
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<textarea id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "</textarea>") }
++
+ , fieldEnctype = UrlEncoded
+ }
+ where showVal = either id (pack . renderHtml)
+@@ -169,8 +234,6 @@ $newline never
+ -- br-tags.
+ newtype Textarea = Textarea { unTextarea :: Text }
+ deriving (Show, Read, Eq, PersistField, Ord)
+-instance PersistFieldSql Textarea where
+- sqlType _ = SqlString
+ instance ToHtml Textarea where
+ toHtml =
+ unsafeByteString
+@@ -188,10 +251,18 @@ instance ToHtml Textarea where
+ textareaField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Textarea
+ textareaField = Field
+ { fieldParse = parseHelper $ Right . Textarea
+- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet|
+-$newline never
+-<textarea id="#{theId}" name="#{name}" *{attrs}>#{either id unTextarea val}
+-|]
++ , fieldView = \theId name attrs val _isReq -> toWidget $ \ _render_arPf
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<textarea id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ id (toHtml (either id unTextarea val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "</textarea>") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -199,10 +270,19 @@ hiddenField :: (Monad m, PathPiece p, RenderMessage (HandlerSite m) FormMessage)
+ => Field m p
+ hiddenField = Field
+ { fieldParse = parseHelper $ maybe (Left MsgValueRequired) Right . fromPathPiece
+- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet|
+-$newline never
+-<input type="hidden" id="#{theId}" name="#{name}" *{attrs} value="#{either id toPathPiece val}">
+-|]
++ , fieldView = \theId name attrs val _isReq -> toWidget $ \ _render_arPo
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<input type=\"hidden\" id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"");
++ id (toHtml (either id toPathPiece val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -210,20 +290,55 @@ textField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Tex
+ textField = Field
+ { fieldParse = parseHelper $ Right
+ , fieldView = \theId name attrs val isReq ->
+- [whamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required value="#{either id id val}">
+-|]
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"text\"");
++ Text.Hamlet.condH
++ [(isReq,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " required"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (either id id val));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+ passwordField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Text
+ passwordField = Field
+ { fieldParse = parseHelper $ Right
+- , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="password" :isReq:required="" value="#{either id id val}">
+-|]
++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_arPF
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "\" type=\"password\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (either id id val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -295,10 +410,24 @@ emailField = Field
+ case Email.canonicalizeEmail $ encodeUtf8 s of
+ Just e -> Right $ decodeUtf8With lenientDecode e
+ Nothing -> Left $ MsgInvalidEmail s
+- , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="email" :isReq:required="" value="#{either id id val}">
+-|]
++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_arQe
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"email\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (either id id val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -307,20 +436,78 @@ searchField :: Monad m => RenderMessage (HandlerSite m) FormMessage => AutoFocus
+ searchField autoFocus = Field
+ { fieldParse = parseHelper Right
+ , fieldView = \theId name attrs val isReq -> do
+- [whamlet|\
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="search" :isReq:required="" :autoFocus:autofocus="" value="#{either id id val}">
+-|]
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"search\"");
++ Text.Hamlet.condH
++ [(isReq,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ Text.Hamlet.condH
++ [(autoFocus,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " autofocus=\"\""))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (either id id val));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ when autoFocus $ do
+ -- we want this javascript to be placed immediately after the field
+- [whamlet|
+-$newline never
+-<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('#{theId}').focus();}
+-|]
+- toWidget [cassius|
+- ##{theId}
+- -webkit-appearance: textfield
+- |]
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "').focus();}</script>") }
++
++ toWidget $ \ _render_arQv
++ -> (Text.Css.CssNoWhitespace
++ . (foldr ($) []))
++ [((++)
++ $ (map
++ Text.Css.TopBlock
++ (((Text.Css.Block
++ {Text.Css.blockSelector = Data.Monoid.mconcat
++ [(Text.Css.fromText
++ . Text.Css.pack)
++ "#",
++ toCss theId],
++ Text.Css.blockAttrs = (concat
++ $ ([Text.Css.Attr
++ (Data.Monoid.mconcat
++ [(Text.Css.fromText
++ . Text.Css.pack)
++ "-webkit-appearance"])
++ (Data.Monoid.mconcat
++ [(Text.Css.fromText
++ . Text.Css.pack)
++ "textfield"])]
++ :
++ (map
++ Text.Css.mixinAttrs
++ []))),
++ Text.Css.blockBlocks = (),
++ Text.Css.blockMixins = ()}
++ :)
++ . ((foldr (.) id [])
++ . (concatMap Text.Css.mixinBlocks [] ++)))
++ [])))]
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -331,7 +518,30 @@ urlField = Field
+ Nothing -> Left $ MsgInvalidUrl s
+ Just _ -> Right s
+ , fieldView = \theId name attrs val isReq ->
+- [whamlet|<input ##{theId} name=#{name} *{attrs} type=url :isReq:required value=#{either id id val}>|]
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"url\"");
++ Text.Hamlet.condH
++ [(isReq,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " required"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (either id id val));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -344,18 +554,56 @@ selectField :: (Eq a, RenderMessage site FormMessage)
+ => HandlerT site IO (OptionList a)
+ -> Field (HandlerT site IO) a
+ selectField = selectFieldHelper
+- (\theId name attrs inside -> [whamlet|
+-$newline never
+-<select ##{theId} name=#{name} *{attrs}>^{inside}
+-|]) -- outside
+- (\_theId _name isSel -> [whamlet|
+-$newline never
+-<option value=none :isSel:selected>_{MsgSelectNone}
+-|]) -- onOpt
+- (\_theId _name _attrs value isSel text -> [whamlet|
+-$newline never
+-<option value=#{value} :isSel:selected>#{text}
+-|]) -- inside
++ (\theId name attrs inside -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<select id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) inside;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</select>") })
++ -- outside
++ (\_theId _name isSel -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<option value=\"none\"");
++ Text.Hamlet.condH
++ [(isSel,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " selected"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ ((Control.Monad.liftM (toHtml .) getMessageRender)
++ >>=
++ (\ urender_arQS
++ -> (Yesod.Core.Widget.asWidgetT . toWidget)
++ (urender_arQS MsgSelectNone)));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</option>") })
++ -- onOpt
++ (\_theId _name _attrs value isSel text -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<option value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml value);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ Text.Hamlet.condH
++ [(isSel,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " selected"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml text);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</option>") })
++ -- inside
+
+ multiSelectFieldList :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg)
+ => [(msg, a)]
+@@ -378,11 +626,48 @@ multiSelectField ioptlist =
+ view theId name attrs val isReq = do
+ opts <- fmap olOptions $ handlerToWidget ioptlist
+ let selOpts = map (id &&& (optselected val)) opts
+- [whamlet|
+- <select ##{theId} name=#{name} :isReq:required multiple *{attrs}>
+- $forall (opt, optsel) <- selOpts
+- <option value=#{optionExternalValue opt} :optsel:selected>#{optionDisplay opt}
+- |]
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<select id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ Text.Hamlet.condH
++ [(isReq,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " required"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " multiple");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ Data.Foldable.mapM_
++ (\ (opt_arRl, optsel_arRm)
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<option value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (optionExternalValue opt_arRl));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ Text.Hamlet.condH
++ [(optsel_arRm,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " selected"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (optionDisplay opt_arRl));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</option>") })
++ selOpts;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</select>") }
++
+ where
+ optselected (Left _) _ = False
+ optselected (Right vals) opt = (optionInternalValue opt) `elem` vals
+@@ -392,67 +677,172 @@ radioFieldList :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg)
+ -> Field (HandlerT site IO) a
+ radioFieldList = radioField . optionsPairs
+
+-checkboxesFieldList :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg) => [(msg, a)]
+- -> Field (HandlerT site IO) [a]
+-checkboxesFieldList = checkboxesField . optionsPairs
+-
+-checkboxesField :: (Eq a, RenderMessage site FormMessage)
+- => HandlerT site IO (OptionList a)
+- -> Field (HandlerT site IO) [a]
+-checkboxesField ioptlist = (multiSelectField ioptlist)
+- { fieldView =
+- \theId name attrs val isReq -> do
+- opts <- fmap olOptions $ handlerToWidget ioptlist
+- let optselected (Left _) _ = False
+- optselected (Right vals) opt = (optionInternalValue opt) `elem` vals
+- [whamlet|
+- <span ##{theId}>
+- $forall opt <- opts
+- <label>
+- <input type=checkbox name=#{name} value=#{optionExternalValue opt} *{attrs} :optselected val opt:checked>
+- #{optionDisplay opt}
+- |]
+- }
+
+ radioField :: (Eq a, RenderMessage site FormMessage)
+ => HandlerT site IO (OptionList a)
+ -> Field (HandlerT site IO) a
+ radioField = selectFieldHelper
+- (\theId _name _attrs inside -> [whamlet|
+-$newline never
+-<div ##{theId}>^{inside}
+-|])
+- (\theId name isSel -> [whamlet|
+-$newline never
+-<label .radio for=#{theId}-none>
+- <div>
+- <input id=#{theId}-none type=radio name=#{name} value=none :isSel:checked>
+- _{MsgSelectNone}
+-|])
+- (\theId name attrs value isSel text -> [whamlet|
+-$newline never
+-<label .radio for=#{theId}-#{value}>
+- <div>
+- <input id=#{theId}-#{value} type=radio name=#{name} value=#{value} :isSel:checked *{attrs}>
+- \#{text}
+-|])
++ (\theId _name _attrs inside -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<div id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) inside;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div>") })
++
++ (\theId name isSel -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<label class=\"radio\" for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "-none\"><div><input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "-none\" type=\"radio\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"none\"");
++ Text.Hamlet.condH
++ [(isSel,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " checked"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ ((Control.Monad.liftM (toHtml .) getMessageRender)
++ >>=
++ (\ urender_arRA
++ -> (Yesod.Core.Widget.asWidgetT . toWidget)
++ (urender_arRA MsgSelectNone)));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div></label>") })
++
++ (\theId name attrs value isSel text -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<label class=\"radio\" for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "-");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml value);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "\"><div><input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "-");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml value);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "\" type=\"radio\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml value);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ Text.Hamlet.condH
++ [(isSel,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " checked"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml text);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div></label>") })
++
+
+ boolField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Bool
+ boolField = Field
+ { fieldParse = \e _ -> return $ boolParser e
+- , fieldView = \theId name attrs val isReq -> [whamlet|
+-$newline never
+- $if not isReq
+- <input id=#{theId}-none *{attrs} type=radio name=#{name} value=none checked>
+- <label for=#{theId}-none>_{MsgSelectNone}
++ , fieldView = \theId name attrs val isReq -> do { Text.Hamlet.condH
++ [(not isReq,
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "-none\" type=\"radio\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "\" value=\"none\" checked");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "><label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "-none\">");
++ ((Control.Monad.liftM (toHtml .) getMessageRender)
++ >>=
++ (\ urender_arRX
++ -> (Yesod.Core.Widget.asWidgetT . toWidget)
++ (urender_arRX MsgSelectNone)));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</label>") })]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "-yes\" type=\"radio\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"yes\"");
++ Text.Hamlet.condH
++ [(showVal id val,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " checked"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "><label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "-yes\">");
++ ((Control.Monad.liftM (toHtml .) getMessageRender)
++ >>=
++ (\ urender_arRY
++ -> (Yesod.Core.Widget.asWidgetT . toWidget)
++ (urender_arRY MsgBoolYes)));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "</label><input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "-no\" type=\"radio\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"no\"");
++ Text.Hamlet.condH
++ [(showVal not val,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " checked"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "><label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "-no\">");
++ ((Control.Monad.liftM (toHtml .) getMessageRender)
++ >>=
++ (\ urender_arRZ
++ -> (Yesod.Core.Widget.asWidgetT . toWidget)
++ (urender_arRZ MsgBoolNo)));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</label>") }
+
+-
+-<input id=#{theId}-yes *{attrs} type=radio name=#{name} value=yes :showVal id val:checked>
+-<label for=#{theId}-yes>_{MsgBoolYes}
+-
+-<input id=#{theId}-no *{attrs} type=radio name=#{name} value=no :showVal not val:checked>
+-<label for=#{theId}-no>_{MsgBoolNo}
+-|]
+ , fieldEnctype = UrlEncoded
+ }
+ where
+@@ -478,10 +868,25 @@ $newline never
+ checkBoxField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Bool
+ checkBoxField = Field
+ { fieldParse = \e _ -> return $ checkBoxParser e
+- , fieldView = \theId name attrs val _ -> [whamlet|
+-$newline never
+-<input id=#{theId} *{attrs} type=checkbox name=#{name} value=yes :showVal id val:checked>
+-|]
++ , fieldView = \theId name attrs val _ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml theId);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "\" type=\"checkbox\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"yes\"");
++ Text.Hamlet.condH
++ [(showVal id val,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " checked"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = UrlEncoded
+ }
+
+@@ -525,49 +930,7 @@ optionsPairs opts = do
+ optionsEnum :: (MonadHandler m, Show a, Enum a, Bounded a) => m (OptionList a)
+ optionsEnum = optionsPairs $ map (\x -> (pack $ show x, x)) [minBound..maxBound]
+
+-optionsPersist :: ( YesodPersist site, PersistEntity a
+- , PersistQuery (YesodDB site)
+- , PathPiece (Key a)
+- , PersistEntityBackend a ~ PersistMonadBackend (YesodDB site)
+- , RenderMessage site msg
+- )
+- => [Filter a]
+- -> [SelectOpt a]
+- -> (a -> msg)
+- -> HandlerT site IO (OptionList (Entity a))
+-optionsPersist filts ords toDisplay = fmap mkOptionList $ do
+- mr <- getMessageRender
+- pairs <- runDB $ selectList filts ords
+- return $ map (\(Entity key value) -> Option
+- { optionDisplay = mr (toDisplay value)
+- , optionInternalValue = Entity key value
+- , optionExternalValue = toPathPiece key
+- }) pairs
+-
+--- | An alternative to 'optionsPersist' which returns just the @Key@ instead of
+--- the entire @Entity@.
+---
+--- Since 1.3.2
+-optionsPersistKey
+- :: (YesodPersist site
+- , PersistEntity a
+- , PersistQuery (YesodPersistBackend site (HandlerT site IO))
+- , PathPiece (Key a)
+- , RenderMessage site msg
+- , PersistEntityBackend a ~ PersistMonadBackend (YesodDB site))
+- => [Filter a]
+- -> [SelectOpt a]
+- -> (a -> msg)
+- -> HandlerT site IO (OptionList (Key a))
+-
+-optionsPersistKey filts ords toDisplay = fmap mkOptionList $ do
+- mr <- getMessageRender
+- pairs <- runDB $ selectList filts ords
+- return $ map (\(Entity key value) -> Option
+- { optionDisplay = mr (toDisplay value)
+- , optionInternalValue = key
+- , optionExternalValue = toPathPiece key
+- }) pairs
++
+
+ selectFieldHelper
+ :: (Eq a, RenderMessage site FormMessage)
+@@ -611,9 +974,21 @@ fileField = Field
+ case files of
+ [] -> Right Nothing
+ file:_ -> Right $ Just file
+- , fieldView = \id' name attrs _ isReq -> toWidget [hamlet|
+- <input id=#{id'} name=#{name} *{attrs} type=file :isReq:required>
+- |]
++ , fieldView = \id' name attrs _ isReq -> toWidget $ \ _render_arSN
++ -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml id');
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"file\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required"))]
++ Nothing;
++ id ((Text.Hamlet.attrsToHtml . toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fieldEnctype = Multipart
+ }
+
+@@ -640,10 +1015,20 @@ fileAFormReq fs = AForm $ \(site, langs) menvs ints -> do
+ { fvLabel = toHtml $ renderMessage site langs $ fsLabel fs
+ , fvTooltip = fmap (toHtml . renderMessage site langs) $ fsTooltip fs
+ , fvId = id'
+- , fvInput = [whamlet|
+-$newline never
+-<input type=file name=#{name} ##{id'} *{fsAttrs fs}>
+-|]
++ , fvInput = do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<input type=\"file\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml id');
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) (fsAttrs fs));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fvErrors = errs
+ , fvRequired = True
+ }
+@@ -672,10 +1057,20 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do
+ { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs
+ , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs
+ , fvId = id'
+- , fvInput = [whamlet|
+-$newline never
+-<input type=file name=#{name} ##{id'} *{fsAttrs fs}>
+-|]
++ , fvInput = do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<input type=\"file\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml name);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" id=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml id');
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Hamlet.attrsToHtml . toAttributes) (fsAttrs fs));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ , fvErrors = errs
+ , fvRequired = False
+ }
+diff --git a/Yesod/Form/Functions.hs b/Yesod/Form/Functions.hs
+index 8a36710..c375ae0 100644
+--- a/Yesod/Form/Functions.hs
++++ b/Yesod/Form/Functions.hs
+@@ -59,6 +59,10 @@ import Data.Maybe (listToMaybe, fromMaybe)
+ import qualified Data.Map as Map
+ import qualified Data.Text.Encoding as TE
+ import Control.Arrow (first)
++import qualified Text.Blaze.Internal
++import qualified Yesod.Core.Widget
++import qualified Data.Foldable
++import qualified Text.Hamlet
+
+ -- | Get a unique identifier.
+ newFormIdent :: Monad m => MForm m Text
+@@ -210,7 +214,14 @@ postHelper form env = do
+ let token =
+ case reqToken req of
+ Nothing -> mempty
+- Just n -> [shamlet|<input type=hidden name=#{tokenKey} value=#{n}>|]
++ Just n -> do { id
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<input type=\"hidden\" name=\"");
++ id (toHtml tokenKey);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\"");
++ id (toHtml n);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\">") }
++
+ m <- getYesod
+ langs <- languages
+ ((res, xml), enctype) <- runFormGeneric (form token) m langs env
+@@ -279,7 +290,12 @@ getHelper :: MonadHandler m
+ -> Maybe (Env, FileEnv)
+ -> m (a, Enctype)
+ getHelper form env = do
+- let fragment = [shamlet|<input type=hidden name=#{getKey}>|]
++ let fragment = do { id
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<input type=\"hidden\" name=\"");
++ id (toHtml getKey);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\">") }
++
+ langs <- languages
+ m <- getYesod
+ runFormGeneric (form fragment) m langs env
+@@ -293,19 +309,66 @@ renderTable, renderDivs, renderDivsNoLabels :: Monad m => FormRender m a
+ renderTable aform fragment = do
+ (res, views') <- aFormToForm aform
+ let views = views' []
+- let widget = [whamlet|
+-$newline never
+-\#{fragment}
+-$forall view <- views
+- <tr :fvRequired view:.required :not $ fvRequired view:.optional>
+- <td>
+- <label for=#{fvId view}>#{fvLabel view}
+- $maybe tt <- fvTooltip view
+- <div .tooltip>#{tt}
+- <td>^{fvInput view}
+- $maybe err <- fvErrors view
+- <td .errors>#{err}
+-|]
++ let widget = do { (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml fragment);
++ Data.Foldable.mapM_
++ (\ view_aagq
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<tr");
++ Text.Hamlet.condH
++ [(or [fvRequired view_aagq, not (fvRequired view_aagq)],
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " class=\"");
++ Text.Hamlet.condH
++ [(fvRequired view_aagq,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "required "))]
++ Nothing;
++ Text.Hamlet.condH
++ [(not (fvRequired view_aagq),
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "optional"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"") })]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "><td><label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml (fvId view_aagq));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (fvLabel view_aagq));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</label>");
++ Text.Hamlet.maybeH
++ (fvTooltip view_aagq)
++ (\ tt_aagr
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<div class=\"tooltip\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml tt_aagr);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</td><td>");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (fvInput view_aagq);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</td>");
++ Text.Hamlet.maybeH
++ (fvErrors view_aagq)
++ (\ err_aags
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<td class=\"errors\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml err_aags);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</td>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</tr>") })
++ views }
++
+ return (res, widget)
+
+ -- | render a field inside a div
+@@ -318,19 +381,67 @@ renderDivsMaybeLabels :: Monad m => Bool -> FormRender m a
+ renderDivsMaybeLabels withLabels aform fragment = do
+ (res, views') <- aFormToForm aform
+ let views = views' []
+- let widget = [whamlet|
+-$newline never
+-\#{fragment}
+-$forall view <- views
+- <div :fvRequired view:.required :not $ fvRequired view:.optional>
+- $if withLabels
+- <label for=#{fvId view}>#{fvLabel view}
+- $maybe tt <- fvTooltip view
+- <div .tooltip>#{tt}
+- ^{fvInput view}
+- $maybe err <- fvErrors view
+- <div .errors>#{err}
+-|]
++ let widget = do { (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml fragment);
++ Data.Foldable.mapM_
++ (\ view_aagE
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<div");
++ Text.Hamlet.condH
++ [(or [fvRequired view_aagE, not (fvRequired view_aagE)],
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) " class=\"");
++ Text.Hamlet.condH
++ [(fvRequired view_aagE,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "required "))]
++ Nothing;
++ Text.Hamlet.condH
++ [(not (fvRequired view_aagE),
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "optional"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\"") })]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ Text.Hamlet.condH
++ [(withLabels,
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "<label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml (fvId view_aagE));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (fvLabel view_aagE));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</label>") })]
++ Nothing;
++ Text.Hamlet.maybeH
++ (fvTooltip view_aagE)
++ (\ tt_aagF
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<div class=\"tooltip\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml tt_aagF);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget) (fvInput view_aagE);
++ Text.Hamlet.maybeH
++ (fvErrors view_aagE)
++ (\ err_aagG
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<div class=\"errors\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml err_aagG);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div>") })
++ views }
++
+ return (res, widget)
+
+ -- | Render a form using Bootstrap-friendly shamlet syntax.
+@@ -354,19 +465,63 @@ renderBootstrap aform fragment = do
+ let views = views' []
+ has (Just _) = True
+ has Nothing = False
+- let widget = [whamlet|
+- $newline never
+- \#{fragment}
+- $forall view <- views
+- <div .control-group .clearfix :fvRequired view:.required :not $ fvRequired view:.optional :has $ fvErrors view:.error>
+- <label .control-label for=#{fvId view}>#{fvLabel view}
+- <div .controls .input>
+- ^{fvInput view}
+- $maybe tt <- fvTooltip view
+- <span .help-block>#{tt}
+- $maybe err <- fvErrors view
+- <span .help-block>#{err}
+- |]
++ let widget = do { (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml fragment);
++ Data.Foldable.mapM_
++ (\ view_aagR
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<div class=\"control-group clearfix ");
++ Text.Hamlet.condH
++ [(fvRequired view_aagR,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "required "))]
++ Nothing;
++ Text.Hamlet.condH
++ [(not (fvRequired view_aagR),
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "optional "))]
++ Nothing;
++ Text.Hamlet.condH
++ [(has (fvErrors view_aagR),
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "error"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "\"><label class=\"control-label\" for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml (fvId view_aagR));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (fvLabel view_aagR));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "</label><div class=\"controls input\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (fvInput view_aagR);
++ Text.Hamlet.maybeH
++ (fvTooltip view_aagR)
++ (\ tt_aagS
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<span class=\"help-block\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml tt_aagS);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</span>") })
++ Nothing;
++ Text.Hamlet.maybeH
++ (fvErrors view_aagR)
++ (\ err_aagT
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<span class=\"help-block\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml err_aagT);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</span>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . pack) "</div></div>") })
++ views }
++
+ return (res, widget)
+
+ check :: (Monad m, RenderMessage (HandlerSite m) msg)
+diff --git a/Yesod/Form/Jquery.hs b/Yesod/Form/Jquery.hs
+index 2c4ae25..4362188 100644
+--- a/Yesod/Form/Jquery.hs
++++ b/Yesod/Form/Jquery.hs
+@@ -12,6 +12,18 @@ module Yesod.Form.Jquery
+ , Default (..)
+ ) where
+
++import qualified Text.Blaze as Text.Blaze.Internal
++import qualified Text.Blaze.Internal
++import qualified Text.Hamlet
++import qualified Yesod.Core.Widget
++import qualified Text.Css
++import qualified Data.Monoid
++import qualified Data.Foldable
++import qualified Control.Monad
++import qualified Text.Julius
++import qualified Data.Text.Lazy.Builder
++import qualified Text.Shakespeare
++
+ import Yesod.Core
+ import Yesod.Form
+ import Data.Time (Day)
+@@ -60,27 +72,59 @@ jqueryDayField jds = Field
+ . readMay
+ . unpack
+ , fieldView = \theId name attrs val isReq -> do
+- toWidget [shamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="date" :isReq:required="" value="#{showVal val}">
+-|]
++ toWidget $ do { id
++ ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"date\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . Text.Hamlet.toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ addScript' urlJqueryJs
+ addScript' urlJqueryUiJs
+ addStylesheet' urlJqueryUiCss
+- toWidget [julius|
+-$(function(){
+- var i = document.getElementById("#{rawJS theId}");
+- if (i.type != "date") {
+- $(i).datepicker({
+- dateFormat:'yy-mm-dd',
+- changeMonth:#{jsBool $ jdsChangeMonth jds},
+- changeYear:#{jsBool $ jdsChangeYear jds},
+- numberOfMonths:#{rawJS $ mos $ jdsNumberOfMonths jds},
+- yearRange:#{toJSON $ jdsYearRange jds}
+- });
+- }
+-});
+-|]
++ toWidget $ Text.Julius.asJavascriptUrl
++ (\ _render_a1lYC
++ -> mconcat
++ [Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\n$(function(){\n var i = document.getElementById(\""),
++ Text.Julius.toJavascript (rawJS theId),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\");\n if (i.type != \"date\") {\n $(i).datepicker({\n dateFormat:'yy-mm-dd',\n changeMonth:"),
++ Text.Julius.toJavascript (jsBool (jdsChangeMonth jds)),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ ",\n changeYear:"),
++ Text.Julius.toJavascript (jsBool (jdsChangeYear jds)),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ ",\n numberOfMonths:"),
++ Text.Julius.toJavascript (rawJS (mos (jdsNumberOfMonths jds))),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ ",\n yearRange:"),
++ Text.Julius.toJavascript (toJSON (jdsYearRange jds)),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\n });\n }\n});")])
++
+ , fieldEnctype = UrlEncoded
+ }
+ where
+@@ -101,16 +145,47 @@ jqueryAutocompleteField :: (RenderMessage site FormMessage, YesodJquery site)
+ jqueryAutocompleteField src = Field
+ { fieldParse = parseHelper $ Right
+ , fieldView = \theId name attrs val isReq -> do
+- toWidget [shamlet|
+-$newline never
+-<input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required="" value="#{either id id val}" .autocomplete>
+-|]
++ toWidget $ do { id
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<input class=\"autocomplete\" id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id
++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"text\"");
++ Text.Hamlet.condH
++ [(isReq,
++ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))]
++ Nothing;
++ id ((Text.Blaze.Internal.preEscapedText . pack) " value=\"");
++ id (toHtml (either id id val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . Text.Hamlet.toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">") }
++
+ addScript' urlJqueryJs
+ addScript' urlJqueryUiJs
+ addStylesheet' urlJqueryUiCss
+- toWidget [julius|
+-$(function(){$("##{rawJS theId}").autocomplete({source:"@{src}",minLength:2})});
+-|]
++ toWidget $ Text.Julius.asJavascriptUrl
++ (\ _render_a1lYP
++ -> mconcat
++ [Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\n$(function(){$(\"#"),
++ Text.Julius.toJavascript (rawJS theId),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\").autocomplete({source:\""),
++ Text.Julius.Javascript
++ (Data.Text.Lazy.Builder.fromText
++ (_render_a1lYP src [])),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\",minLength:2})});")])
++
+ , fieldEnctype = UrlEncoded
+ }
+
+diff --git a/Yesod/Form/MassInput.hs b/Yesod/Form/MassInput.hs
+index 332eb66..5015e7b 100644
+--- a/Yesod/Form/MassInput.hs
++++ b/Yesod/Form/MassInput.hs
+@@ -9,6 +9,16 @@ module Yesod.Form.MassInput
+ , massTable
+ ) where
+
++import qualified Data.Text
++import qualified Text.Blaze as Text.Blaze.Internal
++import qualified Text.Blaze.Internal
++import qualified Text.Hamlet
++import qualified Yesod.Core.Widget
++import qualified Text.Css
++import qualified Data.Monoid
++import qualified Data.Foldable
++import qualified Control.Monad
++
+ import Yesod.Form.Types
+ import Yesod.Form.Functions
+ import Yesod.Form.Fields (boolField)
+@@ -70,16 +80,28 @@ inputList label fixXml single mdef = formToAForm $ do
+ { fvLabel = label
+ , fvTooltip = Nothing
+ , fvId = theId
+- , fvInput = [whamlet|
+-$newline never
+-^{fixXml views}
+-<p>
+- $forall xml <- xmls
+- ^{xml}
+- <input .count type=hidden name=#{countName} value=#{count}>
+- <input type=checkbox name=#{addName}>
+- Add another row
+-|]
++ , fvInput = do { (Yesod.Core.Widget.asWidgetT . toWidget) (fixXml views);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "<p>");
++ Data.Foldable.mapM_
++ (\ xml_aUS3 -> (Yesod.Core.Widget.asWidgetT . toWidget) xml_aUS3)
++ xmls;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<input class=\"count\" type=\"hidden\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml countName);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "\" value=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml count);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "\"><input type=\"checkbox\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml addName);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "\">Add another row</p>") }
++
+ , fvErrors = Nothing
+ , fvRequired = False
+ }])
+@@ -92,10 +114,14 @@ withDelete af = do
+ deleteName <- newFormIdent
+ (menv, _, _) <- ask
+ res <- case menv >>= Map.lookup deleteName . fst of
+- Just ("yes":_) -> return $ Left [whamlet|
+-$newline never
+-<input type=hidden name=#{deleteName} value=yes>
+-|]
++ Just ("yes":_) -> return $ Left $ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<input type=\"hidden\" name=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml deleteName);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "\" value=\"yes\">") }
++
+ _ -> do
+ (_, xml2) <- aFormToForm $ areq boolField FieldSettings
+ { fsLabel = SomeMessage MsgDelete
+@@ -121,32 +147,155 @@ fixme eithers =
+ massDivs, massTable
+ :: [[FieldView site]]
+ -> WidgetT site IO ()
+-massDivs viewss = [whamlet|
+-$newline never
+-$forall views <- viewss
+- <fieldset>
+- $forall view <- views
+- <div :fvRequired view:.required :not $ fvRequired view:.optional>
+- <label for=#{fvId view}>#{fvLabel view}
+- $maybe tt <- fvTooltip view
+- <div .tooltip>#{tt}
+- ^{fvInput view}
+- $maybe err <- fvErrors view
+- <div .errors>#{err}
+-|]
++massDivs viewss = Data.Foldable.mapM_
++ (\ views_aUSm
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<fieldset>");
++ Data.Foldable.mapM_
++ (\ view_aUSn
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "<div");
++ Text.Hamlet.condH
++ [(or [fvRequired view_aUSn, not (fvRequired view_aUSn)],
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ " class=\"");
++ Text.Hamlet.condH
++ [(fvRequired view_aUSn,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "required "))]
++ Nothing;
++ Text.Hamlet.condH
++ [(not (fvRequired view_aUSn),
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "optional"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "\"") })]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "><label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml (fvId view_aUSn));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (fvLabel view_aUSn));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</label>");
++ Text.Hamlet.maybeH
++ (fvTooltip view_aUSn)
++ (\ tt_aUSo
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<div class=\"tooltip\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml tt_aUSo);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</div>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget) (fvInput view_aUSn);
++ Text.Hamlet.maybeH
++ (fvErrors view_aUSn)
++ (\ err_aUSp
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<div class=\"errors\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml err_aUSp);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</div>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</div>") })
++ views_aUSm;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</fieldset>") })
++ viewss
++
++
++massTable viewss = Data.Foldable.mapM_
++ (\ views_aUSu
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<fieldset><table>");
++ Data.Foldable.mapM_
++ (\ view_aUSv
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "<tr");
++ Text.Hamlet.condH
++ [(or [fvRequired view_aUSv, not (fvRequired view_aUSv)],
++ do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ " class=\"");
++ Text.Hamlet.condH
++ [(fvRequired view_aUSv,
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "required "))]
++ Nothing;
++ Text.Hamlet.condH
++ [(not (fvRequired view_aUSv),
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "optional"))]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "\"") })]
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "><td><label for=\"");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (toHtml (fvId view_aUSv));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml (fvLabel view_aUSv));
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</label>");
++ Text.Hamlet.maybeH
++ (fvTooltip view_aUSv)
++ (\ tt_aUSw
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<div class=\"tooltip\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml tt_aUSw);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</div>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</td><td>");
++ (Yesod.Core.Widget.asWidgetT . toWidget) (fvInput view_aUSv);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</td>");
++ Text.Hamlet.maybeH
++ (fvErrors view_aUSv)
++ (\ err_aUSx
++ -> do { (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "<td class=\"errors\">");
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ (toHtml err_aUSx);
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</td>") })
++ Nothing;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</tr>") })
++ views_aUSu;
++ (Yesod.Core.Widget.asWidgetT . toWidget)
++ ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
++ "</table></fieldset>") })
++ viewss
+
+-massTable viewss = [whamlet|
+-$newline never
+-$forall views <- viewss
+- <fieldset>
+- <table>
+- $forall view <- views
+- <tr :fvRequired view:.required :not $ fvRequired view:.optional>
+- <td>
+- <label for=#{fvId view}>#{fvLabel view}
+- $maybe tt <- fvTooltip view
+- <div .tooltip>#{tt}
+- <td>^{fvInput view}
+- $maybe err <- fvErrors view
+- <td .errors>#{err}
+-|]
+diff --git a/Yesod/Form/Nic.hs b/Yesod/Form/Nic.hs
+index 2862678..7b49b1a 100644
+--- a/Yesod/Form/Nic.hs
++++ b/Yesod/Form/Nic.hs
+@@ -9,6 +9,19 @@ module Yesod.Form.Nic
+ , nicHtmlField
+ ) where
+
++import qualified Text.Blaze as Text.Blaze.Internal
++import qualified Text.Blaze.Internal
++import qualified Text.Hamlet
++import qualified Yesod.Core.Widget
++import qualified Text.Css
++import qualified Data.Monoid
++import qualified Data.Foldable
++import qualified Control.Monad
++import qualified Text.Julius
++import qualified Data.Text.Lazy.Builder
++import qualified Text.Shakespeare
++
++
+ import Yesod.Core
+ import Yesod.Form
+ import Text.HTML.SanitizeXSS (sanitizeBalance)
+@@ -27,20 +40,48 @@ nicHtmlField :: YesodNic site => Field (HandlerT site IO) Html
+ nicHtmlField = Field
+ { fieldParse = \e _ -> return . Right . fmap (preEscapedToMarkup . sanitizeBalance) . listToMaybe $ e
+ , fieldView = \theId name attrs val _isReq -> do
+- toWidget [shamlet|
+-$newline never
+- <textarea id="#{theId}" *{attrs} name="#{name}" .html>#{showVal val}
+-|]
++ toWidget $ do { id
++ ((Text.Blaze.Internal.preEscapedText . pack)
++ "<textarea class=\"html\" id=\"");
++ id (toHtml theId);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\"");
++ id (toHtml name);
++ id ((Text.Blaze.Internal.preEscapedText . pack) "\"");
++ id ((Text.Hamlet.attrsToHtml . Text.Hamlet.toAttributes) attrs);
++ id ((Text.Blaze.Internal.preEscapedText . pack) ">");
++ id (toHtml (showVal val));
++ id ((Text.Blaze.Internal.preEscapedText . pack) "</textarea>") }
++
+ addScript' urlNicEdit
+ master <- getYesod
+ toWidget $
+ case jsLoader master of
+- BottomOfHeadBlocking -> [julius|
+-bkLib.onDomLoaded(function(){new nicEditor({fullPanel:true}).panelInstance("#{rawJS theId}")});
+-|]
+- _ -> [julius|
+-(function(){new nicEditor({fullPanel:true}).panelInstance("#{rawJS theId}")})();
+-|]
++ BottomOfHeadBlocking -> Text.Julius.asJavascriptUrl
++ (\ _render_a1qhO
++ -> Data.Monoid.mconcat
++ [Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\nbkLib.onDomLoaded(function(){new nicEditor({true}).panelInstance(\""),
++ Text.Julius.toJavascript (rawJS theId),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\")});")])
++
++ _ -> Text.Julius.asJavascriptUrl
++ (\ _render_a1qhS
++ -> Data.Monoid.mconcat
++ [Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\n(function(){new nicEditor({true}).panelInstance(\""),
++ Text.Julius.toJavascript (rawJS theId),
++ Text.Julius.Javascript
++ ((Data.Text.Lazy.Builder.fromText
++ . Text.Shakespeare.pack')
++ "\")})();")])
++
+ , fieldEnctype = UrlEncoded
+ }
+ where
+diff --git a/yesod-form.cabal b/yesod-form.cabal
+index 39fa680..88ed066 100644
+--- a/yesod-form.cabal
++++ b/yesod-form.cabal
+@@ -19,6 +19,7 @@ library
+ , time >= 1.1.4
+ , hamlet >= 1.1 && < 1.2
+ , shakespeare-css >= 1.0 && < 1.1
++ , shakespeare
+ , shakespeare-js >= 1.0.2 && < 1.3
+ , persistent >= 1.2 && < 1.3
+ , template-haskell
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod-persistent_do-not-really-build.patch b/standalone/android/haskell-patches/yesod-persistent_do-not-really-build.patch
new file mode 100644
index 000000000..ecccf75ac
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod-persistent_do-not-really-build.patch
@@ -0,0 +1,26 @@
+From 03819615edb1c5f7414768dae84234d6791bd758 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 04:11:46 +0000
+Subject: [PATCH] do not really build
+
+---
+ yesod-persistent.cabal | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/yesod-persistent.cabal b/yesod-persistent.cabal
+index 98c2146..11960cf 100644
+--- a/yesod-persistent.cabal
++++ b/yesod-persistent.cabal
+@@ -23,8 +23,7 @@ library
+ , lifted-base
+ , pool-conduit
+ , resourcet
+- exposed-modules: Yesod.Persist
+- Yesod.Persist.Core
++ exposed-modules:
+ ghc-options: -Wall
+
+ test-suite test
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod-routes_export-module-referenced-by-TH-splices.patch b/standalone/android/haskell-patches/yesod-routes_export-module-referenced-by-TH-splices.patch
new file mode 100644
index 000000000..e20e3c7f1
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod-routes_export-module-referenced-by-TH-splices.patch
@@ -0,0 +1,29 @@
+From f6bfe8e01d8fe6d129ad3819070aa17934094a0a Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 06:24:09 +0000
+Subject: [PATCH] export module referenced by TH splices
+
+---
+ yesod-routes.cabal | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/yesod-routes.cabal b/yesod-routes.cabal
+index 0b245f2..a97582a 100644
+--- a/yesod-routes.cabal
++++ b/yesod-routes.cabal
+@@ -27,11 +27,11 @@ library
+ Yesod.Routes.Class
+ Yesod.Routes.Parse
+ Yesod.Routes.Overlap
++ Yesod.Routes.TH.Types
+ other-modules: Yesod.Routes.TH.Dispatch
+ Yesod.Routes.TH.RenderRoute
+ Yesod.Routes.TH.ParseRoute
+ Yesod.Routes.TH.RouteAttrs
+- Yesod.Routes.TH.Types
+ ghc-options: -Wall
+
+ test-suite runtests
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod_001_hacked-up-for-Android.patch b/standalone/android/haskell-patches/yesod_001_hacked-up-for-Android.patch
new file mode 100644
index 000000000..23ba50d33
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod_001_hacked-up-for-Android.patch
@@ -0,0 +1,74 @@
+From 8bf7c428a42b984f63f435bb34f22743202ae449 Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 05:24:19 +0000
+Subject: [PATCH] hacked up for Android
+
+---
+ Yesod.hs | 2 --
+ Yesod/Default/Util.hs | 17 -----------------
+ 2 files changed, 19 deletions(-)
+
+diff --git a/Yesod.hs b/Yesod.hs
+index b367144..3050bf5 100644
+--- a/Yesod.hs
++++ b/Yesod.hs
+@@ -5,9 +5,7 @@ module Yesod
+ ( -- * Re-exports from yesod-core
+ module Yesod.Core
+ , module Yesod.Form
+- , module Yesod.Persist
+ ) where
+
+ import Yesod.Core
+ import Yesod.Form
+-import Yesod.Persist
+diff --git a/Yesod/Default/Util.hs b/Yesod/Default/Util.hs
+index a10358e..c5a4e58 100644
+--- a/Yesod/Default/Util.hs
++++ b/Yesod/Default/Util.hs
+@@ -8,7 +8,6 @@ module Yesod.Default.Util
+ , widgetFileNoReload
+ , widgetFileReload
+ , TemplateLanguage (..)
+- , defaultTemplateLanguages
+ , WidgetFileSettings
+ , wfsLanguages
+ , wfsHamletSettings
+@@ -20,9 +19,6 @@ import Yesod.Core -- purposely using complete import so that Haddock will see ad
+ import Control.Monad (when, unless)
+ import System.Directory (doesFileExist, createDirectoryIfMissing)
+ import Language.Haskell.TH.Syntax
+-import Text.Lucius (luciusFile, luciusFileReload)
+-import Text.Julius (juliusFile, juliusFileReload)
+-import Text.Cassius (cassiusFile, cassiusFileReload)
+ import Text.Hamlet (HamletSettings, defaultHamletSettings)
+ import Data.Maybe (catMaybes)
+ import Data.Default (Default (def))
+@@ -69,24 +65,11 @@ data TemplateLanguage = TemplateLanguage
+ , tlReload :: FilePath -> Q Exp
+ }
+
+-defaultTemplateLanguages :: HamletSettings -> [TemplateLanguage]
+-defaultTemplateLanguages hset =
+- [ TemplateLanguage False "hamlet" whamletFile' whamletFile'
+- , TemplateLanguage True "cassius" cassiusFile cassiusFileReload
+- , TemplateLanguage True "julius" juliusFile juliusFileReload
+- , TemplateLanguage True "lucius" luciusFile luciusFileReload
+- ]
+- where
+- whamletFile' = whamletFileWithSettings hset
+-
+ data WidgetFileSettings = WidgetFileSettings
+ { wfsLanguages :: HamletSettings -> [TemplateLanguage]
+ , wfsHamletSettings :: HamletSettings
+ }
+
+-instance Default WidgetFileSettings where
+- def = WidgetFileSettings defaultTemplateLanguages defaultHamletSettings
+-
+ widgetFileNoReload :: WidgetFileSettings -> FilePath -> Q Exp
+ widgetFileNoReload wfs x = combine "widgetFileNoReload" x False $ wfsLanguages wfs $ wfsHamletSettings wfs
+
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/yesod_002_hack-around-missing-symbols.patch b/standalone/android/haskell-patches/yesod_002_hack-around-missing-symbols.patch
new file mode 100644
index 000000000..eaad739e5
--- /dev/null
+++ b/standalone/android/haskell-patches/yesod_002_hack-around-missing-symbols.patch
@@ -0,0 +1,41 @@
+From 7e815b11f242d6836f9615439e32f9937bf2feaf Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sun, 22 Sep 2013 13:59:34 +0000
+Subject: [PATCH] hack around missing symbols
+
+---
+ Yesod.hs | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/Yesod.hs b/Yesod.hs
+index 3050bf5..fbe309c 100644
+--- a/Yesod.hs
++++ b/Yesod.hs
+@@ -5,7 +5,24 @@ module Yesod
+ ( -- * Re-exports from yesod-core
+ module Yesod.Core
+ , module Yesod.Form
++ , insertBy
++ , replace
++ , deleteBy
++ , delete
++ , insert
++ , Key
+ ) where
+
+ import Yesod.Core
+ import Yesod.Form
++
++-- These symbols are usually imported from persistent,
++-- But it is not built on Android. Still export them
++-- just so that hiding them will work.
++data Key = DummyKey
++insertBy = undefined
++replace = undefined
++deleteBy = undefined
++delete = undefined
++insert = undefined
++
+--
+1.7.10.4
+
diff --git a/standalone/android/haskell-patches/zlib_0.5.4.0_0001-hack-to-build-on-Android.patch b/standalone/android/haskell-patches/zlib_0.5.4.0_0001-hack-to-build-on-Android.patch
new file mode 100644
index 000000000..a899fb892
--- /dev/null
+++ b/standalone/android/haskell-patches/zlib_0.5.4.0_0001-hack-to-build-on-Android.patch
@@ -0,0 +1,35 @@
+From 63d07ae4a1e3b77cbe023364599f7c2c3e853d5f Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Thu, 28 Feb 2013 23:40:57 -0400
+Subject: [PATCH] hack to build on Android
+
+---
+ Codec/Compression/Zlib/Stream.hsc | 4 ++--
+ zlib.cabal | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Codec/Compression/Zlib/Stream.hsc b/Codec/Compression/Zlib/Stream.hsc
+index fe851e6..c6168f4 100644
+--- a/Codec/Compression/Zlib/Stream.hsc
++++ b/Codec/Compression/Zlib/Stream.hsc
+@@ -921,7 +921,7 @@ foreign import ccall unsafe "zlib.h inflateInit2_"
+
+ c_inflateInit2 :: StreamState -> CInt -> IO CInt
+ c_inflateInit2 z n =
+- withCAString #{const_str ZLIB_VERSION} $ \versionStr ->
++ withCAString "1.2.5" $ \versionStr ->
+ c_inflateInit2_ z n versionStr (#{const sizeof(z_stream)} :: CInt)
+
+ foreign import ccall unsafe "zlib.h inflate"
+@@ -940,7 +940,7 @@ foreign import ccall unsafe "zlib.h deflateInit2_"
+ c_deflateInit2 :: StreamState
+ -> CInt -> CInt -> CInt -> CInt -> CInt -> IO CInt
+ c_deflateInit2 z a b c d e =
+- withCAString #{const_str ZLIB_VERSION} $ \versionStr ->
++ withCAString "1.2.5" $ \versionStr ->
+ c_deflateInit2_ z a b c d e versionStr (#{const sizeof(z_stream)} :: CInt)
+
+ foreign import ccall unsafe "zlib.h deflateSetDictionary"
+--
+1.7.10.4
+
diff --git a/standalone/android/icons/drawable-hdpi/ic_launcher.png b/standalone/android/icons/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..6170d723c
--- /dev/null
+++ b/standalone/android/icons/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/standalone/android/icons/drawable-hdpi/ic_stat_service_notification_icon.png b/standalone/android/icons/drawable-hdpi/ic_stat_service_notification_icon.png
new file mode 100644
index 000000000..f30483b38
--- /dev/null
+++ b/standalone/android/icons/drawable-hdpi/ic_stat_service_notification_icon.png
Binary files differ
diff --git a/standalone/android/icons/drawable-ldpi/ic_launcher.png b/standalone/android/icons/drawable-ldpi/ic_launcher.png
new file mode 100644
index 000000000..0c5d55ab6
--- /dev/null
+++ b/standalone/android/icons/drawable-ldpi/ic_launcher.png
Binary files differ
diff --git a/standalone/android/icons/drawable-ldpi/ic_stat_service_notification_icon.png b/standalone/android/icons/drawable-ldpi/ic_stat_service_notification_icon.png
new file mode 100644
index 000000000..0e0b33e95
--- /dev/null
+++ b/standalone/android/icons/drawable-ldpi/ic_stat_service_notification_icon.png
Binary files differ
diff --git a/standalone/android/icons/drawable-mdpi/ic_launcher.png b/standalone/android/icons/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..46302b21a
--- /dev/null
+++ b/standalone/android/icons/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/standalone/android/icons/drawable-mdpi/ic_stat_service_notification_icon.png b/standalone/android/icons/drawable-mdpi/ic_stat_service_notification_icon.png
new file mode 100644
index 000000000..7febe040d
--- /dev/null
+++ b/standalone/android/icons/drawable-mdpi/ic_stat_service_notification_icon.png
Binary files differ
diff --git a/standalone/android/icons/drawable-xhdpi/ic_launcher.png b/standalone/android/icons/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..601b787cb
--- /dev/null
+++ b/standalone/android/icons/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/standalone/android/icons/drawable-xhdpi/ic_stat_service_notification_icon.png b/standalone/android/icons/drawable-xhdpi/ic_stat_service_notification_icon.png
new file mode 100644
index 000000000..253e90eb8
--- /dev/null
+++ b/standalone/android/icons/drawable-xhdpi/ic_stat_service_notification_icon.png
Binary files differ
diff --git a/standalone/android/icons/drawable/ic_launcher.png b/standalone/android/icons/drawable/ic_launcher.png
new file mode 120000
index 000000000..28d94e566
--- /dev/null
+++ b/standalone/android/icons/drawable/ic_launcher.png
@@ -0,0 +1 @@
+../drawable-mdpi/ic_launcher.png \ No newline at end of file
diff --git a/standalone/android/icons/drawable/ic_stat_service_notification_icon.png b/standalone/android/icons/drawable/ic_stat_service_notification_icon.png
new file mode 120000
index 000000000..3c30c49b0
--- /dev/null
+++ b/standalone/android/icons/drawable/ic_stat_service_notification_icon.png
@@ -0,0 +1 @@
+../drawable-mdpi/ic_stat_service_notification_icon.png \ No newline at end of file
diff --git a/standalone/android/install-haskell-packages b/standalone/android/install-haskell-packages
new file mode 100755
index 000000000..f0a4b9113
--- /dev/null
+++ b/standalone/android/install-haskell-packages
@@ -0,0 +1,120 @@
+#!/bin/bash
+# Bootstraps from an empty cabal to all the necessary haskell packages
+# being installed, with the necessary patches to work on Android.
+#
+# You should install ghc-android first.
+#
+# Note that the newest version of packages is installed.
+# It attempts to reuse patches for older versions, but
+# new versions of packages often break cross-compilation by adding TH,
+# etc
+#
+# Future work: Convert to using the method used here:
+# https://github.com/kaoskorobase/ghc-ios-cabal-scripts/
+
+set -e
+
+if [ ! -d haskell-patches ]; then
+ cd standalone/android
+fi
+
+cabalopts="$@"
+
+cabalinstall () {
+ echo cabal install "$@" "$cabalopts"
+ eval cabal install "$@" "$cabalopts"
+}
+
+patched () {
+ pkg=$1
+ shift 1
+ cabal unpack $pkg
+ cd $pkg*
+ git init
+ git config user.name dummy
+ git config user.email dummy@example.com
+ git add .
+ git commit -m "pre-patched state of $pkg"
+ for patch in ../../haskell-patches/${pkg}_*; do
+ echo trying $patch
+ if ! patch -p1 < $patch; then
+ echo "failed to apply $patch"
+ echo "please resolve this, replace the patch with a new version, and exit the subshell to continue"
+ $SHELL
+ fi
+ done
+ cabalinstall "$@"
+ rm -rf $pkg*
+ cd ..
+}
+
+installgitannexdeps () {
+ pushd ../..
+ echo cabal install --only-dependencies "$@"
+ cabal install --only-dependencies "$@"
+ popd
+}
+
+install_pkgs () {
+ rm -rf tmp
+ mkdir tmp
+ cd tmp
+
+ patched network
+ patched unix-time
+ patched lifted-base
+ patched zlib
+ patched process
+ patched MissingH
+ patched bloomfilter
+ patched SafeSemaphore
+ patched distributive
+ patched comonad
+ patched HTTP
+ patched MonadCatchIO-transformers
+ patched iproute
+ patched primitive
+ patched socks
+ patched entropy
+ patched vector
+ patched stm-chans
+ patched persistent
+ patched profunctors
+ patched skein
+ patched lens
+ patched persistent-template
+ patched wai-app-static
+ patched shakespeare
+ patched shakespeare-css
+ patched yesod-routes
+ patched yesod-core
+ patched yesod-persistent
+ patched yesod-form
+ patched crypto-numbers
+ patched yesod-auth
+ patched yesod
+ patched async
+ patched gnuidn
+ patched DAV
+ patched language-javascript
+ patched uuid
+
+ cd ..
+
+ installgitannexdeps -fAndroid -f-Pairing
+}
+
+echo
+echo
+echo native build
+echo
+cabal update
+installgitannexdeps
+
+echo
+echo
+echo cross build
+echo
+PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH
+cabal update
+install_pkgs
diff --git a/standalone/android/openssh.config.h b/standalone/android/openssh.config.h
new file mode 100644
index 000000000..31e78e0b8
--- /dev/null
+++ b/standalone/android/openssh.config.h
@@ -0,0 +1,249 @@
+#define DISABLE_SHADOW 1
+#define DISABLE_UTMP 1
+#define DISABLE_UTMPX 1
+#define DISABLE_WTMP 1
+#define DISABLE_WTMPX 1
+#define ENABLE_PKCS11 /**/
+#define GETPGRP_VOID 1
+#define GLOB_HAS_ALTDIRFUNC 1
+#define HAS_SHADOW_EXPIRE 1
+#define HAVE_ADDR_IN_UTMP 1
+#define HAVE_ADDR_IN_UTMPX 1
+#define HAVE_ADDR_V6_IN_UTMP 1
+#define HAVE_ADDR_V6_IN_UTMPX 1
+#define HAVE_ASPRINTF 1
+#define HAVE_ATTRIBUTE__NONNULL__ 1
+#define HAVE_BASENAME 1
+#define HAVE_BCOPY 1
+#define HAVE_BN_IS_PRIME_EX 1
+#define HAVE_CLOCK 1
+#define HAVE_CLOCK_T 1
+#define HAVE_CONST_GAI_STRERROR_PROTO 1
+#define HAVE_CONTROL_IN_MSGHDR 1
+#define HAVE_DAEMON 1
+#define HAVE_DECL_GLOB_NOMATCH 1
+#define HAVE_DECL_H_ERRNO 1
+#define HAVE_DECL_MAXSYMLINKS 1
+#define HAVE_DECL_OFFSETOF 1
+#define HAVE_DECL_O_NONBLOCK 1
+#define HAVE_DECL_SHUT_RD 1
+#define HAVE_DECL_WRITEV 1
+#define HAVE_DECL__GETLONG 0
+#define HAVE_DECL__GETSHORT 0
+#define HAVE_DEV_PTMX 1
+#define HAVE_DIRENT_H 1
+#define HAVE_DIRFD 1
+#define HAVE_DIRNAME 1
+#define HAVE_DSA_GENERATE_PARAMETERS_EX 1
+#define HAVE_ENDIAN_H 1
+#define HAVE_ENDUTENT 1
+#define HAVE_ENDUTXENT 1
+#define HAVE_EVP_SHA256 1
+#define HAVE_EXIT_IN_UTMP 1
+#define HAVE_FCHMOD 1
+#define HAVE_FCHOWN 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FEATURES_H 1
+#define HAVE_FREEADDRINFO 1
+#define HAVE_FSBLKCNT_T 1
+#define HAVE_FSFILCNT_T 1
+#define HAVE_GAI_STRERROR 1
+#define HAVE_GETADDRINFO 1
+#define HAVE_GETCWD 1
+#define HAVE_GETNAMEINFO 1
+#define HAVE_GETOPT 1
+#define HAVE_GETOPT_H 1
+#define HAVE_GETPAGESIZE 1
+#define HAVE_GETRLIMIT 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_GETTTYENT 1
+#define HAVE_GETUTENT 1
+#define HAVE_GETUTID 1
+#define HAVE_GETUTLINE 1
+#define HAVE_GETUTXENT 1
+#define HAVE_GETUTXID 1
+#define HAVE_GETUTXLINE 1
+#define HAVE_GLOB 1
+#define HAVE_GLOB_H 1
+#define HAVE_HEADER_AD 1
+#define HAVE_HMAC_CTX_INIT 1
+#define HAVE_HOST_IN_UTMP 1
+#define HAVE_HOST_IN_UTMPX 1
+#define HAVE_ID_IN_UTMP 1
+#define HAVE_ID_IN_UTMPX 1
+#define HAVE_INET_ATON 1
+#define HAVE_INET_NTOA 1
+#define HAVE_INET_NTOP 1
+#define HAVE_INT64_T 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_INTXX_T 1
+#define HAVE_IN_ADDR_T 1
+#define HAVE_ISBLANK 1
+#define HAVE_LASTLOG_H 1
+#define HAVE_LIBGEN_H 1
+#define HAVE_LIBNSL 1
+#define HAVE_LIBZ 1
+#define HAVE_LIMITS_H 1
+#define HAVE_LINUX_AUDIT_H 1
+#define HAVE_LINUX_FILTER_H 1
+#define HAVE_LINUX_IF_TUN_H 1
+#define HAVE_LOGOUT 1
+#define HAVE_LOGWTMP 1
+#define HAVE_LONG_DOUBLE 1
+#define HAVE_LONG_LONG 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMORY_H 1
+#define HAVE_MKDTEMP 1
+#define HAVE_MMAP 1
+#define HAVE_MODE_T 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_NETDB_H 1
+#define HAVE_OPENSSL 1
+#define HAVE_PATHS_H 1
+#define HAVE_PID_IN_UTMP 1
+#define HAVE_PID_T 1
+#define HAVE_POLL 1
+#define HAVE_POLL_H 1
+#define HAVE_PRCTL 1
+#define HAVE_PROC_PID 1
+#define HAVE_PUTUTLINE 1
+#define HAVE_PUTUTXLINE 1
+#define HAVE_REALPATH 1
+#define HAVE_RECVMSG 1
+#define HAVE_RLIMIT_NPROC /**/
+#define HAVE_RSA_GENERATE_KEY_EX 1
+#define HAVE_RSA_GET_DEFAULT_METHOD 1
+#define HAVE_SA_FAMILY_T 1
+#define HAVE_SENDMSG 1
+#define HAVE_SETEGID 1
+#define HAVE_SETENV 1
+#define HAVE_SETEUID 1
+#define HAVE_SETGROUPS 1
+#define HAVE_SETREGID 1
+#define HAVE_SETRESGID 1
+#define HAVE_SETRESUID 1
+#define HAVE_SETREUID 1
+#define HAVE_SETRLIMIT 1
+#define HAVE_SETSID 1
+#define HAVE_SETUTENT 1
+#define HAVE_SETUTXENT 1
+#define HAVE_SETVBUF 1
+#define HAVE_SHA256_UPDATE 1
+#define HAVE_SIGACTION 1
+#define HAVE_SIGVEC 1
+#define HAVE_SIG_ATOMIC_T 1
+#define HAVE_SIZE_T 1
+#define HAVE_SNPRINTF 1
+#define HAVE_SOCKETPAIR 1
+#define HAVE_SO_PEERCRED 1
+#define HAVE_SSIZE_T 1
+#define HAVE_SS_FAMILY_IN_SS 1
+#define HAVE_STATFS 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRICT_MKSTEMP 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRNLEN 1
+#define HAVE_STRPTIME 1
+#define HAVE_STRSEP 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRUCT_ADDRINFO 1
+#define HAVE_STRUCT_IN6_ADDR 1
+#define HAVE_STRUCT_SOCKADDR_IN6 1
+#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+#define HAVE_STRUCT_TIMESPEC 1
+#define HAVE_STRUCT_TIMEVAL 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYS_CDEFS_H 1
+#define HAVE_SYS_DIR_H 1
+#define HAVE_SYS_ERRLIST 1
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_MOUNT_H 1
+#define HAVE_SYS_NERR 1
+#define HAVE_SYS_POLL_H 1
+#define HAVE_SYS_PRCTL_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_SYSMACROS_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_UN_H 1
+#define HAVE_TCGETPGRP 1
+#define HAVE_TCSENDBREAK 1
+#define HAVE_TIME 1
+#define HAVE_TIME_H 1
+#define HAVE_TRUNCATE 1
+#define HAVE_TV_IN_UTMP 1
+#define HAVE_TV_IN_UTMPX 1
+#define HAVE_TYPE_IN_UTMP 1
+#define HAVE_TYPE_IN_UTMPX 1
+#define HAVE_UINTXX_T 1
+#define HAVE_UNISTD_H 1
+#define HAVE_UNSETENV 1
+#define HAVE_UNSIGNED_LONG_LONG 1
+#define HAVE_UPDWTMP 1
+#define HAVE_UPDWTMPX 1
+#define HAVE_UTIMES 1
+#define HAVE_UTIME_H 1
+#define HAVE_UTMPNAME 1
+#define HAVE_UTMPXNAME 1
+#define HAVE_UTMP_H 1
+#define HAVE_U_CHAR 1
+#define HAVE_U_INT 1
+#define HAVE_U_INT64_T 1
+#define HAVE_U_INTXX_T 1
+#define HAVE_VASPRINTF 1
+#define HAVE_VA_COPY 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_WAITPID 1
+#define HAVE__GETLONG 1
+#define HAVE__GETSHORT 1
+#define HAVE__RES_EXTERN 1
+#define HAVE___FUNCTION__ 1
+#define HAVE___PROGNAME 1
+#define HAVE___VA_COPY 1
+#define HAVE___func__ 1
+#define IPV4_IN_IPV6 1
+#define LINK_OPNOTSUPP_ERRNO EPERM
+#define LINUX_OOM_ADJUST 1
+#define LOCKED_PASSWD_PREFIX "!"
+#define LOGIN_PROGRAM_FALLBACK "/bin/login"
+#define MISSING_FD_MASK 1
+#define MISSING_HOWMANY 1
+#define OPENSSL_HAS_ECC 1
+#define OPENSSL_PRNG_ONLY 1
+#define PACKAGE_BUGREPORT "openssh-unix-dev@mindrot.org"
+#define PACKAGE_NAME "OpenSSH"
+#define PACKAGE_STRING "OpenSSH Portable"
+#define PACKAGE_TARNAME "openssh"
+#define PACKAGE_URL ""
+#define PACKAGE_VERSION "Portable"
+#define PAM_TTY_KLUDGE 1
+#define SANDBOX_RLIMIT 1
+#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_ARM
+#define SIZEOF_CHAR 1
+#define SIZEOF_INT 4
+#define SIZEOF_LONG_INT 8
+#define SIZEOF_LONG_LONG_INT 8
+#define SIZEOF_SHORT_INT 2
+#define SNPRINTF_CONST const
+#define SPT_TYPE SPT_REUSEARGV
+#define SSH_PRIVSEP_USER "shell"
+#define SSH_TUN_COMPAT_AF 1
+#define SSH_TUN_LINUX 1
+#define SSH_TUN_PREPEND_AF 1
+#define STDC_HEADERS 1
+#define USER_PATH "/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin"
+#define XAUTH_PATH "/usr/bin/xauth"
+#define _PATH_BTMP "/var/log/btmp"
+#define _PATH_PASSWD_PROG "/usr/bin/passwd"
+#define _PATH_SSH_PIDDIR "/var/run"
+#define ANDROID
diff --git a/standalone/android/openssh.patch b/standalone/android/openssh.patch
new file mode 100644
index 000000000..6cdb29596
--- /dev/null
+++ b/standalone/android/openssh.patch
@@ -0,0 +1,205 @@
+diff --git a/auth.c b/auth.c
+index 6623e0f..dd10253 100644
+--- a/auth.c
++++ b/auth.c
+@@ -337,7 +337,7 @@ expand_authorized_keys(const char *filename, struct passwd *pw)
+ char *file, ret[MAXPATHLEN];
+ int i;
+
+- file = percent_expand(filename, "h", pw->pw_dir,
++ file = percent_expand(filename, "h", _PATH_ROOT_HOME_PREFIX,
+ "u", pw->pw_name, (char *)NULL);
+
+ /*
+@@ -347,7 +347,7 @@ expand_authorized_keys(const char *filename, struct passwd *pw)
+ if (*file == '/')
+ return (file);
+
+- i = snprintf(ret, sizeof(ret), "%s/%s", pw->pw_dir, file);
++ i = snprintf(ret, sizeof(ret), "%s/%s", _PATH_ROOT_HOME_PREFIX, file);
+ if (i < 0 || (size_t)i >= sizeof(ret))
+ fatal("expand_authorized_keys: path too long");
+ xfree(file);
+@@ -436,7 +436,7 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
+ strerror(errno));
+ return -1;
+ }
+- if (realpath(pw->pw_dir, homedir) != NULL)
++ if (realpath(_PATH_ROOT_HOME_PREFIX, homedir) != NULL)
+ comparehome = 1;
+
+ /* check the open file to avoid races */
+diff --git a/misc.c b/misc.c
+index 0bf2db6..4327d03 100644
+--- a/misc.c
++++ b/misc.c
+@@ -25,6 +25,7 @@
+ */
+
+ #include "includes.h"
++#include "pathnames.h"
+
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
+@@ -538,12 +539,13 @@ tilde_expand_filename(const char *filename, uid_t uid)
+ } else if ((pw = getpwuid(uid)) == NULL) /* ~/path */
+ fatal("tilde_expand_filename: No such uid %ld", (long)uid);
+
+- if (strlcpy(ret, pw->pw_dir, sizeof(ret)) >= sizeof(ret))
++ char *pw_dir=_PATH_ROOT_HOME_PREFIX;
++ if (strlcpy(ret, pw_dir, sizeof(ret)) >= sizeof(ret))
+ fatal("tilde_expand_filename: Path too long");
+
+ /* Make sure directory has a trailing '/' */
+- len = strlen(pw->pw_dir);
+- if ((len == 0 || pw->pw_dir[len - 1] != '/') &&
++ len = strlen(pw_dir);
++ if ((len == 0 || pw_dir[len - 1] != '/') &&
+ strlcat(ret, "/", sizeof(ret)) >= sizeof(ret))
+ fatal("tilde_expand_filename: Path too long");
+
+diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c
+index d2bea21..5b5d599 100644
+--- a/openbsd-compat/getrrsetbyname.c
++++ b/openbsd-compat/getrrsetbyname.c
+@@ -56,8 +56,7 @@
+ #include <arpa/inet.h>
+
+ #include "getrrsetbyname.h"
+-#include "nameser.h"
+-#include "nameser_compat.h"
++#include "arpa/nameser.h"
+
+ #if defined(HAVE_DECL_H_ERRNO) && !HAVE_DECL_H_ERRNO
+ extern int h_errno;
+diff --git a/pathnames.h b/pathnames.h
+index b7b9d91..3c10b11 100644
+--- a/pathnames.h
++++ b/pathnames.h
+@@ -67,7 +67,7 @@
+ #endif
+
+ #ifndef _PATH_ROOT_HOME_PREFIX
+-#define _PATH_ROOT_HOME_PREFIX "/data"
++#define _PATH_ROOT_HOME_PREFIX getenv("HOME")
+ #endif
+
+ /*
+diff --git a/readconf.c b/readconf.c
+index 097bb05..dcbc008 100644
+--- a/readconf.c
++++ b/readconf.c
+@@ -1085,7 +1085,7 @@ read_config_file(const char *filename, const char *host, Options *options,
+ if ((f = fopen(filename, "r")) == NULL)
+ return 0;
+
+- if (checkperm) {
++ if (checkperm && 0) {
+ struct stat sb;
+
+ if (fstat(fileno(f), &sb) == -1)
+diff --git a/ssh-add.c b/ssh-add.c
+index 738644d..f6fce4a 100644
+--- a/ssh-add.c
++++ b/ssh-add.c
+@@ -471,7 +471,7 @@ main(int argc, char **argv)
+ }
+
+ for (i = 0; default_files[i]; i++) {
+- snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
++ snprintf(buf, sizeof(buf), "%s/%s", _PATH_ROOT_HOME_PREFIX,
+ default_files[i]);
+ if (stat(buf, &st) < 0)
+ continue;
+diff --git a/ssh-keygen.c b/ssh-keygen.c
+index 4baf7df..ef8bb25 100644
+--- a/ssh-keygen.c
++++ b/ssh-keygen.c
+@@ -224,7 +224,7 @@ ask_filename(struct passwd *pw, const char *prompt)
+ }
+ }
+ snprintf(identity_file, sizeof(identity_file), "%s/%s",
+- strcmp(pw->pw_dir, "/") ? pw->pw_dir : _PATH_ROOT_HOME_PREFIX, name);
++ _PATH_ROOT_HOME_PREFIX, name);
+ fprintf(stderr, "%s (%s): ", prompt, identity_file);
+ if (fgets(buf, sizeof(buf), stdin) == NULL)
+ exit(1);
+@@ -2268,7 +2268,7 @@ main(int argc, char **argv)
+
+ /* Create ~/.ssh directory if it doesn't already exist. */
+ snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",
+- strcmp(pw->pw_dir, "/") ? pw->pw_dir : _PATH_ROOT_HOME_PREFIX,
++ _PATH_ROOT_HOME_PREFIX,
+ _PATH_SSH_USER_DIR);
+ if (strstr(identity_file, dotsshdir) != NULL) {
+ if (stat(dotsshdir, &st) < 0) {
+diff --git a/ssh.c b/ssh.c
+index 898e966..ef6c858 100644
+--- a/ssh.c
++++ b/ssh.c
+@@ -703,7 +703,7 @@ main(int ac, char **av)
+ fatal("Can't open user config file %.100s: "
+ "%.100s", config, strerror(errno));
+ } else {
+- r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir,
++ r = snprintf(buf, sizeof buf, "%s/%s", _PATH_ROOT_HOME_PREFIX,
+ _PATH_SSH_USER_CONFFILE);
+ if (r > 0 && (size_t)r < sizeof(buf))
+ (void)read_config_file(buf, host, &options, 1);
+@@ -748,7 +748,7 @@ main(int ac, char **av)
+ if (options.local_command != NULL) {
+ debug3("expanding LocalCommand: %s", options.local_command);
+ cp = options.local_command;
+- options.local_command = percent_expand(cp, "d", pw->pw_dir,
++ options.local_command = percent_expand(cp, "d", _PATH_ROOT_HOME_PREFIX,
+ "h", host, "l", thishost, "n", host_arg, "r", options.user,
+ "p", portstr, "u", pw->pw_name, "L", shorthost,
+ (char *)NULL);
+@@ -888,7 +888,7 @@ main(int ac, char **av)
+ */
+ if (config == NULL) {
+ r = snprintf(buf, sizeof buf, "%s/%s",
+- strcmp(pw->pw_dir, "/") ? pw->pw_dir : _PATH_ROOT_HOME_PREFIX,
++ _PATH_ROOT_HOME_PREFIX,
+ _PATH_SSH_USER_DIR);
+ if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) {
+ #ifdef WITH_SELINUX
+@@ -1532,7 +1532,7 @@ load_public_identity_files(void)
+ if ((pw = getpwuid(original_real_uid)) == NULL)
+ fatal("load_public_identity_files: getpwuid failed");
+ pwname = xstrdup(pw->pw_name);
+- pwdir = xstrdup(pw->pw_dir);
++ pwdir = xstrdup(_PATH_ROOT_HOME_PREFIX);
+ if (gethostname(thishost, sizeof(thishost)) == -1)
+ fatal("load_public_identity_files: gethostname: %s",
+ strerror(errno));
+diff --git a/uidswap.c b/uidswap.c
+index bc6194e..5cbf5d1 100644
+--- a/uidswap.c
++++ b/uidswap.c
+@@ -28,7 +28,6 @@
+ #include "xmalloc.h"
+
+ #ifdef ANDROID
+-#include <private/android_filesystem_config.h>
+ #include <linux/capability.h>
+ #include <linux/prctl.h>
+ #endif
+@@ -230,7 +229,7 @@ permanently_set_uid(struct passwd *pw)
+ debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
+ (u_int)pw->pw_gid);
+
+-#ifdef ANDROID
++#if 0
+ if (pw->pw_uid == AID_SHELL) {
+ prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
+
+@@ -317,7 +316,7 @@ permanently_set_uid(struct passwd *pw)
+ (u_int)pw->pw_uid);
+ }
+
+-#ifdef ANDROID
++#if 0
+ if (pw->pw_uid == AID_SHELL) {
+ /* set CAP_SYS_BOOT capability, so "adb reboot" will succeed */
+ header.version = _LINUX_CAPABILITY_VERSION;
diff --git a/standalone/android/rsync.patch b/standalone/android/rsync.patch
new file mode 100644
index 000000000..692e9cabb
--- /dev/null
+++ b/standalone/android/rsync.patch
@@ -0,0 +1,40 @@
+From f91df535053958600d57f9df78d9ce84c8718655 Mon Sep 17 00:00:00 2001
+From: Joey Hess <joey@kitenet.net>
+Date: Wed, 13 Feb 2013 15:51:40 -0400
+Subject: [PATCH] android portability
+
+---
+ authenticate.c | 3 ++-
+ batch.c | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/authenticate.c b/authenticate.c
+index 7650377..626dec6 100644
+--- a/authenticate.c
++++ b/authenticate.c
+@@ -296,7 +296,8 @@ void auth_client(int fd, const char *user, const char *challenge)
+ *
+ * OpenBSD has a readpassphrase() that might be more suitable.
+ */
+- pass = getpass("Password: ");
++ /*pass = getpass("Password: "); */
++ exit(1);
+ }
+
+ if (!pass)
+diff --git a/batch.c b/batch.c
+index a3e9dca..ee31532 100644
+--- a/batch.c
++++ b/batch.c
+@@ -221,7 +221,7 @@ void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
+ stringjoin(filename, sizeof filename,
+ batch_name, ".sh", NULL);
+ fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC,
+- S_IRUSR | S_IWUSR | S_IEXEC);
++ S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ rsyserr(FERROR, errno, "Batch file %s open error",
+ filename);
+--
+1.7.10.4
+
diff --git a/standalone/android/runshell b/standalone/android/runshell
new file mode 100755
index 000000000..ef6744494
--- /dev/null
+++ b/standalone/android/runshell
@@ -0,0 +1,132 @@
+#!/system/bin/sh
+# This is runs a shell in an environment configured for git-annex.
+# Nearly the only command that can be used in here is busybox!
+# lib.start.so will run us in the root of our app directory
+base=$(./busybox pwd)
+cmd=$base/busybox
+
+set -e
+
+prep () {
+ # Cannot rely on Android providing a sane HOME
+ HOME="/sdcard/git-annex.home"
+ export HOME
+}
+
+buildtree () {
+ $cmd echo "Installation starting to $base"
+ $cmd cat "lib/lib.version.so"
+
+ if $cmd test -e "$base/bin"; then
+ $cmd mv "$base/bin" "$base/bin.old"
+ fi
+ $cmd mkdir -p "$base/bin"
+
+ for prog in busybox git-annex git-shell git-upload-pack git gpg rsync ssh ssh-keygen; do
+ $cmd echo "installing $prog"
+ if $cmd test -e "$base/bin/$prog"; then
+ $cmd rm -f "$base/bin/$prog"
+ fi
+ $cmd ln -s "$base/lib/lib.$prog.so" "$base/bin/$prog"
+ done
+
+ $cmd --install $base/bin
+
+ $cmd rm -rf "$base/bin.old"
+
+ $cmd tar zxf $base/lib/lib.git.tar.gz.so
+ for prog in git git-shell git-upload-pack; do
+ for link in $($cmd cat "$base/links/$prog"); do
+ $cmd echo "linking $link to $prog"
+ if $cmd test -e "$base/$link"; then
+ $cmd rm -f "$base/$link"
+ fi
+ $cmd ln -s "$base/bin/$prog" "$base/$link"
+ done
+ $cmd rm -f "$base/links/$prog"
+ done
+
+ $cmd mkdir -p "$base/templates"
+ $cmd mkdir -p "$base/tmp"
+
+ $cmd echo "#!/system/bin/sh" > "$base/runshell"
+ $cmd echo "exec $base/lib/lib.start.so" >> "$base/runshell"
+ $cmd chmod 755 runshell
+
+ $cmd cat "$base/lib/lib.version.so" > "$base/installed-version"
+ $cmd echo "Installation complete"
+}
+
+install () {
+ if ! $cmd mkdir -p "$HOME"; then
+ $cmd echo "mkdir of $HOME failed!"
+ fi
+ if $cmd test ! -e "$base/bin/git-annex"; then
+ if ! buildtree > $HOME/git-annex-install.log 2>&1; then
+ $cmd echo "Installation failed! Please report a bug and attach $HOME/git-annex-install.log"
+ $cmd sh
+ fi
+ elif $cmd test ! -e "$base/installed-version" || ! $cmd cmp "$base/installed-version" "$base/lib/lib.version.so" >/dev/null; then
+ if ! buildtree > $HOME/git-annex-install.log 2>&1; then
+ $cmd echo "Upgrade failed! Please report a bug and attach $HOME/git-annex-install.log"
+ fi
+ fi
+}
+
+run () {
+ PATH="$base/bin:$PATH"
+ export PATH
+
+ ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"
+ export ORIG_GIT_EXEC_PATH
+ GIT_EXEC_PATH=$base/libexec/git-core
+ export GIT_EXEC_PATH
+
+ ORIG_GIT_TEMPLATE_DIR="$GIT_TEMPLATE_DIR"
+ export ORIG_GIT_TEMPLATE_DIR
+ GIT_TEMPLATE_DIR="$base/templates"
+ export GIT_TEMPLATE_DIR
+
+ # Indicate which variables were exported above.
+ GIT_ANNEX_STANDLONE_ENV="GIT_EXEC_PATH GIT_TEMPLATE_DIR"
+ export GIT_ANNEX_STANDLONE_ENV
+
+ # This is a temporary directory on a non-crippled filesystem.
+ # Needs to be as short a path as possible, for ssh sockets.
+ GIT_ANNEX_TMP_DIR=$base/tmp
+ export GIT_ANNEX_TMP_DIR
+ # /tmp probably doesn't exist, so also use it as TMPDIR
+ TMPDIR=$GIT_ANNEX_TMP_DIR
+ export TMPDIR
+
+ if $cmd test ! -e "$HOME/.gitconfig"; then
+ git config --global user.email "git-annex@android"
+ git config --global user.name "android"
+ fi
+
+ if $cmd test "$1"; then
+ cmd="$1"
+ shift 1
+ exec "$cmd" "$@"
+ else
+ # As good a start point as any.
+ cd "$HOME"
+
+ /system/bin/sh
+ fi
+}
+
+if $cmd test -n "$MKFIFO"; then
+ # because java is insane
+ $cmd mkfifo "$MKFIFO"
+else
+ if ! prep; then
+ $cmd echo "prep failed. Please report a bug."
+ read line
+ fi
+ if ! install; then
+ $cmd echo "install failed. Please report a bug."
+ read line
+ fi
+ run
+fi
diff --git a/standalone/android/start b/standalone/android/start
new file mode 100755
index 000000000..44dcb3cf4
--- /dev/null
+++ b/standalone/android/start
Binary files differ
diff --git a/standalone/android/start.c b/standalone/android/start.c
new file mode 100644
index 000000000..c67c5da0c
--- /dev/null
+++ b/standalone/android/start.c
@@ -0,0 +1,64 @@
+/* Installed as lib.start.so, this bootstraps a working busybox and uses
+ * it to run lib.runshell.so. */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+void chopdir (char *s) {
+ char *p=strrchr(s, '/');
+ if (p == NULL) {
+ fprintf(stderr, "cannot find directory in %s", s);
+ exit(1);
+ }
+ p[0] = '\0';
+}
+
+main () {
+ char buf[1024];
+ char *p;
+ struct stat st_buf;
+
+ /* Get something like /data/data/ga.androidterm/lib/lib.start.so */
+ int n=readlink("/proc/self/exe", buf, 1023);
+ if (n < 1) {
+ fprintf(stderr, "failed to find own name");
+ exit(1);
+ }
+ buf[n] = '\0';
+
+ /* Change directory to something like /data/data/ga.androidterm */
+ chopdir(buf);
+ chopdir(buf);
+ if (chdir(buf) != 0) {
+ perror("chdir");
+ exit(1);
+ }
+
+ if (stat("lib/lib.busybox.so", &st_buf) != 0) {
+ /* TODO my lib dir should be in LD_LIBRARY_PATH; check that */
+ fprintf(stderr, "Falling back to hardcoded app location; cannot find expected files in %s\n", buf);
+ if (chdir("/data/data/ga.androidterm") != 0) {
+ perror("chdir");
+ exit(1);
+ }
+ }
+
+ /* If this is the first run, set up busybox symlink,
+ * which allows busybox to run. */
+ if (stat("busybox", &st_buf) != 0) {
+ if (symlink("lib/lib.busybox.so", "busybox") != 0) {
+ /* Just in case! */
+ if (link("lib/lib.busybox.so", "busybox") != 0) {
+ perror("link busybox");
+ exit(1);
+ }
+ }
+ }
+
+ execl("./busybox", "./busybox", "sh", "lib/lib.runshell.so", NULL);
+ perror("error running busybox sh");
+}
diff --git a/standalone/android/term.patch b/standalone/android/term.patch
new file mode 100644
index 000000000..5f7d40335
--- /dev/null
+++ b/standalone/android/term.patch
@@ -0,0 +1,598 @@
+diff --git a/AndroidManifest.xml b/AndroidManifest.xml
+index b0e866a..1ab8515 100644
+--- a/AndroidManifest.xml
++++ b/AndroidManifest.xml
+@@ -7,6 +7,7 @@
+ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
++ <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <permission android:name="jackpal.androidterm.permission.RUN_SCRIPT"
+ android:label="@string/perm_run_script"
+diff --git a/examples/widget/src/jackpal/androidterm/sample/telnet/TermActivity.java b/examples/widget/src/jackpal/androidterm/sample/telnet/TermActivity.java
+index f6952f0..1a8df8f 100644
+--- a/examples/widget/src/jackpal/androidterm/sample/telnet/TermActivity.java
++++ b/examples/widget/src/jackpal/androidterm/sample/telnet/TermActivity.java
+@@ -166,7 +166,7 @@ public class TermActivity extends Activity
+ /* ... create a process ... */
+ String execPath = LaunchActivity.getDataDir(this) + "/bin/execpty";
+ ProcessBuilder execBuild =
+- new ProcessBuilder(execPath, "/system/bin/sh", "-");
++ new ProcessBuilder(execPath, "/data/data/ga.androidterm/lib/lib.start.so", "");
+ execBuild.redirectErrorStream(true);
+ Process exec = null;
+ try {
+diff --git a/res/menu/main.xml b/res/menu/main.xml
+index 064f833..fe5f3a3 100644
+--- a/res/menu/main.xml
++++ b/res/menu/main.xml
+@@ -16,6 +16,8 @@
+ -->
+
+ <menu xmlns:android="http://schemas.android.com/apk/res/android">
++ <item android:id="@+id/menu_send_email"
++ android:title="@string/send_email" />
+ <item android:id="@+id/menu_new_window"
+ android:title="@string/new_window"
+ android:icon="@drawable/ic_menu_add" />
+@@ -34,8 +36,6 @@
+ android:icon="@drawable/ic_menu_preferences" />
+ <item android:id="@+id/menu_reset"
+ android:title="@string/reset" />
+- <item android:id="@+id/menu_send_email"
+- android:title="@string/send_email" />
+ <item android:id="@+id/menu_toggle_wakelock"
+ android:title="@string/enable_wakelock" />
+ <item android:id="@+id/menu_toggle_wifilock"
+diff --git a/res/values-cz/strings.xml b/res/values-cz/strings.xml
+index f3d19bc..882e19b 100644
+--- a/res/values-cz/strings.xml
++++ b/res/values-cz/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Predešlé okno</string>
+ <string name="next_window">Další okno</string>
+ <string name="reset">Reset terminálu</string>
+- <string name="send_email">Napiš email</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Speciální znaky</string>
+ <string name="toggle_soft_keyboard">Přepnout soft. klávesnici</string>
+
+@@ -124,4 +124,4 @@
+ <string name="control_key_dialog_fn_disabled_text">Není nastaveno žádné tlačitko pro funkční klávesu.</string>
+
+ <string name="confirm_window_close_message">Zavřít okno?</string>
+-</resources>
+\ No newline at end of file
++</resources>
+diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
+index f6134a5..06d2e1f 100644
+--- a/res/values-de/strings.xml
++++ b/res/values-de/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Vorh. Fenster</string>
+ <string name="next_window">Nächst. Fenster</string>
+ <string name="reset">Zurücksetzen</string>
+- <string name="send_email">Email schreiben</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Spezialtasten</string>
+ <string name="toggle_soft_keyboard">Tastatur an/aus</string>
+
+@@ -124,4 +124,4 @@
+
+ <string name="perm_run_script">Beliebige Scripte im Terminal Emulator ausführen</string>
+ <string name="permdesc_run_script">Erlaubt Anwendungen, neue Fenster im Android Terminal Emulator zu öffnen und in diesen Befehle auszuführen. Dies schließt alle Berechtigungen von Android Terminal Emulator ein, inklusive Internetzugang und Schreib-/Leserechte auf der SD-Karte.</string>
+-</resources>
+\ No newline at end of file
++</resources>
+diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
+index 94553b2..92d9e2a 100644
+--- a/res/values-es/strings.xml
++++ b/res/values-es/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Ventana anterior</string>
+ <string name="next_window">Ventana posterior</string>
+ <string name="reset">Reiniciar consola</string>
+- <string name="send_email">Enviar email</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Teclas especiales</string>
+ <string name="toggle_soft_keyboard">Ver/ocultar teclado</string>
+
+diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml
+index b9f0586..92a16a0 100644
+--- a/res/values-eu/strings.xml
++++ b/res/values-eu/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Aurreko leihoa</string>
+ <string name="next_window">Hurrengo leihoa</string>
+ <string name="reset">Berrezarri terminala</string>
+- <string name="send_email">Bidali eposta ...(r)i</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Tekla bereziak</string>
+ <string name="toggle_soft_keyboard">Txandakatu soft teklatua</string>
+
+diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
+index beab2be..529f720 100644
+--- a/res/values-fr/strings.xml
++++ b/res/values-fr/strings.xml
+@@ -24,7 +24,7 @@
+ <string name="prev_window">Fenêtre Préc.</string>
+ <string name="next_window">Fenêtre Suiv.</string>
+ <string name="reset">Terminal par défaut</string>
+- <string name="send_email">Envoyer un e-mail</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Touches spéciales</string>
+ <string name="toggle_soft_keyboard">Afficher/Masquer Clavier</string>
+
+diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml
+index 5dbecb5..ce917c5 100644
+--- a/res/values-hu/strings.xml
++++ b/res/values-hu/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Előző ablak</string>
+ <string name="next_window">Következő ablak</string>
+ <string name="reset">Alaphelyzet</string>
+- <string name="send_email">Küldés emailben</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Speciális billentyűk</string>
+ <string name="toggle_soft_keyboard">Billentyűzet ki/be</string>
+
+@@ -148,4 +148,4 @@
+ <string name="alt_sends_esc">Az Alt billentyű ESC-et küld</string>
+ <string name="alt_sends_esc_summary_on">Az Alt billentyű ESC-et küld.</string>
+ <string name="alt_sends_esc_summary_off">Az Alt billentyű nem ESC-et küld.</string>
+-</resources>
+\ No newline at end of file
++</resources>
+diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
+index e6a7294..9d97869 100644
+--- a/res/values-it/strings.xml
++++ b/res/values-it/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Fin. successiva</string>
+ <string name="next_window">Fin. precedente</string>
+ <string name="reset">Reset terminale</string>
+- <string name="send_email">Invia email</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Tasti speciali</string>
+ <string name="toggle_soft_keyboard">Mostra/nascondi tastiera</string>
+
+diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
+index 502fa23..dbfe9fa 100644
+--- a/res/values-ja/strings.xml
++++ b/res/values-ja/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">前のウインドウ</string>
+ <string name="next_window">次のウインドウ</string>
+ <string name="reset">端末をリセット</string>
+- <string name="send_email">メール送信</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">特殊キー</string>
+ <string name="toggle_soft_keyboard">ソフトキーボード</string>
+
+diff --git a/res/values-ka/strings.xml b/res/values-ka/strings.xml
+index 06629d0..1d545b6 100644
+--- a/res/values-ka/strings.xml
++++ b/res/values-ka/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">წინა ფანჯარა</string>
+ <string name="next_window">შემდეგი ფანჯარა</string>
+ <string name="reset">ტერმინალის რესტარტი</string>
+- <string name="send_email">ელ-ფოსტის გაგზავნა</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">სპეციალური ღილაკები</string>
+ <string name="toggle_soft_keyboard">პროგრამული კლავიატურის ჩართ./გამორთ.</string>
+
+diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
+index d81ee07..c370c6f 100644
+--- a/res/values-nb/strings.xml
++++ b/res/values-nb/strings.xml
+@@ -18,7 +18,7 @@
+ <string name="application_terminal">Terminal Emulator</string>
+ <string name="preferences">Innstillinger</string>
+ <string name="reset">Tilbakestill terminal</string>
+- <string name="send_email">Send epost til</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Spesielle tegn</string>
+ <string name="toggle_soft_keyboard">Veksle virtuelt tastatur</string>
+
+diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
+index 19fa3d0..e24fbf5 100644
+--- a/res/values-nl/strings.xml
++++ b/res/values-nl/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Vorig venster</string>
+ <string name="next_window">Volgend venster</string>
+ <string name="reset">Herstellen</string>
+- <string name="send_email">E-mail sturen naar</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Speciale knoppen</string>
+ <string name="toggle_soft_keyboard">Toetsenbord aan/uit</string>
+
+diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
+index 25b3b43..2e0e651 100644
+--- a/res/values-pl/strings.xml
++++ b/res/values-pl/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Poprzednie okno</string>
+ <string name="next_window">Następne okno</string>
+ <string name="reset">Wyczyść terminal</string>
+- <string name="send_email">Wyślij e-mail</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Przyciski specjalne</string>
+ <string name="toggle_soft_keyboard">Pokaż klawiaturę</string>
+
+diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
+index aa4ba54..aa3d735 100644
+--- a/res/values-pt-rPT/strings.xml
++++ b/res/values-pt-rPT/strings.xml
+@@ -18,7 +18,7 @@
+ <string name="application_terminal">Terminal Emulator</string>
+ <string name="preferences">Preferências</string>
+ <string name="reset">Reset terminal</string>
+- <string name="send_email">Email para</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Teclas especiais</string>
+ <string name="toggle_soft_keyboard">Abrir teclado</string>
+
+diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
+index 2d992f9..e53a9ac 100644
+--- a/res/values-pt/strings.xml
++++ b/res/values-pt/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Anterior</string>
+ <string name="next_window">Seguinte</string>
+ <string name="reset">Repor terminal</string>
+- <string name="send_email">Enviar mensagem para</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Teclas especiais</string>
+ <string name="toggle_soft_keyboard">Mostrar/ocultar teclado</string>
+
+diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
+index 3c7ea06..7a072d0 100644
+--- a/res/values-ro/strings.xml
++++ b/res/values-ro/strings.xml
+@@ -21,7 +21,7 @@
+ <string name="prev_window">"Fereastra anterioră"</string>
+ <string name="next_window">"Fereastra următoare"</string>
+ <string name="reset">"Resetaţi "</string>
+- <string name="send_email">"E-mail"</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">"Taste speciale"</string>
+ <string name="toggle_soft_keyboard">"Comutați tastatura"</string>
+
+@@ -123,4 +123,4 @@
+ <string name="alt_sends_esc">"Tasta Alt trimite ESC"</string>
+ <string name="alt_sends_esc_summary_on">"Tasta Alt trimite ESC."</string>
+ <string name="alt_sends_esc_summary_off">"Tasta Alt nu trimite ESC."</string>
+-</resources>
+\ No newline at end of file
++</resources>
+diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
+index 0e96360..762324e 100644
+--- a/res/values-ru/strings.xml
++++ b/res/values-ru/strings.xml
+@@ -8,7 +8,7 @@
+ <string name="prev_window">Предыдущее окно</string>
+ <string name="next_window">Следующее окно</string>
+ <string name="reset">Сбросить терминал</string>
+- <string name="send_email">Отправить Email</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Специальные клавиши</string>
+ <string name="toggle_soft_keyboard">Экранная клавиатура</string>
+ <string name="reset_toast_notification">Терминальное состояние этого окна было сброшено.</string>
+diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml
+index ef35366..cc31d80 100644
+--- a/res/values-sk/strings.xml
++++ b/res/values-sk/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Dalšie okno</string>
+ <string name="next_window">Predch. okno</string>
+ <string name="reset">Obnoviť term.</string>
+- <string name="send_email">Poslať e-mailom</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Špec. klávesy</string>
+ <string name="toggle_soft_keyboard">Skryť/zobraziť klávesnicu</string>
+
+diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
+index 1aa9055..8de6c09 100644
+--- a/res/values-sv/strings.xml
++++ b/res/values-sv/strings.xml
+@@ -3,7 +3,7 @@
+ <string name="application_terminal">Terminalemulator</string>
+ <string name="preferences">Inställningar</string>
+ <string name="reset">Återställ terminal</string>
+- <string name="send_email">E-posta till</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Special tangenter</string>
+ <string name="toggle_soft_keyboard">Växla till virtuellt tangentbord</string>
+ <string name="enable_wakelock">Aktivera VäckningsLås</string>
+diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
+index b45fa12..fb70f78 100644
+--- a/res/values-tr/strings.xml
++++ b/res/values-tr/strings.xml
+@@ -18,7 +18,7 @@
+ <string name="application_terminal">Terminal Emülatörü</string>
+ <string name="preferences">Tercihler</string>
+ <string name="reset">Terminali yeniden başlat</string>
+- <string name="send_email">Email olarak yolla</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Özel tuşlar</string>
+ <string name="toggle_soft_keyboard">Ekran klavyesine geç</string>
+
+diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml
+index 2f267a9..d3622c4 100644
+--- a/res/values-uk/strings.xml
++++ b/res/values-uk/strings.xml
+@@ -8,7 +8,7 @@
+ <string name="prev_window">Попереднє вікно</string>
+ <string name="next_window">Наступне вікно</string>
+ <string name="reset">Скинути термінал</string>
+- <string name="send_email">Відіслати Email</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">Спеціальні клавіші</string>
+ <string name="toggle_soft_keyboard">Екранна клавіатура</string>
+ <string name="reset_toast_notification">"Термінальний стан цього вікна було скинуто."</string>
+diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
+index 6f47b4f..81316ec 100644
+--- a/res/values-zh-rCN/strings.xml
++++ b/res/values-zh-rCN/strings.xml
+@@ -18,7 +18,7 @@
+ <string name="application_terminal">终端模拟器</string>
+ <string name="preferences">首选项</string>
+ <string name="reset">重置终端</string>
+- <string name="send_email">发送电子邮件到...</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">特殊键</string>
+ <string name="toggle_soft_keyboard">打开/关闭软键盘</string>
+
+diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
+index afda0f1..37d1b50 100644
+--- a/res/values-zh-rTW/strings.xml
++++ b/res/values-zh-rTW/strings.xml
+@@ -18,7 +18,7 @@
+ <string name="application_terminal">模擬終端</string>
+ <string name="preferences">設定</string>
+ <string name="reset">結束</string>
+- <string name="send_email">以電郵傳送</string>
++ <string name="send_email">WebApp</string>
+ <string name="special_keys">特別按鍵</string>
+ <string name="toggle_soft_keyboard">顯示/隱藏鍵盤</string>
+
+diff --git a/res/values/defaults.xml b/res/values/defaults.xml
+index 67287b2..9b7cfcd 100644
+--- a/res/values/defaults.xml
++++ b/res/values/defaults.xml
+@@ -13,10 +13,10 @@
+ <string name="pref_fnkey_default">4</string>
+ <string name="pref_ime_default">0</string>
+ <bool name="pref_alt_sends_esc_default">false</bool>
+- <string name="pref_shell_default">/system/bin/sh -</string>
+- <string name="pref_initialcommand_default"></string>
++ <string name="pref_shell_default">/data/data/ga.androidterm/lib/lib.start.so</string>
++ <string name="pref_initialcommand_default">git annex webapp</string>
+ <string name="pref_termtype_default">screen</string>
+- <bool name="pref_close_window_on_process_exit_default">true</bool>
++ <bool name="pref_close_window_on_process_exit_default">false</bool>
+ <bool name="pref_verify_path_default">true</bool>
+ <bool name="pref_do_path_extensions_default">true</bool>
+ <bool name="pref_allow_prepend_path_default">true</bool>
+diff --git a/res/values/strings.xml b/res/values/strings.xml
+index f1464e9..b06ec9a 100644
+--- a/res/values/strings.xml
++++ b/res/values/strings.xml
+@@ -23,7 +23,7 @@
+ <string name="prev_window">Prev window</string>
+ <string name="next_window">Next window</string>
+ <string name="reset">Reset term</string>
+- <string name="send_email">Email to</string>
++ <string name="send_email">Open WebApp</string>
+ <string name="special_keys">Special keys</string>
+ <string name="toggle_soft_keyboard">Toggle soft keyboard</string>
+
+diff --git a/src/jackpal/androidterm/ShellTermSession.java b/src/jackpal/androidterm/ShellTermSession.java
+index 501e7ab..0b43513 100644
+--- a/src/jackpal/androidterm/ShellTermSession.java
++++ b/src/jackpal/androidterm/ShellTermSession.java
+@@ -80,12 +80,12 @@ public class ShellTermSession extends TermSession {
+ }
+ };
+
+- public ShellTermSession(TermSettings settings, String initialCommand) {
++ public ShellTermSession(TermSettings settings, String initialCommand, String webAppFifo) {
+ super();
+
+ updatePrefs(settings);
+
+- initializeSession();
++ initializeSession(webAppFifo);
+ mInitialCommand = initialCommand;
+
+ mWatcherThread = new Thread() {
+@@ -106,7 +106,7 @@ public class ShellTermSession extends TermSession {
+ setDefaultUTF8Mode(settings.defaultToUTF8Mode());
+ }
+
+- private void initializeSession() {
++ private void initializeSession(String webAppFifo) {
+ TermSettings settings = mSettings;
+
+ int[] processId = new int[1];
+@@ -128,9 +128,10 @@ public class ShellTermSession extends TermSession {
+ if (settings.verifyPath()) {
+ path = checkPath(path);
+ }
+- String[] env = new String[2];
++ String[] env = new String[3];
+ env[0] = "TERM=" + settings.getTermType();
+ env[1] = "PATH=" + path;
++ env[2] = "FIFO=" + webAppFifo;
+
+ createSubprocess(processId, settings.getShell(), env);
+ mProcId = processId[0];
+diff --git a/src/jackpal/androidterm/Term.java b/src/jackpal/androidterm/Term.java
+index 8a3a4ac..824025d 100644
+--- a/src/jackpal/androidterm/Term.java
++++ b/src/jackpal/androidterm/Term.java
+@@ -20,6 +20,13 @@ import java.io.UnsupportedEncodingException;
+ import java.text.Collator;
+ import java.util.Arrays;
+ import java.util.Locale;
++import java.lang.Process;
++import java.lang.ProcessBuilder;
++import java.util.Map;
++
++import java.io.FileReader;
++import java.io.BufferedReader;
++import java.io.File;
+
+ import android.app.Activity;
+ import android.app.AlertDialog;
+@@ -59,6 +66,11 @@ import android.view.inputmethod.InputMethodManager;
+ import android.widget.TextView;
+ import android.widget.Toast;
+
++import android.content.Intent;
++import android.net.Uri;
++import android.app.Activity;
++import android.content.Context;
++
+ import jackpal.androidterm.emulatorview.ColorScheme;
+ import jackpal.androidterm.emulatorview.EmulatorView;
+ import jackpal.androidterm.emulatorview.TermSession;
+@@ -107,6 +119,9 @@ public class Term extends Activity implements UpdateCallback {
+ public static final String EXTRA_WINDOW_ID = "jackpal.androidterm.window_id";
+ private int onResumeSelectWindow = -1;
+
++ public static String appDir;
++ public static String webAppFifo;
++
+ private PowerManager.WakeLock mWakeLock;
+ private WifiManager.WifiLock mWifiLock;
+ // Available on API 12 and later
+@@ -257,6 +272,48 @@ public class Term extends Activity implements UpdateCallback {
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
++
++ try {
++ appDir = getApplicationContext().getPackageManager().getPackageInfo(getPackageName(), 0).applicationInfo.dataDir;
++ } catch (Exception e) {
++ appDir = "/data/data/ga.androidterm";
++ }
++ webAppFifo = appDir + "/fifo";
++
++ /* webapp url opening thread */
++ new Thread() {
++ @Override
++ public void run() {
++ try {
++ /* First, set up the fifo that urls to open will be
++ * read from. This is complicated by java not being
++ * able to mkfifo. */
++ File f = new File (webAppFifo);
++ if (! f.exists()) {
++ ProcessBuilder pb = new ProcessBuilder(appDir + "/lib/lib.start.so");
++ Map<String, String> env = pb.environment();
++ env.put("MKFIFO", webAppFifo);
++ Process p = pb.start();
++ p.waitFor();
++ }
++
++ /* Reading from the fifo blocks until a url is written
++ * to it. */
++ while (true) {
++ BufferedReader buf = new BufferedReader(new FileReader(webAppFifo));
++ String s = buf.readLine();
++ try {
++ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(s));
++ startActivity(intent);
++ } catch (Exception e) {
++ }
++
++ }
++ } catch (Exception e) {
++ }
++ }
++ }.start();
++
+ Log.e(TermDebug.LOG_TAG, "onCreate");
+ mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+ mSettings = new TermSettings(getResources(), mPrefs);
+@@ -427,7 +484,7 @@ public class Term extends Activity implements UpdateCallback {
+ }
+
+ protected static TermSession createTermSession(Context context, TermSettings settings, String initialCommand) {
+- ShellTermSession session = new ShellTermSession(settings, initialCommand);
++ ShellTermSession session = new ShellTermSession(settings, initialCommand, webAppFifo);
+ // XXX We should really be able to fetch this from within TermSession
+ session.setProcessExitMessage(context.getString(R.string.process_exit_message));
+
+@@ -911,31 +968,15 @@ public class Term extends Activity implements UpdateCallback {
+ }
+
+ private void doEmailTranscript() {
++ // Hack: repurposed to open the git-annex webapp
+ TermSession session = getCurrentTermSession();
+ if (session != null) {
+- // Don't really want to supply an address, but
+- // currently it's required, otherwise nobody
+- // wants to handle the intent.
+- String addr = "user@example.com";
+- Intent intent =
+- new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"
+- + addr));
+-
+- String subject = getString(R.string.email_transcript_subject);
+- String title = session.getTitle();
+- if (title != null) {
+- subject = subject + " - " + title;
+- }
+- intent.putExtra(Intent.EXTRA_SUBJECT, subject);
+- intent.putExtra(Intent.EXTRA_TEXT,
+- session.getTranscriptText().trim());
+ try {
+- startActivity(Intent.createChooser(intent,
+- getString(R.string.email_transcript_chooser_title)));
+- } catch (ActivityNotFoundException e) {
+- Toast.makeText(this,
+- R.string.email_transcript_no_email_activity_found,
+- Toast.LENGTH_LONG).show();
++ BufferedReader buf = new BufferedReader(new FileReader("/sdcard/git-annex.home/.git-annex-url"));
++ String s = buf.readLine();
++ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(s));
++ startActivity(intent);
++ } catch (Exception e) {
+ }
+ }
+ }
+diff --git a/tools/build-debug b/tools/build-debug
+index 1f15cd2..e611956 100755
+--- a/tools/build-debug
++++ b/tools/build-debug
+@@ -34,4 +34,4 @@ fi
+
+ rm -rf `find . -name bin -o -name obj -prune`
+ cd jni
+-$ANDROID_NDK_ROOT/ndk-build && cd .. && ant debug
++$ANDROID_NDK_ROOT/ndk-build && cd ..
+diff --git a/tools/update.sh b/tools/update.sh
+index 57219c3..79b45ef 100755
+--- a/tools/update.sh
++++ b/tools/update.sh
+@@ -18,7 +18,7 @@ command -v "$ANDROID" >/dev/null 2>&1 || { echo >&2 "The $ANDROID tool is not fo
+
+ # Make sure target-11 is installed
+
+-$ANDROID update sdk -u -t android-11
++$ANDROID update sdk -u -t android-17
+
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+ ATE_ROOT="$( cd $DIR/.. && pwd )"
+@@ -31,5 +31,5 @@ for PROJECT_FILE in $PROJECT_FILES
+ do
+ PROJECT_DIR="$( dirname "$PROJECT_FILE" )"
+ echo "Updating $PROJECT_FILE"
+- $ANDROID update project -p "$PROJECT_DIR" --target android-11
++ $ANDROID update project -p "$PROJECT_DIR" --target android-17
+ done
diff --git a/standalone/licences.gz b/standalone/licences.gz
new file mode 100644
index 000000000..422f84225
--- /dev/null
+++ b/standalone/licences.gz
Binary files differ
diff --git a/standalone/linux/README b/standalone/linux/README
new file mode 100644
index 000000000..18983fd7a
--- /dev/null
+++ b/standalone/linux/README
@@ -0,0 +1,25 @@
+You can put this directory into your PATH, and use git-annex the same
+as if you'd installed it using a package manager.
+
+Or, you can use the runshell script in this directory to start a shell
+that is configured to use git-annex and the other utilities included in
+this bundle, including git, gpg, rsync, ssh, etc.
+
+This should work on any Linux system of the appropriate architecture.
+More or less. There are no external dependencies, except for glibc.
+Any recent-ish version of glibc should work (2.13 is ok; so is 2.11).
+
+
+How it works: This directory tree contains a lot of libraries and programs
+that git-annex needs. But it's not a chroot. Instead, runshell sets PATH
+and LD_LIBRARY_PATH to point to the stuff in here.
+
+The glibc libs are not included. Instead, it runs with the host system's
+glibc. We trust that glibc's excellent backwards and forward compatability
+is good enough to run binaries that were linked for a newer or older
+version. Of course, this could fail. Particularly if the binaries try to
+use some new glibc feature. But hopefully not.
+
+Why not bundle glibc too? I've not gotten it to work! The host system's
+ld-linux.so will be used for sure, as that's hardcoded into the binaries.
+When I tried including libraries from glibc in here, everything segfaulted.
diff --git a/standalone/linux/git-annex b/standalone/linux/git-annex
new file mode 100755
index 000000000..d9ec8baa5
--- /dev/null
+++ b/standalone/linux/git-annex
@@ -0,0 +1,25 @@
+#!/bin/sh
+base="$(dirname "$0")"
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+if [ ! -e "$base/runshell" ]; then
+ echo "** cannot find $base/runshell" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# If this is a standalone app, set a variable that git-annex can use to
+# install itself.
+if [ -e "$base/bin/git-annex" ]; then
+ GIT_ANNEX_APP_BASE="$base"
+ export GIT_ANNEX_APP_BASE
+fi
+
+exec "$base/runshell" git-annex "$@"
diff --git a/standalone/linux/git-annex-shell b/standalone/linux/git-annex-shell
new file mode 100755
index 000000000..44d5f694e
--- /dev/null
+++ b/standalone/linux/git-annex-shell
@@ -0,0 +1,25 @@
+#!/bin/sh
+base="$(dirname "$0")"
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+if [ ! -e "$base/runshell" ]; then
+ echo "** cannot find $base/runshell" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# If this is a standalone app, set a variable that git-annex can use to
+# install itself.
+if [ -e "$base/bin/git-annex" ]; then
+ GIT_ANNEX_APP_BASE="$base"
+ export GIT_ANNEX_APP_BASE
+fi
+
+exec "$base/runshell" git-annex-shell "$@"
diff --git a/standalone/linux/git-annex-webapp b/standalone/linux/git-annex-webapp
new file mode 100755
index 000000000..2698af9b5
--- /dev/null
+++ b/standalone/linux/git-annex-webapp
@@ -0,0 +1,25 @@
+#!/bin/sh
+base="$(dirname "$0")"
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+if [ ! -e "$base/runshell" ]; then
+ echo "** cannot find $base/runshell" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# If this is a standalone app, set a variable that git-annex can use to
+# install itself.
+if [ -e "$base/bin/git-annex" ]; then
+ GIT_ANNEX_APP_BASE="$base"
+ export GIT_ANNEX_APP_BASE
+fi
+
+exec "$base/runshell" git-annex webapp "$@"
diff --git a/standalone/linux/glibc-libs b/standalone/linux/glibc-libs
new file mode 100644
index 000000000..3f6e64112
--- /dev/null
+++ b/standalone/linux/glibc-libs
@@ -0,0 +1,43 @@
+libanl-.*.so
+libutil-.*.so
+libnss_hesiod-.*.so
+libcrypt-.*.so
+libnss_compat-.*.so
+libm-.*.so
+libr.so
+libpcprofile.so
+libnss_nis-.*.so
+libSegFault.so
+libpthread-.*.so
+librt-.*.so
+libnss_dns-.*.so
+libdl-.*.so
+libBrokenLocale-.*.so
+libnss_nisplus-.*.so
+libthread_db-1.0.so
+libmemusage.so
+libcidn-.*.so
+libnss_files-.*.so
+libnsl-.*.so
+libc-.*.so
+ld-.*.so
+libnss_nis.so
+libthread_db.so
+libanl.so
+libr.so
+libnss_compat.so
+libm.so
+libnss_dns.so
+libpthread.so
+libc.so
+librt.so
+libcidn.so
+libnss_nisplus.so
+libnsl.so
+libutil.so
+libBrokenLocale.so
+ld-linux.so
+libnss_files.so
+libdl.so
+libnss_hesiod.so
+libcrypt.so
diff --git a/standalone/linux/runshell b/standalone/linux/runshell
new file mode 100755
index 000000000..a36e49083
--- /dev/null
+++ b/standalone/linux/runshell
@@ -0,0 +1,76 @@
+#!/bin/sh
+# Runs a shell command (or interactive shell) using the binaries and
+# libraries bundled with this app.
+
+set -e
+
+base="$(dirname "$0")"
+
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+
+if [ ! -e "$base/bin/git-annex" ]; then
+ echo "** base directory $base does not contain bin/git-annex" >&2
+ exit 1
+fi
+if [ ! -e "$base/bin/git" ]; then
+ echo "** base directory $base does not contain bin/git" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# Install shim that's used to run git-annex-shell from ssh authorized_keys.
+# The assistant also does this when run, but the user may not be using the
+# assistant.
+if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
+ mkdir "$HOME/.ssh" >/dev/null 2>&1 || true
+ (
+ echo "#!/bin/sh"
+ echo "set -e"
+ echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\""
+ ) > "$HOME/.ssh/git-annex-shell"
+ chmod +x "$HOME/.ssh/git-annex-shell"
+fi
+
+# Put our binaries first, to avoid issues with out of date or incompatable
+# system binaries.
+ORIG_PATH="$PATH"
+export ORIG_PATH
+PATH=$base/bin:$PATH
+export PATH
+
+ORIG_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
+export ORIG_LD_LIBRARY_PATH
+for lib in $(cat $base/libdirs); do
+ LD_LIBRARY_PATH="$base/$lib:$LD_LIBRARY_PATH"
+done
+export LD_LIBRARY_PATH
+
+ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"
+export ORIG_GIT_EXEC_PATH
+GIT_EXEC_PATH=$base/git-core
+export GIT_EXEC_PATH
+
+ORIG_GIT_TEMPLATE_DIR="$GIT_TEMPLATE_DIR"
+export ORIG_GIT_TEMPLATE_DIR
+GIT_TEMPLATE_DIR="$base/templates"
+export GIT_TEMPLATE_DIR
+
+# Indicate which variables were exported above.
+GIT_ANNEX_STANDLONE_ENV="PATH LD_LIBRARY_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR"
+export GIT_ANNEX_STANDLONE_ENV
+
+if [ "$1" ]; then
+ cmd="$1"
+ shift 1
+ exec "$cmd" "$@"
+else
+ sh
+fi
diff --git a/standalone/osx/git-annex.app/Contents/Info.plist b/standalone/osx/git-annex.app/Contents/Info.plist
new file mode 100644
index 000000000..91f804987
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/Info.plist
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>git-annex-webapp</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>GPL 3</string>
+ <key>CFBundleGetInfoString</key>
+ <string>0.0.1</string>
+ <key>CFBundleIconFile</key>
+ <string>git-annex</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.branchable.git-annex</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>GIT-ANNEX</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>0.0.1</string>
+ <key>CFBundleSignature</key>
+ <string>git-annex</string>
+ <key>CFBundleVersion</key>
+ <string>0.0.1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.5</string>
+ <key>CFBundleDisplayName</key>
+ <string>Start git-annex webapp</string>
+ <key>LSMinimumSystemVersionByArchitecture</key>
+ <dict>
+ <key>i386</key>
+ <string>10.5.0</string>
+ <key>x86_64</key>
+ <string>10.6.0</string>
+ </dict>
+</dict>
+</plist>
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/README b/standalone/osx/git-annex.app/Contents/MacOS/README
new file mode 100644
index 000000000..c4bcea383
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/MacOS/README
@@ -0,0 +1,9 @@
+This is a app bundle for git-annex. Most users are going to want to
+just click on the icon to start up the git-annex webapp.
+
+To use git-annex at the command line, you can put the directory containing
+this README into your PATH.
+
+Or, you can use the runshell script in this directory to start a shell
+that is configured to use git-annex and the other utilities included in
+this bundle, including git, gpg, rsync, ssh, etc.
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/git-annex b/standalone/osx/git-annex.app/Contents/MacOS/git-annex
new file mode 100755
index 000000000..452a46694
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/MacOS/git-annex
@@ -0,0 +1,25 @@
+#!/bin/sh
+base="$(dirname "$0")"
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+if [ ! -e "$base/runshell" ]; then
+ echo "** cannot find $base/runshell" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# If this is a standalone app, set a variable that git-annex can use to
+# install itself.
+if [ -e "$base/git-annex" ]; then
+ GIT_ANNEX_APP_BASE="$base"
+ export GIT_ANNEX_APP_BASE
+fi
+
+exec "$base/runshell" git-annex "$@"
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell
new file mode 100755
index 000000000..9e8c0ad69
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-shell
@@ -0,0 +1,25 @@
+#!/bin/sh
+base="$(dirname "$0")"
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+if [ ! -e "$base/runshell" ]; then
+ echo "** cannot find $base/runshell" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# If this is a standalone app, set a variable that git-annex can use to
+# install itself.
+if [ -e "$base/git-annex" ]; then
+ GIT_ANNEX_APP_BASE="$base"
+ export GIT_ANNEX_APP_BASE
+fi
+
+exec "$base/runshell" git-annex-shell "$@"
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp
new file mode 100755
index 000000000..37a4984af
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/MacOS/git-annex-webapp
@@ -0,0 +1,26 @@
+#!/bin/sh
+base="$(dirname "$0")"
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+if [ ! -e "$base/runshell" ]; then
+ echo "** cannot find $base/runshell" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# If this is a standalone app, set a variable that git-annex can use to
+# install itself.
+if [ -e "$base/git-annex" ]; then
+ GIT_ANNEX_APP_BASE="$base"
+ export GIT_ANNEX_APP_BASE
+fi
+
+# OSX wants this to run in the background.
+exec "$base/runshell" git-annex webapp "$@" &
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/runshell b/standalone/osx/git-annex.app/Contents/MacOS/runshell
new file mode 100755
index 000000000..9f1457e25
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/MacOS/runshell
@@ -0,0 +1,71 @@
+#!/bin/sh
+# Runs a shell command (or interactive shell) using the binaries
+# bundled with this app.
+
+set -e
+
+base="$(dirname "$0")"
+
+if [ ! -d "$base" ]; then
+ echo "** cannot find base directory (I seem to be $0)" >&2
+ exit 1
+fi
+
+bundle="$base/bundle"
+
+if [ ! -e "$bundle/git-annex" ]; then
+ echo "** bundle directory $bundle does not contain git-annex" >&2
+ exit 1
+fi
+if [ ! -e "$bundle/git" ]; then
+ echo "** bundle directory $bundle does not contain git" >&2
+ exit 1
+fi
+
+# Get absolute path to base, to avoid breakage when things change directories.
+orig="$(pwd)"
+cd "$base"
+base="$(pwd)"
+cd "$orig"
+
+# Install shim that's used to run git-annex-shell from ssh authorized_keys.
+# The assistant also does this when run, but the user may not be using the
+# assistant.
+if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
+ mkdir "$HOME/.ssh" >/dev/null 2>&1 || true
+ (
+ echo "#!/bin/sh"
+ echo "set -e"
+ echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\""
+ ) > "$HOME/.ssh/git-annex-shell"
+ chmod +x "$HOME/.ssh/git-annex-shell"
+fi
+
+# Put our binaries first, to avoid issues with out of date or incompatable
+# system binaries.
+ORIG_PATH="$PATH"
+export ORIG_PATH
+PATH=$bundle:$PATH
+export PATH
+
+ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"
+export ORIG_GIT_EXEC_PATH
+GIT_EXEC_PATH=$bundle
+export GIT_EXEC_PATH
+
+ORIG_GIT_TEMPLATE_DIR="$GIT_TEMPLATE_DIR"
+export ORIG_GIT_TEMPLATE_DIR
+GIT_TEMPLATE_DIR="$bundle/templates"
+export GIT_TEMPLATE_DIR
+
+# Indicate which variables were exported above.
+GIT_ANNEX_STANDLONE_ENV="PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR"
+export GIT_ANNEX_STANDLONE_ENV
+
+if [ "$1" ]; then
+ cmd="$1"
+ shift 1
+ exec "$cmd" "$@"
+else
+ $SHELL
+fi
diff --git a/standalone/osx/git-annex.app/Contents/Resources/git-annex.icns b/standalone/osx/git-annex.app/Contents/Resources/git-annex.icns
new file mode 100644
index 000000000..a79c6d9e7
--- /dev/null
+++ b/standalone/osx/git-annex.app/Contents/Resources/git-annex.icns
Binary files differ
diff --git a/standalone/windows/build.sh b/standalone/windows/build.sh
new file mode 100644
index 000000000..74148dfe5
--- /dev/null
+++ b/standalone/windows/build.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# This script is run by the jenkins autobuilder, in a mingw environment,
+# to build git-annex for Windows.
+
+set -x
+set -e
+
+HP="/c/Program Files (x86)/Haskell Platform/2012.4.0.0"
+FLAGS="-Webapp -Assistant -XMPP"
+
+PATH="$HP/bin:$HP/lib/extralibs/bin:/c/Program Files (x86)/NSIS:$PATH"
+
+UPGRADE_LOCATION=http://downloads.kitenet.net/git-annex/windows/current/git-annex-installer.exe
+
+# Run a command with the cygwin environment available.
+# However, programs not from cygwin are preferred.
+withcyg () {
+ PATH="$PATH:/c/cygwin/bin" "$@"
+}
+
+# Don't allow build artifact from a past successful build to be extracted
+# if we fail.
+rm -f git-annex-installer.exe
+
+# Install haskell dependencies.
+# cabal install is not run in cygwin, because we don't want configure scripts
+# for haskell libraries to link them with the cygwin library.
+cabal update || true
+
+cabal install --only-dependencies -f"$FLAGS"
+
+# Detect when the last build was an incremental build and failed,
+# and try a full build. Done this way because this shell seems a bit
+# broken.
+if [ -e last-incremental-failed ]; then
+ cabal clean || true
+ # windows breakage..
+ rm -rf dist
+fi
+touch last-incremental-failed
+
+# Build git-annex
+withcyg cabal configure -f"$FLAGS"
+withcyg cabal build
+
+# Build the installer
+cabal install nsis
+ghc --make Build/NullSoftInstaller.hs
+withcyg Build/NullSoftInstaller.exe
+
+rm -f last-incremental-failed
+
+# Test git-annex
+rm -rf .t
+withcyg dist/build/git-annex/git-annex.exe test || true