-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-toolchain
executable file
·48 lines (36 loc) · 1009 Bytes
/
build-toolchain
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
#!/bin/bash
cwd=$(pwd)
script_path=$(cd $(dirname $0); pwd)
set -e
cd ${script_path}
if [ ! -e ./prerequisites/build-stamp ]; then
pushd prerequisites
./build-prerequisites
touch build-stamp
popd
fi
packages="binutils-microblaze \
gcc-microblaze-bootstrap \
newlib-microblaze \
gcc-microblaze \
gdb-microblaze"
ncores=$(grep -c ^processor /proc/cpuinfo || echo 1)
arch=$(dpkg --print-architecture)
for pkg in ${packages}; do
grep ^${pkg}\$ ./build-stamp >/dev/null 2>&1 && continue
pushd ${pkg}
nice -n 19 dpkg-buildpackage -rfakeroot -uc -us -j${ncores}
pkg_version=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
popd
case ${pkg} in
newlib-*)
sudo dpkg -i $(ls -1 lib${pkg}*${pkg_version}*.deb | grep -v doc_)
;;
*)
sudo dpkg -i ${pkg}_${pkg_version}_${arch}.deb
;;
esac
echo ${pkg} >> build-stamp
done
echo "Build succeded."
# vim: set filetype=sh ts=4 sw=4 sts=4 et: