galeb

Једноставна статичка дистрибуција заснована на musl-у
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување bea71c7a73da8c557075cc64e102bcf185dddb60
родитељ 9baa30f36ff943d14a7a26e34bd0ebd4fe298d1f
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Wed, 13 Jul 2022 08:13:24 +0200

Chroot up to util-linux (parts missing from [su]base); BUGS: New file

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M01-cross.sh | 27+++++++++++++++++++++++++--
M03-chroot.sh | 120++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
ABUGS | 22++++++++++++++++++++++
Afil/util-linux-adelie/ttydefaults.h | 39+++++++++++++++++++++++++++++++++++++++
Mlib/env.sh | 2+-
Mlib/fun.sh | 3++-
Mlib/pkgs.tsv | 2++
Apat-11.2.1/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch | 11+++++++++++
Apat-11.2.1/util-linux-void/fix-musl.patch | 20++++++++++++++++++++
измењених датотека: 9, додавања: 229(+), брисања: 17(-)

diff --git a/01-cross.sh b/01-cross.sh @@ -47,7 +47,9 @@ link_if_ne bin ${GR}/local/sbin check_dir ${GR}/share check_dir ${GR}/sucks/bin check_dir ${GR}/sucks/lib +check_dir ${GR}/sucks/share link_if_ne bin ${GR}/sucks/sbin +link_if_ne ../../share/locale ${GR}/sucks/share/locale :>${GR}/etc/fstab @@ -748,11 +750,32 @@ else fi end_substep -begin_substep byacc-20220128 +# Sucky util-linux explicitly *requires* bison. And we need it for lsblk etc. +# Sigh... + +# begin_substep byacc-20220128 +# if [ -x ${TL}/bin/yacc ]; then +# msg info "%s exists, skipping %s" ${TL}/bin/yacc ${pkg} +# else +# extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz +# ( +# cd_or_fail ${G_SRC}/${pkg} +# run_configure . \ +# --prefix=/${TLD} \ +# --build=${G_HOST} \ +# --host=${G_TARGET} +# run_make ${JN} +# run_make install +# ) || exit 1 +# remove_dir ${G_SRC}/${pkg} +# fi +# end_substep + +begin_substep bison-3.8.2 if [ -x ${TL}/bin/yacc ]; then msg info "%s exists, skipping %s" ${TL}/bin/yacc ${pkg} else - extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} run_configure . \ diff --git a/03-chroot.sh b/03-chroot.sh @@ -507,7 +507,6 @@ if [ -x /plan9/bin/bc ]; then elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then unpack_pkg ${pkg} / else - git_clone ${pkg} git://git.suckless.org/9base ( cd_or_fail ${G_SRC}/${pkg} @@ -850,9 +849,8 @@ if [ -x /sucks/bin/gcc ]; then elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then unpack_pkg ${pkg} / else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( - remove_dir ${G_SRC}/${pkg} - extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz cd_or_fail ${G_SRC}/${pkg} msg info "Applying patches" @@ -876,7 +874,6 @@ mkpk_install() DESTDIR=/build export CFLAGS CXXFLAGS DESTDIR - if false; then SED=/${TLD}/bin/sed libat_cv_have_ifunc=no \\ ./configure \\ --prefix=/sucks \\ @@ -913,8 +910,7 @@ mkpk_install() --enable-plugins \\ --with-system-zlib \\ --with-linker-hash-style=gnu \\ - --with-isl - fi + --with-isl || exit 1 make ${JN} || exit 1 make install-strip @@ -922,9 +918,9 @@ mkpk_install() CFLAGS+='-static --static -fcommon' LDFLAGS='-static --static -fcommon' export CFLAGS LDFLAGS - cc -fpie ../${FLD}/musl/getent.c -o getent - cc -fpie ../${FLD}/musl/getconf.c -o getconf - cc -fpie ../${FLD}/musl/iconv.c -o iconv + cc -fpie \${CFLAGS} ../${FLD}/musl/getent.c -o getent + cc -fpie \${CFLAGS} ../${FLD}/musl/getconf.c -o getconf + cc -fpie \${CFLAGS} ../${FLD}/musl/iconv.c -o iconv install -dm 755 ../build/bin install -m 755 getent ../build/bin/ @@ -978,7 +974,6 @@ if [ -x /bin/tcc ]; then elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then unpack_pkg ${pkg} / else - git_clone ${pkg} git://repo.or.cz/tinycc.git ( cd_or_fail ${G_SRC}/${pkg} cat <<! >MKPK @@ -1019,7 +1014,6 @@ mkpk_install() fi end_substep - begin_substep bzip2-1.0.8 if [ -x /bin/bzip2 ]; then msg info "%s exists, skipping %s" /bin/bzip2 ${pkg} @@ -2967,12 +2961,11 @@ mkpk_name() mkpk_install() { - SLED_CC='tcc -O2 -Wall -static -fcommon' + SLED_CC='tcc -O2 -static -fcommon' FALLBACKVER=${pkg##*-} PREFIX=/build export SLED_CC FALLBACKVER PREFIX ./do -c install - true } ! mkpk ${pkg} @@ -3368,6 +3361,107 @@ mkpk_install() fi end_substep +# ERROR: You must have bison installed to build the util-linux. +# - Riiiight. +begin_substep util-linux-2.38 +if [ -x /sucks/bin/lsblk ]; then + msg info "%s exists, skipping %s" /sucks/bin/lsblk ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz + ( + cd_or_fail ${G_SRC}/${pkg} + + apply_patch final-system -Np0 -i \ + ${G_PAT}/util-linux-void/fix-musl.patch + + apply_patch final-system -Np1 -i \ + ${G_PAT}/util-linux-mlfs/use-tiparm-when-compiling-\ +with-netbsd_curses.patch + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-O3 -march=native -mtune=native -pipe -static --static -fcommon -fPIC' + LDFLAGS='-static --static -fcommon' + DESTDIR=/build + YACC=/${TLD}/bin/yacc + export CFLAGS LDFLAGS DESTDIR YACC + + mkdir -pv /build/var/lib/hwclock + + cp -v ${G_FIL}/util-linux-adelie/ttydefaults.h include/ + + :>config/config.rpath + :>config.h.in + + libtoolize --force || exit 1 + aclocal -I m4 || exit 1 + autoconf -v || exit 1 + automake --add-missing || exit 1 + + CFLAGS+=' -D_DIRENT_HAVE_D_TYPE ' + export CFLAGS + + NOCONFIGURE=1 ./autogen.sh || exit 1 + + ./configure \\ + --prefix=/sucks \\ + ADJTIME_PATH=/var/lib/hwclock/adjtime \\ + --docdir=/sucks/share/doc/util-linux-2.37.4 \\ + --disable-cal \\ + --disable-chfn-chsh \\ + --disable-eject \\ + --disable-fallocate \\ + --disable-hwclock \\ + --disable-kill \\ + --disable-last \\ + --disable-logger \\ + --disable-login \\ + --disable-mesg \\ + --disable-mount \\ + --disable-mountpoint \\ + --disable-nologin \\ + --disable-pivot_root \\ + --disable-setpriv \\ + --disable-su \\ + --disable-swapon \\ + --disable-switch_root \\ + --disable-runuser \\ + --disable-pylibmount \\ + --disable-unshare \\ + --disable-static \\ + --without-python \\ + --without-systemd \\ + --without-systemdsystemunitdir \\ + --sbindir=/sucks/sbin \\ + --bindir=/sucks/bin \\ + --libdir=/sucks/lib || exit 1 + + make ${JN} || exit 1 + make install-strip + + # Overlap with sbase/ubase + for prog in blkdiscard ctrlaltdel dmesg flock fsfreeze look mkswap \\ + renice rev setsid swaplabel swapoff umount + do + find /build -name \${prog} -exec rm {} \\; + done +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + if false; then begin_substep sbase-20220709 if [ -e /bin/ls ] && [ ! -L /bin/ls ]; then diff --git a/BUGS b/BUGS @@ -0,0 +1,22 @@ +Known bugs +========== + +* Some of the programs from GCC package in the binary have been errorneously + compiled as dynamic instead of static and still went to /bin instead of + /sucks/bin. I have corrected the error in the build script, but I'm too lazy + to recompile everything from the start just because of that. If you are + compiling from source, you should have them compiled statically and put in + /bin as intended. + +* utmp is nonfunctional as I have been reluctant to include skalibs. That might + change in a future version of Galeb. + +* Once you finish compiling and installing everything, the build scripts won't + be functional on that system anymore, due to sbase/ubase utilities having only + a subset of options of coreutils etc. From that point on, you have to compile + everything yourself! Consider this an opportunity to learn if you don't know + how, or tune everything to your liking if you do. You can use the build + scripts for hints on configuration, as well as the documentation for a + particular package. + + diff --git a/fil/util-linux-adelie/ttydefaults.h b/fil/util-linux-adelie/ttydefaults.h @@ -0,0 +1,39 @@ +#ifndef _SYS_TTYDEFAULTS_H_ +#define _SYS_TTYDEFAULTS_H_ +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) +#define TTYDEF_SPEED (B9600) +#define CTRL(x) (x&037) +#define CEOF CTRL('d') +#ifdef _POSIX_VDISABLE +# define CEOL _POSIX_VDISABLE +#else +# define CEOL '\0' +#endif +#define CERASE 0177 +#define CINTR CTRL('c') +#ifdef _POSIX_VDISABLE +# define CSTATUS _POSIX_VDISABLE +#else +# define CSTATUS '\0' +#endif +#define CKILL CTRL('u') +#define CMIN 1 +#define CQUIT 034 +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT CTRL('v') +#define CDISCARD CTRL('o') +#define CWERASE CTRL('w') +#define CREPRINT CTRL('r') +#define CEOT CEOF +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD +#endif + diff --git a/lib/env.sh b/lib/env.sh @@ -36,7 +36,7 @@ G_PKG=${G_SRC}/pkg G_SHORTLOG=${G_LOG}/shortlog G_TARGET=x86_64-galeb-linux-musl G_VER=2.0 -JN=-j$(($(grep ^processor /proc/cpuinfo | wc -l) * 3)) +JN=${JN:- -j$(($(grep ^processor /proc/cpuinfo | wc -l) * 3))} export CT_TRI GR_TRI GHOME GUID GGID GR CTD FLD PTD TLD CT TL G_ARCH G_ARCH_EXT export G_ARCH_EXT_ALT G_FIFO G_LGL G_LOG G_FIL G_LIB G_LOGFILE G_PAT G_PKG diff --git a/lib/fun.sh b/lib/fun.sh @@ -185,7 +185,8 @@ extract_pkg() if [ "${touch}" = "touch" ]; then mopt=-m fi - if ! ${prog} "${G_PKG}/${tarball}" | tar -x ${mopt} -f -; then + if ! ${prog} "${G_PKG}/${tarball}" | /${TLD}/bin/tar -x ${mopt} -f - + then msg err "Extracting %s failed" "${tarball}" exit 1 fi diff --git a/lib/pkgs.tsv b/lib/pkgs.tsv @@ -21,6 +21,7 @@ https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz 12cfa1687ffa2606337efe1a6 https://ftp.gnu.org/gnu/automake/automake-1.16.4.tar.xz 86e8e682bd74e6390a016c4d9c11267c https://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz bb91a17fd6c9032c26d0b2b78b50aff5 https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz 6e39cad1bb414add02b5b1169c18fdc5 +https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz c28f119f405a2304ff0a7ccdcc629713 https://ftp.gnu.org/gnu/coreutils/coreutils-9.1.tar.xz 8b1ca4e018a7dce9bb937faec6618671 https://ftp.gnu.org/gnu/diffutils/diffutils-3.8.tar.xz 6a6b0fdc72acfe3f2829aab477876fbc https://ftp.gnu.org/gnu/findutils/findutils-4.9.0.tar.xz 4a4a547e888a944b2f3af31d789a1137 @@ -58,6 +59,7 @@ https://github.com/pullmoll/musl-fts/archive/v1.2.7.tar.gz musl-fts-1.2.7.tar.gz https://github.com/pullmoll/musl-obstack/archive/v1.1.tar.gz musl-obstack-1.1.tar.gz 185975cc117dba8e6158cce847ba44d5 https://github.com/shadow-maint/shadow/releases/download/v4.11.1/shadow-4.11.1.tar.xz 5a95ec069aa91508167d02fecafaa912 https://github.com/strace/strace/releases/download/v5.18/strace-5.18.tar.xz a563875472463638c19d6639e1c14875 +https://github.com/util-linux/util-linux/archive/refs/tags/v2.38.tar.gz util-linux-2.38.tar.gz d6f945e504db53c9cdea43a38c226d94 https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.6.tar.gz zlib-ng-2.0.6.tar.gz 4ba0da231291632799948c5568906ce4 https://invisible-island.net/archives/byacc/byacc-20220128.tgz c861b313fb59857a5ca3475ce9d62c4e https://invisible-island.net/archives/reflex/reflex-20210808.tgz 31ed4340e8b636cb2c1de2ad378a14e9 diff --git a/pat-11.2.1/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch b/pat-11.2.1/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch @@ -0,0 +1,11 @@ +--- util-linux-2.37.2.orig/text-utils/more.c 2021-08-16 05:57:48.692807016 -0500 ++++ util-linux-2.37.2/text-utils/more.c 2021-12-31 19:18:20.162108917 -0600 +@@ -1990,7 +1990,7 @@ + if (cursor_addr == NULL || *cursor_addr == '\0') { + cursor_addr = tigetstr(TERM_CURSOR_ADDRESS); + if (cursor_addr) +- cursor_addr = tparm(cursor_addr, 0, 0); ++ cursor_addr = tiparm(cursor_addr, 0, 0); + } + if (cursor_addr) + ctl->go_home = xstrdup(cursor_addr); diff --git a/pat-11.2.1/util-linux-void/fix-musl.patch b/pat-11.2.1/util-linux-void/fix-musl.patch @@ -0,0 +1,20 @@ +Define __SWORD_TYPE for musl. + +--- sys-utils/switch_root.c.orig 2014-09-20 21:33:27.551345526 +0200 ++++ sys-utils/switch_root.c 2014-09-20 21:34:17.958584374 +0200 +@@ -47,6 +47,15 @@ + #define MNT_DETACH 0x00000002 /* Just detach from the tree */ + #endif + ++#ifndef __SWORD_TYPE ++# if __WORDSIZE == 32 /* System word size */ ++# define __SWORD_TYPE int ++# else /* __WORDSIZE == 64 */ ++# define __SWORD_TYPE long int ++# endif ++#endif ++ ++ + /* remove all files/directories below dirName -- don't cross mountpoints */ + static int recursiveRemove(int fd) + {