This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
forked from scele/tegra-scripts
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathenv.sh
116 lines (96 loc) · 2.25 KB
/
env.sh
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
set -e
status()
{
echo -e "\e[1m"$*"\e[0m "
}
error()
{
echo -e "\e[91m"$*"\e[0m "
exit 1
}
if [[ -z "$TOP" ]]; then
error "Error: TOP env var not set."
exit 1
fi
if [[ -z "$DISTRO" ]]; then
DISTRO=ArchLinuxArm
fi
if [[ -z "$ARCH" ]]; then
ARCH=arm
fi
case $ARCH in
arm)
;;
aarch64)
;;
*)
error "Invalid ARCH $ARCH (valid values: arm, aarch64)"
exit 1
;;
esac
# Where all the programs/libraries from these scripts will be installed
if [[ -z "$NV_PREFIX" ]]; then
NV_PREFIX=/opt/nouveau
fi
#### helpers
cd_package()
{
if [[ -z "$PACKAGE" ]]; then
error "Error: PACKAGE var not set."
exit 1
fi
mkdir -p $BUILDROOT/$PACKAGE
cd $BUILDROOT/$PACKAGE
}
package_success()
{
status "Installation of $PACKAGE successful!"
}
run_autogen()
{
if [[ -z "$PACKAGE" ]]; then
error "Error: PACKAGE var not set."
exit 1
fi
if [ ! -f "$BUILDROOT/$PACKAGE/Makefile" ]; then
$TOP/$PACKAGE/autogen.sh --host=${CROSS_COMPILE%"-"} --prefix=$NV_PREFIX --with-sysroot=$SYSROOT $*
fi
}
run_make()
{
make DESTDIR=$SYSROOT -j$NPROC $*
}
####
NPROC=$(nproc)
BUILDROOT=$TOP/out/build/$ARCH/$DISTRO
#### toolchain-specific settings
LINARO_GCC_VERSION=6.2.1
LINARO_GCC_RELEASE=2016.11
case $ARCH in
arm)
LINARO_GCC_VARIANT=arm-linux-gnueabihf
;;
aarch64)
LINARO_GCC_VARIANT=aarch64-linux-gnu
;;
esac
LINARO_GCC_PACKAGE=gcc-linaro-${LINARO_GCC_VERSION}-${LINARO_GCC_RELEASE}-x86_64_${LINARO_GCC_VARIANT}
CROSS_COMPILE=${LINARO_GCC_VARIANT}-
SYSTEM_PATH="$PATH"
PATH="$TOP/out/host/$LINARO_GCC_PACKAGE/bin:$PATH"
####
#### user-space only flags!
export SYSROOT="$TOP/out/target/$ARCH/$DISTRO"
export CFLAGS="--sysroot=$SYSROOT"
export CXXFLAGS="$CFLAGS"
export ACLOCAL_PATH="${SYSROOT}/usr/share/aclocal"
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig":"${SYSROOT}/usr/lib/pkgconfig":"${SYSROOT}/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT}"
export PKG_CONFIG_PATH="${SYSROOT}/${NV_PREFIX}/lib/pkgconfig"
# Use our own pkg-config as the toolchain's one is too old (0.25) to handle PKG_CONFIG_SYSROOT_DIR correctly.
export PKG_CONFIG=pkg-config
####
if [ -f scripts/distro/env-$DISTRO ]; then
. scripts/distro/env-$DISTRO
fi