Add NSIS script for generating Windows installer

This commit is contained in:
kichikuou
2020-08-01 21:43:15 +09:00
parent 730b15dfca
commit c66714bab6
4 changed files with 99 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# To use this script in MSYS2 shell, install mingw-w64-x86_64-nsis and
# mingw-w64-x86_64-ntldd-git packages.
if [ $# -ne 2 ]; then
echo 'Usage: make-installer.sh <build-dir> <nsi>'
exit 1
fi
builddir=$1
nsi=$2
echo 'dlls.nsi:'
ntldd -R $builddir/src/xsystem35.exe |perl -ne 'print "File \"$1\"\n" if /=> (.*) \(/' |grep mingw |tee $builddir/dlls.nsi
echo
echo 'dlls-uninstall.nsi:'
sed 's/^File ".*\\/Delete "$INSTDIR\\/' $builddir/dlls.nsi |tee $builddir/dlls-uninstall.nsi
echo
makensis -INPUTCHARSET UTF8 -DBUILDDIR="$builddir" "$nsi"
+4
View File
@@ -0,0 +1,4 @@
Name xsystem35
OutFile xsystem35-32bit.exe
InstallDir $PROGRAMFILES32\xsystem35
!include xsystem35.nsi
+4
View File
@@ -0,0 +1,4 @@
Name xsystem35
OutFile xsystem35-64bit.exe
InstallDir $PROGRAMFILES64\xsystem35
!include xsystem35.nsi
+70
View File
@@ -0,0 +1,70 @@
Unicode true
ManifestDPIAware true
SetCompressor /SOLID lzma
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Japanese.nlf"
Page license
Page directory
Page components
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
LicenseData ..\COPYING
Section
SetOutPath $INSTDIR
FILE ${BUILDDIR}\src\xsystem35.exe
!include ${BUILDDIR}\dlls.nsi
SetOutPath $INSTDIR\fonts
FILE /x CMakeLists.txt ..\fonts\*.*
WriteUninstaller $INSTDIR\uninstall.exe
WriteRegStr HKLM "Software\Kichikuou\xsystem35\profile" "ttfont_gothic" "$INSTDIR\fonts\MTLc3m.ttf"
WriteRegStr HKLM "Software\Kichikuou\xsystem35\profile" "ttfont_mincho" "$INSTDIR\fonts\mincho.ttf"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35" "DisplayName" "xsystem35 (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35" "UninstallString" '"$INSTDIR\uninstall.exe"'
SectionEnd
LangString FileAssociation ${LANG_ENGLISH} "Associate with .ALD file type"
LangString FileAssociation ${LANG_JAPANESE} ".ALD ファイルに関連付け"
Section "$(FileAssociation)"
WriteRegStr HKCR ".ald" "" "System35Archive"
WriteRegStr HKCR "System35Archive" "" "AliceSoft System 3.x archive"
WriteRegStr HKCR "System35Archive\DefaultIcon" "" "$INSTDIR\xsystem35.exe,1"
WriteRegStr HKCR "System35Archive\shell\open\command" "" '"$INSTDIR\xsystem35.exe" "%1"'
SectionEnd
LangString DesktopIcon ${LANG_ENGLISH} "Create Desktop icon"
LangString DesktopIcon ${LANG_JAPANESE} "デスクトップショートカットを作成"
Section "$(DesktopIcon)"
CreateShortcut $DESKTOP\xsystem35.lnk $INSTDIR\xsystem35.exe
SectionEnd
LangString StartMenu ${LANG_ENGLISH} "Create Start menu entry"
LangString StartMenu ${LANG_JAPANESE} "スタートメニューに登録"
Section "$(StartMenu)"
CreateDirectory $SMPROGRAMS\xsystem35
CreateShortcut $SMPROGRAMS\xsystem35\xsystem35.lnk $INSTDIR\xsystem35.exe
CreateShortcut $SMPROGRAMS\xsystem35\uninstall.lnk $INSTDIR\uninstall.exe
SectionEnd
Section "Uninstall"
Delete $DESKTOP\xsystem35.lnk
RMDir /r $SMPROGRAMS\xsystem35
DeleteRegKey HKCR ".ald"
DeleteRegKey HKCR "System35Archive"
DeleteRegKey HKLM "Software\Kichikuou\xsystem35"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xsystem35"
RMDir /r $INSTDIR\fonts
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\xsystem35.exe
!include ${BUILDDIR}\dlls-uninstall.nsi
RMDir $INSTDIR
SectionEnd