Hannes Siebenhandl pushed to branch wip/fendor/ghc-pkg-ospath at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • compiler/GHC/Driver/DynFlags.hs
    ... ... @@ -1208,6 +1208,7 @@ defaultFlags settings
    1208 1208
       = [ Opt_AutoLinkPackages,
    
    1209 1209
           Opt_DiagnosticsShowCaret,
    
    1210 1210
           Opt_EmbedManifest,
    
    1211
    +      Opt_WinLongPathAware,
    
    1211 1212
           Opt_FamAppCache,
    
    1212 1213
           Opt_GenManifest,
    
    1213 1214
           Opt_GhciHistory,
    

  • compiler/GHC/Driver/Flags.hs
    ... ... @@ -743,6 +743,7 @@ data GeneralFlag
    743 743
        | Opt_PrintBindContents
    
    744 744
        | Opt_GenManifest
    
    745 745
        | Opt_EmbedManifest
    
    746
    +   | Opt_WinLongPathAware
    
    746 747
        | Opt_SharedImplib
    
    747 748
        | Opt_BuildingCabalPackage
    
    748 749
        | Opt_IgnoreDotGhci
    

  • compiler/GHC/Driver/Session.hs
    ... ... @@ -2523,6 +2523,7 @@ fFlagsDeps = [
    2523 2523
       flagSpec "eager-blackholing"                Opt_EagerBlackHoling,
    
    2524 2524
       flagSpec "orig-thunk-info"                  Opt_OrigThunkInfo,
    
    2525 2525
       flagSpec "embed-manifest"                   Opt_EmbedManifest,
    
    2526
    +  flagSpec "win-aware-long-paths"             Opt_WinLongPathAware,
    
    2526 2527
       flagSpec "enable-rewrite-rules"             Opt_EnableRewriteRules,
    
    2527 2528
       flagSpec "enable-th-splice-warnings"        Opt_EnableThSpliceWarnings,
    
    2528 2529
       flagSpec "error-spans"                      Opt_ErrorSpans,
    

  • compiler/GHC/Linker/Windows.hs
    ... ... @@ -16,6 +16,7 @@ import System.Directory
    16 16
     
    
    17 17
     data ManifestOpts = ManifestOpts
    
    18 18
       { manifestEmbed :: !Bool    -- ^ Should the manifest be embedded in the binary with Windres
    
    19
    +  , manifestLongPathAware :: !Bool
    
    19 20
       , manifestTempdir :: TempDir
    
    20 21
       , manifestWindresConfig :: WindresConfig
    
    21 22
       , manifestObjectSuf :: String
    
    ... ... @@ -24,11 +25,45 @@ data ManifestOpts = ManifestOpts
    24 25
     initManifestOpts :: DynFlags -> ManifestOpts
    
    25 26
     initManifestOpts dflags = ManifestOpts
    
    26 27
       { manifestEmbed = gopt Opt_EmbedManifest dflags
    
    28
    +  , manifestLongPathAware = gopt Opt_WinLongPathAware dflags
    
    27 29
       , manifestTempdir = tmpDir dflags
    
    28 30
       , manifestWindresConfig = configureWindres dflags
    
    29 31
       , manifestObjectSuf = objectSuf dflags
    
    30 32
       }
    
    31 33
     
    
    34
    +manifestContents :: Bool -> FilePath -> String
    
    35
    +manifestContents longPathAware exe_filename =
    
    36
    +  concat $
    
    37
    +  [ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
    
    38
    +  , "  <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
    
    39
    +  , "  <assemblyIdentity version=\"1.0.0.0\"\n"
    
    40
    +  , "     processorArchitecture=\"X86\"\n"
    
    41
    +  , "     name=\"" ++ dropExtension exe_filename ++ "\"\n"
    
    42
    +  , "     type=\"win32\"/>\n\n"
    
    43
    +  , "  <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n"
    
    44
    +  , "    <security>\n"
    
    45
    +  , "      <requestedPrivileges>\n"
    
    46
    +  , "        <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n"
    
    47
    +  , "      </requestedPrivileges>\n"
    
    48
    +  , "    </security>\n"
    
    49
    +  , "  </trustInfo>\n"
    
    50
    +  ]
    
    51
    +  ++
    
    52
    +  (
    
    53
    +    if longPathAware
    
    54
    +      then
    
    55
    +        [ "  <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n"
    
    56
    +        , "    <windowsSettings xmlns:ws2=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">\n"
    
    57
    +        , "      <ws2:longPathAware>true</ws2:longPathAware>\n"
    
    58
    +        , "    </windowsSettings>\n"
    
    59
    +        , "  </application>\n"
    
    60
    +        ]
    
    61
    +      else
    
    62
    +        []
    
    63
    +  ) ++
    
    64
    +  [ "  </assembly>\n"
    
    65
    +  ]
    
    66
    +
    
    32 67
     maybeCreateManifest
    
    33 68
        :: Logger
    
    34 69
        -> TmpFs
    
    ... ... @@ -37,21 +72,7 @@ maybeCreateManifest
    37 72
        -> IO [FilePath] -- ^ extra objects to embed, maybe
    
    38 73
     maybeCreateManifest logger tmpfs opts exe_filename = do
    
    39 74
        let manifest_filename = exe_filename <.> "manifest"
    
    40
    -       manifest =
    
    41
    -         "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\
    
    42
    -         \  <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n\
    
    43
    -         \  <assemblyIdentity version=\"1.0.0.0\"\n\
    
    44
    -         \     processorArchitecture=\"X86\"\n\
    
    45
    -         \     name=\"" ++ dropExtension exe_filename ++ "\"\n\
    
    46
    -         \     type=\"win32\"/>\n\n\
    
    47
    -         \  <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n\
    
    48
    -         \    <security>\n\
    
    49
    -         \      <requestedPrivileges>\n\
    
    50
    -         \        <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n\
    
    51
    -         \        </requestedPrivileges>\n\
    
    52
    -         \       </security>\n\
    
    53
    -         \  </trustInfo>\n\
    
    54
    -         \</assembly>\n"
    
    75
    +       manifest = manifestContents (manifestLongPathAware opts) exe_filename
    
    55 76
     
    
    56 77
        writeFile manifest_filename manifest
    
    57 78
     
    

  • docs/users_guide/phases.rst
    ... ... @@ -1430,6 +1430,16 @@ for example).
    1430 1430
         See also :ghc-flag:`-pgmwindres ⟨cmd⟩` (:ref:`replacing-phases`) and
    
    1431 1431
         :ghc-flag:`-optwindres ⟨option⟩` (:ref:`forcing-options-through`).
    
    1432 1432
     
    
    1433
    +.. ghc-flag:: -fwin-aware-long-paths
    
    1434
    +    :shortdesc: Do not embed the manifest in the executable (Windows only)
    
    1435
    +    :type: dynamic
    
    1436
    +    :category: linking
    
    1437
    +
    
    1438
    +    .. index::
    
    1439
    +       single: windres
    
    1440
    +
    
    1441
    +    The manifest file that GHC
    
    1442
    +
    
    1433 1443
     .. ghc-flag:: -fno-shared-implib
    
    1434 1444
         :shortdesc: Don't generate an import library for a DLL (Windows only)
    
    1435 1445
         :type: dynamic