| ... |
... |
@@ -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
|
|