Add initial binutils-gdb install script
authorR Veera Kumar <vklr@vkten.in>
Fri, 10 Jun 2022 14:38:30 +0000 (20:08 +0530)
committerR Veera Kumar <vklr@vkten.in>
Fri, 10 Jun 2022 14:38:30 +0000 (20:08 +0530)
binutils-gdb-install [new file with mode: 0755]

diff --git a/binutils-gdb-install b/binutils-gdb-install
new file mode 100755 (executable)
index 0000000..aedbddf
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+if [ "$EUID" -ne 0 ]
+  then echo "Please run as root using 'sudo bash'"
+  exit
+fi
+
+# change into $SUDO_USER home directory
+cd /home/$SUDO_USER
+mkdir -p src/binutils-gdb
+cd src/binutils-gdb
+
+apt-get install -y libcurl3-gnutls git git-man
+
+git clone https://git.libre-soc.org/git/binutils-gdb.git
+
+# Steps to compile binutils-gdb
+
+## Necessary software to install
+
+apt-get install -y build-essential libgmp-dev libmpfr-dev \
+ bison flex file texinfo dejagnu
+
+if [ "`arch`" = "x86_64" ]; then
+ apt-get install -y g++-powerpc64le-linux-gnu
+fi
+
+## Build binutils-gdb
+
+# Set HOST triplet
+
+if [ "`arch`" = "x86_64" ]; then
+ export HOST="x86_64-pc-linux-gnu"
+elif [ "`arch`" = "ppc64le" ]; then
+ export HOST="powerpc64le-linux-gnu"
+fi
+
+cd binutils-gdb
+git checkout svp64
+mkdir ../binutils-gdb-build
+cd ../binutils-gdb-build
+AR=ar AS=as ../binutils-gdb/configure --prefix=/usr/local/binutils-gdb \
+--host=${HOST} --target=powerpc64le-linux-gnu --disable-nls --enable-shared \
+--enable-64-bit-bfd --disable-multilib --enable-ld=default --enable-gold=yes \
+--enable-plugins --enable-threads --disable-werror
+make -j$(nproc)
+# make check |& tee chk.log
+make install
+cd ..
+
+cd /home/$SUDO_USER/src/binutils-gdb
+chown -R $SUDO_USER .
+chgrp -R $SUDO_USER .