-
Notifications
You must be signed in to change notification settings - Fork 0
/
prebuild_natives.cmd
89 lines (65 loc) · 1.73 KB
/
prebuild_natives.cmd
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
@echo off
setlocal EnableDelayedExpansion
set path=C:\msys64\usr\bin;%path%
set LUA_PATH=
set LUA_CPATH=
where /q pacman
if errorlevel 1 (
exit /B 1
)
pacman --noconfirm --needed -Sy make diffutils
where /q curl
if errorlevel 1 (
exit /B 1
)
pushd ext\natives\
mkdir inp
call:UpdateToLatest inp\natives_global.lua https://runtime.fivem.net/doc/natives.lua
call:UpdateToLatest inp\natives_rdr3.lua https://runtime.fivem.net/doc/natives_rdr_tmp.lua
call:UpdateToLatest inp\natives_ny.lua https://runtime.fivem.net/doc/natives_ny_tmp.lua
call:UpdateToLatest inp\natives_global_client_compat.lua https://runtime.fivem.net/doc/natives_global_client_compat.lua
popd
pushd ext\native-doc-gen\
sh build.sh
if errorlevel 1 (
popd
exit /B 1
)
popd
pushd ext\natives\
make -q
if errorlevel 1 (
make -j4
xcopy /y out\*.lua ..\..\data\shared\citizen\scripting\lua
xcopy /y out\*.js ..\..\data\shared\citizen\scripting\v8
xcopy /y out\*.d.ts ..\..\data\shared\citizen\scripting\v8
xcopy /y out\rpc_natives.json ..\..\data\shared\citizen\scripting
xcopy /y out\*.zip ..\..\data\shared\citizen\scripting\lua
xcopy /y out\*.cs ..\..\code\client\clrcore
xcopy /y out\v2\*.cs ..\..\code\client\clrcore-v2\Native
xcopy /y out\Natives*.h ..\..\code\components\citizen-scripting-lua\src
xcopy /y out\PASGen.h ..\..\code\components\rage-scripting-five\src
)
popd
goto :eof
:: Functions
:UpdateToLatest
echo Updating %~1
%systemroot%\system32\curl -z %~1 -Lo %~1.new %~2
if not errorlevel 0 (
echo cURL exited with error code %errorlevel%.
) else (
if exist %~1.new (
if exist %~1 (
diff %~1 %~1.new > nul
if not errorlevel 1 (
del %~1.new
exit /B 0
)
)
move /y %~1.new %~1
) else (
echo File is up-to-date.
)
)
exit /B 0