diff --git a/.gitignore b/.gitignore index 50980ca..8c1ff8b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ cover* # will be treated later /examples/* + +# nsis +nsis/*.dll +nsis/*.exe diff --git a/Makefile b/Makefile index 96d0970..e4369e5 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SHELL := bash .DELETE_ON_ERROR: MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules -.PHONY: help clean build install tests test doc +.PHONY: help clean build install tests test doc nsis all: build @@ -141,6 +141,19 @@ dist/katenary-freebsd-arm64: @echo -e "\033[1;32mBuilding katenary $(VERSION) for freebsd-arm64...\033[0m" $(MAKE) katenary GOOS=freebsd GOARCH=arm64 OUT=$@ + +nsis/EnVar.dll: + curl https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip -o nsis/EnVar_plugin.zip + cd nsis + unzip -o EnVar_plugin.zip Plugins/x86-unicode/EnVar.dll + mv Plugins/x86-unicode/EnVar.dll EnVar.dll + rm -rf EnVar_plugin.zip Plugins + +nsis: nsis/EnVar.dll dist/katenary.exe + @echo -e "\033[1;32mBuilding katenary $(VERSION) for windows with NSIS...\033[0m" + cd nsis && makensis -DAPP_VERSION=$(VERSION) katenary.nsi + + gpg-sign: rm -f dist/*.asc $(MAKE) $(ASC_BINARIES) diff --git a/nsis/katenary.nsi b/nsis/katenary.nsi new file mode 100644 index 0000000..3479ab4 --- /dev/null +++ b/nsis/katenary.nsi @@ -0,0 +1,47 @@ +!define APP_NAME "Katenary" +!define COMPANY_NAME "Katenary" + +OutFile "katenary_installer.exe" +InstallDir "$LOCALAPPDATA\Katenary" +RequestExecutionLevel user + +!include "MUI2.nsh" +!addplugindir "." + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +!insertmacro MUI_LANGUAGE "English" +!insertmacro MUI_LANGUAGE "French" + +Name "${APP_NAME} ${APP_VERSION}" + +Section "Install" + SetOutPath "$INSTDIR" + File "..\dist\katenary.exe" + WriteUninstaller "$INSTDIR\uninstall.exe" + + ; Manipulation PATH utilisateur + EnVar::SetHKCU + Pop $0 + + EnVar::AddValue "Path" "$INSTDIR" + Pop $0 ; 0 = succès + +SectionEnd + +Section "Uninstall" + EnVar::SetHKCU + Pop $0 + + EnVar::DeleteValue "Path" "$INSTDIR" + Pop $0 + + Delete "$INSTDIR\katenary.exe" + Delete "$INSTDIR\uninstall.exe" +SectionEnd