forked from OpenELEC/OpenELEC.tv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
path
231 lines (193 loc) · 5.61 KB
/
path
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
222
223
224
225
226
227
228
229
230
231
set -e
. config/functions
# setup initial directorys (relative to root)
CONFIG=config
SCRIPTS=scripts
PACKAGES=packages
SOURCES=sources
BUILD_BASE=build
TARGET=target
ADDONS=addons
# include ARCH specific options
if [ -f config/arch.$TARGET_ARCH ]; then
. config/arch.$TARGET_ARCH
fi
HOST_NAME=`$LOCAL_CC -dumpmachine`
TARGET_NAME=$(echo $TARGET_SUBARCH | sed -e "s,-,,")-openelec-linux-gnu${TARGET_ABI}
BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$OPENELEC_VERSION
if [ "$OPENELEC_VERSION" = "devel" ] ; then
BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$OS_VERSION-$OPENELEC_VERSION
fi
if [ -n "$BUILD_SUFFIX" ]; then
BUILD=$BUILD-$BUILD_SUFFIX
fi
TARGET_IMG=$ROOT/$TARGET
TARGET_ADDONS="$TARGET_IMG/$ADDONS/$ADDON_PATH"
ADDON_BUILD="$BUILD/$ADDONS/$1"
STAMPS_NOARCH=.stamps
STAMPS=$BUILD/.stamps
STAMPS_INSTALL=$BUILD/image/.stamps
DOCS=DOCS
TOOLCHAIN=$BUILD/toolchain
SYSROOT_PREFIX=$ROOT/$TOOLCHAIN/$TARGET_NAME/sysroot
LIB_PREFIX=$SYSROOT_PREFIX/usr
TARGET_PREFIX=$ROOT/$TOOLCHAIN/bin/$TARGET_NAME-
FAKEROOT_SCRIPT=$ROOT/.fakeroot.$PROJECT.$TARGET_ARCH
if [ -z "$INSTALL" ]; then
INSTALL=$BUILD/image/system
fi
INSTALL_INIT=$BUILD/image/initramfs/root-image
. config/sources
MAKE="$ROOT/$TOOLCHAIN/bin/make"
MAKEINSTALL="$ROOT/$TOOLCHAIN/bin/make -j1 DESTDIR=$SYSROOT_PREFIX install"
SED="sed -i"
# set package metadata
PKG_NAME="$1"
PKG_VERSION="0.0invalid"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="unknown"
PKG_SITE=""
PKG_URL=""
PKG_DEPENDS_TARGET=""
PKG_DEPENDS_HOST=""
PKG_DEPENDS_INIT=""
PKG_DEPENDS_BOOTSTRAP=""
PKG_PRIORITY="optional"
PKG_SECTION=""
PKG_SHORTDESC="$1 (autogenerated)"
PKG_LONGDESC=""
PKG_IS_ADDON="no"
if [ -n "$1" ]; then
_PKG_ROOT_NAME=$(echo $1 | cut -d: -f1)
_ALL_DIRS=""
_FOUND=0
PKG_DIR=""
# first check project folder for a package
for DIR in $(find $ROOT/projects/$PROJECT/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do
if [ -r "$DIR/package.mk" ]; then
# found first, set $PKG_DIR
PKG_DIR="$DIR"
# keep track of dirs with package.mk for detecting multiple folders
_ALL_DIRS="${_ALL_DIRS}${DIR}\\n"
_FOUND=$((_FOUND+1))
if [ $_FOUND -gt 1 ]; then
# _FOUND more ? fail
echo "Error - multiple package folders:"
echo -e "$_ALL_DIRS"
exit 1
fi
fi
done
# then check packages folder if not found already
if [ $_FOUND -eq 0 ]; then
for DIR in $(find $ROOT/$PACKAGES -type d -name $_PKG_ROOT_NAME 2>/dev/null); do
if [ -r "$DIR/package.mk" ]; then
# found first, set $PKG_DIR
PKG_DIR="$DIR"
# keep track of dirs with package.mk for detecting multiple folders
_ALL_DIRS="${_ALL_DIRS}${DIR}\\n"
_FOUND=$((_FOUND+1))
if [ $_FOUND -gt 1 ]; then
# found more ? fail
echo "Error - multiple package folders:"
echo -e "$_ALL_DIRS"
exit 1
fi
fi
done
fi
fi
if [ -r $PKG_DIR/package.mk ]; then
. $PKG_DIR/package.mk
fi
if [ "$PKG_IS_ADDON" = "yes" ] ; then
[ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="`echo $PKG_SECTION | sed 's,/,.,g'`.$PKG_NAME"
fi
PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}"
XORG_PATH_DRI=/usr/lib/dri
XORG_PATH_XKB=/usr/share/X11/xkb
XORG_PATH_XKB_OUTPUT=/var/lib/xkb
XORG_PATH_RGB=/usr/lib/X11/rgb
XORG_PATH_MODULES=/usr/lib/xorg/modules
XORG_PATH_DRIVERS=/usr/lib/xorg/modules/drivers
SSL_CERTIFICATES="/etc/ssl"
TOOLCHAIN_LANGUAGES=c
[ "$TOOLCHAIN_CXX" = yes ] && TOOLCHAIN_LANGUAGES=${TOOLCHAIN_LANGUAGES},c++
unset TARGET_CPP
TARGET_CC=${TARGET_PREFIX}gcc
TARGET_CXX=${TARGET_PREFIX}g++
TARGET_LD=${TARGET_PREFIX}ld
TARGET_AS=${TARGET_PREFIX}as
TARGET_AR=${TARGET_PREFIX}ar
TARGET_NM=${TARGET_PREFIX}nm
TARGET_RANLIB=${TARGET_PREFIX}ranlib
TARGET_OBJCOPY=${TARGET_PREFIX}objcopy
TARGET_OBJDUMP=${TARGET_PREFIX}objdump
TARGET_STRIP=${TARGET_PREFIX}strip
. config/optimize
TARGET_PKG_CONFIG_PATH=""
TARGET_PKG_CONFIG_LIBDIR="$SYSROOT_PREFIX/usr/lib/pkgconfig:$SYSROOT_PREFIX/usr/share/pkgconfig"
TARGET_PKG_CONFIG_SYSROOT_DIR="$SYSROOT_PREFIX"
unset HOST_CPP
HOST_AWK=gawk
HOST_CC=$ROOT/$TOOLCHAIN/bin/host-gcc
HOST_CXX=$ROOT/$TOOLCHAIN/bin/host-g++
HOST_LD=ld
HOST_AS=as
HOST_AR=ar
HOST_NM=nm
HOST_RANLIB=ranlib
HOST_OBJCOPY=objcopy
HOST_STRIP=strip
HOST_PKG_CONFIG_PATH=""
HOST_PKG_CONFIG_LIBDIR="$ROOT/$TOOLCHAIN/lib/pkgconfig:$ROOT/$TOOLCHAIN/share/pkgconfig"
HOST_PKG_CONFIG_SYSROOT_DIR=""
if [ -z "$CCACHE_DIR" ]; then
export CCACHE_DIR=$HOME/.ccache-openelec
fi
export MAKEFLAGS=-j$CONCURRENCY_MAKE_LEVEL
export PKG_CONFIG=$ROOT/$TOOLCHAIN/bin/pkg-config
if [ -z "$PATH" -o "$PATH" = "${PATH#$ROOT/$TOOLCHAIN/bin:}" ]; then
export PATH="$ROOT/$TOOLCHAIN/bin:$ROOT/$TOOLCHAIN/sbin:$PATH"
fi
if [ -z "$LD_LIBRARY_PATH" -o "$LD_LIBRARY_PATH" = "${LD_LIBRARY_PATH#$ROOT/$TOOLCHAIN/lib:}" ]; then
export LD_LIBRARY_PATH="$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH"
fi
VERSION_SUFFIX=$TARGET_ARCH
check_path
check_config
setup_toolchain target
SILENT_OUT=3
VERBOSE_OUT=4
if [ "$VERBOSE" = yes ]; then
exec 3>&1
exec 4>&2
else
exec 3>&2
exec 4>/dev/null
fi
BUILD_INDENT_SIZE=4
# define colors
black="\e[0;30m"
boldblack="\e[1;30m"
red="\e[0;31m"
boldred="\e[1;31m"
green="\e[0;32m"
boldgreen="\e[1;32m"
yellow="\e[0;33m"
boldyellow="\e[1;33m"
blue="\e[0;34m"
boldblue="\e[1;34m"
magenta="\e[0;35m"
boldmagenta="\e[1;35m"
cyan="\e[0;36m"
boldcyan="\e[1;36m"
white="\e[0;37m"
boldwhite="\e[1;37m"
endcolor="\e[0m"
# multilib? nah
unset CONFIG_SITE
# meh suse
unset PYTHONSTARTUP
unset PYTHONPATH