Hannes Siebenhandl pushed to branch wip/fendor/ghc-pkg-ospath at Glasgow Haskell Compiler / GHC Commits: 1bee130a by Fendor at 2026-02-25T22:23:53+01:00 Long Path aware manifest - - - - - 5 changed files: - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Linker/Windows.hs - docs/users_guide/phases.rst Changes: ===================================== compiler/GHC/Driver/DynFlags.hs ===================================== @@ -1208,6 +1208,7 @@ defaultFlags settings = [ Opt_AutoLinkPackages, Opt_DiagnosticsShowCaret, Opt_EmbedManifest, + Opt_WinLongPathAware, Opt_FamAppCache, Opt_GenManifest, Opt_GhciHistory, ===================================== compiler/GHC/Driver/Flags.hs ===================================== @@ -743,6 +743,7 @@ data GeneralFlag | Opt_PrintBindContents | Opt_GenManifest | Opt_EmbedManifest + | Opt_WinLongPathAware | Opt_SharedImplib | Opt_BuildingCabalPackage | Opt_IgnoreDotGhci ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -2523,6 +2523,7 @@ fFlagsDeps = [ flagSpec "eager-blackholing" Opt_EagerBlackHoling, flagSpec "orig-thunk-info" Opt_OrigThunkInfo, flagSpec "embed-manifest" Opt_EmbedManifest, + flagSpec "win-aware-long-paths" Opt_WinLongPathAware, flagSpec "enable-rewrite-rules" Opt_EnableRewriteRules, flagSpec "enable-th-splice-warnings" Opt_EnableThSpliceWarnings, flagSpec "error-spans" Opt_ErrorSpans, ===================================== compiler/GHC/Linker/Windows.hs ===================================== @@ -13,9 +13,11 @@ import GHC.Utils.Logger import System.FilePath import System.Directory +import Debug.Trace data ManifestOpts = ManifestOpts { manifestEmbed :: !Bool -- ^ Should the manifest be embedded in the binary with Windres + , manifestLongPathAware :: !Bool , manifestTempdir :: TempDir , manifestWindresConfig :: WindresConfig , manifestObjectSuf :: String @@ -24,11 +26,45 @@ data ManifestOpts = ManifestOpts initManifestOpts :: DynFlags -> ManifestOpts initManifestOpts dflags = ManifestOpts { manifestEmbed = gopt Opt_EmbedManifest dflags + , manifestLongPathAware = gopt Opt_WinLongPathAware dflags , manifestTempdir = tmpDir dflags , manifestWindresConfig = configureWindres dflags , manifestObjectSuf = objectSuf dflags } +manifestContents :: Bool -> FilePath -> String +manifestContents longPathAware exe_filename = + concat $ + [ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + , " <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n" + , " <assemblyIdentity version=\"1.0.0.0\"\n" + , " processorArchitecture=\"X86\"\n" + , " name=\"" ++ dropExtension exe_filename ++ "\"\n" + , " type=\"win32\"/>\n\n" + , " <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n" + , " <security>\n" + , " <requestedPrivileges>\n" + , " <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n" + , " </requestedPrivileges>\n" + , " </security>\n" + , " </trustInfo>\n" + ] + ++ + ( + if longPathAware + then + [ " <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n" + , " <windowsSettings xmlns:ws2=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">\n" + , " <ws2:longPathAware>true</ws2:longPathAware>\n" + , " </windowsSettings>\n" + , " </application>\n" + ] + else + [] + ) ++ + [ " </assembly>\n" + ] + maybeCreateManifest :: Logger -> TmpFs @@ -37,22 +73,9 @@ maybeCreateManifest -> IO [FilePath] -- ^ extra objects to embed, maybe maybeCreateManifest logger tmpfs opts exe_filename = do let manifest_filename = exe_filename <.> "manifest" - manifest = - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\ - \ <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n\ - \ <assemblyIdentity version=\"1.0.0.0\"\n\ - \ processorArchitecture=\"X86\"\n\ - \ name=\"" ++ dropExtension exe_filename ++ "\"\n\ - \ type=\"win32\"/>\n\n\ - \ <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n\ - \ <security>\n\ - \ <requestedPrivileges>\n\ - \ <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n\ - \ </requestedPrivileges>\n\ - \ </security>\n\ - \ </trustInfo>\n\ - \</assembly>\n" - + manifest = manifestContents (manifestLongPathAware opts) exe_filename + traceM "XML MANIFEST" + traceM manifest writeFile manifest_filename manifest -- Windows will find the manifest file if it is named ===================================== docs/users_guide/phases.rst ===================================== @@ -1430,6 +1430,16 @@ for example). See also :ghc-flag:`-pgmwindres ⟨cmd⟩` (:ref:`replacing-phases`) and :ghc-flag:`-optwindres ⟨option⟩` (:ref:`forcing-options-through`). +.. ghc-flag:: -fwin-aware-long-paths + :shortdesc: Do not embed the manifest in the executable (Windows only) + :type: dynamic + :category: linking + + .. index:: + single: windres + + The manifest file that GHC + .. ghc-flag:: -fno-shared-implib :shortdesc: Don't generate an import library for a DLL (Windows only) :type: dynamic View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bee130ab8a34b8060725e15d4142ea3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bee130ab8a34b8060725e15d4142ea3... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Hannes Siebenhandl (@fendor)