refactor
- extract patch to version file - added silent to bootstrap configure functions & glibc patch section - renamed build.sh to build.bash - moved flags, utilities and version to their own files - extract glibc patch url to version file
This commit is contained in:
681
build.sh
681
build.sh
@@ -1,681 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
umask 022
|
||||
|
||||
export LC_ALL="POSIX"
|
||||
|
||||
export TARGET="x86_64-axe-linux-gnu"
|
||||
|
||||
export MAKEFLAGS="-j$(nproc)"
|
||||
|
||||
export SYSROOT="$PWD/sysroot"
|
||||
|
||||
export PROJDIR="$PWD"
|
||||
|
||||
export SOURCES="$SYSROOT/sources"
|
||||
|
||||
export CROSS="$SYSROOT/cross"
|
||||
|
||||
export PATH="$CROSS/bin:/usr/bin:/usr/sbin"
|
||||
|
||||
export CONFIG_SITE="$SYSROOT/usr/share/config.site"
|
||||
|
||||
BINUTILS_VERSION=2.45.1
|
||||
BINUTILS_URL=https://mirror.ufs.ac.za/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz
|
||||
|
||||
GCC_VERSION=15.2.0
|
||||
GCC_URL=https://mirror.ufs.ac.za/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
|
||||
|
||||
GMP_VERSION=6.3.0
|
||||
GMP_URL=https://mirror.ufs.ac.za/gnu/gmp/gmp-$GMP_VERSION.tar.xz
|
||||
|
||||
MPC_VERSION=1.3.1
|
||||
MPC_URL=https://mirror.ufs.ac.za/gnu/mpc/mpc-$MPC_VERSION.tar.gz
|
||||
|
||||
MPFR_VERSION=4.2.2
|
||||
MPFR_URL=https://mirror.ufs.ac.za/gnu/mpfr/mpfr-$MPFR_VERSION.tar.xz
|
||||
|
||||
ISL_VERSION=0.27
|
||||
ISL_URL=https://libisl.sourceforge.io/isl-$ISL_VERSION.tar.xz
|
||||
|
||||
GLIBC_VERSION=2.43
|
||||
GLIBC_URL=https://mirror.ufs.ac.za/gnu/glibc/glibc-$GLIBC_VERSION.tar.xz
|
||||
|
||||
LINUX_VERSION=6.18.7
|
||||
IFS='.' read -r LINUX_VERSION_MAJOR LINUX_VERSION_MINOR LINUX_VERSION_PATCH <<< $LINUX_VERSION
|
||||
LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v$LINUX_VERSION_MAJOR.x/linux-$LINUX_VERSION.tar.xz
|
||||
|
||||
M4_VERSION=1.4.20
|
||||
M4_URL=https://mirror.ufs.ac.za/gnu/m4/m4-$M4_VERSION.tar.xz
|
||||
|
||||
NCURSES_VERSION=6.6
|
||||
NCURSES_URL=https://mirror.ufs.ac.za/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz
|
||||
|
||||
BASH_VERSION=5.3
|
||||
BASH_URL=https://mirror.ufs.ac.za/gnu/bash/bash-$BASH_VERSION.tar.gz
|
||||
|
||||
COREUTILS_VERSION=9.9
|
||||
COREUTILS_URL=https://mirror.ufs.ac.za/gnu/coreutils/coreutils-$COREUTILS_VERSION.tar.xz
|
||||
|
||||
DIFFUTILS_VERSION=3.12
|
||||
DIFFUTILS_URL=https://mirror.ufs.ac.za/gnu/diffutils/diffutils-$DIFFUTILS_VERSION.tar.xz
|
||||
|
||||
FILE_VERSION=5.46
|
||||
FILE_URL=https://astron.com/pub/file/file-$FILE_VERSION.tar.gz
|
||||
|
||||
FINDUTILS_VERSION=4.10.0
|
||||
FINDUTILS_URL=https://mirror.ufs.ac.za/gnu/findutils/findutils-$FINDUTILS_VERSION.tar.xz
|
||||
|
||||
GAWK_VERSION=5.3.2
|
||||
GAWK_URL=https://mirror.ufs.ac.za/gnu/gawk/gawk-$GAWK_VERSION.tar.xz
|
||||
|
||||
GREP_VERSION=3.12
|
||||
GREP_URL=https://mirror.ufs.ac.za/gnu/grep/grep-$GREP_VERSION.tar.xz
|
||||
|
||||
GZIP_VERSION=1.14
|
||||
GZIP_URL=https://mirror.ufs.ac.za/gnu/gzip/gzip-$GZIP_VERSION.tar.xz
|
||||
|
||||
MAKE_VERSION=4.4.1
|
||||
MAKE_URL=https://mirror.ufs.ac.za/gnu/make/make-$MAKE_VERSION.tar.gz
|
||||
|
||||
PATCH_VERSION=2.8
|
||||
PATCH_URL=https://mirror.ufs.ac.za/gnu/patch/patch-$PATCH_VERSION.tar.xz
|
||||
|
||||
SED_VERSION=4.9
|
||||
SED_URL=https://mirror.ufs.ac.za/gnu/sed/sed-$SED_VERSION.tar.xz
|
||||
|
||||
TAR_VERSION=1.35
|
||||
TAR_URL=https://mirror.ufs.ac.za/gnu/tar/tar-$TAR_VERSION.tar.xz
|
||||
|
||||
XZ_VERSION=5.8.2
|
||||
XZ_URL=https://github.com//tukaani-project/xz/releases/download/v$XZ_VERSION/xz-$XZ_VERSION.tar.xz
|
||||
|
||||
create_directories() {
|
||||
if [ ! -d "$SYSROOT" ]; then
|
||||
mkdir -p "$SYSROOT"/{etc,cross,sources,usr,dev,proc,sys,run}
|
||||
mkdir -p "$SYSROOT"/usr/{bin,sbin,lib,include}
|
||||
mkdir -p "$SYSROOT"/var/{cache,lib,run}
|
||||
|
||||
for directory in bin sbin lib; do
|
||||
ln -fs usr/$directory "$SYSROOT"/$directory
|
||||
done
|
||||
|
||||
ln -s usr/lib "$SYSROOT"/lib64
|
||||
|
||||
ln -s run "$SYSROOT"/var/run
|
||||
ln -sfv run/lock "$SYSROOT"/var/lock
|
||||
|
||||
install -dv -m 0750 "$SYSROOT"/root
|
||||
install -dv -m 1777 "$SYSROOT"/tmp "$SYSROOT"/var/tmp
|
||||
fi
|
||||
}
|
||||
|
||||
create_files() {
|
||||
if [[ ! -L "$SYSROOT"/etc/mtab ]]; then
|
||||
sudo ln -s proc/self/mounts "$SYSROOT"/etc/mtab
|
||||
|
||||
cat > "$SYSROOT"/etc/hosts <<- "EOF"
|
||||
127.0.0.1 localhost axe
|
||||
::1 localhost
|
||||
EOF
|
||||
|
||||
cat > "$SYSROOT"/etc/passwd <<- "EOF"
|
||||
root:x:0:0:root:/root:/usr/bin/bash
|
||||
uuidd:x:6:6::/dev/null:/usr/bin/nologin
|
||||
messagebus:x:7:7::/run/dbus:/usr/bin/nologin
|
||||
nobody:x:65534:65534::/dev/null:/usr/bin/nologin
|
||||
EOF
|
||||
|
||||
cat > "$SYSROOT"/etc/group <<- "EOF"
|
||||
root:x:0:
|
||||
tty:x:1:
|
||||
audio:x:2:
|
||||
video:x:3:
|
||||
input:x:4:
|
||||
wheel:x:5:
|
||||
uuidd:x:6:
|
||||
messagebus:x:7:
|
||||
users:x:999:
|
||||
nogroup:x:65534:
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
create_sysroot() {
|
||||
create_directories
|
||||
create_files
|
||||
}
|
||||
|
||||
change_owner() {
|
||||
sudo chown -R root:root "$SYSROOT"/{etc,cross,usr,dev,proc,sys,run,var}
|
||||
}
|
||||
|
||||
do_mount() {
|
||||
if ! mountpoint -q "$SYSROOT/dev"; then
|
||||
sudo mount --bind /dev "$SYSROOT"/dev
|
||||
sudo mount -t devpts devpts -o gid=5,mode=0620 "$SYSROOT"/dev/pts
|
||||
sudo mount -t proc proc "$SYSROOT"/proc
|
||||
sudo mount -t sysfs sysfs "$SYSROOT"/sys
|
||||
sudo mount -t tmpfs tmpfs "$SYSROOT"/run
|
||||
if [ -h "$SYSROOT"/dev/shm ]; then
|
||||
sudo install -d -m 1777 "$SYSROOT"$(realpath /dev/shm)
|
||||
else
|
||||
sudo mount -t tmpfs -o nosuid,nodev tmpfs "$SYSROOT"/dev/shm
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
do_unmount() {
|
||||
sudo umount -R "$SYSROOT/"
|
||||
}
|
||||
|
||||
fetch() {
|
||||
wget -N -c --show-progress -q -P "$SOURCES" $1
|
||||
}
|
||||
|
||||
bootstrap_binutils() {
|
||||
fetch $BINUTILS_URL
|
||||
|
||||
cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
../configure \
|
||||
--prefix="$CROSS" \
|
||||
--with-sysroot="$SYSROOT" \
|
||||
--target=$TARGET \
|
||||
--disable-nls \
|
||||
--enable-gprofng=no \
|
||||
--disable-werror \
|
||||
--enable-new-dtags \
|
||||
--enable-default-hash-style=gnu
|
||||
|
||||
make && make install
|
||||
|
||||
cd "$SOURCES"
|
||||
rm -rf binutils-$BINUTILS_VERSION
|
||||
}
|
||||
|
||||
bootstap_gcc() {
|
||||
fetch $GCC_URL
|
||||
fetch $GMP_URL
|
||||
fetch $ISL_URL
|
||||
fetch $MPC_URL
|
||||
fetch $MPFR_URL
|
||||
|
||||
cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION
|
||||
|
||||
tar xf ../gmp-$GMP_VERSION.tar.xz && mv gmp-$GMP_VERSION gmp
|
||||
tar xf ../isl-$ISL_VERSION.tar.xz && mv isl-$ISL_VERSION isl
|
||||
tar xf ../mpc-$MPC_VERSION.tar.gz && mv mpc-$MPC_VERSION mpc
|
||||
tar xf ../mpfr-$MPFR_VERSION.tar.xz && mv mpfr-$MPFR_VERSION mpfr
|
||||
|
||||
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
../configure \
|
||||
--target=$TARGET \
|
||||
--prefix="$CROSS" \
|
||||
--with-glibc-version=$GLIBC_VERSION \
|
||||
--with-sysroot="$SYSROOT" \
|
||||
--with-newlib \
|
||||
--without-headers \
|
||||
--enable-default-pie \
|
||||
--enable-default-ssp \
|
||||
--disable-nls \
|
||||
--disable-shared \
|
||||
--disable-multilib \
|
||||
--disable-threads \
|
||||
--disable-libatomic \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libstdcxx \
|
||||
--enable-languages=c,c++
|
||||
|
||||
make && make install
|
||||
|
||||
cd ..
|
||||
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > "`dirname $($TARGET-gcc -print-libgcc-file-name)`/include/limits.h"
|
||||
|
||||
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION
|
||||
}
|
||||
|
||||
bootstap_linux() {
|
||||
fetch $LINUX_URL
|
||||
|
||||
cd "$SOURCES" && tar xf linux-$LINUX_VERSION.tar.xz && cd linux-$LINUX_VERSION
|
||||
|
||||
make mrproper
|
||||
make headers
|
||||
find usr/include -type f ! -name '*.h' -delete
|
||||
cp -r usr/include "$SYSROOT"/usr
|
||||
|
||||
cd "$SOURCES" && rm -rf linux-$LINUX_VERSION
|
||||
}
|
||||
|
||||
bootstap_glibc() {
|
||||
fetch $GLIBC_URL
|
||||
fetch https://www.linuxfromscratch.org/patches/lfs/development/glibc-fhs-1.patch
|
||||
|
||||
cd "$SOURCES" && tar xf glibc-$GLIBC_VERSION.tar.xz && cd glibc-$GLIBC_VERSION
|
||||
|
||||
ln -sf ld-linux-x86-64.so.2 "$SYSROOT"/lib/ld-lsb-x86-64.so.3
|
||||
|
||||
patch -Np1 -i "$SOURCES"/glibc-fhs-1.patch
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
echo "rootsbindir=/usr/sbin" > configparms
|
||||
|
||||
../configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(../scripts/config.guess) \
|
||||
--disable-nscd \
|
||||
--disable-nls \
|
||||
libc_cv_slibdir=/usr/lib \
|
||||
--enable-kernel=$LINUX_VERSION
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
sed '/RTLDLIST=/s@/usr@@g' -i "$SYSROOT"/usr/bin/ldd
|
||||
|
||||
cd "$SOURCES" && rm -rf gcc-$GLIBC_VERSION
|
||||
}
|
||||
|
||||
bootstap_libstdcpp() {
|
||||
cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
../libstdc++-v3/configure \
|
||||
--host=$TARGET \
|
||||
--build=$(../config.guess) \
|
||||
--prefix=/usr \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libstdcxx-pch \
|
||||
--with-gxx-include-dir=/cross/$TARGET/include/c++/$GCC_VERSION
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
rm -rf "$SYSROOT"/usr/lib/lib{stdc++{,exp,fs},supc++}.la
|
||||
|
||||
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION
|
||||
}
|
||||
|
||||
toolchain_m4() {
|
||||
fetch $M4_URL
|
||||
|
||||
cd "$SOURCES" && tar xf m4-$M4_VERSION.tar.xz && cd m4-$M4_VERSION
|
||||
|
||||
sed -r '/_GL_EXTERN_C/s/w?memchr|bsearch/(&)/' -i $(find -name \*.in.h)
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf m4-$M4_VERSION
|
||||
}
|
||||
|
||||
toolchain_ncurses() {
|
||||
fetch $NCURSES_URL
|
||||
|
||||
cd "$SOURCES" && tar xf ncurses-$NCURSES_VERSION.tar.gz && cd ncurses-$NCURSES_VERSION
|
||||
|
||||
mkdir -p build
|
||||
|
||||
pushd build
|
||||
../configure \
|
||||
--prefix="$CROSS" \
|
||||
AWK=gawk
|
||||
make -C include
|
||||
make -C progs tic
|
||||
install progs/tic "$CROSS/bin"
|
||||
popd
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(./config.guess) \
|
||||
--mandir=/usr/share/man \
|
||||
--with-manpage-format=normal \
|
||||
--with-shared \
|
||||
--without-normal \
|
||||
--with-cxx-shared \
|
||||
--without-debug \
|
||||
--without-ada \
|
||||
--disable-stripping \
|
||||
AWK=gawk
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
ln -s libncursesw.so "$SYSROOT"/usr/lib/libncurses.so
|
||||
|
||||
sed -e 's/^#if.*XOPEN.*$/#if 1/' -i "$SYSROOT"/usr/include/curses.h
|
||||
|
||||
cd "$SOURCES" && rm -rf ncurses-$NCURSES_VERSION
|
||||
}
|
||||
|
||||
toolchain_bash() {
|
||||
fetch $BASH_URL
|
||||
|
||||
cd "$SOURCES" && tar xf bash-$BASH_VERSION.tar.gz && cd bash-$BASH_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--build=$(sh support/config.guess) \
|
||||
--host=$TARGET \
|
||||
--without-bash-malloc
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
ln -sv bash "$SYSROOT"/bin/sh
|
||||
|
||||
cd "$SOURCES" && rm -rf bash-$BASH_VERSION
|
||||
}
|
||||
|
||||
toolchain_coreutils() {
|
||||
fetch $COREUTILS_URL
|
||||
|
||||
cd "$SOURCES" && tar xf coreutils-$COREUTILS_VERSION.tar.xz && cd coreutils-$COREUTILS_VERSION
|
||||
|
||||
sed -r '/_GL_EXTERN_C/s/w?memchr|bsearch/(&)/' -i $(find -name \*.in.h)
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess) \
|
||||
--enable-install-program=hostname \
|
||||
--enable-no-install-program=kill,uptime
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
mv "$SYSROOT"/usr/bin/chroot "$SYSROOT"/usr/sbin
|
||||
|
||||
cd "$SOURCES" && rm -rf coreutils-$COREUTILS_VERSION
|
||||
}
|
||||
|
||||
toolchain_diffutils() {
|
||||
fetch $DIFFUTILS_URL
|
||||
|
||||
cd "$SOURCES" && tar xf diffutils-$DIFFUTILS_VERSION.tar.xz && cd diffutils-$DIFFUTILS_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
gl_cv_func_strcasecmp_works=y \
|
||||
--build=$(./build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf diffutils-$DIFFUTILS_VERSION
|
||||
}
|
||||
|
||||
toolchain_file() {
|
||||
fetch $FILE_URL
|
||||
|
||||
cd "$SOURCES" && tar xf file-$FILE_VERSION.tar.gz && cd file-$FILE_VERSION
|
||||
|
||||
mkdir -p build
|
||||
|
||||
pushd build
|
||||
../configure \
|
||||
--disable-bzlib \
|
||||
--disable-libseccomp \
|
||||
--disable-xzlib \
|
||||
--disable-zlib
|
||||
make
|
||||
popd
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host="$TARGET" \
|
||||
--build=$(./config.guess)
|
||||
|
||||
make FILE_COMPILE="$(pwd)/build/src/file" && make DESTDIR="$SYSROOT" install
|
||||
|
||||
rm "$SYSROOT"/usr/lib/libmagic.la
|
||||
|
||||
cd "$SOURCES" && rm -rf file-$FILE_VERSION
|
||||
}
|
||||
|
||||
toolchain_findutils() {
|
||||
fetch $FINDUTILS_URL
|
||||
|
||||
cd "$SOURCES" && tar xf findutils-$FINDUTILS_VERSION.tar.xz && cd findutils-$FINDUTILS_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--localstatedir=/var/lib/locate \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf findutils-$FINDUTILS_VERSION
|
||||
}
|
||||
|
||||
toolchain_gawk() {
|
||||
fetch $GAWK_URL
|
||||
|
||||
cd "$SOURCES" && tar xf gawk-$GAWK_VERSION.tar.xz && cd gawk-$GAWK_VERSION
|
||||
|
||||
sed -i 's/extras//' Makefile.in
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf gawk-$GAWK_VERSION
|
||||
}
|
||||
|
||||
toolchain_grep() {
|
||||
fetch $GREP_URL
|
||||
|
||||
cd "$SOURCES" && tar xf grep-$GREP_VERSION.tar.xz && cd grep-$GREP_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf grep-$GREP_VERSION
|
||||
}
|
||||
|
||||
toolchain_gzip() {
|
||||
fetch $GZIP_URL
|
||||
|
||||
cd "$SOURCES" && tar xf gzip-$GZIP_VERSION.tar.xz && cd gzip-$GZIP_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf gzip-$GZIP_VERSION
|
||||
}
|
||||
|
||||
toolchain_make() {
|
||||
fetch $MAKE_URL
|
||||
|
||||
cd "$SOURCES" && tar xf make-$MAKE_VERSION.tar.gz && cd make-$MAKE_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf make-$MAKE_VERSION
|
||||
}
|
||||
|
||||
toolchain_patch() {
|
||||
fetch $PATCH_URL
|
||||
|
||||
cd "$SOURCES" && tar xf patch-$PATCH_VERSION.tar.xz && cd patch-$PATCH_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf patch-$PATCH_VERSION
|
||||
}
|
||||
|
||||
toolchain_sed() {
|
||||
fetch $SED_URL
|
||||
|
||||
cd "$SOURCES" && tar xf sed-$SED_VERSION.tar.xz && cd sed-$SED_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf sed-$SED_VERSION
|
||||
}
|
||||
|
||||
toolchain_tar() {
|
||||
fetch $TAR_URL
|
||||
|
||||
cd "$SOURCES" && tar xf tar-$TAR_VERSION.tar.xz && cd tar-$TAR_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess)
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
cd "$SOURCES" && rm -rf tar-$TAR_VERSION
|
||||
}
|
||||
|
||||
toolchain_xz() {
|
||||
fetch $XZ_URL
|
||||
|
||||
cd "$SOURCES" && tar xf xz-$XZ_VERSION.tar.xz && cd xz-$XZ_VERSION
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--host=$TARGET \
|
||||
--build=$(build-aux/config.guess) \
|
||||
--disable-static
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
rm "$SYSROOT"/usr/lib/liblzma.la
|
||||
|
||||
cd "$SOURCES" && rm -rf xz-$XZ_VERSION
|
||||
}
|
||||
|
||||
toolchain_binutils() {
|
||||
cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION
|
||||
|
||||
sed '6031s/$add_dir//' -i ltmain.sh
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
../configure \
|
||||
--prefix=/usr \
|
||||
--build=$(../config.guess) \
|
||||
--host=$TARGET \
|
||||
--disable-nls \
|
||||
--enable-shared \
|
||||
--enable-gprofng=no \
|
||||
--disable-werror \
|
||||
--enable-64-bit-bfd \
|
||||
--enable-new-dtags \
|
||||
--enable-default-hash-style=gnu
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
rm "$SYSROOT"/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la}
|
||||
|
||||
cd "$SOURCES" && rm -rf binutils-$BINUTILS_VERSION
|
||||
}
|
||||
|
||||
toolchain_gcc() {
|
||||
cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION
|
||||
|
||||
tar xf ../gmp-$GMP_VERSION.tar.xz && mv gmp-$GMP_VERSION gmp
|
||||
tar xf ../isl-$ISL_VERSION.tar.xz && mv isl-$ISL_VERSION isl
|
||||
tar xf ../mpc-$MPC_VERSION.tar.gz && mv mpc-$MPC_VERSION mpc
|
||||
tar xf ../mpfr-$MPFR_VERSION.tar.xz && mv mpfr-$MPFR_VERSION mpfr
|
||||
|
||||
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
|
||||
|
||||
sed '/thread_header =/s/@.*@/gthr-posix.h/' -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
../configure \
|
||||
--build=$(../config.guess) \
|
||||
--host=$TARGET \
|
||||
--target=$TARGET \
|
||||
--prefix=/usr \
|
||||
--with-build-sysroot="$SYSROOT" \
|
||||
--enable-default-pie \
|
||||
--enable-default-ssp \
|
||||
--disable-nls \
|
||||
--disable-multilib \
|
||||
--disable-libatomic \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libsanitizer \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--enable-languages=c,c++ \
|
||||
LDFLAGS_FOR_TARGET=-L"$PWD/$TARGET/libgcc"
|
||||
|
||||
make && make DESTDIR="$SYSROOT" install
|
||||
|
||||
ln -s gcc "$SYSROOT"/usr/bin/cc
|
||||
|
||||
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION
|
||||
}
|
||||
|
||||
#create_sysroot
|
||||
#bootstrap_binutils
|
||||
#bootstap_gcc
|
||||
#bootstap_linux
|
||||
#bootstap_glibc
|
||||
#bootstap_libstdcpp
|
||||
#toolchain_m4
|
||||
#toolchain_ncurses
|
||||
#toolchain_bash
|
||||
#toolchain_coreutils
|
||||
#toolchain_diffutils
|
||||
#toolchain_file
|
||||
#toolchain_findutils
|
||||
#toolchain_gawk
|
||||
#toolchain_grep
|
||||
#toolchain_gzip
|
||||
#toolchain_make
|
||||
#toolchain_patch
|
||||
#toolchain_sed
|
||||
#toolchain_tar
|
||||
#toolchain_xz
|
||||
#toolchain_binutils
|
||||
#toolchain_gcc
|
||||
#change_owner
|
||||
#do_mount
|
||||
Reference in New Issue
Block a user