Skip to content

Commit

Permalink
Specify default exe extension on wasm32 to be .wasm
Browse files Browse the repository at this point in the history
Specify default exe extension on wasm32 to be .wasm, following the convention in other WebAssembly toolchains.
  • Loading branch information
TerrorJack committed Dec 13, 2022
1 parent 63b0f6f commit 5e2cdeb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Cabal/src/Distribution/Simple/BuildPaths.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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\"@.
Expand Down
7 changes: 4 additions & 3 deletions Cabal/src/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
_ -> [""]

-- ------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions changelog.d/pr-8633
Original file line number Diff line number Diff line change
@@ -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.
}

0 comments on commit 5e2cdeb

Please sign in to comment.