# I pass --disable-nls to configure below because I'm in the US and only
# read/write English (well). If this is not the case for you, leave that
# off below.
# Prerequisites:
# Bison
# m4
# flex
# texinfo
# itself (you need as, ranlib, etc. to build this)
# Java
# Get the tarball
cd
test -f installed/binutils-2.42.tar.xz &&
mv installed/binutils-2.42.tar.xz .
test ! -f binutils-2.42.tar.xz &&
wget http://ftpmirror.gnu.org/binutils/binutils-2.42.tar.xz
# Verify tarball w/ sha256sum:
# (this comes from the mailing list announcement)
echo "f6e4d41fd5fc778b06b7891457b3620da5ecea1006c6a4a41ae998109f85a8\
00 binutils-2.42.tar.xz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "binutils-*" -exec rm -r {} \;
tar xJvf ~/binutils-2.42.tar.xz
cd binutils-2.42
test $UID = 0 && chown -R root:root .
# Verify the extracted files with sha256sum, if it outputs nothing, then
# they're all OK:
sha256sum -c sha256.sum | egrep -v ": OK$"
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --sysconfdir=/etc --prefix=/usr --infodir=/usr/info \
--libdir=/usr/lib64 --mandir=/usr/man --disable-nls
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --sysconfdir=/etc --prefix=/usr --infodir=/usr/info \
--mandir=/usr/man --disable-nls
# Build
make
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg binutils
# Copy newly compiled binaries in place so we can use them to install this
cp binutils/strip-new /usr/bin/strip
binutils/strip-new /usr/bin/strip
install -s binutils/ar binutils/ranlib binutils/strings /usr/bin/
install -s gas/as-new /usr/bin/as
install -s ld/ld-new /usr/bin/ld
# Install it
make install
ldconfig
# Make sure everything is owned by your non-root user (or root if you're
# doing this as root) so you'll be able to remove the source directory
# later.
chown -R $(logname) .
chmod -R u+rw .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/binutils-*.tar.*
mv binutils-2.42.tar.xz installed/
# You can't really, if you want to be able to build and install software,
# but if you ever want to uninstall binutils, this should do it:
# (there is no 'make uninstall' target)
cd
su
rm -f /etc/gprofng.rc
( cd /usr/bin
rm -f addr2line ar as c++filt elfedit gp-archive gp-collect-app \
gp-display-src gp-display-html gp-display-text gprof gprofng ld \
ld.bfd nm objcopy objdump ranlib readelf size strings strip )
( cd /usr/include
rm -f ansidecl.h bfd.h bfdlink.h collectorAPI.h ctf-api.h ctf.h \
diagnostics.h dis-asm.h libcollector.h libfcollector.h plugin-api.h \
sframe-api.h sframe.h symcat.h )
( cd /usr/info
rm -f as.info bdf.info binutils.info ctf-spec.info gprof.info \
gprofng.info ld.info ldint.info sframe-spec.info )
( cd /usr/lib64
rm -f libbfd.* libctf-nobfd.* libctf.* libgprofng.* libopcodes.* \
libsframe.* )
test -d /usr/lib64/bfd-plugins && rm -r /usr/lib64/bfd-plugins
test -d /usr/lib64/gprofng && rm -r /usr/lib64/gprofng
( cd /usr/man/man1
rm -f addr2line.1 ar.1 as.1 c++filt.1 dlltool.1 elfedit.1 gp-archive.1 \
gp-collect-app.1 gp-display-html.1 gp-display-src.1 gp-display-text.1 \
gprof.1 gprofng.1 ld.1 nm.1 objcopy.1 objdump.1 ranlib.1 readelf.1 \
size.1 strings.1 strip.1 windmc.1 windres.1 )
( cd /usr/x86_64-pc-linux-gnu/bin
rm -f ar as ld ld.bfd nm objcopy objdump ranlib readelf strip )
test -d /usr/x86_64-pc-linux-gnu/lib/ldscripts &&
rm -f /usr/x86_64-pc-linux-gnu/lib/ldscripts
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "binutils-*" -exec rm -r {} \;
rm -f ~/installed/binutils-*.tar.*