termux-packages/packages/ghc-libs/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>
--- ghc-8.10.7/libraries/Cabal/Cabal/Distribution/Simple.hs 2022-02-09 09:22:38.381445950 +0530
+++ ghc-8.10.7-patch/libraries/Cabal/Cabal/Distribution/Simple.hs 2022-03-05 12:03:02.509066261 +0530
@@ -105,10 +105,20 @@
import Distribution.Compat.Environment (getEnvironment)
import Distribution.Compat.GetShortPathName (getShortPathName)
-import Data.List (unionBy, (\\))
+import Data.List (unionBy, (\\), take, drop, 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.
@@ -754,7 +764,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