summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/bsd.pkg.mk6
-rw-r--r--mk/misc/uac-manifest14
-rw-r--r--mk/misc/uac-manifest.mk39
3 files changed, 58 insertions, 1 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index c0a5e6d2d62..22150739334 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1983 2012/12/06 11:36:30 jperkin Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1984 2013/02/10 13:04:08 obache Exp $
#
# This file is in the public domain.
#
@@ -787,6 +787,10 @@ ${_MAKEVARS_MK.${_phase_}}: ${WRKDIR}
.include "pbulk/pbulk-index.mk"
.endif
+.if ${OPSYS} == "Cygwin" && defined(UAC_REQD_EXECS) && !empty(UAC_REQD_EXECS)
+. include "misc/uac-manifest.mk"
+.endif
+
.if defined(PKG_DEVELOPER) && ${PKG_DEVELOPER} != "no"
. include "misc/developer.mk"
.endif
diff --git a/mk/misc/uac-manifest b/mk/misc/uac-manifest
new file mode 100644
index 00000000000..80713804a7f
--- /dev/null
+++ b/mk/misc/uac-manifest
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- $NetBSD: uac-manifest,v 1.1 2013/02/10 13:04:08 obache Exp $ -->
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0"
+ name="pkgsrc.@PKGNAME@.@PROGNAME@"
+ type="win32"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
diff --git a/mk/misc/uac-manifest.mk b/mk/misc/uac-manifest.mk
new file mode 100644
index 00000000000..4900fa62b5b
--- /dev/null
+++ b/mk/misc/uac-manifest.mk
@@ -0,0 +1,39 @@
+# $NetBSD: uac-manifest.mk,v 1.1 2013/02/10 13:04:08 obache Exp $
+#
+# This file generate manifest files for Windows.
+# For Windows Vista or later, executable files including special keywords
+# (install, update, patch, and so on) in its name are expected as requireing
+# privileged permissions by default (UAC).
+# If not, it must be specified with manifest file, or it will be failed to
+# execute as "Permission denied".
+#
+# Package-settable variables:
+#
+# UAC_REQD_EXECS
+# A list of files requireing manifest file for UAC.
+# Paths are relative to PREFIX.
+#
+# Default value: not defined
+#
+
+GENERATE_PLIST+= ${UAC_MANIFEST_GENERATE_PLIST}
+UAC_MANIFEST_GENERATE_PLIST= \
+ ${ECHO} "@comment The following lines are automatically generated." && \
+ ( cd ${DESTDIR}${PREFIX}; \
+ for file in ${UAC_REQD_EXECS}; do \
+ ${TEST} $${file} -ef $${file}.exe && file=$${file}.exe; \
+ ${ECHO} $${file}.manifest; \
+ done)
+
+.PHONY: generate-uac-manifests
+post-install: generate-uac-manifests
+generate-uac-manifests:
+.for file in ${UAC_REQD_EXECS}
+ ${RUN} progname=`basename ${file} .exe`; \
+ filename=${file}; \
+ cd ${DESTDIR}${PREFIX}; \
+ ${TEST} ${file} -ef ${file}.exe && filename=${file}.exe; \
+ ${SED} -e s,@PKGNAME@,${PKGBASE}, -e s,@PROGNAME@,$${progname}, \
+ ${PKGSRCDIR}/mk/misc/uac-manifest \
+ > $${filename}.manifest
+.endfor \ No newline at end of file