aboutsummaryrefslogtreecommitdiff
path: root/tools/rbp/setup-sdk.sh
blob: c261640083317737e2ea348b621d8b85c07b3cc5 (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
#!/bin/bash

SCRIPT_PATH=$(cd `dirname $0` && pwd)

USE_BUILDROOT=1

if [ "$USE_BUILDROOT" = "1" ]; then
  BUILDROOT=${BUILDROOT:-"/opt/xbmc-bcm/buildroot"}
  TARBALLS=${TARBALLS:-"/opt/xbmc-tarballs"}
  XBMCPREFIX=${XBMCPREFIX:-"/opt/xbmc-bcm/xbmc-bin"}

  SDKSTAGE=$BUILDROOT/output/staging
  TARGETFS=$BUILDROOT/output/target
  TOOLCHAIN=$BUILDROOT/output/host/usr/
else
  TARBALLS=/opt/xbmc-tarballs
  SDKSTAGE=/opt/bcm-rootfs
  XBMCPREFIX=/opt/xbmc-bcm/xbmc-bin
  TARGETFS=/opt/bcm-rootfs
  TOOLCHAIN=/usr/local/bcm-gcc
  BUILDROOT=/opt/bcm-rootfs
fi

if [ -d $XBMCPREFIX ]
then
  [ -O $XBMCPREFIX ] || { command -v sudo >/dev/null 2>&1 && SUDO="sudo"; }
else
  [ -w $(dirname $XBMCPREFIX) ] || { command -v sudo >/dev/null 2>&1 && SUDO="sudo"; }
fi

if [ -z "$KODI_MIRROR" ]
then
  KODI_MIRROR="http://mirrors.kodi.tv"
fi

$SUDO mkdir -p $XBMCPREFIX
$SUDO chmod 777 $XBMCPREFIX
mkdir -p $XBMCPREFIX/lib
mkdir -p $XBMCPREFIX/include

echo "SDKSTAGE=$SDKSTAGE"                                              >  $SCRIPT_PATH/Makefile.include
echo "XBMCPREFIX=$XBMCPREFIX"                                          >> $SCRIPT_PATH/Makefile.include
echo "TARGETFS=$TARGETFS"                                              >> $SCRIPT_PATH/Makefile.include
echo "TOOLCHAIN=$TOOLCHAIN"                                            >> $SCRIPT_PATH/Makefile.include
echo "BUILDROOT=$BUILDROOT"                                            >> $SCRIPT_PATH/Makefile.include
echo "USE_BUILDROOT=$USE_BUILDROOT"                                    >> $SCRIPT_PATH/Makefile.include
echo "BASE_URL=${KODI_MIRROR}/build-deps/darwin-libs"                  >> $SCRIPT_PATH/Makefile.include
echo "TARBALLS_LOCATION=$TARBALLS"                                     >> $SCRIPT_PATH/Makefile.include
echo "RETRIEVE_TOOL=/usr/bin/curl"                                     >> $SCRIPT_PATH/Makefile.include
echo "RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output \$(TARBALLS_LOCATION)/\$(ARCHIVE)" >> $SCRIPT_PATH/Makefile.include
echo "ARCHIVE_TOOL=/bin/tar"                                           >> $SCRIPT_PATH/Makefile.include
echo "ARCHIVE_TOOL_FLAGS=xf"                                           >> $SCRIPT_PATH/Makefile.include
echo "JOBS=$((`grep -c processor /proc/cpuinfo -1`))"                  >> $SCRIPT_PATH/Makefile.include