This repository has been archived by the owner on May 6, 2024. It is now read-only.
forked from jakubg1/OpenSMCE
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.bat
221 lines (203 loc) · 5.97 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
@echo off
setlocal enabledelayedexpansion
:: 0/7: Setup
set SVZFOUND=0
set RHFOUND=0
set 32FOUND=0
set 64FOUND=0
set SVZ=
set RH=
:: Flags
set NOPACKAGES=0
for %%a in (%*) do (
if "%%a"=="--no-packages" (
set NOPACKAGES=1
)
)
if exist ".\build" (
echo Deleting previous build folder.
del /s /q ".\build"
)
:: Check for 7-zip
echo Checking for 7-zip...
for %%a in (7z "C:\Program Files\7-Zip\7z.exe" "C:\Program Files (x86)\7-Zip\7z.exe") do (
if !SVZFOUND!==0 (
%%a>nul
if !ERRORLEVEL!==0 (
set SVZ=%%a
set SVZFOUND=1
echo 7-zip found^^!
)
)
)
if %SVZFOUND%==0 (
echo Error: Could not locate 7z in %%PATH%% or Program Files.
pause && exit
)
:: Check for Resource Hacker
echo Checking for Resource Hacker...
for %%a in (ResourceHacker "C:\Program Files (x86)\Resource Hacker\ResourceHacker.exe") do (
if !RHFOUND!==0 (
%%a -help>nul
if !ERRORLEVEL!==0 (
set RH=%%a
set RHFOUND=1
echo Resource Hacker found^^!
)
)
)
:: 1/5: Prepare for fusing
echo Compiling files... (1/7)
if not exist exlist.txt (
echo Error: exlist.txt not found.
echo Make sure this file exists - this is a list of what not to include in the archive.
pause && exit
)
%SVZ% a compiled.zip .\* [email protected]
:: 2/5: 32-bit compiling
echo.
echo Fusing 32-bit LOVE exe... (2/7)
if %PROCESSOR_ARCHITECTURE%==32 (
:: 32-bit
if exist "C:\Program Files\LOVE\love.exe" (
set 32FOUND=1
mkdir build\x32
copy /b "C:\Program Files\LOVE\love.exe"+compiled.zip "build\x32\ZumaBlitzRemake.exe"
) else (
echo 32-bit LOVE directory could not be found. Skipping...
)
if exist "C:\Program Files\LOVE\love.exe" (
set 32FOUND=1
mkdir build\x32
copy /b "C:\Program Files\LOVE\love.exe"+compiled.zip "build\x32\ZumaBlitzRemake.exe"
) else (
echo 32-bit LOVE directory could not be found. Skipping...
)
) else (
:: 64-bit
if exist "C:\Program Files (x86)\LOVE\love.exe" (
set 32FOUND=1
mkdir build\x32
copy /b "C:\Program Files (x86)\LOVE\love.exe"+compiled.zip "build\x32\ZumaBlitzRemake.exe"
) else (
echo 32-bit LOVE directory could not be found. Skipping...
)
if exist "C:\Program Files (x86)\LOVE\love.exe" (
set 32FOUND=1
mkdir build\x32
copy /b "C:\Program Files (x86)\LOVE\love.exe"+compiled.zip "build\x32\ZumaBlitzRemake.exe"
) else (
echo 32-bit LOVE directory could not be found. Skipping...
)
)
:: 3/5: 64-bit compiling
echo.
if %PROCESSOR_ARCHITECTURE%==32 (
echo 32-bit machine detected, skipping 64-bit build...
goto skip64bitif32
)
echo Fusing 64-bit LOVE exe... (3/7)
if exist "C:\Program Files\LOVE\love.exe" (
set 64FOUND=1
mkdir build\x64
copy /b "C:\Program Files\LOVE\love.exe"+compiled.zip "build\x64\ZumaBlitzRemake.exe"
) else (
echo 64-bit LOVE directory could not be found. Skipping...
)
:: Abort if neither directories are found
if !32FOUND!==0 (
if !64FOUND!== 0 (
echo Error: Neither 32-bit nor 64-bit LOVE directories were found.
echo Aborting...
pause && exit
)
)
:skip64bitif32
:: 4/5: copy files
echo.
echo Copying assets... (4/7)
for %%a in (32 64) do (
if exist "build\x%%a" (
:: LOVE/shared binaries
if %%a==32 (
if %PROCESSOR_ARCHITECTURE%==32 (
for %%f in (love.dll lua51.dll mpg123.dll msvcp120.dll msvcr120.dll OpenAL32.dll SDL2.dll) do (
copy /b "C:\Program Files\LOVE\%%f" "build\x%%a\%%f"
)
) else (
for %%f in (love.dll lua51.dll mpg123.dll msvcp120.dll msvcr120.dll OpenAL32.dll SDL2.dll) do (
copy /b "C:\Program Files (x86)\LOVE\%%f" "build\x%%a\%%f"
)
)
) else (
for %%f in (love.dll lua51.dll mpg123.dll msvcp120.dll msvcr120.dll OpenAL32.dll SDL2.dll) do (
copy /b "C:\Program Files\LOVE\%%f" "build\x%%a\%%f"
)
)
:: doc files
for %%h in (autoload.txt LICENSE) do (
copy /b ".\%%h" "build\x%%a\%%h"
)
:: doc files that need to be specifiically renamed
copy /b ".\README-RELEASEVER.txt" "build\x%%a\README.txt"
copy /b ".\CHANGELOG-RELEASEVER.txt" "build\x%%a\CHANGELOG.txt"
:: folders
for %%g in (dll engine games schemas) do (
robocopy "%%g" "build\x%%a\%%g" *.* /s
)
:: I CAN'T BELIEVE I FORGOT THIS AND ONLY REALIZED THIS NOW AFTER
:: RELEASING ALPHA v0.1.1 AHHH
del /s /q ".\build\x%%a\games\ZumaBlitzRemake\runtime.json"
del /s /q ".\build\x%%a\games\ZumaBlitzRemake\*.py"
del /s /q ".\build\x%%a\games\ZumaBlitzRemake\.gitignore"
del /s /q ".\build\x%%a\games\ZumaBlitzRemake\.gitattributes"
del /s /q ".\build\x%%a\games\ZumaBlitzRemake\*.md"
)
)
:: 5/7: change metadata
if %RHFOUND%==0 (
echo Resource Hacker was not found, skipping...
goto skipresourcehacker
)
echo.
echo Changing EXE metadata... (5/7)
for %%a in (32 64) do (
if exist "build\x%%a" (
%RH% -open .\build\x%%a\ZumaBlitzRemake.exe -save .\build\x%%a\ZumaBlitzRemake.exe -action addoverwrite -res exe_resources.res
)
)
:skipresourcehacker
:: 6/7: create packages
if !NOPACKAGES!==1 (
echo Package creation skipped.
goto skippackages
)
echo.
echo Creating packages... (6/7)
for %%a in (32 64) do (
if exist "build\x%%a" (
%SVZ% a "build\ZumaBlitzRemake-windows-x%%a.zip" .\build\x%%a\*
)
)
:skippackages
:: 7/7: cleanup
echo.
echo Cleaning up... (7/7)
echo Deleting zip file...
del compiled.zip
if !ERRORLEVEL!==0 (
echo Deleted compiled.zip
) else (
echo Could not delete compiled.zip
)
echo.
echo ================================
echo.
echo Building finished:
if !32FOUND!==1 (
echo - Built 32-bit version.
)
if !64FOUND!==1 (
echo - Built 64-bit version.
)
pause