fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

BkacjiosAdded an option to installer for creating a desktop shortcut. Added links to latest installer/portable release to the README.d8a7a00

settings-overhaul
3.0 KiB114 linesraw
1@echo OFF
2
3REM Release name
4SET NAME=m-overlay
5
6REM Architecture
7REM auto, x64, x86
8SET BIT=x64
9
10SET INNO_SETUP_DIR="C:\Program Files (x86)\Inno Setup 6"
11
12SET LOVE_64_DIR="C:\Program Files\LOVE"
13SET LOVE_32_DIR="C:\Program Files (x86)\LOVE"
14
15IF "%BIT%"=="x64" (
16	if exist %LOVE_64_DIR% SET LOVE_DIR=%LOVE_64_DIR%
17)
18IF "%BIT%"=="x86" (
19	if exist %LOVE_32_DIR% SET LOVE_DIR=%LOVE_32_DIR%
20)
21
22if not exist %LOVE_DIR% goto :exit
23
24where /q 7z || ECHO Could not find 7Zip, please download and install: https://www.7-zip.org/download.html and add it to PATH && goto :exit
25
26SET INSTALLER_DIR=.\installer
27SET BUILD_DIR=.\build
28SET BUILD_OUTPUT_DIR=%BUILD_DIR%\%BIT%
29SET SOURCE_DIR=.\source
30SET RELEASES_DIR=.\releases
31SET TOOLS_DIR=.\tools
32
33if not exist %BUILD_DIR% mkdir %BUILD_DIR%
34if not exist %RELEASES_DIR% mkdir %RELEASES_DIR%
35if not exist %BUILD_OUTPUT_DIR% mkdir %BUILD_OUTPUT_DIR%
36
37SET BRANCH=dirty
38SET COMMIT=1
39SET VERSION=v0.0.0
40
41REM Get GIT commit number
42FOR /F "tokens=* USEBACKQ" %%F IN (`git -C %SOURCE_DIR% rev-list --count --first-parent HEAD`) DO (
43	SET COMMIT=%%F
44)
45
46REM Get latest tag
47FOR /F "tokens=* USEBACKQ" %%F IN (`git -C %SOURCE_DIR% describe --tags`) DO (
48	echo %%F
49	SET VERSION=%%F
50)
51
52IF "%VERSION:~0,1%"=="v" (
53	echo Stripping 'v' from VERSION
54	SET VERSION=%VERSION:~1%
55)
56
57echo %VERSION% > "%SOURCE_DIR%\version.txt"
58
59REM Get GIT branch
60FOR /F "tokens=* USEBACKQ" %%F IN (`git -C %SOURCE_DIR% rev-parse --abbrev-ref HEAD`) DO (
61	SET BRANCH=%%F
62)
63
64SET PATH=%PATH%;%INNO_SETUP_DIR%;%TOOLS_DIR%
65
66SET EXE_NAME=%NAME%-%BIT%.exe
67SET EXE_PATH=%BUILD_OUTPUT_DIR%\%EXE_NAME%
68
69SET ZIP="%RELEASES_DIR%\%VERSION%\%NAME%-%BIT%.love"
70REM SET ZIP=%BUILD_DIR%\%NAME%.love
71
72echo Zipping files in %SOURCE_DIR% into %ZIP%
73
74if exist %ZIP% del %ZIP%
75
76REM timeout /t 3 /nobreak
77
787z a -tzip -mx=9 -xr!*.git -xr!*.dll %ZIP% "%SOURCE_DIR%\*"
79
80echo Copying LOVE2D binaries and license to %BUILD_OUTPUT_DIR%
81copy %LOVE_DIR%\license.txt %BUILD_OUTPUT_DIR%
82xcopy /d %LOVE_DIR%\*.dll %BUILD_OUTPUT_DIR% /y
83xcopy /d %SOURCE_DIR%\*.dll %BUILD_OUTPUT_DIR% /y
84
85echo Copying love.exe %BUILD_DIR%
86copy /b %LOVE_DIR%\love.exe+,, %BUILD_DIR%
87
88echo Customizing love.exe
89rcedit-x64 "%BUILD_DIR%\love.exe" --set-icon "%INSTALLER_DIR%\icon.ico"
90rcedit-x64 "%BUILD_DIR%\love.exe" --set-version-string "FileDescription" "M'Overlay"
91rcedit-x64 "%BUILD_DIR%\love.exe" --set-file-version "%VERSION%"
92rcedit-x64 "%BUILD_DIR%\love.exe" --set-version-string "InternalName" "%NAME%-%BIT%"
93rcedit-x64 "%BUILD_DIR%\love.exe" --set-version-string "OriginalFilename" "%EXE_NAME%"
94
95REM We have to merge AFTER rcedit, since rcedit destroys the merged data
96echo Merging love.exe + %ZIP% into %EXE_PATH%
97copy /b "%BUILD_DIR%\love.exe"+%ZIP% %EXE_PATH%
98
99SET ZIP="%RELEASES_DIR%\%VERSION%\%NAME%-%BIT%-portable.zip"
100
101REM Remove old zip if it exists
102if exist %ZIP% del %ZIP%
103
104REM Create a release zip
1057z a -tzip -mx=9 %ZIP% "%BUILD_OUTPUT_DIR%\*"
106
107if exist %INNO_SETUP_DIR% (
108	echo Building installer
109	iscc release.iss
110	move "%RELEASES_DIR%\m-overlay-x64-installer.exe" "%RELEASES_DIR%\%VERSION%"
111)
112
113:exit
114@PAUSE