aboutsummaryrefslogtreecommitdiff
path: root/winrt
diff options
context:
space:
mode:
authorLenny Komow <lenny@lunarg.com>2018-06-14 16:21:18 -0600
committerLenny Komow <lenny@lunarg.com>2018-06-14 16:26:39 -0600
commitdc1012e9665be3cdb839dd57f8b83dc86ff683c6 (patch)
treefe4c7a5e2229b091ff89290aef9edfa6e3c1b025 /winrt
parent27f50a60cd2999ef9cd679664cfa97056e79f3e7 (diff)
downloadvulkan-tools-dc1012e9665be3cdb839dd57f8b83dc86ff683c6.tar.gz
winrt: Add the windows runtime installer sources
Diffstat (limited to 'winrt')
-rw-r--r--winrt/InstallerRT.nsi165
-rw-r--r--winrt/NSIS_Security.patch58
-rw-r--r--winrt/README.md38
-rw-r--r--winrt/V.bmpbin0 -> 27626 bytes
-rw-r--r--winrt/V.icobin0 -> 101492 bytes
-rw-r--r--winrt/VulkanRT-License.txt18
6 files changed, 279 insertions, 0 deletions
diff --git a/winrt/InstallerRT.nsi b/winrt/InstallerRT.nsi
new file mode 100644
index 00000000..a37d93a6
--- /dev/null
+++ b/winrt/InstallerRT.nsi
@@ -0,0 +1,165 @@
+# The Vulkan runtime installer NSIS script
+
+!include LogicLib.nsh
+
+# Input file locations
+!define RES "."
+
+# Input parameters
+!ifndef MAJOR
+ !define MAJOR "1"
+ !define MINOR "1"
+ !define PATCH "73"
+ !define BUILD "0.dev"
+!endif
+!define VERSION "${MAJOR}.${MINOR}.${PATCH}.${BUILD}"
+!ifndef PUBLISHER
+ !define PUBLISHER "YourCompany, Inc."
+!endif
+!ifndef COPYRIGHT
+ !define COPYRIGHT ""
+!endif
+
+# Installer information
+Icon ${RES}\V.ico
+OutFile "VulkanRT-${VERSION}-Installer.exe"
+InstallDir "$PROGRAMFILES\VulkanRT"
+
+RequestExecutionLevel admin
+AddBrandingImage left 150
+Caption "Vulkan Runtime ${VERSION} Setup"
+Name "Vulkan Runtime ${VERSION}"
+LicenseData "${RES}\VulkanRT-License.txt"
+Page custom brandimage "" ": Brand Image"
+Page license
+Page instfiles
+
+VIProductVersion "${VERSION}"
+VIAddVersionKey "ProductName" "Vulkan Runtime"
+VIAddVersionKey "FileVersion" "${VERSION}"
+VIAddVersionKey "ProductVersion" "${VERSION}"
+VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
+VIAddVersionKey "FileDescription" "Vulkan Runtime Installer"
+
+Function brandimage
+ SetOutPath "$TEMP"
+ SetFileAttributes V.bmp temporary
+ File "${RES}\V.bmp"
+ SetBrandingImage "$TEMP/V.bmp"
+Functionend
+
+# Utilties to check if a file is older than this installer or not
+Function NeedsReplacing
+ Pop $0
+
+ # Extract the version of the existing file
+ GetDllVersion "$0" $R0 $R1
+ IntOp $R2 $R0 >> 16
+ IntOp $R2 $R2 & 0xffff
+ IntOp $R3 $R0 & 0xffff
+ IntOp $R4 $R1 >> 16
+ IntOp $R4 $R4 & 0xffff
+ IntOp $R5 $R1 & 0xffff
+
+ # Check major versions
+ ${IF} ${MAJOR} > $R2
+ Push True
+ ${ELSEIF} ${MAJOR} < $R2
+ Push False
+
+ # Check minor versions
+ ${ELSEIF} ${MINOR} > $R3
+ Push True
+ ${ELSEIF} ${MINOR} < $R3
+ Push False
+
+ # Check patch versions
+ ${ELSEIF} ${PATCH} > $R4
+ Push True
+ ${ELSEIF} ${PATCH} < $R4
+ Push False
+
+ # Check build versions
+ ${ELSEIF} ${BUILD} > $R5
+ Push True
+ ${ELSEIF} ${BUILD} < $R5
+ Push False
+
+ # If they match exactly, then we update
+ ${ELSE}
+ Push True
+ ${ENDIF}
+FunctionEnd
+
+!macro InstallIfNewer SrcPath OutName
+ Push "$OUTDIR\${OutName}"
+ Call NeedsReplacing
+ Pop $0
+
+ ${IF} $0 == True
+ DetailPrint "File $OUTDIR\${OutName} (version $R2.$R3.$R4.$R5) will be upgraded to ${VERSION}"
+ File /oname=${OutName} "${SrcPath}"
+ ${ELSE}
+ DetailPrint "File $OUTDIR\${OutName} (version $R2.$R3.$R4.$R5) will not be replaced with ${VERSION}"
+ ${ENDIF}
+!macroend
+
+# Utilities to check if this is a 64-bit OS or not
+!define IsWow64 `"" IsWow64 ""`
+!macro _IsWow64 _a _b _t _f
+ !insertmacro _LOGICLIB_TEMP
+ System::Call kernel32::GetCurrentProcess()p.s
+ System::Call kernel32::IsWow64Process(ps,*i0s)
+ Pop $_LOGICLIB_TEMP
+ !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
+!macroend
+
+!define RunningX64 `"" RunningX64 ""`
+!macro _RunningX64 _a _b _t _f
+ !if ${NSIS_PTR_SIZE} > 4
+ !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
+ !else
+ !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
+ !endif
+!macroend
+
+# Installer
+Section
+ Delete "$INSTDIR\install.log"
+ LogSet on
+
+ # Disable filesystem redirection
+ System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
+
+ ${IF} ${RunningX64}
+ SetOutPath $WINDIR\System32
+ !insertmacro InstallIfNewer "${LOADER64}" "vulkan-1.dll"
+ !insertmacro InstallIfNewer "${LOADER64}" "vulkan-1-999-0-0-0.dll"
+ !insertmacro InstallIfNewer "${VULKANINFO64}" "vulkaninfo.exe"
+ !insertmacro InstallIfNewer "${VULKANINFO64}" "vulkaninfo-1-999-0-0-0.exe"
+ SetOutPath $WINDIR\SysWOW64
+ ${ELSE}
+ SetOutPath $WINDIR\System32
+ ${ENDIF}
+
+ # Install 32-bit contents
+ !insertmacro InstallIfNewer "${LOADER32}" "vulkan-1.dll"
+ !insertmacro InstallIfNewer "${LOADER32}" "vulkan-1-999-0-0-0.dll"
+ !insertmacro InstallIfNewer "${VULKANINFO32}" "vulkaninfo.exe"
+ !insertmacro InstallIfNewer "${VULKANINFO32}" "vulkaninfo-1-999-0-0-0.exe"
+
+ # Dump licenses into a the installation directory
+ SetOutPath "$INSTDIR"
+ AccessControl::DisableFileInheritance $INSTDIR
+ AccessControl::SetFileOwner $INSTDIR "Administrators"
+ AccessControl::ClearOnFile $INSTDIR "Administrators" "FullAccess"
+ AccessControl::SetOnFile $INSTDIR "SYSTEM" "FullAccess"
+ AccessControl::GrantOnFile $INSTDIR "Everyone" "ListDirectory"
+ AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericExecute"
+ AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericRead"
+ AccessControl::GrantOnFile $INSTDIR "Everyone" "ReadAttributes"
+ File "${RES}\VulkanRT-License.txt"
+ File /oname=LICENSE.txt "${RES}\..\COPYRIGHT.txt"
+
+ LogSet off
+SectionEnd
diff --git a/winrt/NSIS_Security.patch b/winrt/NSIS_Security.patch
new file mode 100644
index 00000000..b275aae0
--- /dev/null
+++ b/winrt/NSIS_Security.patch
@@ -0,0 +1,58 @@
+diff --git a/nsis-3.0b3-src/SCons/Config/ms b/nsis-3.0b3-src/SCons/Config/ms
+index 32d3d33..d2c4d25 100644
+--- a/nsis-3.0b3-src/SCons/Config/ms
++++ b/nsis-3.0b3-src/SCons/Config/ms
+@@ -16,7 +16,7 @@ def entry(x,u):
+
+ defenv['ENTRY_FLAG'] = entry
+ defenv['MAP_FLAG'] = '/map'
+-defenv['NODEFLIBS_FLAG'] = '/NODEFAULTLIB'
++#defenv['NODEFLIBS_FLAG'] = '/NODEFAULTLIB'
+ defenv['C_FLAG'] = '/TC'
+ defenv['CPP_FLAG'] = '/TP'
+ defenv['CPP_REQUIRES_STDLIB'] = 0
+@@ -29,7 +29,7 @@ defenv['STDCALL'] = '__stdcall'
+ msvs_version = float(defenv['MSVS_VERSION'].replace('Exp',''))
+ if msvs_version >= 8.0:
+ defenv['EXCEPTION_FLAG'] = '/EHsc'
+- defenv.Append(CCFLAGS = ['/GS-'])
++ defenv.Append(CCFLAGS = ['/GS'])
+ defenv.Append(CPPDEFINES = ['_CRT_SECURE_NO_WARNINGS', '_CRT_NONSTDC_NO_WARNINGS', '_CRT_SECURE_NO_DEPRECATE', '_CRT_NON_CONFORMING_SWPRINTFS'])
+ defenv['MSVCRT_FLAG'] = '/MT' # Avoid msvcr?0.dll dependency
+ else:
+@@ -43,6 +43,10 @@ if msvs_version >= 11.0:
+ defenv['SUBSYS_CON'] = '/subsystem:console,5.01' # support windows xp
+ defenv['SUBSYS_WIN'] = '/subsystem:windows,5.01' # support windows xp
+
++if msvs_version >= 14.0:
++ defenv.Append(CCFLAGS = ['/guard:cf'])
++ defenv.Append(LINKFLAGS = ['/guard:cf'])
++
+ ### defines
+
+ defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
+@@ -143,9 +147,9 @@ stub_env.Append(CCFLAGS = ['/Fa${TARGET}.lst']) # listing file name
+ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no default libraries
+ stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
+
+-if msvs_version >= 10.0:
+- # no relocations that our resource editor ignores
+- stub_env.Append(LINKFLAGS = ['/FIXED'])
++#if msvs_version >= 10.0:
++# # no relocations that our resource editor ignores
++# stub_env.Append(LINKFLAGS = ['/FIXED'])
+
+ stub_uenv = stub_env.Clone()
+ stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
+diff --git a/nsis-3.0b3-src/Source/exehead/Main.c b/nsis-3.0b3-src/Source/exehead/Main.c
+index eb231e7..e4642ce 100644
+--- a/nsis-3.0b3-src/Source/exehead/Main.c
++++ b/nsis-3.0b3-src/Source/exehead/Main.c
+@@ -84,6 +84,7 @@ void *g_SHGetFolderPath;
+ NSIS_ENTRYPOINT_GUINOCRT
+ EXTERN_C void NSISWinMainNOCRT()
+ {
++ __security_init_cookie();
+ int ret = 0;
+ const TCHAR *m_Err = _LANG_ERRORWRITINGTEMP;
+
diff --git a/winrt/README.md b/winrt/README.md
new file mode 100644
index 00000000..d0dd5958
--- /dev/null
+++ b/winrt/README.md
@@ -0,0 +1,38 @@
+
+## Windows Runtime Installer
+
+This directory contains the files required for building the Windows Vulkan Runtime Installer package.
+The runtime installer is a method of delivering a Vulkan loader to system.
+The runtime installer is used by the SDK installer.
+It is also used by some drivers to ensure that an adequate Vulkan loader is installed on a system.
+Additionally, applications may install a runtime to ensure that a minimum loader version is present.
+
+To build a runtime installer:
+1. Get a copy of the Nullsoft Install System (NSIS) version 3.0b3.
+ Other versions may work, but the patch included in this directory is built against version 3.0b3.
+ Apply the `NSIS_Security.patch` file provided in this directory to the NSIS source code.
+ This security patch adds the /DYNAMICBASE /GS, and /guard:cf options to the build.
+ In addition, it will be necessary to specify NSIS_CONFIG_LOG=yes and NSIS_MAX_STRLEN=8192 when compiling.
+ Once you have applied the patch, compile NSIS with the command:
+ ```
+ scons SKIPUTILS="NSIS Menu","MakeLangId" UNICODE=yes \
+ ZLIB_W32=<path_to_zlib>\zlib-1.2.7-win32-x86 NSIS_MAX_STRLEN=8192 \
+ NSIS_CONFIG_LOG=yes NSIS_CONFIG_LOG_TIMESTAMP=yes \
+ APPEND_CCFLAGS="/DYNAMICBASE /Zi" APPEND_LINKFLAGS="/DYNAMICBASE \
+ /DEBUG /OPT:REF /OPT:ICF" SKIPDOC=all dist-zip
+ ```
+
+2. The compilation should have created a zip file containing the new NSIS build.
+ Unzip this file to the location of your choosing.
+ Download the NSIS Access Control plugin in copy it into the plugin directory in the build you just unzipped.
+ It may be useful to prepend this NSIS binary directory to your system's path, so that this NSIS will be run when you type "makensis".
+ Otherwise, you will just have to specify the full path to makensis.exe in the following steps.
+ It may be useful to verify that all shared libraries in the build have the DYNAMIC_BASE and NX_COMPAT flags set.
+
+3. Build the Vulkan-Loader repository and this one.
+
+4. Build the runtime installer from this directory with the command:
+ ```
+ makensis InstallerRT.nsi -DLOADER64="?" -DLOADER32="?" -DVULKANINFO64="?" -DVULKANINFO32="?"
+ ```
+ where the question marks are replaced with the 64 and 32 bit versions of the loader and vulkaninfo builds.
diff --git a/winrt/V.bmp b/winrt/V.bmp
new file mode 100644
index 00000000..dea3353c
--- /dev/null
+++ b/winrt/V.bmp
Binary files differ
diff --git a/winrt/V.ico b/winrt/V.ico
new file mode 100644
index 00000000..61166983
--- /dev/null
+++ b/winrt/V.ico
Binary files differ
diff --git a/winrt/VulkanRT-License.txt b/winrt/VulkanRT-License.txt
new file mode 100644
index 00000000..11d8095c
--- /dev/null
+++ b/winrt/VulkanRT-License.txt
@@ -0,0 +1,18 @@
+Copyright (c) 2015-2018 The Khronos Group Inc.
+Copyright (c) 2015-2018 LunarG, Inc.
+Copyright (c) 2015-2018 Valve Corporation
+
+Licensed under the Apache License, Version 2.0 (the "License"); you man not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on as "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+Unless otherwise noted in the LICENSE.txt file in the install folder, all
+components of the Vulkan Runtime are licensed under the above license. Licenses
+for any components not so licensed are listed in the LICENSE.txt file.