NSIS: Always pass ARCH variable to script and handle case when the variable is empty
This commit is contained in:
parent
1f1367bb5a
commit
f38a31e208
3 changed files with 105 additions and 27 deletions
|
@ -18,7 +18,7 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
!define _DEBUG
|
#!define _DEBUG
|
||||||
#!define _INCLUDE_DATA_FILES
|
#!define _INCLUDE_DATA_FILES
|
||||||
|
|
||||||
Name ScummVM
|
Name ScummVM
|
||||||
|
@ -31,7 +31,7 @@ Name ScummVM
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
#!define top_srcdir ""
|
#!define top_srcdir ""
|
||||||
#!define staging_dir ""
|
#!define staging_dir ""
|
||||||
#!define ARCH "" ;(optional, defaults to win32)
|
#!define ARCH "" ;(optional, defaults to win32)
|
||||||
|
|
||||||
# Check parameters
|
# Check parameters
|
||||||
|
@ -46,6 +46,12 @@ Name ScummVM
|
||||||
!ifndef ARCH
|
!ifndef ARCH
|
||||||
!warning "ARCH has not been defined, defaulting to 'win32'"
|
!warning "ARCH has not been defined, defaulting to 'win32'"
|
||||||
!define ARCH "win32"
|
!define ARCH "win32"
|
||||||
|
!else
|
||||||
|
!if "${ARCH}" == ""
|
||||||
|
!warning "ARCH was empty, defaulting to 'win32'"
|
||||||
|
!undef ARCH
|
||||||
|
!define ARCH "win32"
|
||||||
|
!endif
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
@ -219,7 +225,7 @@ Section "ScummVM" SecMain
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
|
|
||||||
# Text files
|
# Text files
|
||||||
File /oname=AUTHORS.txt "${top_srcdir}\AUTHORS"
|
File /oname=AUTHORS.txt "${top_srcdir}\AUTHORS"
|
||||||
File /oname=COPYING.LGPL.txt "${top_srcdir}\COPYING.LGPL"
|
File /oname=COPYING.LGPL.txt "${top_srcdir}\COPYING.LGPL"
|
||||||
File /oname=COPYING.txt "${top_srcdir}\COPYING"
|
File /oname=COPYING.txt "${top_srcdir}\COPYING"
|
||||||
File /oname=COPYRIGHT.txt "${top_srcdir}\COPYRIGHT"
|
File /oname=COPYRIGHT.txt "${top_srcdir}\COPYRIGHT"
|
||||||
|
@ -228,15 +234,15 @@ Section "ScummVM" SecMain
|
||||||
|
|
||||||
# Convert line endings
|
# Convert line endings
|
||||||
Push "$INSTDIR\AUTHORS.txt"
|
Push "$INSTDIR\AUTHORS.txt"
|
||||||
Call unix2dos
|
Call unix2dos
|
||||||
Push "$INSTDIR\COPYING.LGPL.txt"
|
Push "$INSTDIR\COPYING.LGPL.txt"
|
||||||
Call unix2dos
|
Call unix2dos
|
||||||
Push "$INSTDIR\COPYING.txt"
|
Push "$INSTDIR\COPYING.txt"
|
||||||
Call unix2dos
|
Call unix2dos
|
||||||
Push "$INSTDIR\COPYRIGHT.txt"
|
Push "$INSTDIR\COPYRIGHT.txt"
|
||||||
Call unix2dos
|
Call unix2dos
|
||||||
Push "$INSTDIR\NEWS.txt"
|
Push "$INSTDIR\NEWS.txt"
|
||||||
Call unix2dos
|
Call unix2dos
|
||||||
Push "$INSTDIR\README.txt"
|
Push "$INSTDIR\README.txt"
|
||||||
Call unix2dos
|
Call unix2dos
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,7 @@ Name ScummVM
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
#!define top_srcdir ""
|
#!define top_srcdir ""
|
||||||
#!define build_dir ""
|
#!define staging_dir ""
|
||||||
#!define text_dir ""
|
|
||||||
#!define ARCH "" ;(optional, defaults to win32)
|
#!define ARCH "" ;(optional, defaults to win32)
|
||||||
|
|
||||||
# Check parameters
|
# Check parameters
|
||||||
|
@ -40,17 +39,19 @@ Name ScummVM
|
||||||
!error "Top source folder has not been passed to command line!"
|
!error "Top source folder has not been passed to command line!"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifndef build_dir
|
!ifndef staging_dir
|
||||||
!error "Build folder has not been passed to command line (this folder should contain the executable and linked DLLs)!"
|
!error "Staging folder has not been passed to command line (this folder should contain the executable and linked DLLs)!"
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifndef text_dir
|
|
||||||
!error "Text folder has not been passed to command line (this folder should contain all the text files used by the installer)!"
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifndef ARCH
|
!ifndef ARCH
|
||||||
!warning "ARCH has not been defined, defaulting to 'win32'"
|
!warning "ARCH has not been defined, defaulting to 'win32'"
|
||||||
!define ARCH "win32"
|
!define ARCH "win32"
|
||||||
|
!else
|
||||||
|
!if "${ARCH}" == ""
|
||||||
|
!warning "ARCH was empty, defaulting to 'win32'"
|
||||||
|
!undef ARCH
|
||||||
|
!define ARCH "win32"
|
||||||
|
!endif
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
@ -72,7 +73,7 @@ Name ScummVM
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Installer configuration
|
# Installer configuration
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
OutFile ${build_dir}\scummvm-${VERSION}-${ARCH}.exe
|
OutFile ${staging_dir}\scummvm-${VERSION}-${ARCH}.exe
|
||||||
InstallDir $PROGRAMFILES\ScummVM ; Default installation folder
|
InstallDir $PROGRAMFILES\ScummVM ; Default installation folder
|
||||||
InstallDirRegKey HKCU "Software\ScummVM\ScummVM" "InstallPath" ; Get installation folder from registry if available
|
InstallDirRegKey HKCU "Software\ScummVM\ScummVM" "InstallPath" ; Get installation folder from registry if available
|
||||||
; The application name needs to be refered directly instead of through ${REGKEY}
|
; The application name needs to be refered directly instead of through ${REGKEY}
|
||||||
|
@ -224,13 +225,26 @@ Section "ScummVM" SecMain
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
|
|
||||||
# Text files
|
# Text files
|
||||||
File /oname=AUTHORS.txt "${text_dir}\AUTHORS"
|
File /oname=AUTHORS.txt "${top_srcdir}\AUTHORS"
|
||||||
File /oname=COPYING.LGPL.txt "${text_dir}\COPYING.LGPL"
|
File /oname=COPYING.LGPL.txt "${top_srcdir}\COPYING.LGPL"
|
||||||
File /oname=COPYING.txt "${text_dir}\COPYING"
|
File /oname=COPYING.txt "${top_srcdir}\COPYING"
|
||||||
File /oname=COPYRIGHT.txt "${text_dir}\COPYRIGHT"
|
File /oname=COPYRIGHT.txt "${top_srcdir}\COPYRIGHT"
|
||||||
File /oname=NEWS.txt "${text_dir}\NEWS"
|
File /oname=NEWS.txt "${top_srcdir}\NEWS"
|
||||||
File /oname=README.txt "${text_dir}\README"
|
File /oname=README.txt "${top_srcdir}\README"
|
||||||
File /oname=README-SDL.txt "${build_dir}\README-SDL"
|
|
||||||
|
# Convert line endings
|
||||||
|
Push "$INSTDIR\AUTHORS.txt"
|
||||||
|
Call unix2dos
|
||||||
|
Push "$INSTDIR\COPYING.LGPL.txt"
|
||||||
|
Call unix2dos
|
||||||
|
Push "$INSTDIR\COPYING.txt"
|
||||||
|
Call unix2dos
|
||||||
|
Push "$INSTDIR\COPYRIGHT.txt"
|
||||||
|
Call unix2dos
|
||||||
|
Push "$INSTDIR\NEWS.txt"
|
||||||
|
Call unix2dos
|
||||||
|
Push "$INSTDIR\README.txt"
|
||||||
|
Call unix2dos
|
||||||
|
|
||||||
!ifdef _INCLUDE_DATA_FILES
|
!ifdef _INCLUDE_DATA_FILES
|
||||||
# Engine data
|
# Engine data
|
||||||
|
@ -253,8 +267,8 @@ Section "ScummVM" SecMain
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
# Main exe and dlls
|
# Main exe and dlls
|
||||||
File "${build_dir}\scummvm.exe"
|
File "${staging_dir}\scummvm.exe"
|
||||||
File "${build_dir}\SDL.dll"
|
File "${staging_dir}\SDL.dll"
|
||||||
|
|
||||||
WriteRegStr HKCU "${REGKEY}" InstallPath "$INSTDIR" ; Store installation folder
|
WriteRegStr HKCU "${REGKEY}" InstallPath "$INSTDIR" ; Store installation folder
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
@ -354,3 +368,61 @@ Function un.onInit
|
||||||
ReadRegStr $INSTDIR HKCU "${REGKEY}" InstallPath
|
ReadRegStr $INSTDIR HKCU "${REGKEY}" InstallPath
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# Helper functions
|
||||||
|
#########################################################################################
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------
|
||||||
|
; strips all CRs and then converts all LFs into CRLFs
|
||||||
|
; (this is roughly equivalent to "cat file | dos2unix | unix2dos")
|
||||||
|
;
|
||||||
|
; Usage:
|
||||||
|
; Push "infile"
|
||||||
|
; Call unix2dos
|
||||||
|
;
|
||||||
|
; Note: this function destroys $0 $1 $2
|
||||||
|
Function unix2dos
|
||||||
|
ClearErrors
|
||||||
|
|
||||||
|
Pop $2
|
||||||
|
Rename $2 $2.U2D
|
||||||
|
FileOpen $1 $2 w
|
||||||
|
|
||||||
|
FileOpen $0 $2.U2D r
|
||||||
|
|
||||||
|
Push $2 ; save name for deleting
|
||||||
|
|
||||||
|
IfErrors unix2dos_done
|
||||||
|
|
||||||
|
; $0 = file input (opened for reading)
|
||||||
|
; $1 = file output (opened for writing)
|
||||||
|
|
||||||
|
unix2dos_loop:
|
||||||
|
; read a byte (stored in $2)
|
||||||
|
FileReadByte $0 $2
|
||||||
|
IfErrors unix2dos_done ; EOL
|
||||||
|
; skip CR
|
||||||
|
StrCmp $2 13 unix2dos_loop
|
||||||
|
; if LF write an extra CR
|
||||||
|
StrCmp $2 10 unix2dos_cr unix2dos_write
|
||||||
|
|
||||||
|
unix2dos_cr:
|
||||||
|
FileWriteByte $1 13
|
||||||
|
|
||||||
|
unix2dos_write:
|
||||||
|
; write byte
|
||||||
|
FileWriteByte $1 $2
|
||||||
|
; read next byte
|
||||||
|
Goto unix2dos_loop
|
||||||
|
|
||||||
|
unix2dos_done:
|
||||||
|
; close files
|
||||||
|
FileClose $0
|
||||||
|
FileClose $1
|
||||||
|
|
||||||
|
; delete original
|
||||||
|
Pop $0
|
||||||
|
Delete $0.U2D
|
||||||
|
FunctionEnd
|
||||||
|
|
2
ports.mk
2
ports.mk
|
@ -189,7 +189,7 @@ win32setup: $(EXECUTABLE)
|
||||||
mkdir -p $(srcdir)/$(STAGINGPATH)
|
mkdir -p $(srcdir)/$(STAGINGPATH)
|
||||||
$(STRIP) $(EXECUTABLE) -o $(srcdir)/$(STAGINGPATH)/$(EXECUTABLE)
|
$(STRIP) $(EXECUTABLE) -o $(srcdir)/$(STAGINGPATH)/$(EXECUTABLE)
|
||||||
cp /usr/local/bin/SDL.dll $(srcdir)/$(STAGINGPATH)
|
cp /usr/local/bin/SDL.dll $(srcdir)/$(STAGINGPATH)
|
||||||
makensis -V2 -Dtop_srcdir="../.." -Dstaging_dir="../../$(STAGINGPATH)" $(srcdir)/dists/win32/scummvm.nsi
|
makensis -V2 -Dtop_srcdir="../.." -Dstaging_dir="../../$(STAGINGPATH)" -Darch=$(ARCH) $(srcdir)/dists/win32/scummvm.nsi
|
||||||
|
|
||||||
#
|
#
|
||||||
# AmigaOS specific
|
# AmigaOS specific
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue