From: Aditya Alok Signed-off-by: Aditya Alok --- 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