***************************************************************
***************************************************************
#
#
# build temp-system  mit GNU LibC 2.11.3
#
# gcc, gc++, gcj, gcobjc  -> 4.7.4
#
# 2015-02-18
# svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch
# ergibt dann einen 4.7.4
# 'gcc (GCC) 4.7.4'
# angefangen mit gcc-4.5.4
exit 1

# http://www.linuxfromscratch.org/lfs/view/6.6/index.html
# http://www.linuxfromscratch.org/lfs/view/7.12
# http://www.linuxfromscratch.org/patches/downloads/

# http://oss.erdfunkstelle.de/lfs-de/6.4/online/chapter05/gcc-pass1.html

Basis LFS 7.2 und SuSE-12.2/3


gmp-dev
mpfr-dev
mp-dev

-------------------------------

weiter mit User lfs
su - lfs

#.bashrc
set +h
umask 022
LFS=/data/2_15
LC_ALL=POSIX
#LFS_TGT=$(uname -m)-lfs-linux-gnu
LFS_TGT=i486-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH

#env

TERM=xterm
LC_ALL=POSIX
LFS=/data/2_15
PATH=/tools/bin:/bin:/usr/bin
PWD=/data/2_15/source
LFS_TGT=i486-lfs-linux-gnu
PS1=\u:\w\$
SHLVL=1
HOME=/home/lfs



# binutils 2.23.2
# patches from SuSE-12.3 with rpm

tar xf binutils-2.23.2.tar.xz &&
mkdir -v binutils-pass1 &&
cd binutils-pass1

../binutils-2.23.2/configure   \
    --prefix=/tools            \
    --with-sysroot=$LFS        \
    --with-lib-path=/tools/lib \
    --target=$LFS_TGT          \
    --disable-nls              \
    --disable-werror

make
make install


# gcc-4.7.4
# gcc-4_7-branch
# with patches form SuSE 12.3
# gcc-4.7.2-20130108 with rpm

tar xf gcc-4_7-branch.tar.xz

tar xf gcc-4.7.4-20140108.tar.xz


for file in \
 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
      -e 's@/usr@/tools@g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done

sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure

cp gcc/BASE-VER gcc/FULL-VER


mkdir -v gcc-pass1 &&
cd gcc-pass1

../gcc-4.7.4-20140108/configure \
    --target=$LFS_TGT          \
    --prefix=/tools            \
    --with-sysroot=$LFS        \
    --with-newlib              \
    --without-headers          \
    --with-local-prefix=/tools \
    --with-native-system-header-dir=/tools/include \
    --disable-nls              \
    --disable-shared           \
    --disable-multilib         \
    --disable-decimal-float    \
    --disable-threads          \
    --disable-libmudflap       \
    --disable-libssp           \
    --disable-libgomp          \
    --disable-libquadmath      \
    --enable-languages=c


