-
Notifications
You must be signed in to change notification settings - Fork 50
/
local.env
109 lines (80 loc) · 3.85 KB
/
local.env
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
#!/bin/bash
#######################################################################################################################
# environment variables
WORKDIR=${WORKDIR:=~/mod-workdir}
#######################################################################################################################
# find path to this script
if [ -n "${BASH_SOURCE-}" ]; then
CURRENT_SCRIPT="${BASH_SOURCE}"
elif [ -n "${ZSH_VERSION-}" ]; then
CURRENT_SCRIPT="${(%):-%x}"
elif [ -n "${KSH_VERSION-}" ]; then
CURRENT_SCRIPT=${.sh.file}
else
CURRENT_SCRIPT=""
fi
if [ -n "${CURRENT_SCRIPT-}" ]; then
SCRIPT_DIR=$(dirname "${CURRENT_SCRIPT}")
else
SCRIPT_DIR="."
fi
#######################################################################################################################
# check arguments
PLATFORM=$1
if [ -z "${PLATFORM}" ] || [ ! -e "${SCRIPT_DIR}/plugins-dep/configs/${PLATFORM}_defconfig" ]; then
echo "Usage: $0 <platform>"
echo " Where platform can be one of: $(echo $(ls "${SCRIPT_DIR}/plugins-dep/configs" | grep _defconfig | sed 's/_defconfig//g' | sort))"
else
#######################################################################################################################
# import defconfig variables
function DOWNLOAD_PATH { echo ""; }
function TOOLCHAIN_PATH { echo ""; }
source "${SCRIPT_DIR}/plugins-dep/configs/${PLATFORM}_defconfig"
#######################################################################################################################
# setup directories
HOST_DIR="${WORKDIR}/${PLATFORM}/host"
STAGING_DIR="${WORKDIR}/${PLATFORM}/staging"
TARGET_DIR="${WORKDIR}/${PLATFORM}/target"
TOOLCHAIN_DIR="${WORKDIR}/${PLATFORM}/toolchain"
#######################################################################################################################
# setup compiler variables
export AR="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-gcc-ar"
export CC="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-gcc"
export CPP="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-cpp"
export CXX="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-g++"
export LD="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-ld"
export RANLIB="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-ranlib"
export STRIP="${BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX}-strip"
export PATH="${HOST_DIR}/usr/bin":${PATH}
export PKG_CONFIG_PATH="${STAGING_DIR}/usr/lib/pkgconfig"
export CFLAGS="${BR2_TARGET_OPTIMIZATION} -I${STAGING_DIR}/usr/include"
export CXXFLAGS="${BR2_TARGET_OPTIMIZATION} -I${STAGING_DIR}/usr/include"
export LDFLAGS="${BR2_TARGET_LDFLAGS} -L${STAGING_DIR}/usr/lib"
unset CPPFLAGS
export HOST_DIR
export JUCE_6_0_TOOLCHAIN_FILE="${STAGING_DIR}/usr/lib/cmake/JUCE-6.0.8/toolchainfile.cmake"
export JUCE_6_1_TOOLCHAIN_FILE="${STAGING_DIR}/usr/lib/cmake/JUCE-6.1.6/toolchainfile.cmake"
export JUCE_7_0_TOOLCHAIN_FILE="${STAGING_DIR}/usr/lib/cmake/JUCE-7.0.9/toolchainfile.cmake"
export JUCE_8_0_TOOLCHAIN_FILE="${STAGING_DIR}/usr/lib/cmake/JUCE-8.0.4/toolchainfile.cmake"
alias ar=${AR}
alias cc=${CC}
alias cpp=${CPP}
alias gcc=${CC}
alias g++=${CXX}
alias ld=${ld}
alias strip=${strip}
CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE='${HOST_DIR}/usr/share/buildroot/toolchainfile.cmake'"
if [ x"${BR2_arm}" = x"y" ]; then
CMAKE="${CMAKE} -DCMAKE_CROSSCOMPILING_EMULATOR='qemu-arm-static -L ${TARGET_DIR}'"
elif [ x"${BR2_aarch64}" = x"y" ]; then
CMAKE="${CMAKE} -DCMAKE_CROSSCOMPILING_EMULATOR='qemu-aarch64-static -L ${TARGET_DIR}'"
elif [ x"${BR2_x86_64}" = x"y" ]; then
CMAKE="${CMAKE} -DCMAKE_CROSSCOMPILING_EMULATOR='qemu-x86_64-static -L ${TARGET_DIR}'"
fi
alias cmake="$CMAKE"
#######################################################################################################################
echo "Success! Environment is now ready to build stuff"
fi
#######################################################################################################################
unset CURRENT_SCRIPT
unset SCRIPT_DIR