1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-21 23:08:53 -05:00

Generate a windows installer

This commit is contained in:
Raphael Assenat 2016-01-21 23:05:59 -05:00
parent 019301b7b2
commit f0880762a2
3 changed files with 103 additions and 1 deletions

View File

@ -1,5 +1,6 @@
CC=gcc CC=gcc
LD=$(CC) LD=$(CC)
VERSION=1.0
UNAME := $(shell uname -s) UNAME := $(shell uname -s)
ifeq ($(UNAME), Linux) ifeq ($(UNAME), Linux)
@ -13,6 +14,7 @@ ifeq ($(shell uname -o), Msys)
COMPAT_OBJS=sleep.o memmem.o strcasestr.o app.o COMPAT_OBJS=sleep.o memmem.o strcasestr.o app.o
PLATFORM_CFLAGS=-DWINDOWS PLATFORM_CFLAGS=-DWINDOWS
EXTRA_LDFLAGS=-mwindows # uncomment for console output EXTRA_LDFLAGS=-mwindows # uncomment for console output
MAKENSIS=/c/Program\ Files\ \(x86\)/NSIS/makensis
endif endif
CFLAGS=-Wall -g `pkg-config $(HIDAPI_NAME) --cflags` --std=c99 $(PLATFORM_CFLAGS) CFLAGS=-Wall -g `pkg-config $(HIDAPI_NAME) --cflags` --std=c99 $(PLATFORM_CFLAGS)
@ -76,6 +78,9 @@ install:
@echo "Install not done yet. Sorry" @echo "Install not done yet. Sorry"
release_windows: release_windows:
cp *.exe release_windows cp $(addsuffix .exe,$(PROGS)) release_windows
cp gui.xml release_windows cp gui.xml release_windows
cp project_image.png release_windows cp project_image.png release_windows
$(MAKENSIS) //DVERSION=$(VERSION) gcn64ctl.nsi
ls installers
@echo "Done"

96
tools/gcn64ctl.nsi Normal file
View File

@ -0,0 +1,96 @@
; example2.nsi
;
; This script is based on example1.nsi, but it remember the directory,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install example2.nsi into a directory that the user selects,
;--------------------------------
; The name of the installer
Name "gcn64ctl"
; The file to write
OutFile "installers/gcn64ctl-install-${VERSION}.exe"
; The default installation directory
InstallDir $PROGRAMFILES\gcn64ctl
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\gcn64ctl" "Install_Dir"
LicenseData ../LICENSE
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
!include "LogicLib.nsh"
!include "x64.nsh"
; Pages
Page license
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "gcn64ctl (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File /r "release_windows\*.*"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\gcn64ctl "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\gcn64ctl" "DisplayName" "gcn64ctl"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\gcn64ctl" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\gcn64ctl" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\gcn64ctl" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\raphnet-tech gcn64ctl"
CreateShortCut "$SMPROGRAMS\raphnet-tech gcn64ctl\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\raphnet-tech gcn64ctl\gcn64ctl.lnk" "$INSTDIR\gcn64ctl_gui.exe" "" "$INSTDIR\gcn64ctl_gui.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\gcn64ctl"
DeleteRegKey HKLM SOFTWARE\gcn64ctl
; Remove files and uninstaller
Delete "$INSTDIR\*.*"
; Remove shortcuts, if any
Delete "$SMPROGRAMS\gcn64ctl\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\gcn64ctl"
RMDir "$INSTDIR"
SectionEnd

1
tools/installers/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.exe