wincompat: add resource and manifest and enable lto
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									66714e2c47
								
							
						
					
					
						commit
						843a256697
					
				
							
								
								
									
										10
									
								
								src/Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/Makefile
									
									
									
									
									
								
							| @ -57,9 +57,13 @@ LDLIBS += -lnetwork -lbsd | ||||
| endif | ||||
| ifeq ($(PLATFORM),windows) | ||||
| CC := x86_64-w64-mingw32-gcc | ||||
| CFLAGS += -Iwincompat/include -include wincompat/compat.h | ||||
| LDLIBS += -lws2_32 | ||||
| wg: wincompat/libc.o wincompat/init.o | ||||
| WINDRES := x86_64-w64-mingw32-windres | ||||
| CFLAGS += -Iwincompat/include -include wincompat/compat.h -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -flto | ||||
| LDLIBS += -lws2_32 -flto | ||||
| VERSION := $(patsubst "%",%,$(filter "%",$(file < version.h))) | ||||
| wg: wincompat/libc.o wincompat/init.o wincompat/resources.o | ||||
| wincompat/resources.o: wincompat/resources.rc wincompat/manifest.xml | ||||
| 	$(WINDRES) -DVERSION_STR=$(VERSION) -O coff -c 65001 -i $< -o $@ | ||||
| endif | ||||
| 
 | ||||
| ifneq ($(V),1) | ||||
|  | ||||
							
								
								
									
										23
									
								
								src/wincompat/manifest.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/wincompat/manifest.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||||
| <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||||
|     <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="wg" type="win32" /> | ||||
|     <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||||
|         <application> | ||||
|             <!-- Windows 10 --> | ||||
|             <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> | ||||
|             <!-- Windows 8.1 --> | ||||
|             <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> | ||||
|             <!-- Windows 8 --> | ||||
|             <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> | ||||
|             <!-- Windows 7 --> | ||||
|             <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> | ||||
|         </application> | ||||
|     </compatibility> | ||||
|     <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||||
|         <security> | ||||
|             <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||||
|                 <requestedExecutionLevel level="requireAdministrator" /> | ||||
|             </requestedPrivileges> | ||||
|         </security> | ||||
|     </trustInfo> | ||||
| </assembly> | ||||
							
								
								
									
										40
									
								
								src/wincompat/resources.rc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/wincompat/resources.rc
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| /* SPDX-License-Identifier: GPL-2.0 | ||||
|  * | ||||
|  * Copyright (C) 2020 Jason A. Donenfeld. All Rights Reserved. | ||||
|  */ | ||||
| 
 | ||||
| #include <windows.h> | ||||
| 
 | ||||
| #pragma code_page(65001) // UTF-8 | ||||
| 
 | ||||
| LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||
| CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml | ||||
| 
 | ||||
| #define STRINGIZE(x) #x | ||||
| #define EXPAND(x) STRINGIZE(x) | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
| FILEOS         VOS_NT_WINDOWS32 | ||||
| FILETYPE       VFT_APP | ||||
| FILESUBTYPE    VFT2_UNKNOWN | ||||
| BEGIN | ||||
|   BLOCK "StringFileInfo" | ||||
|   BEGIN | ||||
|     BLOCK "040904b0" | ||||
|     BEGIN | ||||
|       VALUE "CompanyName", "WireGuard LLC" | ||||
|       VALUE "FileDescription", "WireGuard wg(8) CLI: Fast, Modern, Secure VPN Tunnel" | ||||
|       VALUE "FileVersion", EXPAND(VERSION_STR) | ||||
|       VALUE "InternalName", "wg" | ||||
|       VALUE "LegalCopyright", "Copyright © 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved." | ||||
|       VALUE "OriginalFilename", "wg.exe" | ||||
|       VALUE "ProductName", "WireGuard" | ||||
|       VALUE "ProductVersion", EXPAND(VERSION_STR) | ||||
|       VALUE "Comments", "https://www.wireguard.com/" | ||||
|     END | ||||
|   END | ||||
|   BLOCK "VarFileInfo" | ||||
|   BEGIN | ||||
|     VALUE "Translation", 0x409, 0x4b0 | ||||
|   END | ||||
| END | ||||
		Reference in New Issue
	
	Block a user
	 Jason A. Donenfeld
						Jason A. Donenfeld