0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std
Ryan Liptak 5f15acc463 Add preliminary support for Windows .manifest files
An embedded manifest file is really just XML data embedded as a RT_MANIFEST resource (ID = 24). Typically, the Windows-only 'Manifest Tool' (`mt.exe`) is used to embed manifest files, and `mt.exe` also seems to perform some transformation of the manifest data before embedding, but in testing it doesn't seem like the transformations are necessary to get the intended result.

So, to handle embedding manifest files, Zig now takes the following approach:

- Generate a .rc file with the contents `1 24 "path-to-manifest.manifest"`
- Compile that generated .rc file into a .res file
- Link the .res file into the final binary

This effectively achieves the same thing as `mt.exe` minus the validation/transformations of the XML data that it performs.

How this is used:

On the command line:
```
zig build-exe main.zig main.manifest
```
(on the command line, specifying a .manifest file when the target object format is not COFF is an error)

or in build.zig:

```
const exe = b.addExecutable(.{
    .name = "manifest-test",
    .root_source_file = .{ .path = "main.zig" },
    .target = target,
    .optimize = optimize,
    .win32_manifest = .{ .path = "main.manifest" },
});
```
(in build.zig, the manifest file is ignored if the target object format is not COFF)

Note: Currently, only one manifest file can be specified per compilation. This is because the ID of the manifest resource is currently always 1. Specifying multiple manifests could be supported if a way for the user to specify an ID for each manifest is added (manifest IDs must be a u16).

Closes #17406

