From 5e2cdebdada69393e6556fb3dcdb610fee6ee112 Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Tue, 13 Dec 2022 11:23:14 +0000 Subject: [PATCH] Specify default exe extension on wasm32 to be .wasm Specify default exe extension on wasm32 to be .wasm, following the convention in other WebAssembly toolchains. --- Cabal/src/Distribution/Simple/BuildPaths.hs | 5 +++-- Cabal/src/Distribution/Simple/Utils.hs | 7 ++++--- changelog.d/pr-8633 | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 changelog.d/pr-8633 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"] _ -> [""] -- ------------------------------------------------------------ diff --git a/changelog.d/pr-8633 b/changelog.d/pr-8633 new file mode 100644 index 00000000000..2aafda9a837 --- /dev/null +++ b/changelog.d/pr-8633 @@ -0,0 +1,7 @@ +synopsis: Specify default exe extension on wasm32 to be .wasm +packages: Cabal +prs: #8633 +issues: +description: { + Specify default exe extension on wasm32 to be .wasm, following the convention in other WebAssembly toolchains. +}