0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 14:13:36 +00:00
termux-packages/packages/ghc-libs/correct-host-triplet.patch
Aditya Alok ef9d15744e
ghc-libs: Bump to 9.2.5
- disable static splitting of package (see #1280)

Signed-off-by: Aditya Alok <alok@termux.dev>
2023-02-21 03:09:32 +05:30

34 lines
1.5 KiB
Diff

--- ghc.orig/libraries/Cabal/Cabal/src/Distribution/Simple.hs 2022-11-07 01:11:17.000000000 +0530
+++ ghc.mod/libraries/Cabal/Cabal/src/Distribution/Simple.hs 2022-11-10 13:28:41.695682098 +0530
@@ -108,10 +108,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.
@@ -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