summaryrefslogtreecommitdiffstats
path: root/tools/buildsteps/windows/download-dependencies.bat
blob: 0a129fd76f1899e28622b0e0231af7421430a7e0 (plain)
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
@ECHO OFF

SETLOCAL

PUSHD %~dp0\..\..\..
SET WORKSPACE=%CD%
POPD

SET TARGETPLATFORM=%1
SET NATIVEPLATFORM=%2

IF "%TARGETPLATFORM%" == "" SET TARGETPLATFORM=win32
IF "%NATIVEPLATFORM%" == "" SET NATIVEPLATFORM=win32

ECHO TARGETPLATFORM: %TARGETPLATFORM%
ECHO NATIVEPLATFORM: %NATIVEPLATFORM%

REM If KODI_MIRROR is not set externally to this script, set it to the default mirror URL
IF "%KODI_MIRROR%" == "" SET KODI_MIRROR=http://mirrors.kodi.tv
echo Downloading from mirror %KODI_MIRROR%

REM Locate the BuildDependencies directory, based on the path of this script
SET BUILD_DEPS_PATH=%WORKSPACE%\project\BuildDependencies
SET APP_PATH=%WORKSPACE%\project\BuildDependencies\%TARGETPLATFORM%
SET TMP_PATH=%BUILD_DEPS_PATH%\scripts\tmp

REM Change to the BuildDependencies directory, if we're not there already
PUSHD %BUILD_DEPS_PATH%

REM Can't run rmdir and md back to back. access denied error otherwise.
IF EXIST %TMP_PATH% rmdir %TMP_PATH% /S /Q

SET DL_PATH="%BUILD_DEPS_PATH%\downloads"
SET WGET=%BUILD_DEPS_PATH%\bin\wget
SET ZIP=%BUILD_DEPS_PATH%\..\Win32BuildSetup\tools\7z\7za

IF NOT EXIST %DL_PATH% md %DL_PATH%

md %TMP_PATH%

cd scripts

SET FORMED_OK_FLAG=%TMP_PATH%\got-all-formed-packages
REM Trick to preserve console title
start /b /wait cmd.exe /c get_formed.cmd
IF NOT EXIST %FORMED_OK_FLAG% (
  ECHO ERROR: Not all formed packages are ready!
  ECHO.
  ECHO I tried to get the packages from %KODI_MIRROR%;
  ECHO if this download mirror seems to be having problems, try choosing another from
  ECHO the list on http://mirrors.kodi.tv/timestamp.txt?mirrorlist, and setting %%KODI_MIRROR%% to
  ECHO point to it, like so:
  ECHO   C:\^> SET KODI_MIRROR=http://example.com/pub/xbmc/
  ECHO.
  ECHO Then, rerun this script.
  
  REM Restore the previous current directory
  POPD

  ENDLOCAL
  
  EXIT /B 101
)

rmdir %TMP_PATH% /S /Q

REM Restore the previous current directory
POPD

ENDLOCAL

EXIT /B 0