diff options
author | tomsmeding <tom.smeding@gmail.com> | 2022-07-16 23:00:09 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2022-07-16 23:00:09 +0200 |
commit | 35a8d735cf66ac3a8867247b3f1a734af2add2ab (patch) | |
tree | 48750d56028ad39338e5cc69524b5b3deeceefaa /notes.txt |
Initial
Diffstat (limited to 'notes.txt')
-rw-r--r-- | notes.txt | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..02a2bc4 --- /dev/null +++ b/notes.txt @@ -0,0 +1,76 @@ +# Getting a statically-linked cabal-install in termux + +Be sure to have lots of free RAM; building the Cabal library from source takes roughly 4.5GiB at peak. Force stop apps if needed. + +apt install ghc ghc-libs-static +apt install cabal-install + +Check using `dpkg -L ghc-libs-static' which libraries have static libs available +Copy the .conf files for just those libraries from /data/data/com.termux/files/usr/lib/ghc-8.10.7/package.conf.d/ into a new direcrory, ghc-boot-pkgdb + +In ghc-boot-pkgdb, run `ghc-pkg recache` + +cat >ghc-shim.sh <<EOF +#!/usr/bin/env bash +if [[ $# = 1 && $1 = --print-global-package-db ]]; then + echo /data/data/com.termux/files/home/ghc-boot-pkgdb +else + #echo >/dev/tty "!! ghc $*" + ghc "$@" +fi +EOF + +cat >ghc-pkg-shim.sh <<EOF +#!/usr/bin/env bash +#echo >/dev/tty "!! ghc-pkg $*" +args=() +for arg; do + if [[ $arg != --global ]]; then + args[${#args[@]}]="$arg" + fi +done +ghc-pkg --package-db /data/data/com.termux/files/home/ghc-boot-pkgdb "${args[@]}" +EOF + +Make a new directory 'cbl', and in that directory: + +cabal get resolv +cabal get cabal-install +cat >cabal.project <<EOF +packages: + resolv-0.1.2.0/ + cabal-install-3.6.2.0/ +EOF +cd resolv-0.1.2.0 +patch -p1 <<EOF # this is https://raw.githubusercontent.com/termux/termux-packages/master/packages/haskell-resolv/hs_resolv.patch +--- resolv-0.1.2.0/cbits/hs_resolv.h 2001-09-09 07:16:40.000000000 +0530 ++++ resolv-0.1.2.0-patch/cbits/hs_resolv.h 2022-02-03 20:54:49.602546255 +0530 +@@ -84,12 +84,8 @@ + { + assert(!s); + +- if (!(_res.options & RES_INIT)) { + int rc = res_init(); + if (rc) return rc; +- } +- +- _res.options |= RES_USE_DNSSEC | RES_USE_EDNS0; + + return 0; + } +@@ -112,7 +108,7 @@ + { + assert(!s); + +- return res_send(msg, msglen, answer, anslen); ++ return -1; + } + + inline static int +EOF +cd .. +cabal install -w ../ghc-shim.sh --with-hc-pkg=../ghc-pkg-shim.sh cabal-install + +# Remove the extraneous dynamic libs that were installed, so that our system is stable again +apt remove cabal-install +apt autoremove |