Skip to content

Commit cb2b639

Browse files
authored
Merge pull request #8633 from type-dance/wasm-ext-wasm
Specify default exe extension on wasm32 to be .wasm
2 parents 30f8a46 + ed407b1 commit cb2b639

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

Cabal/src/Distribution/Simple/BuildPaths.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ mkGenericSharedBundledLibName platform comp lib
235235
-- | Default extension for executable files on the current platform.
236236
-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2)
237237
exeExtension :: Platform -> String
238-
exeExtension (Platform _arch os) = case os of
239-
Windows -> "exe"
238+
exeExtension platform = case platform of
239+
Platform _ Windows -> "exe"
240+
Platform Wasm32 _ -> "wasm"
240241
_ -> ""
241242

242243
-- | Extension for object files. For GHC the extension is @\"o\"@.

Cabal/src/Distribution/Simple/Utils.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,12 +1535,13 @@ dropExeExtension filepath =
15351535
-- | List of possible executable file extensions on the current build
15361536
-- platform.
15371537
exeExtensions :: [String]
1538-
exeExtensions = case buildOS of
1538+
exeExtensions = case (buildArch, buildOS) of
15391539
-- Possible improvement: on Windows, read the list of extensions from the
15401540
-- PATHEXT environment variable. By default PATHEXT is ".com; .exe; .bat;
15411541
-- .cmd".
1542-
Windows -> ["", "exe"]
1543-
Ghcjs -> ["", "exe"]
1542+
(_, Windows) -> ["", "exe"]
1543+
(_, Ghcjs) -> ["", "exe"]
1544+
(Wasm32, _) -> ["", "wasm"]
15441545
_ -> [""]
15451546

15461547
-- ------------------------------------------------------------

changelog.d/pr-8633

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
synopsis: Specify default exe extension on wasm32 to be .wasm
2+
packages: Cabal
3+
prs: #8633
4+
issues:
5+
description: {
6+
Specify default exe extension on wasm32 to be .wasm, following the convention in other WebAssembly toolchains.
7+
}

0 commit comments

Comments
 (0)