blob: e571e83578b8ec5c156534a778a20db34c31202e (
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
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
|
BUILDTHREADS=${BUILDTHREADS:-1}
SDK_VERSION=${SDK_VERSION:-"Default"}
NDK_VERSION=${NDK_VERSION:-"Default"}
NDK_API=${NDK_API:-"Default"}
Configuration=${Configuration:-"Default"}
XBMC_DEPENDS_ROOT=${XBMC_DEPENDS_ROOT:-"Default"}
XCODE_APP=${XCODE_APP:-"Default"}
PATH_CHANGE_REV_FILENAME=".last_success_revision"
FAILED_BUILD_FILENAME=".last_failed_revision"
#TARBALLS ENV-VAR is only used by android scripts atm
TARBALLS=${TARBALLS:-"/opt/xbmc-tarballs"}
RENDER_SYSTEM=${RENDER_SYSTEM:-"Default"}
BUILD_HOST=${BUILD_HOST:-"Default"}
BINARY_ADDONS_ROOT=tools/depends/target
BINARY_ADDONS="binary-addons"
DEPLOYED_BINARY_ADDONS="-e /addons"
# Jenkins env variables
JENKINS_BUILD_TIMESTAMP=${BUILD_TIMESTAMP:-"unknown"}
JENKINS_BUILD_COMMIT=$(echo ${GIT_COMMIT:-"unknown"} | cut -c1-8)
JENKINS_BUILD_REVISION=${Revision:-"unknown"}
JENKINS_BUILD_ID=${BUILD_ID:-"unknown"}
JENKINS_BUILD_STRING="${JENKINS_BUILD_TIMESTAMP}-${JENKINS_BUILD_COMMIT}-${JENKINS_BUILD_REVISION}-${JENKINS_BUILD_ID}"
#set platform defaults
#$XBMC_PLATFORM_DIR matches the platform subdirs!
case $XBMC_PLATFORM_DIR in
ios)
DEFAULT_SDK_VERSION=14.4
DEFAULT_XBMC_DEPENDS_ROOT=$WORKSPACE/tools/depends/xbmc-depends
DEFAULT_CONFIGURATION="Debug"
DEFAULT_XCODE_APP="Xcode12.4.app"
;;
tvos)
DEFAULT_SDK_VERSION=14.3
DEFAULT_XBMC_DEPENDS_ROOT=$WORKSPACE/tools/depends/xbmc-depends
DEFAULT_CONFIGURATION="Debug"
DEFAULT_XCODE_APP="Xcode12.4.app"
;;
osx64)
DEFAULT_SDK_VERSION=11.1
DEFAULT_XBMC_DEPENDS_ROOT=$WORKSPACE/tools/depends/xbmc-depends
DEFAULT_CONFIGURATION="Debug"
DEFAULT_XCODE_APP="Xcode12.4.app"
;;
osx-arm64)
DEFAULT_SDK_VERSION=11.1
DEFAULT_XBMC_DEPENDS_ROOT=$WORKSPACE/tools/depends/xbmc-depends
DEFAULT_CONFIGURATION="Debug"
DEFAULT_XCODE_APP="Xcode12.4.app"
;;
android)
DEFAULT_NDK_VERSION="21e" # NDK package version (newer API can be inside)
DEFAULT_NDK_API="21" # Lollipop API level (21) defined in package ./sysroot/usr/include/android/api-level.h
DEFAULT_XBMC_DEPENDS_ROOT=$WORKSPACE/tools/depends/xbmc-depends
DEFAULT_CONFIGURATION="RelWithDebInfo"
;;
linux)
DEFAULT_XBMC_DEPENDS_ROOT=$WORKSPACE/tools/depends/xbmc-depends
DEFAULT_CONFIGURATION="Debug"
DEFAULT_RENDER_SYSTEM="gl"
DEFAULT_BUILD_HOST="x86_64-linux-gnu"
;;
freebsd)
DEFAULT_CONFIGURATION="Debug"
;;
esac
if [ "$SDK_VERSION" == "Default" ]
then
SDK_VERSION=$DEFAULT_SDK_VERSION
fi
if [ "$NDK_VERSION" == "Default" ]
then
NDK_VERSION=$DEFAULT_NDK_VERSION
fi
if [ "$NDK_API" == "Default" ]
then
NDK_API=$DEFAULT_NDK_API
fi
if [ "$XBMC_DEPENDS_ROOT" == "Default" ]
then
XBMC_DEPENDS_ROOT=$DEFAULT_XBMC_DEPENDS_ROOT
fi
if [ "$XCODE_APP" == "Default" ]
then
XCODE_APP=$DEFAULT_XCODE_APP
fi
# make osx environment aware of the selected xcode app
export DEVELOPER_DIR=/Applications/$XCODE_APP/Contents/Developer
if [ "$Configuration" == "Default" ]
then
Configuration=$DEFAULT_CONFIGURATION
fi
if [ "$Configuration" == "Release" ]
then
DEBUG_SWITCH='--disable-debug'
fi
if [ "$RENDER_SYSTEM" == "Default" ]
then
RENDER_SYSTEM=$DEFAULT_RENDER_SYSTEM
fi
if [ "$BUILD_HOST" == "Default" ]
then
BUILD_HOST=$DEFAULT_BUILD_HOST
fi
#helper functions
#hash a dir based on the git revision, Configuration, SDK_PATH, NDK_PATH, NDK_VERSION, SDK_VERSION, TOOLCHAIN and XBMC_DEPENDS_ROOT
#param1 path to be hashed
function getBuildHash ()
{
local checkPath
checkPath="$1"
local hashStr
hashStr="$(git rev-list HEAD --max-count=1 -- $checkPath)"
hashStr="$hashStr $Configuration $SDK_PATH $NDK_PATH $NDK_VERSION $SDK_VERSION $TOOLCHAIN $XBMC_DEPENDS_ROOT $XCODE_APP"
echo $hashStr
}
#param1 path to be checked for changes
function pathChanged ()
{
local ret
local checkPath
ret="0"
checkPath="$1"
if [ -e $checkPath/$PATH_CHANGE_REV_FILENAME ]
then
if [ "$(cat $checkPath/$PATH_CHANGE_REV_FILENAME)" != "$(getBuildHash $checkPath)" ]
then
ret="1"
fi
else
ret="1"
fi
echo $ret
}
#param1 path to be tagged with hash
function tagSuccessFulBuild ()
{
local pathToTag
pathToTag="$1"
# tag last successful build with revisions of the given dir
# needs to match the checks in function getBuildHash
echo "$(getBuildHash $pathToTag)" > $pathToTag/$PATH_CHANGE_REV_FILENAME
}
#param1 path to be tagged with hash
function tagFailedBuild ()
{
local pathToTag
pathToTag="$1"
# tag last failed build with revisions of the given dir
# needs to match the checks in function getBuildHash
echo "$(getBuildHash $pathToTag)" > $pathToTag/$FAILED_BUILD_FILENAME
}
function getBuildRevDateStr ()
{
echo "${JENKINS_BUILD_STRING}"
}
|