├── .gitignore ├── patches ├── base-EPoll.patch ├── gmp-android-14-x86-4.7-GmpDerivedConstants.h ├── gmp-android-14-arm-linux-androideabi-4.7-GmpDerivedConstants.h ├── gmp-android-14-arm-linux-androideabi-4.8-GmpDerivedConstants.h ├── unix-remove-timespec-ifdefs.patch ├── haskeline-use_termios.h ├── unix-posix_vdisable.patch ├── cabal-wrapper ├── ghc-enable-stage1-th.patch ├── iconv-fix-time_t.patch └── hsc2hs-offset.patch ├── mirror └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /android-ndk-* 2 | /build-* 3 | /ghc-* 4 | /tarfiles 5 | -------------------------------------------------------------------------------- /patches/base-EPoll.patch: -------------------------------------------------------------------------------- 1 | diff --git a/GHC/Event/EPoll.hsc b/GHC/Event/EPoll.hsc 2 | index c7a7662..36bd8ca 100644 3 | --- a/GHC/Event/EPoll.hsc 4 | +++ b/GHC/Event/EPoll.hsc 5 | @@ -169,7 +169,7 @@ newtype EventType = EventType { 6 | , epollOut = EPOLLOUT 7 | , epollErr = EPOLLERR 8 | , epollHup = EPOLLHUP 9 | - , epollOneShot = EPOLLONESHOT 10 | + , epollOneShot = 0x40000000 11 | } 12 | 13 | -- | Create a new epoll context, returning a file descriptor associated with the context. 14 | -------------------------------------------------------------------------------- /patches/gmp-android-14-x86-4.7-GmpDerivedConstants.h: -------------------------------------------------------------------------------- 1 | /* This file is created automatically. Do not edit by hand.*/ 2 | 3 | #define SIZEOF_MP_INT 12 4 | #define OFFSET_MP_INT__mp_alloc 0 5 | #define REP_MP_INT__mp_alloc b32 6 | #define MP_INT__mp_alloc(__ptr__) REP_MP_INT__mp_alloc[__ptr__+OFFSET_MP_INT__mp_alloc] 7 | #define OFFSET_MP_INT__mp_size 4 8 | #define REP_MP_INT__mp_size b32 9 | #define MP_INT__mp_size(__ptr__) REP_MP_INT__mp_size[__ptr__+OFFSET_MP_INT__mp_size] 10 | #define OFFSET_MP_INT__mp_d 8 11 | #define REP_MP_INT__mp_d b32 12 | #define MP_INT__mp_d(__ptr__) REP_MP_INT__mp_d[__ptr__+OFFSET_MP_INT__mp_d] 13 | #define SIZEOF_MP_LIMB_T 4 14 | -------------------------------------------------------------------------------- /patches/gmp-android-14-arm-linux-androideabi-4.7-GmpDerivedConstants.h: -------------------------------------------------------------------------------- 1 | /* This file is created automatically. Do not edit by hand.*/ 2 | 3 | #define SIZEOF_MP_INT 12 4 | #define OFFSET_MP_INT__mp_alloc 0 5 | #define REP_MP_INT__mp_alloc b32 6 | #define MP_INT__mp_alloc(__ptr__) REP_MP_INT__mp_alloc[__ptr__+OFFSET_MP_INT__mp_alloc] 7 | #define OFFSET_MP_INT__mp_size 4 8 | #define REP_MP_INT__mp_size b32 9 | #define MP_INT__mp_size(__ptr__) REP_MP_INT__mp_size[__ptr__+OFFSET_MP_INT__mp_size] 10 | #define OFFSET_MP_INT__mp_d 8 11 | #define REP_MP_INT__mp_d b32 12 | #define MP_INT__mp_d(__ptr__) REP_MP_INT__mp_d[__ptr__+OFFSET_MP_INT__mp_d] 13 | #define SIZEOF_MP_LIMB_T 4 14 | -------------------------------------------------------------------------------- /patches/gmp-android-14-arm-linux-androideabi-4.8-GmpDerivedConstants.h: -------------------------------------------------------------------------------- 1 | /* This file is created automatically. Do not edit by hand.*/ 2 | 3 | #define SIZEOF_MP_INT 12 4 | #define OFFSET_MP_INT__mp_alloc 0 5 | #define REP_MP_INT__mp_alloc b32 6 | #define MP_INT__mp_alloc(__ptr__) REP_MP_INT__mp_alloc[__ptr__+OFFSET_MP_INT__mp_alloc] 7 | #define OFFSET_MP_INT__mp_size 4 8 | #define REP_MP_INT__mp_size b32 9 | #define MP_INT__mp_size(__ptr__) REP_MP_INT__mp_size[__ptr__+OFFSET_MP_INT__mp_size] 10 | #define OFFSET_MP_INT__mp_d 8 11 | #define REP_MP_INT__mp_d b32 12 | #define MP_INT__mp_d(__ptr__) REP_MP_INT__mp_d[__ptr__+OFFSET_MP_INT__mp_d] 13 | #define SIZEOF_MP_LIMB_T 4 14 | -------------------------------------------------------------------------------- /patches/unix-remove-timespec-ifdefs.patch: -------------------------------------------------------------------------------- 1 | diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc 2 | index 3056014..5a2fdb2 100644 3 | --- a/System/Posix/Files/Common.hsc 4 | +++ b/System/Posix/Files/Common.hsc 5 | @@ -83,15 +83,8 @@ module System.Posix.Files.Common ( 6 | import System.Posix.Types 7 | import System.IO.Unsafe 8 | import Data.Bits 9 | -#if defined(HAVE_STRUCT_STAT_ST_CTIM) || \ 10 | - defined(HAVE_STRUCT_STAT_ST_MTIM) || \ 11 | - defined(HAVE_STRUCT_STAT_ST_ATIM) || \ 12 | - defined(HAVE_STRUCT_STAT_ST_ATIMESPEC) || \ 13 | - defined(HAVE_STRUCT_STAT_ST_MTIMESPEC) || \ 14 | - defined(HAVE_STRUCT_STAT_ST_CTIMESPEC) 15 | import Data.Int 16 | import Data.Ratio 17 | -#endif 18 | import Data.Time.Clock.POSIX 19 | import System.Posix.Internals 20 | import Foreign.C 21 | -------------------------------------------------------------------------------- /patches/haskeline-use_termios.h: -------------------------------------------------------------------------------- 1 | From c075607aa2e0905c48dcb90b87b6a88adaa67bde Mon Sep 17 00:00:00 2001 2 | From: Nathan 3 | Date: Sun, 13 Jan 2013 14:57:09 +0100 4 | Subject: [PATCH] add terminfo 5 | 6 | --- 7 | haskeline.cabal | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/haskeline.cabal b/haskeline.cabal 11 | index 2665ae8..7f049a5 100644 12 | --- a/haskeline.cabal 13 | +++ b/haskeline.cabal 14 | @@ -114,6 +114,7 @@ Library 15 | Build-depends: unix>=2.0 && < 2.7 16 | -- unix-2.3 doesn't build on ghc-6.8.1 or earlier 17 | -- Use manual encoding/decoding on ghc<7.4 18 | + cpp-options: -DUSE_TERMIOS_H 19 | if flag (legacy-encoding) || impl(ghc<7.4) { 20 | c-sources: cbits/h_iconv.c 21 | includes: h_iconv.h 22 | -- 23 | 1.7.10.4 24 | -------------------------------------------------------------------------------- /patches/unix-posix_vdisable.patch: -------------------------------------------------------------------------------- 1 | diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc 2 | index 5d718a8..9d077bf 100644 3 | --- a/System/Posix/Terminal/Common.hsc 4 | +++ b/System/Posix/Terminal/Common.hsc 5 | @@ -272,7 +272,7 @@ controlChar termios cc = unsafePerformIO $ do 6 | withTerminalAttributes termios $ \p -> do 7 | let c_cc = (#ptr struct termios, c_cc) p 8 | val <- peekElemOff c_cc (cc2Word cc) 9 | - if val == ((#const _POSIX_VDISABLE)::CCc) 10 | + if val == ((#const '\0')::CCc) 11 | then return Nothing 12 | else return (Just (chr (fromEnum val))) 13 | 14 | @@ -290,7 +290,7 @@ withoutCC :: TerminalAttributes 15 | withoutCC termios cc = unsafePerformIO $ do 16 | withNewTermios termios $ \p -> do 17 | let c_cc = (#ptr struct termios, c_cc) p 18 | - pokeElemOff c_cc (cc2Word cc) ((#const _POSIX_VDISABLE) :: CCc) 19 | + pokeElemOff c_cc (cc2Word cc) ((#const '\0') :: CCc) 20 | 21 | inputTime :: TerminalAttributes -> Int 22 | inputTime termios = unsafePerformIO $ do 23 | -------------------------------------------------------------------------------- /mirror: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | set -e 4 | 5 | OTHER="$1" 6 | 7 | if ! [ -d "$OTHER" ] ; then 8 | echo usage: $0 {existing git checkout dir} 9 | exit 1 10 | else 11 | pushd "$OTHER" > /dev/null 12 | OTHER="$(pwd)" 13 | popd > /dev/null 14 | fi 15 | 16 | # Basedir configuration 17 | BASEDIR="$(dirname $0)" 18 | cd "$BASEDIR" 19 | BASEDIR="$(pwd)" 20 | MIRROR="$BASEDIR/mirror.git" 21 | 22 | if ! [ -e "$MIRROR" ] ; then 23 | git init --bare "$MIRROR" 24 | fi 25 | 26 | function mirror_repo() { 27 | URL="$1" 28 | REPONAME="$2" 29 | git --git-dir "$MIRROR" config --unset remote.${REPONAME}.uri || true 30 | git --git-dir "$MIRROR" config remote.${REPONAME}.url "$URL" 31 | git --git-dir "$MIRROR" config --unset remote.${REPONAME}.fetch || true 32 | git --git-dir "$MIRROR" config --add remote.${REPONAME}.fetch "+refs/heads/*:refs/heads/${REPONAME}/*" 33 | git --git-dir "$MIRROR" config --add remote.${REPONAME}.fetch "+refs/tags/*:refs/tags/${REPONAME}/*" 34 | git --git-dir "$MIRROR" config remote.${REPONAME}.tagopt "--no-tag" 35 | git --git-dir "$MIRROR" fetch "$REPONAME" 36 | } 37 | 38 | for gitdir in $(find "$OTHER" -name .git) ; do 39 | OTHER_URL="$(git --git-dir "$gitdir" config remote.origin.url)" 40 | REPONAME="$(basename -s .git "$OTHER_URL")" 41 | mirror_repo "$gitdir" "$REPONAME" 42 | mirror_repo "$OTHER_URL" "$REPONAME" 43 | done 44 | 45 | mirror_repo "https://github.com/ironsteel/iconv-android.git" "iconv" 46 | 47 | git --git-dir "$MIRROR" gc --aggressive 48 | -------------------------------------------------------------------------------- /patches/cabal-wrapper: -------------------------------------------------------------------------------- 1 | BIN_GHC=$NDK/bin/$GHC_TARGET-ghc 2 | BIN_GHC_PKG=$NDK/bin/$GHC_TARGET-ghc-pkg 3 | BIN_HSC2HS=$NDK/bin/$GHC_TARGET-hsc2hs 4 | BIN_LD=$NDK/bin/$NDK_TARGET-ld 5 | CC=$NDK/bin/$NDK_TARGET-gcc 6 | PKGDB=$NDK/lib/$GHC_TARGET-ghc-$GHC_RELEASE/package.conf.d 7 | export HOME=$NDK 8 | 9 | mkdir -p $NDK/cabal 10 | [ -e "$NDK/.cabal" ] || ln -s $NDK/cabal $NDK/.cabal 11 | 12 | if [ "$1" = install ] ; then 13 | exec $BIN_CABAL \ 14 | -j1 \ 15 | --with-compiler=$BIN_GHC \ 16 | --with-gcc=$CC \ 17 | --with-ghc=$BIN_GHC \ 18 | --with-ghc-pkg=$BIN_GHC_PKG \ 19 | --with-ld=$BIN_LD \ 20 | --with-hsc2hs=$BIN_HSC2HS \ 21 | --package-db=$PKGDB \ 22 | --hsc2hs-options=--cross-compile \ 23 | --configure-option=--host=$NDK_TARGET \ 24 | "$@" 25 | elif [ "$1" = configure ] ; then 26 | exec $BIN_CABAL \ 27 | --with-compiler=$BIN_GHC \ 28 | --with-gcc=$CC \ 29 | --with-ghc=$BIN_GHC \ 30 | --with-ghc-pkg=$BIN_GHC_PKG \ 31 | --with-ld=$BIN_LD \ 32 | --with-hsc2hs=$BIN_HSC2HS \ 33 | --package-db=$PKGDB \ 34 | --hsc2hs-options=--cross-compile \ 35 | --configure-option=--host=$NDK_TARGET \ 36 | "$@" 37 | elif [ "$1" = build ] ; then 38 | exec $BIN_CABAL \ 39 | -j1 \ 40 | --with-gcc=$CC \ 41 | --with-ghc=$BIN_GHC \ 42 | --with-ghc-pkg=$BIN_GHC_PKG \ 43 | --with-ld=$BIN_LD \ 44 | --with-hsc2hs=$BIN_HSC2HS \ 45 | --hsc2hs-options=--cross-compile \ 46 | "$@" 47 | else 48 | exec $BIN_CABAL "$@" 49 | fi 50 | -------------------------------------------------------------------------------- /patches/ghc-enable-stage1-th.patch: -------------------------------------------------------------------------------- 1 | diff --git a/compiler/ghc.mk b/compiler/ghc.mk 2 | index 1a032cc..29505df 100644 3 | --- a/compiler/ghc.mk 4 | +++ b/compiler/ghc.mk 5 | @@ -299,6 +299,7 @@ compiler_stage2_CONFIGURE_OPTS += --flags=ncg 6 | endif 7 | 8 | ifeq "$(GhcWithInterpreter)" "YES" 9 | +compiler_stage1_CONFIGURE_OPTS += --flags=ghci 10 | compiler_stage2_CONFIGURE_OPTS += --flags=ghci 11 | 12 | ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO" 13 | diff --git a/ghc.mk b/ghc.mk 14 | index eaee872..f9c95a8 100644 15 | --- a/ghc.mk 16 | +++ b/ghc.mk 17 | @@ -362,6 +362,7 @@ PACKAGES_STAGE0 = Cabal/Cabal hpc bin-package-db hoopl transformers 18 | ifeq "$(Windows_Host)" "NO" 19 | ifneq "$(HostOS_CPP)" "ios" 20 | PACKAGES_STAGE0 += terminfo 21 | +PACKAGES_STAGE0 += template-haskell 22 | endif 23 | endif 24 | 25 | diff --git a/mk/config.mk.in b/mk/config.mk.in 26 | index 5ef1f5c..95cbe5c 100644 27 | --- a/mk/config.mk.in 28 | +++ b/mk/config.mk.in 29 | @@ -178,7 +178,7 @@ GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised 30 | # Whether to include GHCi in the compiler. Depends on whether the RTS linker 31 | # has support for this OS/ARCH combination. 32 | 33 | -OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu))) 34 | +OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux linux_android solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu))) 35 | ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc sparc64 arm))) 36 | 37 | ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES" 38 | -------------------------------------------------------------------------------- /patches/iconv-fix-time_t.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/iconv.c b/src/iconv.c 2 | index 4bd4121..b49bc54 100644 3 | --- a/src/iconv.c 4 | +++ b/src/iconv.c 5 | @@ -19,6 +19,7 @@ 6 | # define ICONV_CONST 7 | #endif 8 | 9 | +#include 10 | #include 11 | #include 12 | #include 13 | diff --git a/srclib/areadlink.c b/srclib/areadlink.c 14 | index 4e770eb..445cdba 100644 15 | --- a/srclib/areadlink.c 16 | +++ b/srclib/areadlink.c 17 | @@ -21,6 +21,8 @@ 18 | 19 | #include 20 | 21 | +#include 22 | + 23 | /* Specification. */ 24 | #include "areadlink.h" 25 | 26 | diff --git a/srclib/error.c b/srclib/error.c 27 | index 3177bd5..aebfb21 100644 28 | --- a/srclib/error.c 29 | +++ b/srclib/error.c 30 | @@ -23,6 +23,7 @@ 31 | 32 | #include "error.h" 33 | 34 | +#include 35 | #include 36 | #include 37 | #include 38 | diff --git a/srclib/stdint.in.h b/srclib/stdint.in.h 39 | index 53aa34a..3ac1ed0 100644 40 | --- a/srclib/stdint.in.h 41 | +++ b/srclib/stdint.in.h 42 | @@ -29,6 +29,16 @@ 43 | . */ 44 | #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H 45 | 46 | +/* On Android (Bionic libc), includes this file before 47 | + having defined 'time_t'. Therefore in this case avoid including 48 | + other system header files; just include the system's . 49 | + Ideally we should test __BIONIC__ here, but it is only defined after 50 | + has been included; hence test __ANDROID__ instead. */ 51 | +#if defined __ANDROID__ \ 52 | + && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_ 53 | +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ 54 | +#else 55 | + 56 | /* Get those types that are already defined in other system include 57 | files, so that we can "#define int8_t signed char" below without 58 | worrying about a later system include file containing a "typedef 59 | @@ -564,4 +574,5 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 60 | #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ 61 | 62 | #endif /* _GL_STDINT_H */ 63 | +#endif /* !(defined __ANDROID__ && ...) */ 64 | #endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ 65 | diff --git a/srclib/xstrdup.c b/srclib/xstrdup.c 66 | index 9ad1b94..10838eb 100644 67 | --- a/srclib/xstrdup.c 68 | +++ b/srclib/xstrdup.c 69 | @@ -16,6 +16,8 @@ 70 | 71 | #include 72 | 73 | +#include 74 | + 75 | /* Specification. */ 76 | #include "xalloc.h" 77 | 78 | -------------------------------------------------------------------------------- /patches/hsc2hs-offset.patch: -------------------------------------------------------------------------------- 1 | From a6c750e564d0365f84df2caa657cbb1673339d8e Mon Sep 17 00:00:00 2001 2 | From: Nathan 3 | Date: Sun, 13 Jan 2013 13:31:54 +0100 4 | Subject: [PATCH] on android offsetof cannot be used as constant (when 5 | termios.h is included) 6 | 7 | --- 8 | CrossCodegen.hs | 16 ++++++++-------- 9 | 1 file changed, 8 insertions(+), 8 deletions(-) 10 | 11 | diff --git a/CrossCodegen.hs b/CrossCodegen.hs 12 | index 7fbd20a..af44e64 100644 13 | --- a/CrossCodegen.hs 14 | +++ b/CrossCodegen.hs 15 | @@ -208,13 +208,13 @@ outputSpecial :: (String -> TestMonad ()) -> ZCursor Token -> TestMonad () 16 | outputSpecial output (z@ZCursor {zCursor=Special pos@(SourcePos file line) key value}) = 17 | case key of 18 | "const" -> outputConst value show 19 | - "offset" -> outputConst ("offsetof(" ++ value ++ ")") (\i -> "(" ++ show i ++ ")") 20 | + "offset" -> outputConst ("__builtin_offsetof(" ++ value ++ ")") (\i -> "(" ++ show i ++ ")") 21 | "size" -> outputConst ("sizeof(" ++ value ++ ")") (\i -> "(" ++ show i ++ ")") 22 | - "peek" -> outputConst ("offsetof(" ++ value ++ ")") 23 | + "peek" -> outputConst ("__builtin_offsetof(" ++ value ++ ")") 24 | (\i -> "(\\hsc_ptr -> peekByteOff hsc_ptr " ++ show i ++ ")") 25 | - "poke" -> outputConst ("offsetof(" ++ value ++ ")") 26 | + "poke" -> outputConst ("__builtin_offsetof(" ++ value ++ ")") 27 | (\i -> "(\\hsc_ptr -> pokeByteOff hsc_ptr " ++ show i ++ ")") 28 | - "ptr" -> outputConst ("offsetof(" ++ value ++ ")") 29 | + "ptr" -> outputConst ("__builtin_offsetof(" ++ value ++ ")") 30 | (\i -> "(\\hsc_ptr -> hsc_ptr `plusPtr` " ++ show i ++ ")") 31 | "type" -> computeType z >>= output 32 | "enum" -> computeEnum z >>= output 33 | @@ -272,11 +272,11 @@ outValidityCheck :: Token -> Int -> String 34 | outValidityCheck s@(Special pos key value) uniq = 35 | case key of 36 | "const" -> checkValidConst value 37 | - "offset" -> checkValidConst ("offsetof(" ++ value ++ ")") 38 | + "offset" -> checkValidConst ("__builtin_offsetof(" ++ value ++ ")") 39 | "size" -> checkValidConst ("sizeof(" ++ value ++ ")") 40 | - "peek" -> checkValidConst ("offsetof(" ++ value ++ ")") 41 | - "poke" -> checkValidConst ("offsetof(" ++ value ++ ")") 42 | - "ptr" -> checkValidConst ("offsetof(" ++ value ++ ")") 43 | + "peek" -> checkValidConst ("__builtin_offsetof(" ++ value ++ ")") 44 | + "poke" -> checkValidConst ("__builtin_offsetof(" ++ value ++ ")") 45 | + "ptr" -> checkValidConst ("__builtin_offsetof(" ++ value ++ ")") 46 | "type" -> checkValidType 47 | "enum" -> checkValidEnum 48 | _ -> outHeaderCProg' s 49 | -- 50 | 1.7.10.4 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ghc-android 2 | =========== 3 | 4 | Build script for building ghc cross compilers targeting Android. This 5 | script wraps up all the hacks and tweaks that are currently needed to 6 | get a working ghc android crosscompiler. It will download the Android 7 | NDK, the iconv library, the ncurses library and GHC itself as 8 | required. If you already have the Android NDK you can put it in the 9 | tarfiles directory and the build script will reuse it. If you already 10 | have a ghc clone, you can use the mirror script to avoid doing a full 11 | re-download during cloning. 12 | 13 | Before starting a build you will need a working gcc, git, happy, alex 14 | and (at least for arm builds) llvm-3.2 on the build host. You will also 15 | need enough 32 bit support to run the Android NDK compiler. Usually 16 | just glibc, libstdc++ and zlib should be enough. 17 | 18 | To build a ghc-android compiler execute: 19 | 20 | ./build 21 | 22 | By default this should give you a android-14 arm-linux-androideabi-4.7 23 | compiler at: 24 | 25 | ~/.ghc/android-14/arm-linux-androideabi-4.7/bin 26 | 27 | Add this directory to your PATH to use the cross compiler with the 28 | full target prefix. 29 | 30 | Or add: 31 | 32 | ~/.ghc/android-14/arm-linux-androideabi-4.7/arm-linux-androideabi/bin 33 | 34 | to your PATH to use it without prefixes. There is also a cabal wrapper 35 | script in this directory that will cross compile packages with cable 36 | and add them to the ghc package-db. 37 | 38 | You can change various variables via the environment to give you other 39 | configurations. 40 | 41 | There is also a pre-configured x86 variation you can build like this: 42 | 43 | ./build --x86 44 | 45 | If you want to build more than one configuration it is worth building 46 | a local mirror repo to speed up subsequent ghc clones. To build a 47 | mirror run: 48 | 49 | ./mirror {path to existing ghc clone} 50 | 51 | During ./build the GHC repo is cloned into appropriate path, e.g.: 52 | 53 | ./build-android-14-arm-linux-androideabi-4.7/ghc 54 | 55 | So the mirror path can become this: 56 | 57 | ./mirror build-android-14-arm-linux-androideabi-4.7/ghc 58 | 59 | This will build a mirror that will automatically be used by the build 60 | script to speed up cloning. 61 | 62 | The following configurations have been tested on an up-to-date Arch 63 | Linux install and are known to work: 64 | 65 | * ghc-android-14-arm-linux-androideabi-4.7 66 | * ghc-android-14-x86-4.7 67 | 68 | Comments, patches and success reports are welcome. 69 | 70 | ## tested working build with Debian stable 71 | 72 | Running these commands will make a Debian stable chroot and build in there. 73 | 74 | debootstrap --arch=i386 stable debian-stable-android 75 | chroot debian-stable-android 76 | 77 | mount -t proc proc /proc 78 | echo "deb-src http://ftp.us.debian.org/debian stable main" >> /etc/apt/sources.list 79 | apt-get update 80 | apt-get -y install build-essential ghc git libncurses5-dev cabal-install 81 | apt-get -y install llvm-3.0 # not 3.1; buggy on arm. 3.2 is ok too 82 | apt-get -y install ca-certificates curl file m4 autoconf zlib1g-dev 83 | apt-get -y install libgnutls-dev libxml2-dev libgsasl7-dev pkg-config 84 | apt-get -y install python c2hs 85 | wget http://snapshot.debian.org/archive/debian/20130903T155330Z/pool/main/a/automake-1.14/automake_1.14-1_all.deb 86 | dpkg -i automake*.deb 87 | rm *.deb 88 | adduser androidbuilder 89 | su androidbuilder 90 | 91 | cd 92 | rm -rf .ghc .cabal 93 | cabal update 94 | cabal install happy alex --bindir=$HOME/bin 95 | PATH=$HOME/bin:$PATH 96 | export PATH 97 | git clone https://github.com/joeyh/ghc-android 98 | cd ghc-android 99 | git checkout stable-ghc-snapshot 100 | ./build 101 | --------------------------------------------------------------------------------