diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2a66c829f..4c5cf2de6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -141,6 +141,8 @@ jobs: working-directory: build run: | make -j4 + cd .. + mv COPYING tools - name: Upload binaries of MinGW if: ${{ matrix.os == 'ubuntu-latest' }} uses: actions/upload-artifact@v2 @@ -228,30 +230,60 @@ jobs: shell : bash if: ${{ env.release_tag != '' }} run: | - ls mkdir SuperTuxKart-${{ env.release_tag }}-win mv stk-assets SuperTuxKart-${{ env.release_tag }}-win mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code mv data SuperTuxKart-${{ env.release_tag }}-win/stk-code mv tools/run_game.bat SuperTuxKart-${{ env.release_tag }}-win - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingw - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingw64 - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingwa64 - mv i686 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingw/bin - mv x86_64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingw64/bin - mv aarch64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingwa64/bin + mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686 + mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64 + mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64 + mv i686 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686/bin + mv x86_64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64/bin + mv aarch64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin # libwinpthread-1.dll is useless because we statically link - rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-mingwa64/bin/libwinpthread-1.dll + rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin/libwinpthread-1.dll - name: Start packaging STK if: ${{ env.release_tag != '' }} run: | C:\msys64\usr\bin\zip.exe -r SuperTuxKart-${{ env.release_tag }}-win.zip SuperTuxKart-${{ env.release_tag }}-win + - name: Configure NSIS script + shell : bash + if: ${{ env.release_tag != '' && startsWith(github.ref, 'refs/tags/') }} + run: | + mv tools SuperTuxKart-${{ env.release_tag }}-win/stk-code + cd SuperTuxKart-${{ env.release_tag }}-win/stk-code/tools/windows_installer + for arch in i686 x86_64 aarch64 + do + cp supertuxkart-github-actions.nsi $arch.nsi + sed -i "s/define APPNAMEANDVERSION \"\"/define APPNAMEANDVERSION \"SuperTuxKart ${{ env.release_tag }}\"/g" $arch.nsi + sed -i "s/define ARCH \"\"/define ARCH \"$arch\"/g" $arch.nsi + sed -i "s/OutFile \"\"/OutFile \"SuperTuxKart-${{ env.release_tag }}-installer-$arch.exe\"/g" $arch.nsi + for filename in $(ls ../../build-$arch/bin) + do + file="\\\\$filename" + sed -i "286a\ DELETE /REBOOTOK \"\$INSTDIR$file\"" $arch.nsi + done + # Print result + #cat $arch.nsi + done + mv ../COPYING ../.. + - name: Run makensis.exe + if: ${{ env.release_tag != '' && startsWith(github.ref, 'refs/tags/') }} + run: | + cd SuperTuxKart-${{ env.release_tag }}-win\stk-code\tools\windows_installer + C:\msys64\usr\bin\wget.exe https://nsis.sourceforge.io/mediawiki/images/6/6c/Shelllink.zip + C:\msys64\usr\bin\unzip.exe Shelllink.zip + Move-Item Unicode\Plugins\ShellLink.dll . + & "C:\Program Files (x86)\NSIS\makensis.exe" i686.nsi + & "C:\Program Files (x86)\NSIS\makensis.exe" x86_64.nsi + & "C:\Program Files (x86)\NSIS\makensis.exe" aarch64.nsi - name: Create release uses: ncipollo/release-action@v1 if: ${{ env.release_tag != '' }} with: token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "SuperTuxKart-*.zip" + artifacts: "SuperTuxKart-*.zip, SuperTuxKart-${{ env.release_tag }}-win/stk-code/tools/windows_installer/*.exe" tag: ${{ env.release_name }} omitBodyDuringUpdate: true omitNameDuringUpdate: true diff --git a/tools/run_game.bat b/tools/run_game.bat index 0bd10446f..3066e2e1b 100644 --- a/tools/run_game.bat +++ b/tools/run_game.bat @@ -2,12 +2,12 @@ reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT if %OS%==32BIT ( -Pushd %~dp0\stk-code\build-mingw\bin\ +Pushd %~dp0\stk-code\build-i686\bin\ supertuxkart.exe popd ) if %OS%==64BIT ( -Pushd %~dp0\stk-code\build-mingw64\bin\ +Pushd %~dp0\stk-code\build-x86_64\bin\ supertuxkart.exe popd ) diff --git a/tools/windows_installer/prerequisites/vcredist_x64.exe b/tools/windows_installer/prerequisites/vcredist_x64.exe deleted file mode 100755 index b7aabd354..000000000 Binary files a/tools/windows_installer/prerequisites/vcredist_x64.exe and /dev/null differ diff --git a/tools/windows_installer/prerequisites/vcredist_x86.exe b/tools/windows_installer/prerequisites/vcredist_x86.exe deleted file mode 100755 index f025718e2..000000000 Binary files a/tools/windows_installer/prerequisites/vcredist_x86.exe and /dev/null differ diff --git a/tools/windows_installer/supertuxkart-64bit.nsi b/tools/windows_installer/supertuxkart-github-actions.nsi old mode 100755 new mode 100644 similarity index 66% rename from tools/windows_installer/supertuxkart-64bit.nsi rename to tools/windows_installer/supertuxkart-github-actions.nsi index 5e404f2ea..7d9f6fb36 --- a/tools/windows_installer/supertuxkart-64bit.nsi +++ b/tools/windows_installer/supertuxkart-github-actions.nsi @@ -6,14 +6,13 @@ ; To use just put this in a directory below the supertuxkart directory ; which should be called "supertuxkart" and then copy the ; GPL in the supertuxkart directory to 'license.txt'. -; Next to supertuxkart create a subdirectory called 'prerequisites' -; and copy the VC++ (vcredist_x64.exe) redistributables. ; You will then need to make an icon, you can use: ; http://tools.dynamicdrive.com/favicon/ to convert a png to an icon. ; Once you have made an icon put it in the supertuxkart dir and call it -; icon.ico. You will need to do the same for install.ico nd uninstall.ico +; icon.ico. You will need to do the same for install.ico and uninstall.ico ; Once there done then all you need to do is compile with NSIS. +Unicode True ;-------------------------------- ;Include Modern UI !include "MUI2.nsh" @@ -27,23 +26,23 @@ !include "FileFunc.nsh" ;-------------------------------- +;Include x64 lib + !include "x64.nsh" + +;-------------------------------- +; We save ShellLink.dll in current directory + !addplugindir . +;-------------------------------- ;General - ; Version information - ; TOOD get these from the source code directly - !define VERSION_MAJOR 0 - !define VERSION_MINOR 10 - !define VERSION_REVISION 0 - ; Empty means stable, could be -git, -rc1 - !define VERSION_BUILD "-git" - ;Name and file !define APPNAME "SuperTuxKart" - !define APPNAMEANDVERSION "${APPNAME} ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_BUILD}" + !define APPNAMEANDVERSION "" + !define ARCH "" !define DESCRIPTION "3D open-source arcade racer with a variety characters, tracks, and modes to play" Name "${APPNAMEANDVERSION}" - OutFile "${APPNAMEANDVERSION} installer-64bit.exe" + OutFile "" # These will be displayed by the "Click here for support information" link in "Add/Remove Programs" # It is possible to use "mailto:" links in here to open the email client @@ -53,8 +52,8 @@ RequestExecutionLevel admin - ;Default installation folder - InstallDir "$PROGRAMFILES64\${APPNAMEANDVERSION}" + ; Overwrite later by onInit + InstallDir "$PROGRAMFILES\${APPNAMEANDVERSION}" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\${APPNAMEANDVERSION}" "" @@ -65,7 +64,7 @@ ;Set the icon !define MUI_ICON "install.ico" !define MUI_UNICON "uninstall.ico" - !define MUI_HEADERIMAGE + !define MUI_HEADERIMAGE !define MUI_WELCOMEFINISHPAGE_BITMAP "stk_installer.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH !define MUI_HEADERIMAGE_BITMAP "logo_slim.bmp" @@ -82,6 +81,26 @@ ; For the uninstaller in the remove programs !define ADD_REMOVE_KEY_NAME "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAMEANDVERSION}" + Function .onInit + ;Default installation folder + ${If} "${ARCH}" == "x86_64" + ${OrIf} "${ARCH}" == "aarch64" + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + StrCpy $INSTDIR "$PROGRAMFILES64\${APPNAMEANDVERSION}" + ${Else} + StrCpy $INSTDIR "$PROGRAMFILES\${APPNAMEANDVERSION}" + ${EndIf} + ${Else} + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + StrCpy $INSTDIR "$PROGRAMFILES32\${APPNAMEANDVERSION}" + ${Else} + StrCpy $INSTDIR "$PROGRAMFILES\${APPNAMEANDVERSION}" + ${EndIf} + ${EndIf} + FunctionEnd + ;-------------------------------- ;Variables @@ -174,46 +193,43 @@ Section "Install" SecMain ; Try to find the binary directory in a list of 'typical' names: ; The first found directory is used - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld-64\bin\RelWithDebInfo\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld-64\bin\Release\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\build-64\bin\RelWithDebInfo\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\build-64\bin\Release\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build-64\bin\RelWithDebInfo\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build-64\bin\Release\*.* - - File /x *.ilk ${EXEC_PATH} + ;${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\RelWithDebInfo\*.* + ;${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\Release\*.* + ;${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\RelWithDebInfo\*.* + ;${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\Release\*.* + ;${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\RelWithDebInfo\*.* + ;${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\Release\*.* ; Check various options for the editor. Note that us devs mostly use 'bld', ; but documented is the name 'build' - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\Release + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\RelWithDebInfo + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\Release + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\RelWithDebInfo + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\Release + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\RelWithDebInfo + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\Release + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\RelWithDebInfo + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\Release + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\RelWithDebInfo + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\Release + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\RelWithDebInfo + ;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\Release + + File /x *.ilk ..\..\build-${ARCH}\bin\*.* !ifdef EDITOR_PATH File ${EDITOR_PATH}\supertuxkart-editor.exe ${EDITOR_PATH}\supertuxkart-editor.pdb File ${EDITOR_PATH}\..\..\supertuxkart-editor.ico !endif - - File *.ico - ; prereqs - SetOutPath "$INSTDIR\prerequisites" - File /r prerequisites\vcredist_x64.exe + + File *.ico ; data + assets SetOutPath "$INSTDIR\data\" File /r /x .svn /x wip-* ..\..\..\stk-assets\*.* File /r /x *.sh ..\..\data\*.* - + ;Store installation folder WriteRegStr HKCU "Software\${APPNAMEANDVERSION}" "" $INSTDIR @@ -237,18 +253,18 @@ Section "Install" SecMain ; Registry information for add/remove programs ; See http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" \ - "DisplayName" "${APPNAMEANDVERSION} - ${DESCRIPTION}" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "Publisher" "${APPNAME}" + "DisplayName" "${APPNAMEANDVERSION} - ${ARCH}" + WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "Publisher" "SuperTuxKart Team" WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "HelpLink" "$\"${HELPURL}$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLInfoAbout" "$\"${ABOUTURL}$\"" + WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "HelpLink" "${HELPURL}" + WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLUpdateInfo" "${UPDATEURL}" + WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLInfoAbout" "${ABOUTURL}" # There is no option for modifying or repairing the install WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoModify" 1 WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoRepair" 1 - ; Write size + ; Write size ; [...copy all files here, before GetSize...] ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 @@ -256,14 +272,6 @@ Section "Install" SecMain SectionEnd -Section -Prerequisites - ;SetOutPath $INSTDIR\Prerequisites - MessageBox MB_YESNO "Install Microsoft VC++ runtime libraries?" /SD IDYES IDNO endVC - File "prerequisites\vcredist_x64.exe" - ExecWait "$INSTDIR\prerequisites\vcredist_x64.exe /q" - Goto endVC - endVC: -SectionEnd ;-------------------------------- ;Uninstaller Section @@ -273,45 +281,18 @@ Section "Uninstall" redist ; DO NOT USE RMDIR ... $INSTDIR\*.* - if someone should e.g. ; install supertuxkart in c:\Program Files (note: no subdirectory) ; this could remove all files in Program Files!!!!!!!!!!!!!!!!!!! + ; GitHub Actions script will add installed files as seen in windows.yml RMDir /r /REBOOTOK $INSTDIR\data - RMDir /r /REBOOTOK $INSTDIR\prerequisites - DELETE /REBOOTOK "$INSTDIR\install.ico" DELETE /REBOOTOK "$INSTDIR\icon.ico" - DELETE /REBOOTOK "$INSTDIR\libcurl-4.dll" - DELETE /REBOOTOK "$INSTDIR\libeay32.dll" - DELETE /REBOOTOK "$INSTDIR\License.txt" - DELETE /REBOOTOK "$INSTDIR\libfreetype.dll" - DELETE /REBOOTOK "$INSTDIR\libogg-0.dll" - DELETE /REBOOTOK "$INSTDIR\OpenAL32.dll" - DELETE /REBOOTOK "$INSTDIR\physfs.dll" - DELETE /REBOOTOK "$INSTDIR\pthreadVC2.dll" - DELETE /REBOOTOK "$INSTDIR\ssleay32.dll" - DELETE /REBOOTOK "$INSTDIR\supertuxkart.exe" DELETE /REBOOTOK "$INSTDIR\supertuxkart.ico" DELETE /REBOOTOK "$INSTDIR\supertuxkart.icon" - DELETE /REBOOTOK "$INSTDIR\supertuxkart.pdb" - DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.exe" - DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.ico" - DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.pdb" DELETE /REBOOTOK "$INSTDIR\uninstall.ico" - DELETE /REBOOTOK "$INSTDIR\libvorbis-0.dll" - DELETE /REBOOTOK "$INSTDIR\libvorbisenc-2.dll" - DELETE /REBOOTOK "$INSTDIR\libvorbisfile-3.dll" - DELETE /REBOOTOK "$INSTDIR\wiiuse.dll" - DELETE /REBOOTOK "$INSTDIR\wiiuse.ilk" - DELETE /REBOOTOK "$INSTDIR\wiiuse.pdb" - DELETE /REBOOTOK "$INSTDIR\wrap_oal.dll" - DELETE /REBOOTOK "$INSTDIR\zlib.dll" - DELETE /REBOOTOK "$INSTDIR\zlib.pdb" - DELETE /REBOOTOK "$INSTDIR\zlib1.dll" - DELETE /REBOOTOK "$INSTDIR\libjpeg-62.dll" - DELETE /REBOOTOK "$INSTDIR\libturbojpeg.dll" - DELETE /REBOOTOK "$INSTDIR\libvpx.dll" - DELETE /REBOOTOK "$INSTDIR\openglrecorder.dll" - Delete /REBOOTOK "$INSTDIR\Uninstall.exe" + ;DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.exe" + ;DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.ico" + ;DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.pdb" RMDir "$INSTDIR" SetShellVarContext all @@ -321,7 +302,7 @@ Section "Uninstall" redist Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall ${APPNAMEANDVERSION}.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\${APPNAMEANDVERSION}.lnk" - Delete "$SMPROGRAMS\$MUI_TEMP\supertuxkart-editor (beta).lnk" + ;Delete "$SMPROGRAMS\$MUI_TEMP\supertuxkart-editor (beta).lnk" ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" diff --git a/tools/windows_installer/supertuxkart.nsi b/tools/windows_installer/supertuxkart.nsi deleted file mode 100755 index 0502837cd..000000000 --- a/tools/windows_installer/supertuxkart.nsi +++ /dev/null @@ -1,344 +0,0 @@ -; Before you start you will need the shelllink plugin for NSIS -; http://nsis.sourceforge.net/ShellLink_plug-in -; Download it from the nsis webpage, and unzip it in the NSIS -; install dir. -; -; To use just put this in a directory below the supertuxkart directory -; which should be called "supertuxkart" and then copy the -; GPL in the supertuxkart directory to 'license.txt'. -; Next to supertuxkart create a subdirectory called 'prerequisites' -; and copy the VC++ (vcredist_x86.exe) redistributables. -; You will then need to make an icon, you can use: -; http://tools.dynamicdrive.com/favicon/ to convert a png to an icon. -; Once you have made an icon put it in the supertuxkart dir and call it -; icon.ico. You will need to do the same for install.ico nd uninstall.ico -; Once there done then all you need to do is compile with NSIS. - -;-------------------------------- -;Include Modern UI - !include "MUI2.nsh" - -;-------------------------------- -;Include LogicLib http://nsis.sourceforge.net/LogicLib - !include 'LogicLib.nsh' - -;-------------------------------- -;Include FileFunc lib - !include "FileFunc.nsh" - -;-------------------------------- -;General - - ; Version information - ; TOOD get these from the source code directly - !define VERSION_MAJOR 0 - !define VERSION_MINOR 10 - !define VERSION_REVISION 0 - ; Empty means stable, could be -git, -rc1 - !define VERSION_BUILD "-git" - - ;Name and file - !define APPNAME "SuperTuxKart" - !define APPNAMEANDVERSION "${APPNAME} ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_BUILD}" - !define DESCRIPTION "3D open-source arcade racer with a variety characters, tracks, and modes to play" - - Name "${APPNAMEANDVERSION}" - OutFile "${APPNAMEANDVERSION} installer-32bit.exe" - - # These will be displayed by the "Click here for support information" link in "Add/Remove Programs" - # It is possible to use "mailto:" links in here to open the email client - !define HELPURL "https://supertuxkart.net/" # "Support Information" link - !define UPDATEURL "https://supertuxkart.net/" # "Product Updates" link - !define ABOUTURL "https://supertuxkart.net/" # "Publisher" link - - RequestExecutionLevel admin - - ;Default installation folder - InstallDir "$PROGRAMFILES\${APPNAMEANDVERSION}" - - ;Get installation folder from registry if available - InstallDirRegKey HKCU "Software\${APPNAMEANDVERSION}" "" - - ;Sets the text in the bottom corner - BrandingText "${APPNAMEANDVERSION} Installer" - - ;Set the icon - !define MUI_ICON "install.ico" - !define MUI_UNICON "uninstall.ico" - !define MUI_HEADERIMAGE - !define MUI_WELCOMEFINISHPAGE_BITMAP "stk_installer.bmp" - !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH - !define MUI_HEADERIMAGE_BITMAP "logo_slim.bmp" - ;!define MUI_TEXT_INSTALLING_SUBTITLE "Please vote for SuperTuxKart to become SourceForge's Project of the month at vote.supertuxkart.net" - ;!define MUI_TEXT_FINISH_INFO_TEXT "Please vote for SuperTuxKart to become $\"Project of the Month$\" at vote.supertuxkart.net" - - ; Sets the compressor to /SOLID lzma which when I (hiker) tested was the best. - ; Between LZMA and zlib there is only a 20 MB difference. - SetCompressor /SOLID zlib - - ;Vista redirects $SMPROGRAMS to all users without this - RequestExecutionLevel admin - - ; For the uninstaller in the remove programs - !define ADD_REMOVE_KEY_NAME "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAMEANDVERSION}" - -;-------------------------------- -;Variables - - Var MUI_TEMP - Var STARTMENU_FOLDER - -;-------------------------------- -;Interface Settings - - !define MUI_ABORTWARNING - -;-------------------------------- -Function validate_dir - IfFileExists $INSTDIR\data\*.* 0 return - IfFileExists $INSTDIR\Uninstall.exe 0 dont_uninstall - MessageBox MB_YESNO "You can't install ${APPNAMEANDVERSION} in an existing directory. Do you wish to run the uninstaller in $INSTDIR?" IDNO dont_uninstall - ; -?=$INSTDIR makes sure that this installer waits for the uninstaller - ; to finish. The uninstaller (and directory) are not removed, but the - ; uninstaller will be overwritten by our installer anyway. - ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR' - goto return - dont_uninstall: - MessageBox MB_OK "You can't install ${APPNAMEANDVERSION} in an existing directory. Please select a new directory." - abort - return: -FunctionEnd -;-------------------------------- -;Pages - - ;Installer pages - !insertmacro MUI_PAGE_WELCOME - !insertmacro MUI_PAGE_LICENSE "..\..\COPYING" - - !define MUI_PAGE_CUSTOMFUNCTION_LEAVE validate_dir - !insertmacro MUI_PAGE_DIRECTORY - - ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APPNAMEANDVERSION}" - !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER - - !insertmacro MUI_PAGE_INSTFILES - ;!define MUI_FINISHPAGE_LINK "Please vote for SuperTuxkart here" - ;!define MUI_FINISHPAGE_LINK_LOCATION "http://vote.supertuxkart.net" - !insertmacro MUI_PAGE_FINISH - - - ;Uninstaller pages - !insertmacro MUI_UNPAGE_WELCOME - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - !insertmacro MUI_UNPAGE_FINISH - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" - - -; --------------------------------------------------------------------------- -; based on http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time -; Sets the variable _VAR_NAME to _FILE_NAME if _VAR_NAME is not defined yet -; and _FILE_NAME exists: -!macro !setIfUndefinedAndExists _VAR_NAME _FILE_NAME - !ifndef ${_VAR_NAME} - !tempfile _TEMPFILE - !ifdef NSIS_WIN32_MAKENSIS - ; Windows - cmd.exe - !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} "${_FILE_NAME}" > "${_TEMPFILE}"' - !else - ; Posix - sh - !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME} ${_FILE_NAME}" > "${_TEMPFILE}"; fi' - !endif - !include '${_TEMPFILE}' - !delfile '${_TEMPFILE}' - !undef _TEMPFILE - !endif -!macroend -!define !setIfUndefinedAndExists "!insertmacro !setIfUndefinedAndExists" - -;-------------------------------- - -;Installer Sections - -Section "Install" SecMain - - SetOutPath "$INSTDIR" - ; files in root dir - - ; Try to find the binary directory in a list of 'typical' names: - ; The first found directory is used - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\RelWithDebInfo\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\Release\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\RelWithDebInfo\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\Release\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\RelWithDebInfo\*.* - ${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\Release\*.* - - File /x *.ilk ${EXEC_PATH} - - ; Check various options for the editor. Note that us devs mostly use 'bld', - ; but documented is the name 'build' - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\Release - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\RelWithDebInfo - ${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\Release - - !ifdef EDITOR_PATH - File ${EDITOR_PATH}\supertuxkart-editor.exe ${EDITOR_PATH}\supertuxkart-editor.pdb - File ${EDITOR_PATH}\..\..\supertuxkart-editor.ico - !endif - - File *.ico - ; prereqs - SetOutPath "$INSTDIR\prerequisites" - File /r prerequisites\vcredist_x86.exe - - ; data + assets - SetOutPath "$INSTDIR\data\" - File /r /x .svn /x wip-* ..\..\..\stk-assets\*.* - File /r /x *.sh ..\..\data\*.* - - - ;Store installation folder - WriteRegStr HKCU "Software\${APPNAMEANDVERSION}" "" $INSTDIR - - ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - - ;Create shortcuts - SetShellVarContext all - CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall ${APPNAMEANDVERSION}.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\uninstall.ico" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAMEANDVERSION}.lnk" "$INSTDIR\supertuxkart.exe" "" "$INSTDIR\icon.ico" - !ifdef EDITOR_PATH - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\supertuxkart-editor (beta).lnk" "$INSTDIR\supertuxkart-editor.exe" "" "$INSTDIR\supertuxkart-editor.ico" - !endif - ShellLink::SetShortCutShowMode $SMPROGRAMS\$STARTMENU_FOLDER\SuperTuxKart.lnk 0 - - !insertmacro MUI_STARTMENU_WRITE_END - - ; Registry information for add/remove programs - ; See http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" \ - "DisplayName" "${APPNAMEANDVERSION} - ${DESCRIPTION}" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "Publisher" "${APPNAME}" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "HelpLink" "$\"${HELPURL}$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\"" - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLInfoAbout" "$\"${ABOUTURL}$\"" - # There is no option for modifying or repairing the install - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoModify" 1 - WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoRepair" 1 - - ; Write size - ; [...copy all files here, before GetSize...] - ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 - IntFmt $0 "0x%08X" $0 - WriteRegDWORD HKLM "${ADD_REMOVE_KEY_NAME}" "EstimatedSize" "$0" - -SectionEnd - -Section -Prerequisites - ;SetOutPath $INSTDIR\Prerequisites - MessageBox MB_YESNO "Install Microsoft VC++ runtime libraries?" /SD IDYES IDNO endVC - File "prerequisites\vcredist_x86.exe" - ExecWait "$INSTDIR\prerequisites\vcredist_x86.exe /q" - Goto endVC - endVC: -SectionEnd -;-------------------------------- -;Uninstaller Section - -Section "Uninstall" redist - - ;Removes all the supertuxkart data files - ; DO NOT USE RMDIR ... $INSTDIR\*.* - if someone should e.g. - ; install supertuxkart in c:\Program Files (note: no subdirectory) - ; this could remove all files in Program Files!!!!!!!!!!!!!!!!!!! - - RMDir /r /REBOOTOK $INSTDIR\data - RMDir /r /REBOOTOK $INSTDIR\prerequisites - - DELETE /REBOOTOK "$INSTDIR\install.ico" - DELETE /REBOOTOK "$INSTDIR\icon.ico" - DELETE /REBOOTOK "$INSTDIR\Irrlicht.dll" - DELETE /REBOOTOK "$INSTDIR\libcurl.dll" - DELETE /REBOOTOK "$INSTDIR\libeay32.dll" - DELETE /REBOOTOK "$INSTDIR\libidn-11.dll" - DELETE /REBOOTOK "$INSTDIR\License.txt" - DELETE /REBOOTOK "$INSTDIR\freetype6.dll" - DELETE /REBOOTOK "$INSTDIR\libogg.dll" - DELETE /REBOOTOK "$INSTDIR\OpenAL32.dll" - DELETE /REBOOTOK "$INSTDIR\physfs.dll" - DELETE /REBOOTOK "$INSTDIR\pthreadVC2.dll" - DELETE /REBOOTOK "$INSTDIR\ssleay32.dll" - DELETE /REBOOTOK "$INSTDIR\supertuxkart.exe" - DELETE /REBOOTOK "$INSTDIR\supertuxkart.ico" - DELETE /REBOOTOK "$INSTDIR\supertuxkart.icon" - DELETE /REBOOTOK "$INSTDIR\supertuxkart.pdb" - DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.exe" - DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.ico" - DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.pdb" - DELETE /REBOOTOK "$INSTDIR\uninstall.ico" - DELETE /REBOOTOK "$INSTDIR\libvorbis.dll" - DELETE /REBOOTOK "$INSTDIR\libvorbisenc.dll" - DELETE /REBOOTOK "$INSTDIR\libvorbisfile.dll" - DELETE /REBOOTOK "$INSTDIR\wiiuse.dll" - DELETE /REBOOTOK "$INSTDIR\wiiuse.ilk" - DELETE /REBOOTOK "$INSTDIR\wiiuse.pdb" - DELETE /REBOOTOK "$INSTDIR\wrap_oal.dll" - DELETE /REBOOTOK "$INSTDIR\zlib.dll" - DELETE /REBOOTOK "$INSTDIR\zlib.pdb" - DELETE /REBOOTOK "$INSTDIR\zlib1.dll" - DELETE /REBOOTOK "$INSTDIR\libjpeg-62.dll" - DELETE /REBOOTOK "$INSTDIR\libturbojpeg.dll" - DELETE /REBOOTOK "$INSTDIR\libvpx.dll" - DELETE /REBOOTOK "$INSTDIR\openglrecorder.dll" - - Delete /REBOOTOK "$INSTDIR\Uninstall.exe" - RMDir "$INSTDIR" - - SetShellVarContext all - - ;Remove start menu items - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall ${APPNAMEANDVERSION}.lnk" - Delete "$SMPROGRAMS\$MUI_TEMP\${APPNAMEANDVERSION}.lnk" - Delete "$SMPROGRAMS\$MUI_TEMP\supertuxkart-editor (beta).lnk" - - ;Delete empty start menu parent diretories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - startMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors startMenuDeleteLoopDone - - StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop - startMenuDeleteLoopDone: - - DeleteRegKey /ifempty HKCU "Software\${APPNAMEANDVERSION}" - DeleteRegKey HKLM "${ADD_REMOVE_KEY_NAME}" - -SectionEnd