termux-packages/packages/haskell-cabal/correct-host-triplet.patch
Aditya Alok 80f7a2a0df refactor(ghc-libs): rename ghc to ghc-libs
- seperate ghc libraries from ghc bins
- enable dynamic libs for ghc
  * ghc-libs is further seperated into static and dynamic packages
  * enabling dynamic support will reduce package size as well as there
    performance  on device.

closes #5973

Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
2022-03-09 10:01:57 +09:00

38 lines
1.6 KiB
Diff

From: Aditya Alok <dev.aditya.alok@gmail.com>
Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
--- Cabal-3.6.2.0/src/Distribution/Simple.hs 2001-09-09 07:16:40.000000000 +0530
+++ Cabal-3.6.2.0-patch/src/Distribution/Simple.hs 2022-02-17 23:18:09.477872143 +0530
@@ -108,10 +108,20 @@
import Distribution.Compat.Environment (getEnvironment)
import Distribution.Compat.GetShortPathName (getShortPathName)
-import Data.List (unionBy, (\\))
+import Data.List (unionBy, drop, take, isInfixOf, (\\))
import Distribution.PackageDescription.Parsec
+correctHostTriplet :: String -> String
+correctHostTriplet s = do
+ if isInfixOf "-android" s
+ then
+ let arch = take (length s -8) ( drop 0 s ) -- drop "-android"
+ in
+ if arch == "arm" then "armv7a" else arch ++ "-linux-"
+ ++ if arch == "arm" then "androideabi" else "android"
+ else s
+
-- | A simple implementation of @main@ for a Cabal setup script.
-- It reads the package description file using IO, and performs the
-- action specified on the command line.
@@ -722,7 +732,7 @@
overEnv = ("CFLAGS", Just cflagsEnv) :
[("PATH", Just pathEnv) | not (null extraPath)]
hp = hostPlatform lbi
- maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ show (pretty hp)]
+ maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ correctHostTriplet (show (pretty hp))]
args' = configureFile':args ++ ["CC=" ++ ccProgShort] ++ maybeHostFlag
shProg = simpleProgram "sh"
progDb = modifyProgramSearchPath