options
History 2023-10-15 13:33:16 -07:00
..
atomic write function types consistently with a space before fn keyword 2023-09-19 15:15:05 +03:00
Build Add preliminary support for Windows .manifest files 2023-10-15 13:33:16 -07:00
c Merge pull request #17341 from rzezeski/illumos-updates 2023-10-03 11:04:41 -07:00
compress all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
crypto Add illumos OS tag 2023-10-02 15:31:49 -06:00
dwarf Add illumos OS tag 2023-10-02 15:31:49 -06:00
event Add a missing period in Future's description 2023-10-14 11:20:11 +03:00
fmt re-enable test "fmt.parseFloat nan and inf" after llvm fix 2023-07-25 11:03:11 -07:00
fs Merge pull request #17392 from ziglang/fetch 2023-10-09 11:47:37 -07:00
hash std/hash: perform iterative + smhasher tests at comptime 2023-09-02 16:58:03 +12:00
heap GeneralPurposeAllocator.searchBucket: check current bucket before searching the list 2023-10-04 02:55:54 -07:00
http std.simd: return comptime_int from suggestVectorSize 2023-10-13 16:58:05 +03:00
io std: add type-erased reader; base GenericReader on it 2023-10-03 14:55:17 -07:00
json std.json: add fmt function (#17055) 2023-09-13 18:24:59 -04:00
math std.math: add nextAfter (#16894) 2023-10-06 14:44:47 -04:00
mem mem: explicit dupe and dupeZ error on Allocator 2023-09-07 21:56:57 +03:00
meta all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
net std.net: Fix IPv6 address parsing for single digit 2023-09-06 11:14:24 +03:00
os Add pause() to linux.zig 2023-10-06 11:49:31 -07:00
rand Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
sort improve documentation of std.sort.*Context functions (#16145) 2023-06-27 00:51:06 -07:00
target nvptx: omit sm_90a from the CPU target features for now 2023-09-19 09:37:53 -07:00
testing std: enable FailingAllocator to fail on resize 2023-09-06 19:06:32 +03:00
Thread Fix counting in SingleThreadedRwLock's tryLockShared (#16560) 2023-07-26 08:19:52 -05:00
time all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
tz Support legacy TZ format, expose header struct to a potential writer 2022-01-01 12:47:08 +00:00
unicode all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
valgrind valgrind.memcheck: fix makeMem*() 2023-10-03 02:51:01 -07:00
zig drop for loop syntax upgrade mechanisms 2023-10-13 03:43:54 -07:00
array_hash_map.zig std: add unstable sorting to array hash maps 2023-10-08 16:54:31 -07:00
array_list.zig Improve (Unmanaged)ArrayList.insert 2023-09-30 16:17:22 -07:00
ascii.zig migration: std.math.{min, min3, max, max3} -> @min & @max 2023-06-16 13:44:09 -07:00
atomic.zig std: remove names from incorrectly named tests 2023-04-21 23:08:48 -04:00
base64.zig Optimize std.base64.standard.Encoder.encode 2023-08-29 16:00:31 -04:00
bit_set.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
BitStack.zig std.json: Unify stringify and writeStream (#16405) 2023-07-21 19:56:46 -04:00
bounded_array.zig Smaller memory footprint for BoundedArray (#16299) 2023-07-03 13:58:03 -04:00
buf_map.zig doc: fix minor grammar issues 2023-04-22 13:09:15 +03:00
buf_set.zig update codebase to use @memset and @memcpy 2023-04-28 13:24:43 -07:00
Build.zig Add preliminary support for Windows .manifest files 2023-10-15 13:33:16 -07:00
builtin.zig std.os.uefi: reorganize namespaces 2023-08-24 22:38:47 -07:00
c.zig Add illumos OS tag 2023-10-02 15:31:49 -06:00
child_process.zig Sema: add @errorCast which works for both error sets and error unions 2023-10-01 17:00:01 +03:00
coff.zig std.coff: Fixed compile error. 2023-09-02 00:18:53 +02:00
compress.zig std.compress.zstd: renamed from std.compress.zstandard 2023-02-22 00:11:20 +11:00
comptime_string_map.zig ComptimeStringMap: Add version that takes an equality function 2023-09-14 11:03:15 -07:00
crypto.zig std.crypto.ff - Alloc-free, constant-time field arithmetic for crypto (#15795) 2023-05-22 16:11:06 +02:00
debug.zig Add illumos OS tag 2023-10-02 15:31:49 -06:00
dwarf.zig std: remove some unused imports (#16710) 2023-08-06 15:18:50 -04:00
dynamic_library.zig Add illumos OS tag 2023-10-02 15:31:49 -06:00
elf.zig std: remove some unused imports (#16710) 2023-08-06 15:18:50 -04:00
enums.zig Allow empty enum to be used in EnumSet/EnumMap 2023-09-28 21:48:39 +00:00
event.zig std, compiler-rt: remove test names where applicable 2021-09-01 17:54:06 -07:00
fifo.zig std: remove some unused imports (#16710) 2023-08-06 15:18:50 -04:00
fmt.zig Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
fs.zig Merge pull request #17341 from rzezeski/illumos-updates 2023-10-03 11:04:41 -07:00
hash.zig add std.hash.uint32 2023-06-10 20:42:30 -07:00
hash_map.zig std: remove some unused imports (#16710) 2023-08-06 15:18:50 -04:00
heap.zig std: remove some unused imports (#16710) 2023-08-06 15:18:50 -04:00
http.zig std.http: add identity to content encodings (#16493) 2023-09-26 17:16:40 -04:00
Ini.zig add std.Ini for basic .ini file parsing 2023-01-11 15:39:48 -08:00
io.zig std: add type-erased reader; base GenericReader on it 2023-10-03 14:55:17 -07:00
json.zig std.json: add fmt function (#17055) 2023-09-13 18:24:59 -04:00
leb128.zig Use builtin inference over @as where possible 2023-07-24 10:23:51 -07:00
linked_list.zig std: Move TailQueue alias to correct namespace 2023-08-28 17:41:37 -07:00
log.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
macho.zig std.macho: remove alignment from LoadCommandIterator 2023-10-03 14:55:17 -07:00
math.zig std.math: add nextAfter (#16894) 2023-10-06 14:44:47 -04:00
mem.zig std.simd: return comptime_int from suggestVectorSize 2023-10-13 16:58:05 +03:00
meta.zig Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
multi_array_list.zig std: add unstable sorting to array hash maps 2023-10-08 16:54:31 -07:00
net.zig std.net: Fix IPv6 address parsing for single digit 2023-09-06 11:14:24 +03:00
once.zig update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
os.zig Add filled_sigset to os.zig 2023-10-06 11:49:31 -07:00
packed_int_array.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
pdb.zig std.pdb: fix incorrect field alignment in ptrCast 2023-06-30 23:23:03 -04:00
priority_dequeue.zig Update docs of PriorityQueue.iterator() and PriorityDeque.iterator() 2023-10-12 04:48:22 +03:00
priority_queue.zig Update docs of PriorityQueue.iterator() and PriorityDeque.iterator() 2023-10-12 04:48:22 +03:00
process.zig CLI: finish updating module API usage 2023-10-08 16:54:31 -07:00
Progress.zig Fix minor typo in the description of Progress 2023-10-13 00:44:30 +03:00
rand.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
RingBuffer.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
segmented_list.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
SemanticVersion.zig std: replace builtin.Version with SemanticVersion 2023-06-17 13:17:34 -07:00
simd.zig std.simd: return comptime_int from suggestVectorSize 2023-10-13 16:58:05 +03:00
sort.zig std: add unstable sorting to array hash maps 2023-10-08 16:54:31 -07:00
start.zig lib: Fix asm code in _start for SPARC 2023-10-12 16:13:32 -07:00
start_windows_tls.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
std.zig std.cstr: remove deprecated namespace 2023-10-10 02:08:03 +03:00
tar.zig std.tar: fix creation of symlinks with omit_empty_directories 2023-10-08 16:54:31 -07:00
target.zig illumos: fix dynamic linker path 2023-10-02 16:37:37 -06:00
testing.zig std.testing: expectEqualDeep() - support self-referential structs 2023-09-23 20:25:57 +00:00
Thread.zig Add illumos OS tag 2023-10-02 15:31:49 -06:00
time.zig implement std.time.sleep for uefi 2023-07-07 11:57:09 -07:00
treap.zig Treap: do not set key to undefined in remove to allow re-use of removed nodes 2023-10-03 01:21:51 -07:00
tz.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
unicode.zig std.simd: return comptime_int from suggestVectorSize 2023-10-13 16:58:05 +03:00
Uri.zig Allow only relative paths. 2023-09-29 00:32:43 -07:00
valgrind.zig Fix compilation failure in valgrind.zig 2023-10-12 10:17:49 -07:00
wasm.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
zig.zig make Package.Path support string escape formatting 2023-10-08 16:54:31 -07:00