чување 9fb711bda1f3f45bc1e4c8e1dc22646719c65b58 родитељ 33a7b62b21422f21b4d960faa4f540aec637887c Аутор: Страхиња Радић <contact@strahinja.org> Датум: Fri, 1 Jul 2022 21:59:05 +0200 Add sbase, ubase; further development Signed-off-by: Страхиња Радић <contact@strahinja.org> Diffstat:
измењених датотека: 93, додавања: 430(+), брисања: 224(-)
diff --git a/01-cross.sh b/01-cross.sh @@ -5,226 +5,363 @@ WD=${PWD} -trap exit_cleanup HUP PIPE INT QUIT TERM EXIT - -mkfifo ${G_FIFO} +totalsteps=4 +step=1 msg info "${white}Galeb %s${green} bootstrap" "${G_VER}" -msg info "${white}[1/3]: cross-tools" +msg info "${white}[%d/%d]: cross-tools" ${step} ${totalsteps} + check_dir ${CT} check_dir ${G_PAT} check_dir ${G_PKG} check_dir ${G_SRC} -fetch_pkg https://musl.cc/x86_64-linux-musl-cross.tgz -if [ -d ${CT}/bin ]; then - msg info "Directory %s exists" "${CT}"/bin -else - extract_pkg ${CT} "" x86_64-linux-musl-cross.tgz - mv_or_fail "x86_64-linux-musl-cross/*" . -fi +msg info "Setup root structure" +check_dir ${GR}/bin +link_if_ne ../bin ${GR}/sbin +check_dir ${GR}/include +check_dir ${GR}/share +check_dir ${GR}/sucks/bin +check_dir ${GR}/sucks/lib -msg info "${white}[1/3]: Done cross-tools" +cd_or_fail ${G_SRC} -msg info "${white}[2/3]: tools" +begin_pkg musl-cross-make +msg info "Setting up musl-cross-make" +if [ -x ${CT}/bin/${G_TARGET}-gcc ]; then + msg info "%s exists" "${G_TARGET}-gcc" +else + git_clone ${pkg} https://github.com/richfelker/${pkg} + ( + cd_or_fail ${pkg} + cat <<! > config.mak +TARGET = ${G_TARGET} +OUTPUT = ${CT} +COMMON_CONFIG += CFLAGS="-g0 -Os" +! + run_make + run_make install + ) +fi +end_pkg msg info "Setting environment" OLDPATH=${PATH} PATH=${CT}/bin:${OLDPATH} -CC=${CT_TRI}-gcc -CXX=${CT_TRI}-g++ -AR=${CT_TRI}-ar -AS=${CT_TRI}-as -RANLIB=${CT_TRI}-ranlib -LD=${CT_TRI}-ld -STRIP=${CT_TRI}-strip - +CC=${G_TARGET}-gcc +CXX=${G_TARGET}-g++ +AR=${G_TARGET}-ar +AS=${G_TARGET}-as +RANLIB=${G_TARGET}-ranlib +LD=${G_TARGET}-ld +STRIP=${G_TARGET}-strip export PATH CC CXX AR AS RANLIB LD STRIP -pkg=binutils-2.38 +begin_pkg binutils-2.38 if [ -x ${TL}/bin/ar ]; then msg info "%s exists, skipping %s" "${TL}/bin/ar" ${pkg} else -fetch_pkg https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz -extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz -{ - cd_or_fail ${G_SRC}/${pkg} - remove_dir build - check_dir build - cd_or_fail build - export CFLAGS='-static --static -fcommon' - export LDFLAGS='-static --static -Bstatic -fcommon' - run_configure .. \ - --prefix=${TL} \ - --with-lib-path=${TL}/lib \ - --build=${CT_TRI} \ - --host=${G_TARGET} \ - --target=${G_TARGET} \ - --disable-nls \ - --disable-werror \ - --with-static-standard-libraries \ - --with-sysroot - run_make - run_make install-strip - unset CFLAGS LDFLAGS -} -remove_dir ${G_SRC}/${pkg} + fetch_pkg https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz + ( + cd_or_fail ${G_SRC}/${pkg} + remove_dir build + check_dir build + cd_or_fail build + CFLAGS='-static --static -fcommon' + LDFLAGS='-static --static -Bstatic -fcommon' + export CFLAGS LDFLAGS + run_configure .. \ + --prefix=${TL} \ + --with-lib-path=${TL}/lib \ + --build=${G_TARGET} \ + --host=${G_TARGET} \ + --target=${G_TARGET} \ + --disable-nls \ + --disable-werror \ + --with-static-standard-libraries \ + --with-sysroot + run_make + run_make install-strip + unset CFLAGS LDFLAGS + ) + remove_dir ${G_SRC}/${pkg} fi +end_pkg -pkg=gcc-12.1.0 -if [ -x ${TL}/bin/gcc ]; then - msg info "%s exists, skipping %s" "${TL}/bin/gcc" ${pkg} +# ##pkg=gcc-12.1.0 +# pkg=gcc-11-20220101 +# if [ -x ${TL}/bin/gcc ]; then +# msg info "%s exists, skipping %s" "${TL}/bin/gcc" ${pkg} +# else +# #fetch_pkg https://ftp.gnu.org/gnu/gcc/${pkg}/${pkg}.tar.xz +# fetch_pkg https://gcc.gnu.org/pub/gcc/snapshots/11-20220101/gcc-11-20220101.tar.xz +# extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz +# ( +# cd_or_fail ${G_SRC}/${pkg} +# +# subpkg=gmp-6.2.1 +# if [ -d gmp ]; then +# msg info "Subpackage %s exists" "${subpkg}" +# else +# fetch_pkg https://ftp.gnu.org/gnu/gmp/${subpkg}.tar.xz +# extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz +# mv_or_fail ${subpkg} gmp +# fi +# +# subpkg=mpc-1.2.1 +# if [ -d mpc ]; then +# msg info "Subpackage %s exists" "${subpkg}" +# else +# fetch_pkg https://ftp.gnu.org/gnu/mpc/${subpkg}.tar.gz +# extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.gz +# mv_or_fail ${subpkg} mpc +# fi +# +# subpkg=mpfr-4.1.0 +# if [ -d mpfr ]; then +# msg info "Subpackage %s exists" "${subpkg}" +# else +# fetch_pkg https://ftp.gnu.org/gnu/mpfr/${subpkg}.tar.xz +# extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz +# mv_or_fail ${subpkg} mpfr +# fi +# +# msg info "Applying patches" +# for n in 1 3 4 6 7 9 10 11 12 13 14 17 18 19 20 23 24 25 27 28 29 \ +# 32 35 36 37 41 42 43 +# do +# apply_patch -Np1 -i ${WD}/pat/gcc-alpine/$(printf "%04d" \ +# $n)-*.patch +# done +# +# apply_patch -Np1 -i ${WD}/pat/gcc-mlfs/fix_fenv_header.patch +# +# msg info "Generating include-fixed/limits.h" +# if ! cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ +# $(realpath $(dirname $(${CT_TRI}-gcc \ +# -print-libgcc-file-name)))/include-fixed/limits.h +# then +# msg err "Generating include-fixed/limits.h failed" +# exit 1 +# fi +# +# msg info "Modifying linux*.h" +# for f in gcc/config/linux.h \ +# gcc/config/i386/linux.h \ +# gcc/config/i386/linux64.h +# do +# cp -u $f $f.orig +# sed -e 's,/lib\(64\)\?\(32\)\?/ld,/'${TLD}'&,g' \ +# -e 's,/usr,/'${TLD}',g' $f.orig > $f +# cat <<'!' >>$f +# #undef STANDARD_STARTFILE_PREFIX_1 +# #undef STANDARD_STARTFILE_PREFIX_2 +# ! +# printf "#define STANDARD_STARTFILE_PREFIX_1 \"/"${TLD}\ +# "/lib/\"\n" >>$f +# cat <<'!' >>$f +# #define STANDARD_STARTFILE_PREFIX_2 "" +# ! +# touch $f.orig +# done +# +# skip_conf=0 +# if [ ${skip_conf} != 1 ]; then +# remove_dir build +# fi +# check_dir build +# cd_or_fail build +# +# CFLAGS='-g0 -O0' +# CXXFLAGS=${CFLAGS} +# export CFLAGS CXXFLAGS +# +# if [ ! -e ${CT}/bin/${G_TARGET}-gcc ]; then +# ln -s ${CT_TRI}-gcc ${CT}/bin/${G_TARGET}-gcc +# fi +# for tool in cc cpp gcc g++; do +# if [ ! -e ${CT}/bin/${G_TARGET}-${tool} ]; then +# ln -s ${CT_TRI}-${tool} ${CT}/bin/${G_TARGET}-${tool} +# fi +# done +# +# if [ ${skip_conf} != 1 ]; then +# run_configure .. \ +# --target=${G_TARGET} \ +# --build=${CT_TRI} \ +# --host=${G_TARGET} \ +# --prefix=${TL} \ +# --with-local-prefix=${TL} \ +# --with-native-system-header-dir=/${TLD}/include \ +# --enable-languages=c,c++ \ +# --disable-libstdcxx-pch \ +# --disable-multilib \ +# --disable-bootstrap \ +# --disable-libgomp \ +# --disable-libquadmath \ +# --disable-libssp \ +# --disable-libvtv \ +# --disable-symvers \ +# --disable-libitm \ +# --disable-libsanitizer +# fi +# +# PATH=${CT}/bin:/bin:/usr/bin:${TL}/bin +# export PATH +# +# run_make +# run_make install +# +# unset CFLAGS CXXFLAGS +# } +# exit 0 +# remove_dir ${G_SRC}/${pkg} +# fi +# + +begin_pkg mksh +if [ -x ${GR}/bin/mksh ]; then + msg info "%s exists, skipping %s" ${GR}/bin/mksh ${pkg} else -fetch_pkg https://ftp.gnu.org/gnu/gcc/${pkg}/${pkg}.tar.xz -extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz -{ - cd_or_fail ${G_SRC}/${pkg} - - subpkg=gmp-6.2.1 - if [ -d gmp ]; then - msg info "Subpackage %s exists" "${subpkg}" - else - fetch_pkg https://ftp.gnu.org/gnu/gmp/${subpkg}.tar.xz - extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz - mv_or_fail ${subpkg} gmp - fi - - subpkg=mpc-1.2.1 - if [ -d mpc ]; then - msg info "Subpackage %s exists" "${subpkg}" - else - fetch_pkg https://ftp.gnu.org/gnu/mpc/${subpkg}.tar.gz - extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.gz - mv_or_fail ${subpkg} mpc - fi - - subpkg=mpfr-4.1.0 - if [ -d mpfr ]; then - msg info "Subpackage %s exists" "${subpkg}" - else - fetch_pkg https://ftp.gnu.org/gnu/mpfr/${subpkg}.tar.xz - extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz - mv_or_fail ${subpkg} mpfr - fi - - msg info "Applying patches" - for n in 1 3 4 6 7 9 10 11 12 13 14 17 18 19 20 23 24 25 27 28 29 \ - 32 35 36 37 41 42 43 - do - apply_patch -Np1 -i ${WD}/pat/gcc-alpine/$(printf "%04d" \ - $n)-*.patch - done - - apply_patch -Np1 -i ${WD}/pat/gcc-mlfs/fix_fenv_header.patch - - msg info "Generating include-fixed/limits.h" - if ! cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ - $(realpath $(dirname $(${CT_TRI}-gcc \ - -print-libgcc-file-name)))/include-fixed/limits.h - then - msg err "Generating include-fixed/limits.h failed" - exit 1 - fi - - msg info "Modifying linux*.h" - for f in gcc/config/linux.h \ - gcc/config/i386/linux.h \ - gcc/config/i386/linux64.h - do - cp -u $f $f.orig - sed -e 's,/lib\(64\)\?\(32\)\?/ld,/'${TLD}'&,g' \ - -e 's,/usr,/'${TLD}',g' $f.orig > $f - cat <<'!' >>$f -#undef STANDARD_STARTFILE_PREFIX_1 -#undef STANDARD_STARTFILE_PREFIX_2 -! - printf "#define STANDARD_STARTFILE_PREFIX_1 \"/"${TLD}\ -"/lib/\"\n" >>$f - cat <<'!' >>$f -#define STANDARD_STARTFILE_PREFIX_2 "" -! - touch $f.orig - done - - skip_conf=0 - if [ ${skip_conf} != 1 ]; then - remove_dir build - check_dir build - cd_or_fail build - fi - - CFLAGS='-g0 -O0' - CXXFLAGS=${CFLAGS} - export CFLAGS CXXFLAGS - - if [ ${skip_conf} != 1 ]; then - run_configure .. \ - --target=${G_TARGET} \ - --build=${CT_TRI} \ - --host=${G_TARGET} \ - --prefix=${TL} \ - --with-local-prefix=${TL} \ - --with-native-system-header-dir=/${TLD}/include \ - --enable-languages=c,c++ \ - --disable-libstdcxx-pch \ - --disable-multilib \ - --disable-bootstrap \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libssp \ - --disable-libvtv \ - --disable-symvers \ - --disable-libitm \ - --disable-libsanitizer - fi - - PATH=${CT}/bin:/bin:/usr/bin:${TL}/bin - export PATH - - run_make - run_make install - - unset CFLAGS CXXFLAGS -} -exit 0 -remove_dir ${G_SRC}/${pkg} + ( + git_clone mksh https://github.com/mirbsd/mksh + cd_or_fail ${G_SRC}/${pkg} + CFLAGS='-static --static -fcommon' + LDSTATIC='-static' + TARGET_OS=Linux + export CFLAGS LDSTATIC TARGET_OS + unset CPPFLAGS + + check_dir build-mksh + cd_or_fail build-mksh + setup_fifo + sh ../Build.sh -r > ${G_FIFO} + rm ${G_FIFO} + + check_dir ${GR}/share/doc/mksh/examples + check_dir ${GR}/share/man/man1 + + install -c -s -m 555 mksh ${GR}/bin/mksh + install -c -m 444 ../dot.mkshrc \ + ${GR}/share/doc/mksh/examples/ + install -c -m 444 ../lksh.1 ../mksh.1 \ + ${GR}/share/man/man1/ + # install -c -s -o root -g root -m 555 mksh ${GR}/bin/mksh + # install -c -o root -g root -m 444 ../dot.mkshrc \ + # ${GR}/share/doc/mksh/examples/ + # install -c -o root -g root -m 444 ../lksh.1 ../mksh.1 \ + # ${GR}/share/man/man1/ + + cd .. + + CPPFLAGS=-DMKSH_BINSHPOSIX + export CPPFLAGS + check_dir build-lksh + cd_or_fail build-lksh + setup_fifo + sh ../Build.sh -r -L > ${G_FIFO} + rm ${G_FIFO} + + install -c -s -m 555 lksh ${GR}/bin/lksh + link_if_ne lksh ${GR}/bin/sh + + unset CFLAGS LDSTATIC TARGET_OS + ) || exit 1 +fi +end_pkg + +begin_pkg sbase +if [ -x ${GR}/bin/ls ]; then + msg info "%s exists, skipping %s" ${GR}/bin/ls ${pkg} +else + ( + git_clone ${pkg} git://git.suckless.org/sbase + cd_or_fail ${G_SRC}/${pkg} + sed -i -e 's,/usr/local,'${GR}',g;s, \<cc\>,' ${CC}',g' \ + -e 's, \<ar\>,' ${AR}',g' \ + -e 's,CFLAGS\s\+= ,&-static -fcommon ,g' \ + -e 's,LDFLAGS\s\+= ,&-static -fcommon ,g' config.mk + run_make + run_make install + #remove_dir ${G_SRC}/${pkg} + ) || exit 1 fi +end_pkg + +begin_pkg ubase +if [ -x ${GR}/bin/id ]; then + msg info "%s exists, skipping %s" ${GR}/bin/id ${pkg} +else + ( + git_clone ${pkg} git://git.suckless.org/ubase + cd_or_fail ${G_SRC}/${pkg} + sed -i -z 's,<sys/types.h>\n,&#include <sys/sysmacros.h>\n,' \ + mknod.c + sed -i -z 's,"arg.h"\n,&#include <sys/sysmacros.h>\n,' \ + util.h + sed -i -e 's,/usr/local,'${GR}',g' \ + -e 's, \<cc\>, '${CC}',g' \ + -e 's, \<ar\>, '${AR}',g' \ + -e 's,CFLAGS\s\+= ,&-static -fcommon ,g' \ + -e 's,LDFLAGS\s\+= ,&-static -fcommon ,g' \ + -e 's,LDLIBS\s\+= ,&-lc ,g' \ + config.mk + run_make + run_make install + #remove_dir ${G_SRC}/${pkg} + ) || exit 1 +fi +end_pkg + +# msg info "${white}[%d/%d]: tinycc" ${step} ${totalsteps} +# git_clone tinycc git://repo.or.cz/tinycc.git +# pkg=tinycc +# if [ -x ${GR}/bin/tcc ]; then +# msg info "%s exists, skipping %s" ${GR}/bin/tcc ${pkg} +# else +# ( +# cd_or_fail ${G_SRC}/${pkg} +# CFLAGS='-static --static -fcommon' +# LDFLAGS='-static --static -fcommon' +# export CFLAGS LDFLAGS +# run_configure . \ +# --prefix=/ \ +# --config-musl \ +# --sysincludepaths=/include \ +# --crtprefix=/lib \ +# --libpaths=/sucks/lib:/lib +# run_make +# run_make install +# unset CFLAGS LDFLAGS +# ) || exit 1 +# fi +# +# msg info "${white}[%d/%d]: Done tinycc" ${step} ${totalsteps} +# step=$((step+1)) msg info "Cleaning up environment" export PATH=${OLDPATH} unset OLDPATH CC CXX AR AS RANLIB STRIP unset WD -exit 0 - -git_clone tinycc git://repo.or.cz/tinycc.git -pkg=tinycc -{ - cd_or_fail ${G_SRC}/${pkg} - run_configure . --prefix=${CT} - run_make - run_make install -} -exit 0 - -skip=1 -if [ ${skip} != 1 ]; then -fetch_pkg https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.17.13.tar.xz -pkg=linux-5.17.13 -extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz -{ - cd_or_fail ${G_SRC}/${pkg} - run_make ARCH=${G_ARCH} ${JN} headers - check_dir ${CT}/${G_TARGET}/include - cp_or_fail -r "usr/include/*" ${CT}/${G_TARGET}/include/ - msg info "Removing *.cmd" - find ${CT}/${G_TARGET}/include -name '.*.cmd' -exec rm -f {} \; - rm ${CT}/${G_TARGET}/include/Makefile - remove_dir ${G_SRC}/${pkg} -} -fi - -skip=0 -git_clone sbase +msf info "Next: chroot %s /bin/mksh" ${GR} -msg info "${white}[2/3]: Done tools" +# exit 0 +# +# skip=1 +# if [ ${skip} != 1 ]; then +# fetch_pkg https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.17.13.tar.xz +# pkg=linux-5.17.13 +# extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz +# { +# cd_or_fail ${G_SRC}/${pkg} +# run_make ARCH=${G_ARCH} ${JN} headers +# check_dir ${CT}/${G_TARGET}/include +# cp_or_fail -r "usr/include/*" ${CT}/${G_TARGET}/include/ +# msg info "Removing *.cmd" +# find ${CT}/${G_TARGET}/include -name '.*.cmd' -exec rm -f {} \; +# rm ${CT}/${G_TARGET}/include/Makefile +# remove_dir ${G_SRC}/${pkg} +# } +# fi diff --git a/TODO b/TODO @@ -0,0 +1,17 @@ +TODO +==== + +[ ] configure: WARNING: using cross tools not prefixed with host triplet + +[ ] checking for isl 0.15 or later... no + required isl version is 0.15 or later + *** This configuration is not supported in the following subdirectories: + target-libquadmath gnattools gotools target-libada target-libhsail-rt + target-libphobos tar + get-zlib target-libbacktrace target-libgfortran target-libgo target-libffi + target-libobjc targe + t-libgomp target-liboffloadmic target-libitm target-libsanitizer target-libvtv + target-libssp + (Any other directories should still work fine.) + + diff --git a/lib/env.sh b/lib/env.sh @@ -1,13 +1,12 @@ #!/bin/sh -CT=${HOME}/galeb-cross-tools CT_TRI=x86_64-linux-musl GSD=galeb-source GRD=galeb-root -TLD=galeb-tools GS=${HOME}/${GSD} GR=${HOME}/${GRD} -TL=${HOME}/${TLD} +TL=${GR}/tools +CT=${GR}/cross-tools G_ARCH=x86 #G_HOST=$(gcc -dumpmachine) G_FIFO=${GS}/fifo @@ -19,5 +18,5 @@ G_TARGET=x86_64-galeb-linux-musl G_VER=2.0 JN=-j$(($(nproc) * 3)) -export CT CT_TRI GS GR TL G_ARCH G_FIFO G_LOG G_PAT G_PKG G_SRC G_TARGET -export G_VER JN GSD GRD TLD +export CT_TRI GSD GRD GS GR TL CT +export G_ARCH G_FIFO G_LOG G_PAT G_PKG G_SRC G_TARGET G_VER JN diff --git a/lib/fun.sh b/lib/fun.sh @@ -19,13 +19,22 @@ apply_patch() msg info "Patch %s applied" ${pat} return fi + msg info "Patch %s" "$*" - if patch $* 2>&1 | tee -a ${G_LOG}; then + setup_fifo + if patch $* 2>&1 >${G_FIFO}; then : > ${G_PAT}/${pat##*/}.applied else - msg err "Patch %s failed" "$@" + msg err "Patch %s failed" "$*" exit 1 fi + rm ${G_FIFO} +} + +begin_pkg() +{ + pkg=$1 + msg info "${white}[%d/%d]: %s" ${step} ${totalsteps} ${pkg} } cd_or_fail() @@ -52,27 +61,23 @@ check_dir() cp_or_fail() { msg info "cp %s" "$@" - cp $@ || { msg err "Cannot cp"; exit 1; } + if ! cp $*; then + msg err "Cannot cp %s" "$*" + exit 1 + fi } -git_clone() +end_pkg() { - local dir=$1 - shift - - if [ -d "${dir}" ]; then - msg info "Directory %s exists" "${dir}" - return - fi - msg info "git clone %s" "$@" - git clone $@ 2>&1 | tee -a ${G_LOG} + msg info "${white}[%d/%d]: Done %s" ${step} ${totalsteps} ${pkg} + step=$((step+1)) } exit_cleanup() { - rm ${G_FIFO} - unset CT CT_TRI GS GR TL G_ARCH G_FIFO G_LOG G_PAT G_PKG G_SRC G_TARGET - unset G_VER JN GSD GRD TLD + [ -p ${G_FIFO} ] && rm ${G_FIFO} + unset CT_TRI GSD GRD GS GR TL CT + unset G_ARCH G_FIFO G_LOG G_PAT G_PKG G_SRC G_TARGET G_VER JN } extract_pkg() @@ -97,7 +102,10 @@ extract_pkg() *) msg err "Unsupported archive format" exit 1;; esac - ${prog} "${G_PKG}/$1" | pv | tar xf - + if ! ${prog} "${G_PKG}/$1" | pv | tar xf -; then + msg err "Extracting %s failed" "$1" + exit 1 + fi } fetch_pkg() @@ -116,6 +124,38 @@ fetch_pkg() fi } +git_clone() +{ + local dir=$1 + shift + + if [ -d "${dir}" ]; then + msg info "Directory %s exists" "${dir}" + return + fi + msg info "git clone %s" "$*" + setup_fifo + if ! git clone $* 2>&1 > ${G_FIFO}; then + msg err "git clone %s failed" "$*" + exit 1 + fi + rm ${G_FIFO} +} + +link_if_ne() +{ + eval dest=\$$# + if [ -e "${dest}" ]; then + msg info "Symlink %s exists" "${dest}" + return + fi + msg info "Symlinking %s" "${dest}" + if ! ln -s $*; then + msg err "Symlinking %s failed" "${dest}" + exit 1 + fi +} + msg() { local fmt icon icon_plain kind tstamp @@ -146,8 +186,11 @@ msg() mv_or_fail() { - msg info "mv %s" "$@" - mv $@ || { msg err "Cannot mv"; exit 1; } + msg info "mv %s" "$*" + if ! mv $*; then + msg err "Cannot mv" + exit 1 + fi } remove_dir() @@ -163,21 +206,29 @@ run_configure() local location=$1 shift msg info "configure %s" "$*" - if ! ${location}/configure $* 2>&1 | tee -a ${G_LOG}; then + setup_fifo + if ! ${location}/configure $* 2>&1 > ${G_FIFO}; then msg err "configure %s failed" "$*" exit 1 fi + rm ${G_FIFO} } run_make() { msg info "make %s" "$*" - tee -a ${G_LOG} < ${G_FIFO} & - pid=$! - if ! make $* 2>&1; then - kill ${pid} + setup_fifo + if ! make $* 2>&1 > ${G_FIFO}; then msg err "make %s failed" "$*" exit 1 fi - kill ${pid} + rm ${G_FIFO} +} + +setup_fifo() +{ + mkfifo ${G_FIFO} + trap exit_cleanup HUP PIPE INT QUIT TERM EXIT + tee -a ${G_LOG} < ${G_FIFO} & } + diff --git a/pat b/pat @@ -0,0 +1 @@ +pat-12.1.0 +\ No newline at end of file diff --git a/pat/gcc-alpine/0001-posix_memalign.patch b/pat-11.2.1/gcc-alpine/0001-posix_memalign.patch diff --git a/pat/gcc-alpine/0002-gcc-poison-system-directories.patch b/pat-11.2.1/gcc-alpine/0002-gcc-poison-system-directories.patch diff --git a/pat/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch b/pat-11.2.1/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch diff --git a/pat/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch b/pat-11.2.1/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch diff --git a/pat/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch b/pat-11.2.1/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch diff --git a/pat/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch b/pat-11.2.1/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch diff --git a/pat/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch b/pat-11.2.1/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch diff --git a/pat/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat-11.2.1/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch diff --git a/pat/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch b/pat-11.2.1/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch diff --git a/pat/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch b/pat-11.2.1/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch diff --git a/pat/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch b/pat-11.2.1/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch diff --git a/pat/gcc-alpine/0012-libitm-disable-FORTIFY.patch b/pat-11.2.1/gcc-alpine/0012-libitm-disable-FORTIFY.patch diff --git a/pat/gcc-alpine/0013-libgcc_s.patch b/pat-11.2.1/gcc-alpine/0013-libgcc_s.patch diff --git a/pat/gcc-alpine/0014-nopie.patch b/pat-11.2.1/gcc-alpine/0014-nopie.patch diff --git a/pat/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch b/pat-11.2.1/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch diff --git a/pat/gcc-alpine/0016-dlang-update-zlib-binding.patch b/pat-11.2.1/gcc-alpine/0016-dlang-update-zlib-binding.patch diff --git a/pat/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch b/pat-11.2.1/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch diff --git a/pat/gcc-alpine/0018-ada-fix-shared-linking.patch b/pat-11.2.1/gcc-alpine/0018-ada-fix-shared-linking.patch diff --git a/pat/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch b/pat-11.2.1/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch diff --git a/pat/gcc-alpine/0020-add-fortify-headers-paths.patch b/pat-11.2.1/gcc-alpine/0020-add-fortify-headers-paths.patch diff --git a/pat/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch b/pat-11.2.1/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch diff --git a/pat/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch b/pat-11.2.1/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch diff --git a/pat/gcc-alpine/0023-Pure-64-bit-MIPS.patch b/pat-11.2.1/gcc-alpine/0023-Pure-64-bit-MIPS.patch diff --git a/pat/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch b/pat-11.2.1/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch diff --git a/pat/gcc-alpine/0025-always-build-libgcc_eh.a.patch b/pat-11.2.1/gcc-alpine/0025-always-build-libgcc_eh.a.patch diff --git a/pat/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch b/pat-11.2.1/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch diff --git a/pat/gcc-alpine/0027-ada-musl-support-fixes.patch b/pat-11.2.1/gcc-alpine/0027-ada-musl-support-fixes.patch diff --git a/pat/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch b/pat-11.2.1/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch diff --git a/pat/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch b/pat-11.2.1/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch diff --git a/pat/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch b/pat-11.2.1/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch diff --git a/pat/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch b/pat-11.2.1/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch diff --git a/pat/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch b/pat-11.2.1/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch diff --git a/pat/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch b/pat-11.2.1/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch diff --git a/pat/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch b/pat-11.2.1/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch diff --git a/pat/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch b/pat-11.2.1/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch diff --git a/pat/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch b/pat-11.2.1/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch diff --git a/pat/gcc-alpine/0037-gcc-go-link-to-libucontext.patch b/pat-11.2.1/gcc-alpine/0037-gcc-go-link-to-libucontext.patch diff --git a/pat/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch b/pat-11.2.1/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch diff --git a/pat/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat-11.2.1/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch diff --git a/pat/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch b/pat-11.2.1/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch diff --git a/pat/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat-11.2.1/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch diff --git a/pat/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat-11.2.1/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch diff --git a/pat/gcc-alpine/apply_patches_ct.sh b/pat-11.2.1/gcc-alpine/apply_patches_ct.sh diff --git a/pat/gcc-mlfs/fix_fenv_header.patch b/pat-11.2.1/gcc-mlfs/fix_fenv_header.patch diff --git a/pat/gcc-alpine/0001-posix_memalign.patch b/pat-12.1.0/gcc-alpine/0001-posix_memalign.patch diff --git a/pat/gcc-alpine/0002-gcc-poison-system-directories.patch b/pat-12.1.0/gcc-alpine/0002-gcc-poison-system-directories.patch diff --git a/pat/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch b/pat-12.1.0/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch diff --git a/pat/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch b/pat-12.1.0/gcc-alpine/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch diff --git a/pat/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch b/pat-12.1.0/gcc-alpine/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch diff --git a/pat/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch b/pat-12.1.0/gcc-alpine/0006-Enable-Wformat-and-Wformat-security-by-default.patch diff --git a/pat/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch b/pat-12.1.0/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch diff --git a/pat/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat-12.1.0/gcc-alpine/0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch diff --git a/pat/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch b/pat-12.1.0/gcc-alpine/0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch diff --git a/pat/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch b/pat-12.1.0/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch diff --git a/pat/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch b/pat-12.1.0/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch diff --git a/pat/gcc-alpine/0012-libitm-disable-FORTIFY.patch b/pat-12.1.0/gcc-alpine/0012-libitm-disable-FORTIFY.patch diff --git a/pat/gcc-alpine/0013-libgcc_s.patch b/pat-12.1.0/gcc-alpine/0013-libgcc_s.patch diff --git a/pat/gcc-alpine/0014-nopie.patch b/pat-12.1.0/gcc-alpine/0014-nopie.patch diff --git a/pat/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch b/pat-12.1.0/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch diff --git a/pat/gcc-alpine/0016-dlang-update-zlib-binding.patch b/pat-12.1.0/gcc-alpine/0016-dlang-update-zlib-binding.patch diff --git a/pat/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch b/pat-12.1.0/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch diff --git a/pat/gcc-alpine/0018-ada-fix-shared-linking.patch b/pat-12.1.0/gcc-alpine/0018-ada-fix-shared-linking.patch diff --git a/pat/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch b/pat-12.1.0/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch diff --git a/pat/gcc-alpine/0020-add-fortify-headers-paths.patch b/pat-12.1.0/gcc-alpine/0020-add-fortify-headers-paths.patch diff --git a/pat/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch b/pat-12.1.0/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch diff --git a/pat/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch b/pat-12.1.0/gcc-alpine/0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch diff --git a/pat/gcc-alpine/0023-Pure-64-bit-MIPS.patch b/pat-12.1.0/gcc-alpine/0023-Pure-64-bit-MIPS.patch diff --git a/pat/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch b/pat-12.1.0/gcc-alpine/0024-use-pure-64-bit-configuration-where-appropriate.patch diff --git a/pat/gcc-alpine/0025-always-build-libgcc_eh.a.patch b/pat-12.1.0/gcc-alpine/0025-always-build-libgcc_eh.a.patch diff --git a/pat/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch b/pat-12.1.0/gcc-alpine/0026-ada-libgnarl-compatibility-for-musl.patch diff --git a/pat/gcc-alpine/0027-ada-musl-support-fixes.patch b/pat-12.1.0/gcc-alpine/0027-ada-musl-support-fixes.patch diff --git a/pat/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch b/pat-12.1.0/gcc-alpine/0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch diff --git a/pat/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch b/pat-12.1.0/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch diff --git a/pat/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch b/pat-12.1.0/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch diff --git a/pat/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch b/pat-12.1.0/gcc-alpine/0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch diff --git a/pat/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch b/pat-12.1.0/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch diff --git a/pat/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch b/pat-12.1.0/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch diff --git a/pat/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch b/pat-12.1.0/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch diff --git a/pat/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch b/pat-12.1.0/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch diff --git a/pat/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch b/pat-12.1.0/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch diff --git a/pat/gcc-alpine/0037-gcc-go-link-to-libucontext.patch b/pat-12.1.0/gcc-alpine/0037-gcc-go-link-to-libucontext.patch diff --git a/pat/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch b/pat-12.1.0/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch diff --git a/pat/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat-12.1.0/gcc-alpine/0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch diff --git a/pat/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch b/pat-12.1.0/gcc-alpine/0041-Use-generic-errstr.go-implementation-on-musl.patch diff --git a/pat/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch b/pat-12.1.0/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch diff --git a/pat/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/pat-12.1.0/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch diff --git a/pat/gcc-alpine/apply_patches_ct.sh b/pat-12.1.0/gcc-alpine/apply_patches_ct.sh diff --git a/pat/gcc-mlfs/fix_fenv_header.patch b/pat-12.1.0/gcc-mlfs/fix_fenv_header.patch