make
make install


ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`


# Installation von Linux-API-Header 3.2.54-eisfair-1

exit


cd /usr/src/linux

make mrproper


make headers_check
make INSTALL_HDR_PATH=dest headers_install


su -lfs

cp -rv dest/include/* /tools/include



# glibc-2.15

tar xf glibc-2.15.tar.xz
patches from SuSE-12.2 with rpm

patch fuer sed, texinfo, cpuid.h

fix for cpuid.h

http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20110604/75703526/attachment.ksh


sed -i 's/ -lgcc_s//' Makeconfig

mkdir -v glibc-pass1 &&
cd glibc-pass1

../glibc-2.15/configure                             \
      --prefix=/tools                               \
      --host=$LFS_TGT                               \
      --build=$(../glibc-2.15/scripts/config.guess) \
      --disable-profile                             \
      --enable-add-ons                              \
      --enable-kernel=2.6.0                         \
      --with-headers=/tools/include                 \
      libc_cv_forced_unwind=yes                     \
      libc_cv_ctors_header=yes                      \
      libc_cv_c_cleanup=yes


configure: running configure fragment for add-on libidn
configure: running configure fragment for add-on noversion
configure: running configure fragment for add-on nptl



make
make install



echo 'main(){}' > dummy.c
$LFS_TGT-gcc dummy.c
readelf -l a.out | grep ': /tools'

      [Requesting program interpreter: /tools/lib/ld-linux.so.2]

rm -v dummy.c a.out



=========================================================
2. Durchlauf


# binutils 2.23.2

mkdir -v binutils-pass2 &&
cd binutils-pass2

CC=$LFS_TGT-gcc            \
AR=$LFS_TGT-ar             \
RANLIB=$LFS_TGT-ranlib     \
../binutils-2.23.2/configure \
    --prefix=/tools        \
    --disable-nls          \
    --with-lib-path=/tools/lib \
    --build=i486-pc-linux-gnu \
    --host=i486-pc-linux-gnu


make
make install


make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin



# gcc-4.7.4

tar xf gcc-4.7.4-20140108.tar.xz

cd gcc-4.7.4-20140108

cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h


cp -v gcc/Makefile.in{,.tmp}
sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
  > gcc/Makefile.in


  for file in \
 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
  -e 's@/usr@/tools@g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done


cp gcc/BASE-VER gcc/FULL-VER


gmp-5.1.3
mpfr-3.1.2
mpc-1.0.2


tar -Jxf ../mpfr-3.1.2.tar.xz
mv -v mpfr-3.1.2 mpfr
tar -Jxf ../gmp-5.1.3.tar.xz
mv -v gmp-5.1.3 gmp
tar -zxf ../mpc-1.0.2.tar.gz
mv -v mpc-1.0.2cd .. mpc



mkdir -v ../gcc-pass2
cd ../gcc-pass2


CC=$LFS_TGT-gcc \
AR=$LFS_TGT-ar                  \
RANLIB=$LFS_TGT-ranlib          \
../gcc-4.7.4-20140108/configure          \
    --prefix=/tools             \
    --with-local-prefix=/tools  \
    --with-native-system-header-dir=/tools/include \
    --enable-clocale=gnu        \
    --enable-shared             \
    --enable-threads=posix      \
    --enable-__cxa_atexit       \
    --enable-languages=c,c++    \
    --disable-libstdcxx-pch     \
    --disable-multilib          \
    --disable-bootstrap         \
    --disable-libgomp           \
    --with-mpfr-include=$(pwd)/../gcc-4.7.4-20140108/mpfr/src \
    --with-mpfr-lib=$(pwd)/mpfr/src/.libs \
    --build=i486-pc-linux-gnu \
    --host=i486-pc-linux-gnu


make
make install


ln -vs gcc /tools/bin/cc



echo 'main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'

[Requesting program interpreter: /tools/lib/ld-linux.so.2]

rm -v dummy.c a.out


# tcl-8.5.12
# patches from Suse with rpm

tar xf tcl8.5.12.tar.xz

cd tcl8.5.12/unix/

./configure --prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

TZ=UTC make test

make install

chmod -v u+w /tools/lib/libtcl8.5.so

make install-private-headers

ln -sv tclsh8.5 /tools/bin/tclsh


# expect-5.45
# patches from Suse with rpm

tar xf expect5.45.tar.xz

cd expect5.45

cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig > configure


./configure \
--prefix=/tools \
--with-tcl=/tools/lib \
--with-tclinclude=/tools/include \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make SCRIPTS="" install



# dejagnu-1.5.1

tar xf dejagnu-1.5.1.tar.gz
cd dejagnu-1.5.1

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# check-0.9.14

tar xf  check-0.9.14.tar.gz
cd check-0.9.14

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# ncurses-5.9-20150214

tar xf ncurses-5.9-20150214.tgz
cd ncurses-5.9-20150214

./configure \
--prefix=/tools \
--with-shared \
--without-debug \
--without-ada \
--enable-overwrite \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make install



# bash-4.2-75.3.1
patches from Suse with rpm

tar xf bash-4.2.tar.xz
cd bash-4.2

./configure \
--prefix=/tools \
--without-bash-malloc \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install

ln -vs bash /tools/bin/sh



# bzip2-1.0.6
patches from Suse with rpm

tar xf bzip2-1.0.6.tar.xz
cd bzip2-1.0.6

make
make PREFIX=/tools install



# coreutils-8.17
patches from Suse

tar xf coreutils-8.17.tar.xz
cd coreutils-8.17

./configure \
--prefix=/tools \
--enable-install-program=hostname \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make install



# diffutils-3.3

tar xf diffutils-3.3.tar.xz
cd diffutils-3.3

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install


# file-5.22
patches from Suse

tar xf file-5.11.tar.xz
file-5.11

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# findutils-4.5.14
patches from Suse

tar xf findutils-4.5.14.tar.xz
cd findutils-4.5.14

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# gawk-1.1.1
patches from Suse

tar xf gawk-4.1.1.tar.xz
cd gawk-4.1.1

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make install



# gettext-0.19-2
patches from Suse

tar xf gettext-0.19.2.tar.xz
cd gettext-0.19.2

cd gettext-tools

./configure \
--prefix=/tools \
--disable-shared \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make -C gnulib-lib
make -C src msgfmt

cp -v src/msgfmt /tools/bin



# grep-2.21

tar xf grep-2.21.tar.xz
cd grep-2.21

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# gzip-1.6
patches from Suse

tar xf gzip-1.6.tar.xz
cd gzip-1.6

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# m4-1.4.16
patches from Suse

tar xf m4-1.4.16.tar.xz
cd m4-1.4.16

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# make-3.82
patches from Suse

tar xf make-3.82.tar.xz
cd make-3.82

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# patch-2.7.1

tar xf patch-2.7.1.tar.bz2
cd patch-2.7.1

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install




# perl-5.18.1
patches from Suse

tar xf perl-5.18.1.tar.xz
cd perl-5.18.1

sh Configure -des -Dprefix=/tools

cp -v perl cpan/podlators/pod2man /tools/bin
mkdir -pv /tools/lib/perl5/5.18.1
cp -Rv lib/* /tools/lib/perl5/5.18.1



# sed-4.2.2
patches from Suse

tar xf sed-4.2.2.tar.xz
cd sed-4.2.2

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# tar-1.28
patches from Suse

tar xf tar-1.28.tar.xz
cd tar-1.28

# automake-1.14 is missing
autoreconf -vi

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# texinfo-4.13
patches from Suse
4.1.3 required from glibc-2.15

tar xf texinfo-4.13.tar.xz
cd texinfo-4.13

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install



# xz-5.0.7

tar xf xz-5.0.7.tar.gz
cd xz-5.0.7

./configure \
--prefix=/tools \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install




================================================================
# Basissystem aufbauen

als root



mkdir -pv $LFS/{dev,proc,sys}
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3


# Platten einhaengen

mount -v --bind /dev $LFS/dev

mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys



# Chrooten

chroot "$LFS" /tools/bin/env -i \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='\u:\w\$ '              \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
    /tools/bin/bash --login +h


# Ordnerstruktur erstellen

mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt,run}
mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
mkdir -v  /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
for dir in /usr /usr/local; do
  ln -sv share/{man,doc,info} $dir
done
case i486 in
 x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;;
esac
mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{misc,locate},local}


# Dateien erstellen

ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
ln -sv /tools/bin/perl /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
ln -sv bash /bin/sh


touch /etc/mtab


cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF


cat > /etc/group << "EOF"
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
mail:x:34:
nogroup:x:99:
EOF


exec /tools/bin/bash --login +h

touch /var/log/{btmp,lastlog,wtmp}
chgrp -v utmp /var/log/lastlog
chmod -v 664  /var/log/lastlog
chmod -v 600  /var/log/btmp





# loss gehts ;-)


# Linux Header 3.2.54
# eiskernel: 2.8.0 (3.2.54-eisfair-1-SMP)


su - holbru
make mrproper

make headers_check
make INSTALL_HDR_PATH=dest headers_install

find dest/include \( -name .install -o -name ..install.cmd \) -delete

cp -rv dest/include/* /data/2_15/usr/include

# chroot


# Man-pages 3.69
# weill es in lfs steht ;-)
patches from Suse

tar xf man-pages-3.69.tar.xz
cd man-pages-3.69

make install



# glibc-2.15
patches from Suse

rm -rf glibc-2.15
tar xf glibc-2.15.tar.xz
cd glibc-2.15

sed -i 's#<rpc/types.h>#"rpc/types.h"#' sunrpc/rpc_clntout.c
sed -i '/test-installation.pl/d' Makefile
sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in


mkdir -v ../glibc-build
cd ../glibc-build

../glibc-2.15/configure  \
    --prefix=/usr          \
    --disable-profile      \
    --enable-add-ons       \
    --enable-kernel=2.6.0  \
    --libexecdir=/usr/lib/glibc \
    --build=i486-pc-linux-gnu   \
    --host=i486-pc-linux-gnu


configure: running configure fragment for add-on libidn
configure: running configure fragment for add-on noversion
configure: running configure fragment for add-on nptl


make

make -k check 2>&1 | tee glibc-check-log
TIMEOUTFACTOR=32 make -k check 2>&1 | tee glibc-check-log


grep Error glibc-check-log


root:/source/glibc-build# grep Error glibc-check-log
make[2]: [/source/glibc-build/posix/annexc.out] Error 1 (ignored)
root:/source/glibc-build#


touch /etc/ld.so.conf

make install


cp -v ../glibc-2.15/sunrpc/rpc/*.h /usr/include/rpc
cp -v ../glibc-2.15/sunrpc/rpcsvc/*.h /usr/include/rpcsvc
cp -v ../glibc-2.15/nis/rpcsvc/*.h /usr/include/rpcsvc


# localedata/SUPPORTED  bereinigt

make localedata/install-locales


######################
# libc extrahieren

make install_root=/public/glibc-2.15-stripped install
make install_root=/public/glibc-2.15-stripped localedata/install-locales

cp -v ../glibc-2.15/sunrpc/rpc/*.h /public/glibc-2.15-stripped/usr/include/rpc
cp -v ../glibc-2.15/sunrpc/rpcsvc/*.h /public/glibc-2.15-stripped/usr/include/rpcsvc
cp -v ../glibc-2.15/nis/rpcsvc/*.h /public/glibc-2.15-stripped/usr/include/rpcsvc



# kernel header hinzufuegen
# aus dem installierten System nehmen, da Changes durch GLibC moeglich

/usr/src/linux/dest  -> kernel-header.tar.xz


for filename in `find /public/glibc-2.15-stripped -type f`
do
   echo "stripping $filename with -S"
   strip -S "$filename"
done

######################


cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

hosts: files dns
networks: files

protocols: files
services: files
ethers: files
rpc: files

# End /etc/nsswitch.conf
EOF


# timezonedata

http://www.iana.org/time-zones/repository/releases/tzdata2015a.tar.gz


tar -xf ../tzdata2012e.tar.gz

#ZONEINFO=/public/glibc-2.15-stripped/usr/share/zoneinfo

ZONEINFO=/usr/share/zoneinfo
mkdir -pv $ZONEINFO/{posix,right}

for tz in etcetera southamerica northamerica europe africa antarctica  \
          asia australasia backward pacificnew solar87 solar88 solar89 \
          systemv; do
    zic -L /dev/null   -d $ZONEINFO       -y "sh yearistype.sh" ${tz}
    zic -L /dev/null   -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz}
    zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}
done

cp -v zone.tab iso3166.tab $ZONEINFO
zic -d $ZONEINFO -p America/New_York
unset ZONEINFO

tzselect

# Replace <xxx> with the name of the time zone selected (e.g., Canada/Eastern).

cp -v --remove-destination /usr/share/zoneinfo/<xxx> \
    /etc/localtime


cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib

EOF

cat >> /etc/ld.so.conf << "EOF"
# Add an include directory
include /etc/ld.so.conf.d/*.conf

EOF

mkdir /etc/ld.so.conf.d



# Adjusting the toolchain
#################################################################

http://www.linuxfromscratch.org/lfs/view/7.2/chapter06/adjusting.html


mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld


gcc -dumpspecs | sed -e 's@/tools@@g' \
    -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
    -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
    `dirname $(gcc --print-libgcc-file-name)`/specs


echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'

      [Requesting program interpreter: /lib/ld-linux.so.2]


grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log

/usr/lib/crt1.o succeeded
/usr/lib/crti.o succeeded
/usr/lib/crtn.o succeeded


grep -B1 '^ /usr/include' dummy.log

#include <...> search starts here:
 /usr/include


grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'

SEARCH_DIR("/tools/i486-pc-linux-gnu/lib")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib");

root:/source# grep "/lib.*/libc.so.6 " dummy.log
attempt to open /lib/libc.so.6 succeeded

root:/source# grep found dummy.log
found ld-linux.so.2 at /lib/ld-linux.so.2

root:/source# rm -v dummy.c a.out dummy.log
removed 'dummy.c'
removed 'a.out'
removed 'dummy.log'



########################################################

Weiter mit der Toolchain



# zlib-1.2.8

export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"

./configure \
--prefix=/usr

make
make check
                *** zlib test OK ***
                *** zlib shared test OK ***
                *** zlib 64-bit test OK ***
make install



# file-5.11

./configure \
--prefix=/usr \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

make install


unset CFLAGS
unset CXXFLAGS


# binutils-2.23.2
patches from Suse

root:/source# expect -c "spawn ls"
spawn ls

rm -rf binutils-2.23.2
tar xf binutils-2.23.2.tar.xz
cd  binutils-2.23.2

rm -fv etc/standards.info
sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in

mkdir -v ../binutils-build
cd ../binutils-build

../binutils-2.23.2/configure  \
--prefix=/usr               \
--enable-shared             \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu

make tooldir=/usr

make -k check 2>&1 | tee binutils-check-log

grep Error binutils-check-log

                === binutils Summary ===

# of expected passes            92
# of unsupported tests          3

                === gas Summary ===

# of expected passes            371

                === ld Summary ===

# of expected passes            736
# of expected failures          8
# of untested testcases         6


PASS: test-expandargv-0.
PASS: test-expandargv-1.
PASS: test-expandargv-2.
PASS: test-expandargv-3.
PASS: test-expandargv-4.
PASS: test-expandargv-5.
PASS: test-expandargv-6.


make tooldir=/usr install

cp -v ../binutils-2.23.2/include/libiberty.h /usr/include


############

make tooldir=/usr DESTDIR=/public/toolchain/binutils-2.23.2/ install

cp -v ../binutils-2.23.2/include/libiberty.h /public/toolchain/binutils-2.23.2/usr/include/

for filename in `find /public/toolchain/binutils-2.23.2/usr/{bin/*,lib/*.so} -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done

#############


# binutils static -> 'strings' kommt in die base


mkdir -v ../binutils-static
cd ../binutils-static

../binutils-2.23.2/configure  \
--prefix=/usr               \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu

make tooldir=/usr

#############
make tooldir=/usr DESTDIR=/public/toolchain/binutils-2.23.2-static/ install

for filename in `find /public/toolchain/binutils-2.23.2-static/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done

#############



export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"


# gmp-5.1.3
patches from Suse

tar xf gmp-5.1.3.tar.xz
cd gmp-5.1.3

./configure    \
--prefix=/usr             \
--enable-cxx              \
--enable-mpbsd            \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

  Version:           GNU MP 5.1.3
  Host type:         i486-pc-linux-gnu
  ABI:               32
  Install prefix:    /usr
  Compiler:          gcc -std=gnu99
  Static libraries:  yes
  Shared libraries:  yes


make
make check 2>&1 | tee gmp-check-log

awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log

185

make install



# mpfr-3.1.2

tar xf mpfr-3.1.2.tar.bz2
cd mpfr-3.1.2

./configure   \
--prefix=/usr   \
--enable-thread-safe \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make check

====================
All 160 tests passed
(1 test was not run)
====================

make install



# mpc-1.0.2

tar xf mpc-1.0.2.tar.gz
cd mpc-1.0.2

./configure      \
--prefix=/usr      \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check

GMP: include 5.1.3, lib 5.1.3
MPFR: include 3.1.2, lib 3.1.2
MPC: include 1.0.2, lib 1.0.2
C compiler: i486-pc-linux-gnu-gcc
GCC: yes
GCC version: 4.7.4
PASS: tget_version
===================
All 64 tests passed
===================

make install


# gcc
WARNING: `flex' is missing on your system.  You should only need it if
         you modified a `.l' file.  You may need the `Flex' package
         in order for those modifications to take effect.  You can get
         `Flex' from any GNU archive site.


# bison-2.7.1

tar xf bison-2.7.1.tar.xz
cd bison-2.7.1

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check

## ------------- ##
## Test results. ##
## ------------- ##

334 tests were successful.
18 tests were skipped.

make install



# flex-2.5.37
patches from Suse

tar xf flex-2.5.37.tar.xz
cd flex-2.5.37

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

Tests succeeded: 46
Tests FAILED: 0

make install


cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF

chmod -v 755 /usr/bin/lex


ln -sv libfl.a /usr/lib/libl.a


unset CFLAGS
unset CXXFLAGS




# gcc-4_7-branch

tar xf gcc-4_7-branch.tar.xz
cd gcc-4_7-branch

sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in

case i486 in
  i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;
esac

sed -i -e /autogen/d -e /check.sh/d fixincludes/Makefile.in

mkdir -v ../gcc-build
cd ../gcc-build

../gcc-4_7-branch/configure  \
--prefix=/usr            \
--libexecdir=/usr/lib    \
--enable-shared          \
--enable-threads=posix   \
--enable-__cxa_atexit    \
--enable-clocale=gnu     \
--enable-languages=c,c++ \
--disable-multilib       \
--with-system-zlib       \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

--disable-bootstrap      \


make


ulimit -s 32768

make -k check

# dauert ca. 2,5 Std

../gcc-4_7-branch/contrib/test_summary |
         grep -A7 Summ.

                === gcc Summary ===

# of expected passes         86328
# of unexpected failures     11
# of unexpected successes    5
# of expected failures       257
# of unsupported tests       912
/source/gcc-build/gcc/xgcc  version 4.7.4 (GCC)


FAIL: gcc.dg/pr46309.c scan-tree-dump-times reassoc1 "Optimizing range tests a_[0-9]*.D. -.1, 1. and -.2, 2. and -.3, 3. and -.4, 4.[\n\r]* into" 2
FAIL: gcc.dg/pr46309.c scan-tree-dump-times reassoc1 "Optimizing range tests a_[0-9]*.D. -.1, 1. and -.3, 3.[\n\r]* into" 1
FAIL: gcc.dg/pr46309.c scan-tree-dump-times reassoc1 "Optimizing range tests a_[0-9]*.D. -.1, 1. and -.2, 2.[\n\r]* into" 1
FAIL: gcc.dg/pr46309.c scan-tree-dump-times reassoc1 "Optimizing range tests a_[0-9]*.D. -.0, 31. and -.64, 95.[\n\r]* into" 2
FAIL: gcc.dg/pr46309.c scan-tree-dump-times reassoc1 "Optimizing range tests a_[0-9]*.D. -.128, 159. and -.192, 223.[\n\r]* into" 1
FAIL: gcc.dg/pr46309.c scan-tree-dump-times reassoc2 "Optimizing range tests D.[0-9]*_[0-9]* -.0, 31. and -.128, 159.[\n\r]* into" 1
FAIL: gcc.dg/tree-ssa/ssa-dom-thread-4.c scan-tree-dump-times dom1 "Threaded" 3
FAIL: gcc.target/i386/387-3.c scan-assembler fldpi

/* Verify that 387 mathematical constants are recognized.  */
/* { dg-do compile } */
/* { dg-options "-O2 -mfpmath=387 -mfancy-math-387 -mtune=generic" } */
/* { dg-final { scan-assembler "fldpi" } } */
/* { dg-require-effective-target large_long_double } */

FAIL: gcc.target/i386/387-4.c scan-assembler fldpi

/* { dg-do compile { target "i?86-*-*" } } */
/* { dg-options "-O2 -march=i686" } */
/* { dg-final { scan-assembler "fldpi" } } */

FAIL: gcc.target/i386/combine-mul.c scan-assembler-not 12345
FAIL: gcc.target/i386/pr50038.c scan-assembler-times movzbl 2


                === g++ Summary ===

# of expected passes            48076
# of expected failures          286
# of unsupported tests          333

                === libstdc++ Summary ===

# of expected passes            8717
# of expected failures          45
# of unsupported tests          257

                === libmudflap Summary ===

# of expected passes            1906

                === libgomp Summary ===

# of expected passes            1257

                === libitm Summary ===

# of expected passes            26
# of expected failures          3
# of unsupported tests          1


make install

ln -sv ../usr/bin/cpp /lib

ln -sv gcc /usr/bin/cc

echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'

      [Requesting program interpreter: /lib/ld-linux.so.2]

grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
/usr/lib/gcc/i486-pc-linux-gnu/4.7.4/../../../crt1.o succeeded
/usr/lib/gcc/i486-pc-linux-gnu/4.7.4/../../../crti.o succeeded
/usr/lib/gcc/i486-pc-linux-gnu/4.7.4/../../../crtn.o succeeded


grep -B4 '^ /usr/include' dummy.log
#include <...> search starts here:
 /usr/lib/gcc/i486-pc-linux-gnu/4.7.4/include
 /usr/local/include
 /usr/lib/gcc/i486-pc-linux-gnu/4.7.4/include-fixed
 /usr/include


grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
SEARCH_DIR("/usr/i486-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");


grep "/lib.*/libc.so.6 " dummy.log
attempt to open /lib/libc.so.6 succeeded


 grep found dummy.log
found ld-linux.so.2 at /lib/ld-linux.so.2


rm -v dummy.c a.out dummy.log
removed 'dummy.c'
removed 'a.out'
removed 'dummy.log'


mkdir -pv /usr/share/gdb/auto-load/usr/lib

mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib


mv -v /usr/lib/libgcc_s.so.1 /lib
cd /usr/lib/ &&
ln -sfv ../../lib/libgcc_s.so.1 libgcc_s.so


#############################

make DESTDIR=/public/toolchain/gcc install

mkdir -p /public/toolchain/gcc/lib

ln -sv ../usr/bin/cpp  /public/toolchain/gcc/lib

ln -sv gcc /public/toolchain/gcc/usr/bin/cc


mkdir -pv /public/toolchain/gcc/usr/share/gdb/auto-load/usr/lib

mv -v /public/toolchain/gcc/usr/lib/*gdb.py /public/toolchain/gcc/usr/share/gdb/auto-load/usr/lib

mv -v /public/toolchain/gcc/usr/lib/libgcc_s.so.1 /public/toolchain/gcc/lib
cd /public/toolchain/gcc/usr/lib/ &&
ln -sfv ../../lib/libgcc_s.so.1 libgcc_s.so

##############################


export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"


# java benoetigt zip
# zip mit bz2 support


# bzip2-1.0.6
patches from Suse with rpm

rm -rf bzip2-1.0.6
root:/source# tar xf bzip2-1.0.6.tar.xz
root:/source# cd bzip2-1.0.6

# zum relativ linken
sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile

make -f Makefile-libbz2_so
make clean

make
make install PREFIX=/usr

# install shared binarie
cp -v bzip2-shared /usr/bin/bzip2
cp -av libbz2.so* /usr/lib
cd /usr/lib
ln -sfv libbz2.so.1.0 libbz2.so
cd /usr/bin
rm -v {bunzip2,bzcat}
ln -sfv bzip2 bunzip2
ln -sfv bzip2 bzcat



# zip 3.0
patches from Suse

tar xf zip30.tar.xz
root:/source# cd zip30

make -f unix/Makefile prefix=/usr generic
make -f unix/Makefile prefix=/usr install


unset CFLAGS
unset CXXFLAGS



# gcc-all fuer die shared libs und zum einpacken

mkdir gcall-build &&
cd gcall-build


../gcc-4_7-branch/configure \
--prefix=/usr               \
--libexecdir=/usr/lib       \
--enable-shared             \
--enable-threads=posix      \
--enable-__cxa_atexit       \
--enable-clocale=gnu        \
--enable-languages=c,c++,objc,obj-c++,java,fortran  \
--disable-multilib          \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu    \
--disable-bootstrap         \
--with-system-zlib

make

ulimit -s 32768

make -k check

# dauert 2 - 3  Std.


../gcc-4_7-branch/contrib/test_summary |
       grep -A7 Summ.

                === gcc Summary ===

# of expected passes         86328
# of unexpected failures     11
# of unexpected successes    5
# of expected failures       257
# of unsupported tests       912

                === g++ Summary ===

# of expected passes            48076
# of expected failures          286
# of unsupported tests          333

                === gfortran Summary ===

# of expected passes            41043
# of expected failures          42
# of unsupported tests          228

                === objc Summary ===

# of expected passes            2988
# of expected failures          6
# of unsupported tests          74

                === obj-c++ Summary ===

# of expected passes            1450
# of expected failures          2
# of unsupported tests          86

                === libstdc++ Summary ===

# of expected passes            8717
# of expected failures          45
# of unsupported tests          257

                === libmudflap Summary ===

# of expected passes            1906

                === libffi Summary ===

# of expected passes            1634
# of expected failures          10
# of unsupported tests          55

                === libjava Summary ===

# of expected passes         2574

                === boehm-gc Summary ===

# of expected passes            12
# of unsupported tests          1

                === libgomp Summary ===

# of expected passes            2946

                === libitm Summary ===

# of expected passes            26
# of expected failures          3
# of unsupported tests          1

#############################

make DESTDIR=/public/toolchain/gcall install

##############################


--

# objc

cd .. &&
mkdir gcobjc-build &&
cd gcobjc-build



../gcc-4_7-branch/configure \
--prefix=/usr               \
--libexecdir=/usr/lib       \
--enable-shared             \
--enable-threads=posix      \
--enable-__cxa_atexit       \
--enable-clocale=gnu        \
--enable-languages=c,c++,objc,obj-c++  \
--disable-multilib          \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu    \
--disable-bootstrap         \
--with-system-zlib

make


#############################

make DESTDIR=/public/toolchain/gcobjc install

##############################


# fortran

cd .. &&
mkdir gcfortran-build &&
cd gcfortran-build



../gcc-4_7-branch/configure \
--prefix=/usr               \
--libexecdir=/usr/lib       \
--enable-shared             \
--enable-threads=posix      \
--enable-__cxa_atexit       \
--enable-clocale=gnu        \
--enable-languages=c,c++,fortran  \
--disable-multilib          \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu    \
--disable-bootstrap         \
--with-system-zlib


make


#############################

make DESTDIR=/public/toolchain/gcfortran install

##############################


# gcj

cd .. &&
mkdir gcj-build &&
cd gcj-build


../gcc-4_7-branch/configure \
--prefix=/usr               \
--libexecdir=/usr/lib       \
--enable-shared             \
--enable-threads=posix      \
--enable-__cxa_atexit       \
--enable-clocale=gnu        \
--enable-languages=c,c++,java  \
--disable-multilib          \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu    \
--disable-bootstrap         \
--with-system-zlib



make


#############################

make DESTDIR=/public/toolchain/gcj install

##############################


#############################

for filename in `find /public/toolchain/gcall/usr/{bin/*,lib/*.so*} -type f`
do
    echo "Strip: ${filename}"
    strip -R .note -R .comment "${filename}"
done

##############################


gcc, gcj, objc, fortran separieren und zusammenpacken

cd /public/toolchain

find gcobjc ! -type d -name '*' >gcobjc-files
find gcc  ! -type d -name '*' >gcc-files
find gcj  ! -type d -name '*' >gcj-files
find gcfortran ! -type d -name '*' >gcfortran-files


sed -i 's#^gcc/##' gcc-files
sed -i 's#^gcj/##' gcj-files
sed -i 's#^gcobjc/##' gcobjc-files
sed -i 's#^gcfortran/##' gcfortran-files

diff gcc-files gcobjc-files | grep -v '<' >gcobjc-diff-files
diff gcc-files gcj-files | grep -v '<' >gcj-diff-files
diff gcc-files gcfortran-files | grep -v '<' >gcfortran-diff-files

grep '>' gcobjc-diff-files | sed 's#> ##' >gcobjc-files-def
grep '>' gcj-diff-files | sed 's#> ##' >gcj-files-def
grep '>' gcfortran-diff-files | sed 's#> ##' >gcfortran-files-def

cd gcall

tar -r -f ../gcj.tar -T ../gcj-files-def
tar -r -f ../gcobjc.tar -T ../gcobjc-files-def
tar -r -f ../gcc.tar -T ../gcc-files
tar -r -f ../gcfortran.tar -T ../gcfortran-files-def
cd ..

xz -z gcc.tar
xz -z gcobjc.tar
xz -z gcj.tar
xz -z gcfortran.tar



#############################################################################
# toolchain und tools
# nach dem GCC
#############################################################################


export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"


# zlib-1.2.8

export LDFLAGS="-Wl,-z,relro,-z,now"

./configure \
--prefix=/usr

make
make check

     *** zlib test OK ***
     *** zlib shared test OK ***
     *** zlib 64-bit test OK ***

make install

##################
make DESTDIR=/public/lib/z install
##################


unset LDFLAGS



# gmp-5.1.3
wie vor

export CFLAGS="${CFLAGS} -fexceptions"
export CXXFLAGS="${CFLAGS}"

./configure    \
--prefix=/usr             \
--enable-cxx              \
--enable-fat              \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


  Version:           GNU MP 5.1.3
  Host type:         i486-pc-linux-gnu
  ABI:               32
  Install prefix:    /usr
  Compiler:          gcc -std=gnu99
  Static libraries:  yes
  Shared libraries:  yes


make
make check 2>&1 | tee gmp-check-log

awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log

185

make install

##############################
make DESTDIR=/public/lib/gmp install
##############################



export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"


# mpfr 3.1.2

./configure   \
--prefix=/usr   \
--enable-thread-safe \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make check

====================
All 160 tests passed
(1 test was not run)
====================

make install


##############################
make DESTDIR=/public/lib/mpfr install
##############################



# mpc 1.0.2

./configure      \
--prefix=/usr      \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check

GMP: include 5.1.3, lib 5.1.3
MPFR: include 3.1.2, lib 3.1.2
MPC: include 1.0.2, lib 1.0.2
C compiler: i486-pc-linux-gnu-gcc
GCC: yes
GCC version: 4.7.4
PASS: tget_version

===================
All 64 tests passed
===================

make install

##############################
make DESTDIR=/public/lib/mpc install
##############################



# attr-2.4.47

export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"
export OPTIMIZER="${CFLAGS} -fPIC"


./configure \
--prefix=/usr \
--libexecdir=/usr/lib \
--with-pic   \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

make \
prefix=/usr \
install install-lib install-dev

##############################
make \
prefix=/public/lib/attr/usr \
install install-lib install-dev
##############################

unset OPTIMIZER



# acl-2.2.52
patches from Suse

export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"
export OPTIMIZER="${CFLAGS} -fPIC"

./configure \
--prefix=/usr \
--libexecdir=/usr/lib \
--with-pic   \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make

make \
prefix=/usr \
install install-lib install-dev

##############################
make \
prefix=/public/lib/acl/usr \
install install-lib install-dev

rm -fv /public/lib/acl/usr/lib/libacl.a
cp -v /usr/lib/libacl.a  /public/lib/acl/usr/lib/libacl.a
##############################

unset OPTIMIZER



# sed-4.2.2
patches from Suse

tar xf sed-4.2.2.tar.xz
cd sed-4.2.2

./configure \
--prefix=/usr \
--without-included-regex \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

make check

======================================================
All 66 tests behaved as expected (4 expected failures)
======================================================

make install

##################
make DESTDIR=/public/utils/sed install

###########################



# pkg-config-0.28

./configure \
--prefix=/usr \
--disable-host-tool \
--with-internal-glib \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check

===================
All 25 tests passed
===================

make install

##################
make DESTDIR=/public/utils/pkg-config install

##################



export CFLAGS='-O2 -march=i486 -D_REENTRANT -pipe -fPIE'
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="-Wl,-z,relro,-z,now -pie"


# xz-utils-5.2.1

./configure \
--prefix=/usr \
--with-pic \
--build=i486-pc-linux-gnu  \
--host=i486-pc-linux-gnu

make
time make check
==================
All 9 tests passed
==================

real    0m23.100s
user    0m14.173s
sys     0m2.464s

make install

##################
make DESTDIR=/public/utils/xz_utils install

##################

unset LDFLAGS
export CFLAGS='-O2 -march=i486'
export CXXFLAGS="${CFLAGS}"



# m4-1.4.16
patches from Suse
m4-1.4.16-14.1.2.src.rpm

tar xf m4-1.4.16.tar.xz
cd m4-1.4.16



./configure \
--prefix=/usr \
--without-included-regex \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

sed -i -e '/gets is a/d' lib/stdio.in.h

make

sed -i -e '41s/ENOENT/& || errno == EINVAL/' tests/test-readlink.h

make check

=======================
All 115 tests passed
(15 tests were not run)
=======================


make install

##################
make DESTDIR=/public/toolchain/m4 install

for filename in `find /public/toolchain/m4/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
##################



# bison-2.7.1

tar xf bison-2.7.1.tar.xz
cd bison-2.7.1

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

echo '#define YYENABLE_NLS 1' >> lib/config.h

make
make check

## ------------- ##
## Test results. ##
## ------------- ##

334 tests were successful.
18 tests were skipped.

make install

##################

make DESTDIR=/public/toolchain/bison install

for filename in `find /public/toolchain/bison/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done

###########################



# gettext-0.19-2
patches from Suse


tar xf gettext-0.19.2.tar.xz
cd gettext-0.19.2


./configure  \
--prefix=/usr     \
--disable-csharp  \
--enable-shared   \
--enable-static   \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make check

Testsuite summary for gettext-tools 0.19.2
============================================================================
# TOTAL: 391
# PASS:  358
# SKIP:  33
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0


make install


########################
make DESTDIR=/public/lib/gettext install

# strip files/binarys
for filename in `find /public/lib/gettext/usr/{bin/*,lib/{*.so*,gettext/*}} -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
#############################




# autoconf 2.69
patches from Suse
autoconf-2.69-10.1.2.src.rpm

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check
# dauert etwas lange

449 tests behaved as expected.
54 tests were skipped.

make install


##################

make DESTDIR=/public/toolchain/autoconf install

for filename in `find /public/toolchain/autoconf/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done

###########################




# automake 1.13.4
patche sfrom Suse

# korrekt /etc/localtime
/usr/sbin/zic -l CET

# lokalzone setzen
TZ='Europe/Berlin'; export TZ


sh bootstrap.sh

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check
# dauert etwas lange ca. 2 Std.

============================================================================
Testsuite summary for GNU Automake 1.13.4
============================================================================
# TOTAL: 2732
# PASS:  2481
# SKIP:  211
# XFAIL: 40
# FAIL:  0
# XPASS: 0
# ERROR: 0


make install

##################

make DESTDIR=/public/toolchain/automake install

for filename in `find /public/toolchain/autoconf/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done

###########################



# libtool 2.4.2 -> require automake
patches from Suse

create link to aclocal-1.11
create link to autoconf-1.11

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu


make
make check
# dauert etwas

====================
All 106 tests passed
====================
101 tests behaved as expected.
25 tests were skipped.

make install

###########################

make DESTDIR=/public/lib/ltdl install

###########################



# flex-2.5.37 > require autoconf
patches from Suse
flex-2.5.37-7.1.2.src.rpm

tar xf flex-2.5.37.tar.xz
cd flex-2.5.37

autoreconf -fiv

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

Tests succeeded: 46
Tests FAILED: 0

make install


cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF

chmod -v 0755 /usr/bin/lex

cd /usr/bin

ln -sf flex flex++

ln -sv libfl.a /usr/lib/libl.a

ln -sv libfl.a /usr/lib/libfl_pic.a

###################
make DESTDIR=/public/toolchain/flex install

cd /public/toolchain/flex/


cat > usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF
chmod -v 0755 usr/bin/lex

cd usr/bin

ln -sf flex flex++

cd ../lib

ln -sfv libfl.a libl.a
ln -sfv libfl.a libfl_pic.a

for filename in `find /public/toolchain/flex/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
#####################



# bzip2-1.0.6
patches from Suse with rpm -> require autoconf

rm -rf bzip2-1.0.6
root:/source# tar xf bzip2-1.0.6.tar.xz
root:/source# cd bzip2-1.0.6

autoreconf -fiv


./configure               \
--prefix=/usr             \
--with-pic           \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

make install

#################

make DESTDIR=/public/utils/bzip2 install

##################



# make-3.82
patches from Suse
make-3.82-160.2.1.src.rpm

./configure               \
--prefix=/usr             \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make check as root :-(
su - root

make check

434 Tests in 106 Categories Complete ... No Failures :-)

make install

################################
make DESTDIR=/public/toolchain/make install

for filename in `find /public/toolchain/make/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
##############################



# patch-2.7.1

tar xf patch-2.7.1.tar.bz2
cd patch-2.7.1

./configure \
--prefix=/usr \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make

make check

=====================================================
All 33 tests behaved as expected (1 expected failure)
(1 test was not run)
=====================================================
XFAIL: dash-o-append


make install

#################################
make DESTDIR=/public/toolchain/patch install

for filename in `find /public/toolchain/patch/usr/bin/* -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
##############################



# ncurses-5.9-20150214
# ftp://invisible-island.net/ncurses/current/ncurses-5.9-20150214.tgz

patch -Np1 -i ../02-debian-backspace.diff

./configure \
--prefix=/usr \
--with-shared  \
--without-debug  \
--enable-widec   \
--enable-termcap \
--enable-pc-files   \
--includedir=/usr/include/ncursesw \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu




** Configuration summary for NCURSES 5.9 20150214:

       extended funcs: yes
       xterm terminfo: xterm-new

        bin directory: /usr/bin
        lib directory: /usr/lib
    include directory: /usr/include
        man directory: /usr/share/man
   terminfo directory: /usr/share/terminfo
 pkg-config directory: /usr/lib/pkgconfig


make
make install

mv -v /usr/lib/libncursesw.so.5* /lib

ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so

for lib in ncurses form panel menu
do
    rm -vf /usr/lib/lib${lib}.so
    echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so
    ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a
    ln -sfv ${lib}w.pc   /usr/lib/pkgconfig/${lib}.pc
done

ln -sfv libncurses++w.a /usr/lib/libncurses++.a


rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so
ln -sfv libncursesw.a /usr/lib/libcursesw.a
ln -sfv libncurses.a /usr/lib/libcurses.a


##################
make DESTDIR=/public/utils/ncurses install

cd /public/utils/ncurses

mkdir lib

mv -v usr/lib/libncursesw.so.5* lib

ln -sfv ../../lib/libncursesw.so.5 usr/lib/libncursesw.so

for lib in ncurses form panel menu
do
    rm -vf usr/lib/lib${lib}.so
    echo "INPUT(-l${lib}w)" >usr/lib/lib${lib}.so
    ln -sfv lib${lib}w.a usr/lib/lib${lib}.a
    ln -sfv ${lib}w.pc   usr/lib/pkgconfig/${lib}.pc
done

cd  usr/lib

ln -sfv libncurses++w.a libncurses++.a

rm -vf libcursesw.so


echo "INPUT(-lncursesw)" >libcursesw.so
ln -sfv libncurses.so libcurses.so
ln -sfv libncursesw.a libcursesw.a
ln -sfv libncurses.a libcurses.a

ln -sfv libncursesw.so libtinfo.so


# linken der include
cd usr/include


# with --includedir=/usr/include/ncursesw
# mkdir ncursesw
# mv *.h ncursesw/l

for i in ncursesw/* ; do ln -sf $i ; done


##################

fuer die alte ncurses lib

make distclean

./configure \
--prefix=/usr    \
--with-shared    \
--without-normal \
--without-debug  \
--without-cxx-binding \
--enable-termcap            \
--without-xterm-new         \
--build=i486-pc-linux-gnu   \
--host=i486-pc-linux-gnu


** Configuration summary for NCURSES 5.9 20150214:

       extended funcs: yes
       xterm terminfo: xterm-old

        bin directory: /usr/bin
        lib directory: /usr/lib
    include directory: /usr/include
        man directory: /usr/share/man
   terminfo directory: /usr/share/terminfo


make sources libs

cp -av lib/lib*.so.5* /usr/lib

#################
cp -av lib/lib*.so.5* /public/utils/ncurses/usr/lib
#################

#################
for filename in `find /public/utils/ncurses/{lib/*,usr/{bin/*,lib/*.so.*}} -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
#################



# texinfo-4.13 -> require ncurses -> help2man -> Locale::gettext
patches from Suse

tar xf texinfo-4.13.tar.xz
cd texinfo-4.13

./configure \
--prefix=/usr \
--build=i486-pc-linux-gnu \
--host=i486-pc-linux-gnu

make
make install
make TEXMF=/usr/share/texmf install-tex


##############################
make DESTDIR=/public/toolchain/texinfo install
make TEXMF=/public/toolchain/texinfo/usr/share/texmf install-tex

for filename in `find /public/toolchain/texinfo/usr/{bin/*,sbin/*} -type f`
do
    echo $filename
    strip -R .note -R .comment "$filename"
done
##############################




# grep
# readline
# bash

# gdbm
# db
# perl

# gwak
# indent
# gzip

# tar