forked from maki-rxrz/gpac_old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_installer.bat
91 lines (76 loc) · 3.26 KB
/
generate_installer.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
@echo off
set OLDDIR=%CD%
cd /d %~dp0
REM ============================================
echo *** Generating a Windows GPAC installer ***
REM ============================================
:begin
IF "%1"=="win32" GOTO next
IF "%1"=="x64" GOTO next
echo You must specified target architecture : win32 or x64
GOTO Abort
:next
echo:
REM ============================================
echo Check NSIS is in your PATH
REM ============================================
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
SET "PRGROOT=%programfiles(x86)%"
)
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
SET PRGROOT=%programfiles%
)
set NSIS_EXEC="%PRGROOT%\NSIS\makensis.exe"
if not exist "%PRGROOT%\NSIS\makensis.exe" echo NSIS couldn't be found at default location %NSIS_EXEC%
if not exist "%PRGROOT%\NSIS\makensis.exe" goto Abort
echo Found NSIS at default location %NSIS_EXEC%
echo:
REM ============================================
echo Retrieving version/revision information
REM ============================================
if not exist include/gpac/revision.h echo version couldn't be found - check include/gpac/revision.h exists
if not exist include/gpac/revision.h goto Abort
REM execute `git rev-list HEAD -1 --abbrev-commit` and check if the result if found within revision.h
for /f "delims=" %%i in ('git rev-list HEAD -1 --abbrev-commit') do Set VarRevisionGIT=%%i
for /f "tokens=3" %%a in ('findstr GPAC_SVN_REVISION "include\gpac\revision.h"') do set VarRevisionSVN=%%a
for /f "tokens=3" %%a in ('findstr GPAC_GIT_REV_HASH "include\gpac\revision.h"') do set VarRevisionBuild=%%a
set VarRevisionSVN=%VarRevisionSVN:"=%
set VarRevisionBuild=%VarRevisionBuild:"=%
echo VarRevisionBuild = %VarRevisionBuild%
echo VarRevisionGIT = %VarRevisionGIT%
if !"%VarRevisionBuild%"==!"%VarRevisionGIT%" echo local revision and last build revision are not congruent - please consider rebuilding before generating an installer
if !"%VarRevisionBuild%"==!"%VarRevisionGIT%" goto Abort
REM echo version found: %VarRevisionSVN%
move packagers\win32_64\nsis\default.out packagers\win32_64\nsis\default.out_
echo Name "GPAC Framework ${GPAC_VERSION} for %1 revision %VarRevisionSVN%" > packagers\win32_64\nsis\default.out
echo OutFile "GPAC.Framework.Setup-${GPAC_VERSION}-rev%VarRevisionSVN%-%1.exe" >> packagers\win32_64\nsis\default.out
IF "%1"=="x64" echo !define IS_WIN64 >> packagers\win32_64\nsis\default.out
echo:
REM ============================================
echo Executing NSIS
REM ============================================
call %NSIS_EXEC% packagers\win32_64\nsis\gpac_installer.nsi
echo:
REM ============================================
echo Removing temporary files
REM ============================================
move packagers\win32_64\nsis\default.out_ packagers\win32_64\nsis\default.out
echo:
REM ============================================
echo Windows GPAC installer generated - goodbye!
REM ============================================
REM LeaveBatchSuccess
set VarRevisionGIT=
set VarRevisionSVN=
set VarRevisionBuild=
cd /d %OLDDIR%
exit/b 0
:Abort
echo:
echo *** ABORTING: CHECK ERROR MESSAGES ABOVE ***
REM LeaveBatchError
set VarRevisionGIT=
set VarRevisionSVN=
set VarRevisionBuild=
cd /d %OLDDIR%
exit/b 1