-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild-binutils.sh
executable file
·73 lines (60 loc) · 2.59 KB
/
build-binutils.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
#!/bin/bash
###################################################################
#Script Name : build-binutils
#Description : build binutils for the Motorola 68000 toolchain
#Date : samedi, 4 avril 2020
#Args : Welcome to the next level!
#Author : Jacques Belosoukinski (kentosama)
#Email : kentosama@genku.net
###################################################################
VERSION="2.34"
ARCHIVE="binutils-${VERSION}.tar.bz2"
URL="https://ftp.gnu.org/gnu/binutils/${ARCHIVE}"
SHA512SUM="f47e7304e102c7bbc97958a08093e27796b9051d1567ce4fbb723d39ef3e29efa325ee14a1bdcc462a925a7f9bbbc9aee28294c6dc23850f371030f3835a8067"
DIR="binutils-${VERSION}"
# Check if user is root
if [ ${EUID} == 0 ]; then
echo "Please don't run this script as root"
exit 1
fi
# Create build folder
mkdir -p ${BUILD_DIR}/${DIR}
cd ${DOWNLOAD_DIR}
# Download binutils if is needed
if ! [ -f "${ARCHIVE}" ]; then
wget ${URL}
fi
# Extract binutils archive if is needed
if ! [ -d "${SRC_DIR}/${DIR}" ]; then
if [ $(sha512sum ${ARCHIVE} | awk '{print $1}') != ${SHA512SUM} ]; then
echo "SHA512SUM verification of ${ARCHIVE} failed!"
exit
else
tar jxvf ${ARCHIVE} -C ${SRC_DIR}
fi
fi
cd ${BUILD_DIR}/${DIR}
# Enable gold for 64bit
if [ ${ARCH} != "i386" ] && [ ${ARCH} != "i686" ]; then
GOLD="--enable-gold=yes"
fi
# Configure before build
../../source/${DIR}/configure --prefix=${INSTALL_DIR} \
--build=${BUILD_MACH} \
--host=${HOST_MACH} \
--target=${TARGET} \
--disable-werror \
--disable-nls \
--disable-threads \
--disable-multilib \
--enable-libssp \
--enable-lto \
--enable-languages=c
--program-prefix=${PROGRAM_PREFIX} \
${GOD}
# build and install binutils
make -j${NUM_PROC} 2<&1 | tee build.log
# Install binutils
if [ $? -eq 0 ]; then
make install -j${NUM_PROC}
fi