[nasm:nasm-2.16.xx] windows host: add embedded manifest file
nasm-bot for H. Peter Anvin
hpa at zytor.com
Mon Jan 29 17:27:05 PST 2024
Commit-ID: 1e965e30ff3b1dc431bb9dddf8dcc005d70a9926
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1e965e30ff3b1dc431bb9dddf8dcc005d70a9926
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 29 Jan 2024 17:19:32 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 29 Jan 2024 17:19:32 -0800
windows host: add embedded manifest file
Without a manifest, Windows applications force a fixed PATH_MAX limit
to any pathname; this is unnecessary.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
Makefile.in | 18 +++++++++++++-----
Mkfiles/msvc.mak | 18 ++++++++++++------
Mkfiles/openwcom.mak | 7 +++++--
configure.ac | 10 +++++++---
win/.gitignore | 1 +
win/manifest.rc | 2 ++
win/manifest.xml | 24 ++++++++++++++++++++++++
7 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 5be6fc17..3743d787 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -55,6 +55,7 @@ ASCIIDOC = @ASCIIDOC@
XMLTO = @XMLTO@
MAKENSIS = @MAKENSIS@
XZ = @XZ@
+WINDRES = @WINDRES@
# Optional targets
MANPAGES = @MANPAGES@
@@ -98,6 +99,8 @@ endif
.xml.1:
$(XMLTO) man --skip-validation $< 2>/dev/null
+MANIFEST = @MANIFEST@
+
#-- Begin File Lists --#
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
@@ -159,7 +162,7 @@ LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
-SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
+SUBDIRS = stdlib nasmlib output asm disasm x86 common macros win
XSUBDIRS = test doc nsis
DEPDIRS = . include config x86 $(SUBDIRS)
#-- End File Lists --#
@@ -177,11 +180,11 @@ $(NASMLIB): $(LIBOBJ)
$(AR) cq $(NASMLIB) $(LIBOBJ)
$(RANLIB) $(NASMLIB)
-nasm$(X): $(NASM) $(NASMLIB)
- $(CC) $(ALL_LDFLAGS) -o nasm$(X) $(NASM) $(NASMLIB) $(LIBS)
+nasm$(X): $(NASM) $(MANIFEST) $(NASMLIB)
+ $(CC) $(ALL_LDFLAGS) -o nasm$(X) $^ $(LIBS)
-ndisasm$(X): $(NDISASM) $(NASMLIB)
- $(CC) $(ALL_LDFLAGS) -o ndisasm$(X) $(NDISASM) $(NASMLIB) $(LIBS)
+ndisasm$(X): $(NDISASM) $(MANIFEST) $(NASMLIB)
+ $(CC) $(ALL_LDFLAGS) -o ndisasm$(X) $^ $(LIBS)
#-- Begin Generated File Rules --#
@@ -362,6 +365,11 @@ nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
#-- End NSIS Rules --#
+# Windows embedded manifest
+MANIFEST_RC = win/manifest.rc
+win/manifest.$(O): win/manifest.xml $(MANIFEST_RC)
+ $(WINDRES) -I. -Iwin -DMANIFEST_FILE='\"$<\"' -i $(MANIFEST_RC) -o $@
+
# Generated manpages, also pregenerated for distribution
manpages: nasm.1 ndisasm.1
diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak
index da71c5c6..f030b85e 100644
--- a/Mkfiles/msvc.mak
+++ b/Mkfiles/msvc.mak
@@ -18,12 +18,15 @@ exec_prefix = $(prefix)
bindir = $(prefix)/bin
mandir = $(prefix)/man
+MANIFEST_FLAGS = /MANIFEST:EMBED /MANIFESTFILE:$(MANIFEST)
+
!IF "$(DEBUG)" == "1"
CFLAGS = /Od /Zi
-LDFLAGS = /DEBUG
+LDFLAGS = /DEBUG $(MANIFEST_FLAGS)
!ELSE
CFLAGS = /O2 /Zi
-LDFLAGS = /DEBUG /OPT:REF /OPT:ICF # (latter two undoes /DEBUG harm)
+ # /OPT:REF and /OPT:ICF two undo /DEBUG harm
+LDFLAGS = /DEBUG /OPT:REF /OPT:ICF $(MANIFEST_FLAGS)
!ENDIF
CC = cl
@@ -59,6 +62,8 @@ X = .exe
.c.obj:
$(CC) /c $(ALL_CFLAGS) /Fo$@ $<
+MANIFEST = win/manifest.xml
+
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm\nasm.$(O)
@@ -77,7 +82,8 @@ LIBOBJ_NW = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) \
nasmlib\realpath.$(O) nasmlib\path.$(O) \
nasmlib\filename.$(O) nasmlib\rlimit.$(O) \
- nasmlib\zerobuf.$(O) nasmlib\readnum.$(O) nasmlib\bsi.$(O) \
+ nasmlib\readnum.$(O) nasmlib\numstr.$(O) \
+ nasmlib\zerobuf.$(O) nasmlib\bsi.$(O) \
nasmlib\rbtree.$(O) nasmlib\hashtbl.$(O) \
nasmlib\raa.$(O) nasmlib\saa.$(O) \
nasmlib\strlist.$(O) \
@@ -120,7 +126,7 @@ LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
-SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
+SUBDIRS = stdlib nasmlib output asm disasm x86 common macros win
XSUBDIRS = test doc nsis
DEPDIRS = . include config x86 $(SUBDIRS)
#-- End File Lists --#
@@ -129,10 +135,10 @@ NASMLIB = libnasm.$(A)
all: nasm$(X) ndisasm$(X)
-nasm$(X): $(NASM) $(NASMLIB)
+nasm$(X): $(NASM) $(MANIFEST) $(NASMLIB)
$(CC) /Fe$@ $(NASM) $(LDFLAGS) $(NASMLIB) $(LIBS)
-ndisasm$(X): $(NDISASM) $(NASMLIB)
+ndisasm$(X): $(NDISASM) $(MANIFEST) $(NASMLIB)
$(CC) /Fe$@ $(NDISASM) $(LDFLAGS) $(NASMLIB) $(LIBS)
$(NASMLIB): $(LIBOBJ)
diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak
index 605f9afe..84dd2088 100644
--- a/Mkfiles/openwcom.mak
+++ b/Mkfiles/openwcom.mak
@@ -48,6 +48,8 @@ X = .exe
@set INCLUDE=
$(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
+MANIFEST =
+
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm\nasm.$(O)
@@ -66,7 +68,8 @@ LIBOBJ_NW = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) &
nasmlib\realpath.$(O) nasmlib\path.$(O) &
nasmlib\filename.$(O) nasmlib\rlimit.$(O) &
- nasmlib\zerobuf.$(O) nasmlib\readnum.$(O) nasmlib\bsi.$(O) &
+ nasmlib\readnum.$(O) nasmlib\numstr.$(O) &
+ nasmlib\zerobuf.$(O) nasmlib\bsi.$(O) &
nasmlib\rbtree.$(O) nasmlib\hashtbl.$(O) &
nasmlib\raa.$(O) nasmlib\saa.$(O) &
nasmlib\strlist.$(O) &
@@ -109,7 +112,7 @@ LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
-SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
+SUBDIRS = stdlib nasmlib output asm disasm x86 common macros win
XSUBDIRS = test doc nsis
DEPDIRS = . include config x86 $(SUBDIRS)
#-- End File Lists --#
diff --git a/configure.ac b/configure.ac
index c55dfb3c..e30125b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,9 +17,6 @@ dnl cross-compiling when in fact we are; running Wine here is at
dnl the best very slow and doesn't buy us a single thing at all.
PA_CROSS_COMPILE
-dnl Get the canonical target system name
-AC_CANONICAL_HOST
-
dnl Enable any available C extensions
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
@@ -151,6 +148,13 @@ AC_CHECK_INCLUDES_DEFAULT
dnl Check for variadic macro support
PA_VARIADIC_MACROS
+dnl Handle Windows embedded manifests
+AS_CASE([$host],
+ [*-win* | *-mingw*],
+ [AC_CHECK_TOOL(WINDRES, windres, false)
+ AS_IF([test x"$WINDRES" != xfalse],
+ [AC_SUBST(MANIFEST, ['win/manifest.$(O)'])])])
+
PA_ADD_HEADERS(string.h)
PA_ADD_HEADERS(stdarg.h)
PA_ADD_HEADERS(inttypes.h)
diff --git a/win/.gitignore b/win/.gitignore
new file mode 100644
index 00000000..d7ec32ea
--- /dev/null
+++ b/win/.gitignore
@@ -0,0 +1 @@
+!*.xml
diff --git a/win/manifest.rc b/win/manifest.rc
new file mode 100644
index 00000000..411b7cb3
--- /dev/null
+++ b/win/manifest.rc
@@ -0,0 +1,2 @@
+LANGUAGE 0,0
+1 24 MANIFEST_FILE
diff --git a/win/manifest.xml b/win/manifest.xml
new file mode 100644
index 00000000..046fcb50
--- /dev/null
+++ b/win/manifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" />
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <application xmlns="urn:schemas-microsoft-com:asm.v3">
+ <windowsSettings xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
+ <longPathAware>true</longPathAware>
+ </windowsSettings>
+ </application>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+ </application>
+ </compatibility>
+</assembly>
More information about the Nasm-commits
mailing list