From 31428275e0bb665106133e21ad33307f502834e9 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 31 Jul 2021 16:55:37 -0400 Subject: [PATCH] Use "VCV Rack Community Edition 2.x" or "Rack CE 2" in installer on Windows. --- Makefile | 65 +++++++++++++++++++++--------------------- installer.nsi | 79 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 82 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index 9b0603fa..c32daf7a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ RACK_DIR ?= . +EDITION := CE +EDITION_NAME := Community Edition +VERSION_MAJOR := 2 VERSION := 2.dev.$(shell git rev-parse --short HEAD) # VERSION := 2.0.0 @@ -137,15 +140,14 @@ ifdef ARCH_WIN windres $^ -O coff -o $@ endif - DIST_RES := res cacert.pem Core.json template.vcv -DIST_NAME := Rack-"$(VERSION)"-$(ARCH) +DIST_NAME := Rack-$(EDITION)-"$(VERSION)"-$(ARCH) DIST_SDK_DIR := Rack-SDK DIST_SDK := Rack-SDK-$(VERSION).zip ifdef ARCH_MAC - DIST_DIR := VCV Rack.app + DIST_BUNDLE := VCV Rack $(EDITION) $(VERSION_MAJOR).app else - DIST_DIR := Rack + DIST_DIR := Rack$(EDITION)$(VERSION_MAJOR) endif DIST_MD := $(wildcard *.md) DIST_HTML := $(patsubst %.md, build/%.html, $(DIST_MD)) @@ -171,35 +173,35 @@ ifdef ARCH_LIN cp $(DIST_HTML) dist/"$(DIST_DIR)"/ cp plugins/Fundamental/dist/Fundamental-*.vcvplugin dist/"$(DIST_DIR)"/Fundamental.vcvplugin # Make ZIP - cd dist && zip -q -9 -r $(DIST_NAME).zip Rack + cd dist && zip -q -9 -r $(DIST_NAME).zip $(DIST_DIR) endif ifdef ARCH_MAC - mkdir -p dist/"$(DIST_DIR)" - mkdir -p dist/"$(DIST_DIR)"/Contents - mkdir -p dist/"$(DIST_DIR)"/Contents/Resources - mkdir -p dist/"$(DIST_DIR)"/Contents/MacOS - cp $(TARGET) dist/"$(DIST_DIR)"/Contents/Resources/ - cp $(STANDALONE_TARGET) dist/"$(DIST_DIR)"/Contents/MacOS/ - $(STRIP) -S dist/"$(DIST_DIR)"/Contents/Resources/$(TARGET) - $(STRIP) -S dist/"$(DIST_DIR)"/Contents/MacOS/$(STANDALONE_TARGET) - install_name_tool -change $(TARGET) @executable_path/../Resources/$(TARGET) dist/"$(DIST_DIR)"/Contents/MacOS/$(STANDALONE_TARGET) + mkdir -p dist/"$(DIST_BUNDLE)" + mkdir -p dist/"$(DIST_BUNDLE)"/Contents + mkdir -p dist/"$(DIST_BUNDLE)"/Contents/Resources + mkdir -p dist/"$(DIST_BUNDLE)"/Contents/MacOS + cp $(TARGET) dist/"$(DIST_BUNDLE)"/Contents/Resources/ + cp $(STANDALONE_TARGET) dist/"$(DIST_BUNDLE)"/Contents/MacOS/ + $(STRIP) -S dist/"$(DIST_BUNDLE)"/Contents/Resources/$(TARGET) + $(STRIP) -S dist/"$(DIST_BUNDLE)"/Contents/MacOS/$(STANDALONE_TARGET) + install_name_tool -change $(TARGET) @executable_path/../Resources/$(TARGET) dist/"$(DIST_BUNDLE)"/Contents/MacOS/$(STANDALONE_TARGET) # Manually check that no nonstandard shared libraries are linked - otool -L dist/"$(DIST_DIR)"/Contents/Resources/$(TARGET) - otool -L dist/"$(DIST_DIR)"/Contents/MacOS/$(STANDALONE_TARGET) + otool -L dist/"$(DIST_BUNDLE)"/Contents/Resources/$(TARGET) + otool -L dist/"$(DIST_BUNDLE)"/Contents/MacOS/$(STANDALONE_TARGET) # Copy resources - cp Info.plist dist/"$(DIST_DIR)"/Contents/ - $(SED) 's/{VERSION}/$(VERSION)/g' dist/"$(DIST_DIR)"/Contents/Info.plist - cp -R $(DIST_RES) dist/"$(DIST_DIR)"/Contents/Resources/ - cp $(DIST_HTML) dist/"$(DIST_DIR)"/Contents/Resources/ - cp -R icon.icns dist/"$(DIST_DIR)"/Contents/Resources/ - cp plugins/Fundamental/dist/Fundamental-*.vcvplugin dist/"$(DIST_DIR)"/Fundamental.vcvplugin + cp Info.plist dist/"$(DIST_BUNDLE)"/Contents/ + $(SED) 's/{VERSION}/$(VERSION)/g' dist/"$(DIST_BUNDLE)"/Contents/Info.plist + cp -R $(DIST_RES) dist/"$(DIST_BUNDLE)"/Contents/Resources/ + cp $(DIST_HTML) dist/"$(DIST_BUNDLE)"/Contents/Resources/ + cp -R icon.icns dist/"$(DIST_BUNDLE)"/Contents/Resources/ + cp plugins/Fundamental/dist/Fundamental-*.vcvplugin dist/"$(DIST_BUNDLE)"/Fundamental.vcvplugin # Clean up and sign bundle - xattr -cr dist/"$(DIST_DIR)" + xattr -cr dist/"$(DIST_BUNDLE)" # This will only work if you have the private key to my certificate - codesign --verbose --sign "Developer ID Application: Andrew Belt (VRF26934X5)" --options runtime --entitlements Entitlements.plist --deep dist/"$(DIST_DIR)" - codesign --verify --deep --strict --verbose=2 dist/"$(DIST_DIR)" + codesign --verbose --sign "Developer ID Application: Andrew Belt (VRF26934X5)" --options runtime --entitlements Entitlements.plist --deep dist/"$(DIST_BUNDLE)" + codesign --verify --deep --strict --verbose=2 dist/"$(DIST_BUNDLE)" # Make ZIP - cd dist && zip -q -9 -r $(DIST_NAME).zip "$(DIST_DIR)" + cd dist && zip -q -9 -r $(DIST_NAME).zip "$(DIST_BUNDLE)" endif ifdef ARCH_WIN mkdir -p dist/"$(DIST_DIR)" @@ -218,8 +220,7 @@ ifdef ARCH_WIN cd dist && zip -q -9 -r $(DIST_NAME).zip "$(DIST_DIR)" # Make NSIS installer # pacman -S mingw-w64-x86_64-nsis - makensis -DVERSION=$(VERSION) installer.nsi - mv installer.exe dist/$(DIST_NAME).exe + makensis -DEDITION="$(EDITION)" -DEDITION_NAME="$(EDITION_NAME)" -DVERSION_MAJOR="$(VERSION_MAJOR)" -DVERSION="$(VERSION)" "-XOutFile dist/$(DIST_NAME).exe" installer.nsi endif # Build Rack SDK @@ -236,7 +237,7 @@ endif notarize: ifdef ARCH_MAC # This will only work if you have my Apple ID password in your keychain - xcrun altool --notarize-app -f dist/"$(DIST_DIR)"-$(VERSION)-$(ARCH).zip --primary-bundle-id=com.vcvrack.rack -u "andrewpbelt@gmail.com" -p @keychain:notarize --output-format xml > dist/UploadInfo.plist + xcrun altool --notarize-app -f dist/"$(DIST_BUNDLE)"-"$(VERSION)"-$(ARCH).zip --primary-bundle-id=com.vcvrack.rack -u "andrewpbelt@gmail.com" -p @keychain:notarize --output-format xml > dist/UploadInfo.plist # Wait for Apple's servers to approve the app while true; do \ echo "Waiting on Apple servers..." ; \ @@ -247,9 +248,9 @@ ifdef ARCH_MAC sleep 10 ; \ done # Mark app as notarized, check, and re-zip - xcrun stapler staple dist/"$(DIST_DIR)" - spctl --assess --type execute --ignore-cache --no-cache -vv dist/"$(DIST_DIR)" - cd dist && zip -q -9 -r $(DIST_NAME).zip Rack.app + xcrun stapler staple dist/"$(DIST_BUNDLE)" + spctl --assess --type execute --ignore-cache --no-cache -vv dist/"$(DIST_BUNDLE)" + cd dist && zip -q -9 -r "$(DIST_NAME)".zip "$(DIST_BUNDLE)" endif diff --git a/installer.nsi b/installer.nsi index 7fd7928c..4c032d33 100644 --- a/installer.nsi +++ b/installer.nsi @@ -1,16 +1,21 @@ !include "MUI2.nsh" -Name "VCV Rack ${VERSION}" -OutFile "installer.exe" +!define NAME_FULL "VCV Rack ${EDITION_NAME} ${VERSION}" +!define NAME "VCV Rack ${EDITION} ${VERSION_MAJOR}" +Name "${NAME_FULL}" SetCompressor /solid "lzma" SetCompressorDictSize 8 CRCCheck On ; Default installation folder -InstallDir "$PROGRAMFILES\VCV\Rack2" +!define RACK_DIR "Rack${EDITION}${VERSION_MAJOR}" +InstallDir "$PROGRAMFILES\VCV\${RACK_DIR}" ; Get installation folder from registry if available -InstallDirRegKey HKLM "Software\VCV\Rack2" "" +!define INSTALL_REG "Software\VCV\Rack${EDITION}${VERSION_MAJOR}" +InstallDirRegKey HKLM "${INSTALL_REG}" "" + +!define UNINSTALL_REG "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack${EDITION}${VERSION_MAJOR}" ; Request admin permissions so we can install to Program Files and add a registry entry RequestExecutionLevel admin @@ -21,8 +26,8 @@ RequestExecutionLevel admin !define MUI_ICON "icon.ico" ;!define MUI_HEADERIMAGE ;!define MUI_HEADERIMAGE_BITMAP "installer-banner.bmp" ; 150x57 -;!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" ; 164x314 -;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" ; 164x314 +;!define MUI_WELCOMEFINISHPAGE_BITMAP "$NSISDIR\Contrib\Graphics\Wizard\win.bmp" ; 164x314 +;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "$NSISDIR\Contrib\Graphics\Wizard\win.bmp" ; 164x314 !define MUI_COMPONENTSPAGE_NODESC ;!insertmacro MUI_PAGE_COMPONENTS @@ -31,18 +36,32 @@ RequestExecutionLevel admin ; This is necessary because the uninstaller removes the installation directory, which is dangerous for directories that existed before Rack was installed. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE directoryLeave Function directoryLeave - IfFileExists "$INSTDIR" directoryExists directoryNotExists - directoryExists: - MessageBox MB_OK|MB_ICONSTOP "Cannot install to $INSTDIR. Folder already exists." + StrCmp "$INSTDIR" "$PROGRAMFILES" directoryBad + StrCmp "$INSTDIR" "$PROGRAMFILES32" directoryBad + StrCmp "$INSTDIR" "$PROGRAMFILES64" directoryBad + StrCmp "$INSTDIR" "$COMMONFILES" directoryBad + StrCmp "$INSTDIR" "$COMMONFILES32" directoryBad + StrCmp "$INSTDIR" "$COMMONFILES64" directoryBad + StrCmp "$INSTDIR" "$DESKTOP" directoryBad + StrCmp "$INSTDIR" "$WINDIR" directoryBad + StrCmp "$INSTDIR" "$SYSDIR" directoryBad + StrCmp "$INSTDIR" "$DOCUMENTS" directoryBad + StrCmp "$INSTDIR" "$MUSIC" directoryBad + StrCmp "$INSTDIR" "$PICTURES" directoryBad + StrCmp "$INSTDIR" "$VIDEOS" directoryBad + StrCmp "$INSTDIR" "$APPDATA" directoryBad + StrCmp "$INSTDIR" "$LOCALAPPDATA" directoryBad + Return + directoryBad: + MessageBox MB_OK|MB_ICONSTOP "Cannot install to $INSTDIR." Abort - directoryNotExists: FunctionEnd !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_RUN "$INSTDIR\Rack.exe" -!define MUI_FINISHPAGE_RUN_TEXT "Launch VCV Rack" +!define MUI_FINISHPAGE_RUN_TEXT "Launch ${NAME}" !insertmacro MUI_PAGE_FINISH ; MUI uninstaller pages @@ -59,35 +78,35 @@ Section "Install" INSTALL_SECTION SectionIn RO SetOutPath "$INSTDIR" - File /r "dist\Rack\*" + File /r "dist\${RACK_DIR}\*" ; Store installation folder - WriteRegStr HKLM "Software\VCV\Rack2" "" "$INSTDIR" + WriteRegStr HKLM "${INSTALL_REG}" "" "$INSTDIR" ; Write uninstaller info - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "DisplayName" "VCV Rack 2" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "DisplayIcon" '"$INSTDIR\Rack.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "DisplayVersion" "${VERSION}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "UninstallString" '"$INSTDIR\Uninstall.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "InstallLocation" '"$INSTDIR"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "Publisher" "VCV" + WriteRegStr HKLM "${UNINSTALL_REG}" "DisplayName" "${NAME}" + WriteRegStr HKLM "${UNINSTALL_REG}" "DisplayIcon" '"$INSTDIR\Rack.exe"' + WriteRegStr HKLM "${UNINSTALL_REG}" "DisplayVersion" "${VERSION}" + WriteRegStr HKLM "${UNINSTALL_REG}" "UninstallString" '"$INSTDIR\Uninstall.exe"' + WriteRegStr HKLM "${UNINSTALL_REG}" "QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S' + WriteRegStr HKLM "${UNINSTALL_REG}" "InstallLocation" '"$INSTDIR"' + WriteRegStr HKLM "${UNINSTALL_REG}" "Publisher" "VCV" SectionGetSize ${INSTALL_SECTION} $0 - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "EstimatedSize" $0 - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "NoModify" 1 - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" "NoRepair" 1 + WriteRegDWORD HKLM "${UNINSTALL_REG}" "EstimatedSize" $0 + WriteRegDWORD HKLM "${UNINSTALL_REG}" "NoModify" 1 + WriteRegDWORD HKLM "${UNINSTALL_REG}" "NoRepair" 1 ; Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" ; Associate file type WriteRegStr HKLM "Software\Classes\.vcv" "" "VCVRack.Patch" - WriteRegStr HKLM "Software\Classes\VCVRack.Patch" "" "VCV Rack Patch" + WriteRegStr HKLM "Software\Classes\VCVRack.Patch" "" "VCV Rack patch" WriteRegStr HKLM "Software\Classes\VCVRack.Patch\shell\open\command" "" '"$INSTDIR\Rack.exe" "%1"' ; Create shortcuts - CreateShortcut "$DESKTOP\VCV Rack 2.lnk" "$INSTDIR\Rack.exe" - CreateShortcut "$SMPROGRAMS\VCV Rack 2.lnk" "$INSTDIR\Rack.exe" + CreateShortcut "$DESKTOP\${NAME}.lnk" "$INSTDIR\Rack.exe" + CreateShortcut "$SMPROGRAMS\${NAME}.lnk" "$INSTDIR\Rack.exe" SectionEnd @@ -97,12 +116,12 @@ Section "Uninstall" ; Attempt to remove C:\Program Files\VCV if empty RMDir "$INSTDIR\.." - Delete "$DESKTOP\VCV Rack 2.lnk" - Delete "$SMPROGRAMS\VCV Rack 2.lnk" + Delete "$DESKTOP\${NAME}.lnk" + Delete "$SMPROGRAMS\${NAME}.lnk" - DeleteRegKey HKLM "Software\VCV\Rack2" + DeleteRegKey HKLM "${INSTALL_REG}" DeleteRegKey /ifempty HKLM "Software\VCV" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VCVRack2" + DeleteRegKey HKLM "${UNINSTALL_REG}" DeleteRegKey HKLM "Software\Classes\.vcv" DeleteRegKey HKLM "Software\Classes\VCVRack.Patch" SectionEnd