Skip to content

Commit 2309d2c

Browse files
andreabedinihasufell
authored andcommitted
fix: add platform-specific executable extension to build output paths
• Import exeExtension from Distribution.Simple.BuildPaths to determine correct executable naming by platform • Extract platform information from toolchain configuration during build orchestration • Apply platform-specific file extension (e.g., .exe on Windows) when constructing executable paths in build output • Refactor variable naming for clarity (exe → exeName) to distinguish filename base from full executable path • Normalize import formatting for consistency
1 parent bc52b09 commit 2309d2c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cabal-install/src/Distribution/Client/ProjectOrchestration.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ import Distribution.Utils.LogProgress
209209
import Distribution.Utils.NubList
210210
( fromNubList
211211
)
212-
import Distribution.Utils.Path (makeSymbolicPath, (</>))
212+
import Distribution.Utils.Path (makeSymbolicPath, (</>), (<.>))
213213
import Distribution.Verbosity
214214
#ifdef MIN_VERSION_unix
215-
import System.Posix.Signals (sigKILL, sigSEGV)
216-
215+
import System.Posix.Signals (sigKILL, sigSEGV)
217216
#endif
217+
import Distribution.Simple.BuildPaths (exeExtension)
218218

219219
-- | Tracks what command is being executed, because we need to hide this somewhere
220220
-- for cases that need special handling (usually for error reporting).
@@ -545,9 +545,12 @@ installExecutables
545545
, pkg `Set.member` packagesDefinitelyUpToDate postBuildStatus
546546
, Just (InstallPlan.Configured elab) <- [InstallPlan.lookup elaboratedPlanOriginal pkg]
547547
, (ComponentTarget (CExeName cname) _subtarget, _targetSelectors) <- targets
548-
, let exe = unUnqualComponentName cname
549-
, let dir = binDirectoryFor distDirLayout elaboratedShared elab exe
548+
, let platform = toolchainPlatform (getStage toolchains (elabStage elab))
549+
, let exeName = unUnqualComponentName cname
550+
, let dir = binDirectoryFor distDirLayout elaboratedShared elab exeName
551+
, let exe = exeName <.> exeExtension platform
550552
]
553+
toolchains = pkgConfigToolchains elaboratedShared
551554

552555
-- Note that it is a deliberate design choice that the 'buildTargets' is
553556
-- not passed to phase 1, and the various bits of input config is not

0 commit comments

Comments
 (0)