From 4454816746bb6c96c90e111aa4ada159fac27fe6 Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Tue, 13 Dec 2022 11:17:30 +0000 Subject: [PATCH] Specify default exe extension on wasm32 to be .wasm --- Cabal/src/Distribution/Simple/BuildPaths.hs | 5 +++-- Cabal/src/Distribution/Simple/Utils.hs | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cabal/src/Distribution/Simple/BuildPaths.hs b/Cabal/src/Distribution/Simple/BuildPaths.hs index 733953747c8..078633874d1 100644 --- a/Cabal/src/Distribution/Simple/BuildPaths.hs +++ b/Cabal/src/Distribution/Simple/BuildPaths.hs @@ -235,8 +235,9 @@ mkGenericSharedBundledLibName platform comp lib -- | Default extension for executable files on the current platform. -- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2) exeExtension :: Platform -> String -exeExtension (Platform _arch os) = case os of - Windows -> "exe" +exeExtension platform = case platform of + Platform _ Windows -> "exe" + Platform Wasm32 _ -> "wasm" _ -> "" -- | Extension for object files. For GHC the extension is @\"o\"@. diff --git a/Cabal/src/Distribution/Simple/Utils.hs b/Cabal/src/Distribution/Simple/Utils.hs index 6bf0729410a..3fb6f56c738 100644 --- a/Cabal/src/Distribution/Simple/Utils.hs +++ b/Cabal/src/Distribution/Simple/Utils.hs @@ -1535,12 +1535,13 @@ dropExeExtension filepath = -- | List of possible executable file extensions on the current build -- platform. exeExtensions :: [String] -exeExtensions = case buildOS of +exeExtensions = case (buildArch, buildOS) of -- Possible improvement: on Windows, read the list of extensions from the -- PATHEXT environment variable. By default PATHEXT is ".com; .exe; .bat; -- .cmd". - Windows -> ["", "exe"] - Ghcjs -> ["", "exe"] + (_, Windows) -> ["", "exe"] + (_, Ghcjs) -> ["", "exe"] + (Wasm32, _) -> ["", "wasm"] _ -> [""] -- ------------------------------------------------------------