blob: 310002b8231fadb927c5158765d7135eef1b1c40 [file] [log] [blame]
[PATCH 2/6] [cygwin|mingw] Create UAC manifest files.
* build-aux/ltmain.in (func_emit_exe_manifest): New function.
(func_mode_link) [cygwin|mingw]: Create manifest files for wrapper
and target exe when target name matches heuristic that triggers
UAC problems for newer win32 OSs. Clean up $cwrapper.manifest on
error. Ensure manifest files have executable permission.
(func_mode_uninstall): Clean up manifest files.
Various reports by Eric Blake, Kai Tietz, and Cesar Strauss.
---
build-auxltmain.in | 50 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 0418007..1821779 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -4277,6 +4277,41 @@ EOF
}
# end: func_emit_cwrapperexe_src
+# func_emit_exe_manifest
+# emit a Win32 UAC manifest for executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_exe_manifest ()
+{
+ cat <<EOF
+<?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"
+EOF
+
+ case $host in
+ i?86-*-* ) echo ' processorArchitecture="x86"' ;;
+ ia64-*-* ) echo ' processorArchitecture="ia64"' ;;
+ x86_64-*-* ) echo ' processorArchitecture="amd64"' ;;
+ *) echo ' processorArchitecture="*"' ;;
+ esac
+
+ cat <<EOF
+ name="$host_os.$PROGRAM.$outputname"
+ type="win32"/>
+
+ <!-- Identify the application security requirements. -->
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
+EOF
+}
+
# func_win32_import_lib_p ARG
# True if ARG is an import lib, as indicated by $file_magic_cmd
func_win32_import_lib_p ()
@@ -8237,7 +8272,7 @@ EOF
cwrappersource="$output_path/$objdir/lt-$output_name.c"
cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
- trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+ trap "$RM $cwrappersource $cwrapper $cwrapper.manifest; exit $EXIT_FAILURE" 1 2 15
func_emit_cwrapperexe_src > $cwrappersource
@@ -8257,6 +8292,16 @@ EOF
$opt_dry_run || {
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host"; then
+ # Create the UAC manifests first if necessary (but the
+ # manifest files must have executable permission regardless).
+ case $output_name in
+ *instal*|*patch*|*setup*|*update*)
+ func_emit_exe_manifest > $cwrapper.manifest
+ func_emit_exe_manifest > $output_path/$objdir/$output_name.exe.manifest
+ chmod +x $cwrapper.manifest
+ chmod +x $output_path/$objdir/$output_name.exe.manifest
+ ;;
+ esac
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
@@ -8777,8 +8822,9 @@ func_mode_uninstall ()
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
func_append rmfiles " $odir/$name $odir/${name}S.$objext"
+ func_append rmfiles " ${name}.manifest $objdir/${name}.manifest"
if test yes = "$fast_install" && test -n "$relink_command"; then
- func_append rmfiles " $odir/lt-$name"
+ func_append rmfiles " $odir/lt-$name $objdir/lt-${name}.manifest"
fi
if test "X$noexename" != "X$name"; then
func_append rmfiles " $odir/lt-$noexename.c"
--
1.7.1