summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-02-23 16:05:32 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-02-23 16:05:32 +0100
commit02a07b1846dd61be1df300f345143e5462caa7ae (patch)
tree0988ef467bbf604e824e8456186b6ed1dee64611
parentc0d44acb92b16f7ead37642086e903540a148153 (diff)
downloadbootstrap32-02a07b1846dd61be1df300f345143e5462caa7ae.tar.xz
building up to libarchive
-rw-r--r--.Attic/README.old_stage2259
-rw-r--r--TODOS8
-rwxr-xr-xbuild_stage2.sh12
-rw-r--r--i486-stage1/pam/DESCR4
-rw-r--r--i486-stage1/util-linux/DESCR7
-rw-r--r--i486-stage2/libtirpc/DESCR5
-rw-r--r--i486-stage2/pam/DESCR21
-rw-r--r--i486-stage2/pam/pam-1.3.0-unix-passwd-no-yp.patch67
-rw-r--r--i486-stage2/pkg-config/DESCR4
-rw-r--r--i486-stage2/util-linux/DESCR21
-rwxr-xr-xprepare_stage2_repo.sh3
11 files changed, 141 insertions, 270 deletions
diff --git a/.Attic/README.old_stage2 b/.Attic/README.old_stage2
index d5899f5..eb2a232 100644
--- a/.Attic/README.old_stage2
+++ b/.Attic/README.old_stage2
@@ -1,107 +1,12 @@
# old stage 2 based on a broken stage 1, so carefull what to pick
# into the next version..
-#######################################
-##### TODO FROM HERE
-#######################################
-
-# TODO: m4. autoconf, automake, libtool are not really bootstrappable in x-tools
-# basic packages, non-virtual one from above: kernel, shell, pacman, editor, coreutils, development
-# tools (some of them can be bootstrapped inside like the autotools, perl; and they also should!)
-
-# linux-headers is important so we can build kmod inside the chroot
-# linux itself is tricky. For now we will boot with direct kernel parameters and binary in libvirt/qemu
-
-PACKAGES= \
- \
- \
-libffi"
-
-###
-TODO FROM HERE
-
- # TODO:
- # autoreconf needs autotools/m4 and dependencies (crosstool-ng autotools are broken for me)\
- # libunistring for gettext
- # libffi for glib2
- pushd $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot
- bsdtar xf $STAGE1_CHROOT/packages/i486/autoconf-2.69-4-any.pkg.tar.gz
- bsdtar xf $STAGE1_CHROOT/packages/i486/automake-1.15.1-1-any.pkg.tar.gz
- bsdtar xf $STAGE1_CHROOT/packages/i486/libffi-3.2.1-2-i486.pkg.tar.gz
- popd
-
- cd ..
-done
-
-
-# special patches for some packages
-###################################
-
-# autoconf needs help2man, checks need fortan (wow. that package is old!)
-# depends contains base-devel stuff?! diffutils
-sed -i 's@makedepends\(.*\)@#makedepends\1@g' autoconf/PKGBUILD
-sed -i 's@checkdepends\(.*\)@#checkdepends\1@g' autoconf/PKGBUILD
-sed -i 's@depends\(.*\)@#depends=\1@g' autoconf/PKGBUILD
-
-# automake needs dejagnu for testing, not now, disabling checks
-sed -i 's@checkdepends\(.*\)@#checkdepends\1@g' automake/PKGBUILD
-
-# libool: trusting the toolchain here, no silly checks :-)
-sed -i 's@makedepends\(.*\)@#makedepends\1@g' libtool/PKGBUILD
-
-# afterpatching; autreconf has a hard-coded #! /bin/perl -w bang,
-# seriously!
-chmod u+w /home/cross/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/bin/autoreconf
-sed -i 's@^#/bin/perl@/home/cross/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/bin/perl@g' \
- /home/cross/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/bin/autoreconf
-
-
-# glib2
-#######
-# take gettext from host
-sed -i 's@makedepends\(.*\)@#makedepends\1@g' glib2/PKGBUILD
-# get arch-meson wrapper, doens't build without it!
-# ok, forget meson, completly broken, resorting to autotools.
-# autoreconf: running: /home/cross/x-tools/i486-unknown-linux-gnu/bin/autoconf --force
-# configure.ac:88: error: possibly undefined macro: AC_DEFINE
-# huh?
-# retooling seems to be near impossible! ok, autoconf broken, meson unusable.. sweet
-Found pkg-config: /bin/pkg-config (0.27.1)
-Dependency libpcre found: NO
-Library m found: YES
-Not looking for a fallback subproject for the dependency libffi because:
-Automatic wrap-based fallback dependency downloading is disabled.
-
-Meson encountered an error in file meson.build, line 1439, column 0:
-Native dependency 'libffi' not found
-==> ERROR: A failure occurred in build().
- Aborting...
-=> this is all very wrong!
-
-# libarchive calls autoreconf, this is quite annoying as perl in crosstool-nt or
-###
-# stil in phase two, no proper autotools, let's apply the out-of-chroot trick once more..
-# do the autoreconf -fi outside, create a package libarchive-3.3.2-retooled.tgz
-# libarchive has trouble with wchar_t (and has quite some other trouble around autoconf it seems)
-# remove the wchar_t and wchar_t sizeof test in configure.ac manutally before retooling
-# and of course tests fail!
-# no checks again
-sed -i "s@^source=.*@source=('libarchive-3.3.2-retooled.tgz')@g" libarchive/PKGBUILD
-sed -i "s@^sha256sums=.*@sha256sums=('1f856e6f5cc0e1479f381e381a031ba19d09f80b51ac88e74b2c140fc78606e8')@g" libarchive/PKGBUILD
-sed -i 's@autoreconf@#autoreconf@g' libarchive/PKGBUILD
# generic build
###############
for p in $PACKAGES
- # for some packages we cannot execute tests (because the dependencies to install in
- # the toolchain environment would be too much)
- # autoconf: --nocheck
- # automake: --nockeck
- # pacman: --nocheck
- # mpfr: --nocheck
-
# for ncurses, readline for bash
# autoreconf needs autotools/m4 and dependencies (crosstool-ng autotools are broken for me)
# libunistring for gettext
@@ -163,11 +68,6 @@ arch-chroot /home/cross/i486-root/
# package specific things
-
-# xz
-# with gcc 7.2 we get new errors
-sed -i 's@--enable-werror@--disable-werror@g' xz/PKGBUILD
-
# bc
# requires texinfo, is this part of base-devel?
# bootstrap --force
@@ -225,17 +125,6 @@ zlib for now.
# gtk-doc draws in Gnome bullshit again
sed -i 's@^makedepends\(.*\)@#makedepends\1@g' kmod/PKGBUILD
-# libtirpc: break the cyrcle with systemd (via krb5)
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' libtirpc/PKGBUILD
-sed -i 's@^depends\(.*\)@#depends\1@g' libtirpc/PKGBUILD
-# configure: error: gssapi.h not found. Use --disable-gssapi, or install GSS-API.
-# --disable-gssapi
-
-# pam:
-# dependency w3m is for documentation, let's remove it
-rm: cannot remove '/build/pam/pkg/pam/usr/share/doc/Linux-PAM/sag-pam_userdb.html': No such file or directory
-also remove section in PKGBUILD
-
# inetutils:
# disable checks
@@ -292,18 +181,6 @@ sed -i 's@^checkdepends\(.*\)@#checkdepends\1@g' perl-error/PKGBUILD
# no docu
# --disable-man
-# git
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' git/PKGBUILD
-# no make doc
-# disable most things in build
-# disable doc in install-doc
-# NO_GETTEXT=1
-# --nocheck
-=> no luck
-
-# lz4:
-# git tweaking again, use 1.8.0 tarball
-
# tar:
# checking whether mknod can create fifo without root privileges... configure: error: in `/build/tar/src/tar-1.29':
# configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
@@ -312,14 +189,9 @@ sed -i 's@^makedepends\(.*\)@#makedepends\1@g' git/PKGBUILD
sed -i 's@./configure@FORCE_UNSAFE_CONFIGURE=1 ./configure@g' tar/PKGBUILD
#TODO:
-# lz4
-# git package again
-sed -i 's@^makedepends\(.*\)@#makedepends\1@g' lz4/PKGBUILD
-#TODO: cracklib util-linux e2fsprogs libldap keyutils krb5 they end in circlejerk with systemd!
+#TODO: libldap keyutils krb5 they end in circlejerk with systemd!
# we will solve that later by building a non-systemd version and then bootstrapping first systemd
-# git: out of reach for now, far too many dependencies
-perl-error git
# for now we don't rebuild ca-certificates, we had to copy them funilly anyway, and it's
# just a bunch of certs. So, in phase 3 or 4 then..
@@ -363,57 +235,6 @@ sed -i 's/mycarch="i686"/mycarch="i486")/g' pacman/PKGBUILD
sed -i 's/mychost="i686-pc-linux-gnu"/mychost="i486-pc-linux-gnu"/g' pacman/PKGBUILD
sed -i 's/myflags="-march=i686"/myflags=-march=i486/g' pacman/PKGBUILD
-# coreutils
-###########
-sed -i 's@./configure@FORCE_UNSAFE_CONFIGURE=1 ./configure@g' coreutils/PKGBUILD
-
-# TODO: needed in stage 2?
-# apply man generation patch (one has to wonder, is it maintained at all?)
-# help2man errors: help2man: can't get `--help' info from man/chmod.td/chmod
-# http://ftp.lfs-matrix.net/pub/clfs/conglomeration/coreutils/coreutils-8.28-noman.patch
-# based on a patch by William Harrington (kb0iic at cross-lfs dot org) 2014-10-30 for coreutils 8.23
-#sed -i 's@source=(@source=(coreutils-8.28-noman.patch @' PKGBUILD
-#sed -i "s@md5sums=(@md5sums=('SKIP' @" PKGBUILD
-#sed -i '/build()/ i \ prepare() { \n\ cd ${pkgname}-${pkgver}\n\ patch -Np1 < ${srcdir}/coreutils-8.28-noman.patch \n }' PKGBUILD
-
-# zlib
-######
-strip: /lib/libz.so.1: no version information available (required by /lib/libbfd-2.29.1.so)
-=> this is because some tools are built with other versions (toolchain vs. chroot)
-=> so we must not install zlib before we rebuild binutils
-
-# util-linux
-############
-# disable some dependencies on systemd, python, PAM (chfn_chsh)
-# and other stuff we don't need
-# libtool seems broken
-sed -i 's@makedepends\(.*\)@#makedepends\1@g' PKGBUILD
-sed -i 's@ \+depends\(.*\)@#depends\1@g' PKGBUILD
-sed -i 's@--with-python=3@--without-python \\@g' PKGBUILD
-sed -i '/--without-python/ a \ --without-systemd --without-systemdsystemunitdir' PKGBUILD
-sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu@g' PKGBUILD
-sed -i '/--without-python \\/ a \ --disable-chfn-chsh \\' PKGBUILD
-sed -i '/--without-python \\/ a \ --disable-shared --enable-static \\' PKGBUILD
-sed -i 's@\(chmod 4755 "$pkgdir"/usr/bin/{newgrp,ch{sh,fn}}\)@#\1@g' PKGBUILD
-sed -i "s@\(sed -i '/ListenStream.*\)@#\1@g" PKGBUILD
-sed -i 's@\(rm "$pkgdir.*\)@#\1@g' PKGBUILD
-# chgrp: chgrp: invalid group: 'tty'invalid group: 'tty'
-# /etc/group belongs to filesystem, but has only a root entry when installed
-=> filesystem package: post.install hook has not been executed (filesystem.install)
-=> for now do it manually
-groupadd -g 5 tty
-# IMPORTANT DNAGER: the test suite is crazzy and destroys the host!! use --nocheck
-# packaging generates tons of errors, lets hope, they are not critical.
-# cp: omitting directory ‘/’
-# => at least util-linux needs !strip OPTIONS (makepkg-i486.conf)
-#rm "$pkgdir"/usr/lib/lib*.{a,so}*
-
-# pcre
-######
-# no C++
-sed -i 's@./configure@./configure --disable-cpp@g' pcre/PKGBUILD
-# --nocheck as we have trouble to find shared libraries
-
# gmp
#####
# no C++
@@ -440,54 +261,14 @@ sed -i 's@\(ln -sf ssh.1.gz.*\)@#\1@g' PKGBUILD
# git
#####
# manual PKGBUILD fix
-# install: cannot stat 'contrib/credential/libsecret/git-credential-libsecret': No such file or directory
-# => PKGBUILD is a mess, sorry!
-# no asciidoc, as this needs python2
-#asciidoc -b docbook -d manpage -f ../../Documentation/asciidoc.conf \
-# -agit_version=2.15.0 git-subtree.txt
-# disable make install-doc
#make: pkg-config: Command not found
#make: pkg-config: Command not found
#make: Leaving directory '/build/git/src/git-2.15.0/contrib/subtree'
-#mv: cannot stat '/build/git/pkg/git/usr/share/perl5/site_perl/Git/*': No such file or directory
-=> hack away python, perl, systemd, contrib, docu and other things we don't need right now
-
-git clone...
-Cloning into 'strusBase'...
-fatal: cannot run ssh: No such file or directory
-fatal: unable to fork
-fatal: Unable to find remote helper for 'https'
-fatal: Unable to find remote helper for 'http'
-=> we need ssh
# tcl
#####
# disable tests: cynical, disable unit tests of a software needed for testing
-# autoconf
-##########
-# checks need fortan (wow. that package is old!)
-# depends contains base-devel stuff?! diffutils
-sed -i 's@makedepends\(.*\)@#makedepends\1@g' autoconf/PKGBUILD
-sed -i 's@checkdepends\(.*\)@#checkdepends\1@g' autoconf/PKGBUILD
-# not bad, but lets disable testing for now:
-# ERROR: 455 tests were run,
-# 5 failed (4 expected failures).
-# 48 tests were skipped.
-
-# automake
-##########
-# automake needs dejagnu for testing, not now, disabling checks
-sed -i 's@checkdepends\(.*\)@#checkdepends\1@g' automake/PKGBUILD
-# TOTAL: 2901
-# PASS: 2673
-# SKIP: 164
-# XFAIL: 41
-# FAIL: 21
-# XPASS: 0
-# ERROR: 2
-=> ok, but let's disable testing
-
# dejagnu
#########
# has hard-wired AC_PROG_CXX in configure, remove internal C++ tests
@@ -676,10 +457,6 @@ test.c:1:10: fatal error: stdio.h: No such file or directory
# END TODO: gcc
-# libtool
-#########
-# patched heavily again, git version cannot be bootstrapped use official tarball
-
# glibc
#######
# use 2.25 version, not 2.26. Keep the ABI intact!
@@ -743,10 +520,8 @@ for p in $PACKAGES
# libxslt: --nocheck
# inetutils: --nocheck
# bison: --nocheck
- # libarchive: --nocheck
# pacman: --nocheck
# util-linux: --nocheck
- # pcre: --nocheck
# gawk: --nocheck
# tcl: --nocheck
@@ -783,9 +558,6 @@ done
ln -s /usr/bin/ld /usr/lib/gcc/i486-unknown-linux-gnu/7.2.0/ld
etc.
-# libz.so missing?
-ln -s libz.so.1 /usr/lib/libz.so
-
# aftermatch for glibc
# bacause pacman cannot set file permissions
@@ -830,32 +602,3 @@ git: https helpers
chmod 0777 /usr/lib/git-core/git-remote-*
later: for inside the chroot
-
-# uname module hack
-###################
-
-# as root
-# we need i486, so setarch doesn't work for us, because it emulates only,
-# a i686, use the hacked uname kernel module:
-wget http://clfs.org/files/extras/uname_hack-20080713.tar.bz2
-tar xf uname_hack-20080713.tar.bz2
-cd uname_hack
-# swap memset arguments:
-# /root/uname_hack/uname_hack.c:50:2: warning: 'memset' used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
-# memset(uname_hack_uts_machine, uname_hack_uts_machine_len, '\0');
-# ^~~~~~
-# Building modules, stage 2.
-make uname_hack_fake_machine=i486
-insmod uname_hack.ko
-#lib/config.guess in automake returns i486-pc-linux-gnu
-# uname -m returns i486
-cd ..
-
-# patch our hosts pacman.conf, so it doesn't get fooled by the architecture hack
-sed -i 's@^Architecture.*@Architecture = x86_64@g' /etc/pacman.conf
-
-# optional packages for stage 1
-# TODO: do we need this for old machines?
-# linux-firmware
-# use git from the host for now
-#sed -i 's@makedepends\(.*\)@#makedepends\1@g' linux-firmware/PKGBUILD
diff --git a/TODOS b/TODOS
index c770bd4..5b993f8 100644
--- a/TODOS
+++ b/TODOS
@@ -1,3 +1,7 @@
+design bugs:
+- we build now on VMs or real hardware via SSH, we should also try to
+ build with chroots and bin_fmt (thanks to oaken-source mentioning it)
+
general bugs:
- how to clean up sysroot nicely without having to rebuild the cross-compiler?
@@ -66,3 +70,7 @@ stage2 issues:
=> we cannot install via the [temp] repo
=> on the long term, debug pacman and libalpm and see what could be the root cause
- our expectiation is makepkg -o -e would do the trick, but it doesn't
+- cracklib and other packages: something is broken in zlib and thwe way libtool is used there:
+ strip: /usr/lib/libz.so.1: no version information available (required by /usr/lib/libbfd-2.29.1.so)
+ => this is because some tools are built with other versions (toolchain vs. chroot)
+ => so we must not install zlib before we rebuild binutils
diff --git a/build_stage2.sh b/build_stage2.sh
index b8c849e..e7f54f6 100755
--- a/build_stage2.sh
+++ b/build_stage2.sh
@@ -14,13 +14,13 @@ iana-etc filesystem linux-api-headers tzdata
ncurses readline joe
attr acl m4 gmp gdbm db perl openssl
libunistring gettext perl-locale-gettext help2man
-autoconf automake perl-error pcre2 git
+autoconf automake perl-error pcre2 git libtool
+zlib pambase cracklib libtirpc flex pam libcap coreutils
+util-linux pkg-config e2fsprogs expat bzip2 lz4 xz pcre less gzip
+tar libarchive
"
-#~ git
-#~ libtool zlib pambase cracklib libtirpc pam libcap coreutils
-#~ util-linux e2fsprogs
-#~ expat bzip2 lz4 xz pcre less gzip tar libarchive curl
+#~ libarchive curl
#~ pacman-mirrorlist archlinux-keyring archlinux32-keyring pacman
#~ elfutils
#~ sed texinfo grep findutils file diffutils ed patch
@@ -32,8 +32,6 @@ autoconf automake perl-error pcre2 git
#~ make mpfr gawk libmpc binutils gcc glibc
#~ libunwind strace gdb"
-# git
-
# build bash first as 'cd subpackage' in autoconf generated makefiles break
# with cross-compiled bash
diff --git a/i486-stage1/pam/DESCR b/i486-stage1/pam/DESCR
index 24f403e..2138c49 100644
--- a/i486-stage1/pam/DESCR
+++ b/i486-stage1/pam/DESCR
@@ -5,6 +5,7 @@ SYSROOT_INSTALL=1
sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD
# no flex, w3m, docboox-xml/xsl (no docu and take flex from the host)
+# tons of tools needed to build documentation, we ommit the documentation right now
sed -i "s@makedepends=@#makedepends=@" PKGBUILD
# disable NIS/YP
@@ -22,6 +23,3 @@ sed -i 's@./configure@./configure --disable-regenerate-docu@' PKGBUILD
# no documentation built, so nothing to remove
sed -i '2!N; /# FS #40749\n \+rm/ s/rm/#rm/g' PKGBUILD
-
-# tons of tools needed to build documentation, we ommit the documentation right now
-sed -i "s@makedepends@#makedepends@" PKGBUILD
diff --git a/i486-stage1/util-linux/DESCR b/i486-stage1/util-linux/DESCR
index 38e4b24..3c6e73c 100644
--- a/i486-stage1/util-linux/DESCR
+++ b/i486-stage1/util-linux/DESCR
@@ -8,8 +8,11 @@ ADDITIONAL_INSTALL_PACKAGE=libutil-linux
sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD
# disable some dependencies on systemd, python, libcap-ng
-sed -i 's@makedepends\(.*\)@#makedepends\1@g' PKGBUILD
-sed -i 's@ \+depends\(.*\)@#depends\1@g' PKGBUILD
+sed -i "/makedepends=/s/'systemd'//" PKGBUILD
+sed -i "/makedepends=/s/'python'//" PKGBUILD
+sed -i "/makedepends=/s/'libcap-ng'//" PKGBUILD
+sed -i "/depends=/s/'libsystemd'//" PKGBUILD
+sed -i "/depends=/s/'libcap-ng'//" PKGBUILD
# no python
sed -i 's@--with-python=3@--without-python \\@g' PKGBUILD
diff --git a/i486-stage2/libtirpc/DESCR b/i486-stage2/libtirpc/DESCR
new file mode 100644
index 0000000..b6b3568
--- /dev/null
+++ b/i486-stage2/libtirpc/DESCR
@@ -0,0 +1,5 @@
+# disable Kerberos
+sed -i "/depends=/s/'krb5'//" PKGBUILD
+
+# gssapi seems also to be a dependency, not in PKBUILD, disable it
+sed -i 's@./configure@./configure --disable-gssapi@g' PKGBUILD
diff --git a/i486-stage2/pam/DESCR b/i486-stage2/pam/DESCR
new file mode 100644
index 0000000..b2c19a2
--- /dev/null
+++ b/i486-stage2/pam/DESCR
@@ -0,0 +1,21 @@
+# disable NIS/YP
+sed -i 's@./configure@./configure --disable-nis@g' PKGBUILD
+
+# no w3m, docboox-xml/xsl
+# tons of tools needed to build documentation, we ommit the documentation right now
+sed -i "/makedepends=/s/'w3m'//" PKGBUILD
+sed -i "/makedepends=/s/'docbook-xml.*'//" PKGBUILD
+sed -i "/makedepends=/s/'docbook-xsl'//" PKGBUILD
+
+# unix_passwd.c:56:10: fatal error: rpcsvc/yp_prot.h: No such file or directory
+# #include <rpcsvc/yp_prot.h>
+# => pam-1.3.0-unix-passwd-no-yp.patch
+sed -i 's@source=(@source=(pam-1.3.0-unix-passwd-no-yp.patch @' PKGBUILD
+sed -i "s@md5sums=(@md5sums=('3f5edd685cdd2c0a2ca44bc6e75320d8' @" PKGBUILD
+sed -i '/patch -Np/ a \ patch -Np1 -i "${srcdir}/pam-1.3.0-unix-passwd-no-yp.patch"' PKGBUILD
+
+# disable docu rebuilding
+sed -i 's@./configure@./configure --disable-regenerate-docu@' PKGBUILD
+
+# no documentation built, so nothing to remove
+sed -i '2!N; /# FS #40749\n \+rm/ s/rm/#rm/g' PKGBUILD
diff --git a/i486-stage2/pam/pam-1.3.0-unix-passwd-no-yp.patch b/i486-stage2/pam/pam-1.3.0-unix-passwd-no-yp.patch
new file mode 100644
index 0000000..1ac4a11
--- /dev/null
+++ b/i486-stage2/pam/pam-1.3.0-unix-passwd-no-yp.patch
@@ -0,0 +1,67 @@
+diff -rauN pam_unix2-2.9.1/config.h.in pam_unix2-2.9.1-unix-passwd-no-yp-patch/config.h.in
+--- pam_unix2-2.9.1/config.h.in 2012-04-03 15:31:24.000000000 +0200
++++ pam_unix2-2.9.1-unix-passwd-no-yp-patch/config.h.in 2017-12-08 16:15:09.870000003 +0100
+@@ -194,3 +194,6 @@
+
+ /* Define to 1 if you need to in order for `stat' and other things to work. */
+ #undef _POSIX_SOURCE
++
++/* Define to 1 if you have the <rpcsvc/yp_prot.h> header file. */
++#undef HAVE_RPCSVC_YP_PROT_H
+diff -rauN pam_unix2-2.9.1/configure.in pam_unix2-2.9.1-unix-passwd-no-yp-patch/configure.in
+--- pam_unix2-2.9.1/configure.in 2012-04-03 15:31:17.000000000 +0200
++++ pam_unix2-2.9.1-unix-passwd-no-yp-patch/configure.in 2017-12-08 16:15:22.160000000 +0100
+@@ -60,6 +60,7 @@
+ AC_CHECK_HEADERS(crypt.h)
+ AC_CHECK_HEADERS(stdlib.h pwd.h sys/types.h syslog.h sys/syslog.h string.h strings.h, , AC_MSG_ERROR(some basic headers are missing))
+ AC_CHECK_HEADERS(security/pam_appl.h security/pam_modules.h, , AC_MSG_ERROR(broken libpam installation))
++AC_CHECK_HEADERS(rpcsvc/yp_prot.h)
+
+ dnl Check for Linux-PAM 0.99.x
+ AC_CHECK_HEADERS(security/pam_ext.h)
+diff -rauN pam_unix2-2.9.1/src/unix_passwd.c pam_unix2-2.9.1-unix-passwd-no-yp-patch/src/unix_passwd.c
+--- pam_unix2-2.9.1/src/unix_passwd.c 2012-04-03 15:24:51.000000000 +0200
++++ pam_unix2-2.9.1-unix-passwd-no-yp-patch/src/unix_passwd.c 2017-12-08 16:15:33.389999993 +0100
+@@ -53,8 +53,10 @@
+ #include <rpc/types.h>
+ #include <nss.h>
+ #include <syslog.h>
++#if defined(HAVE_YP_PROT_H)
+ #include <rpcsvc/yp_prot.h>
+ #include <rpcsvc/ypclnt.h>
++#endif
+
+ #define PAM_SM_PASSWORD
+ #include <security/pam_modules.h>
+@@ -413,6 +415,7 @@
+ }
+ }
+
++#if defined(HAVE_YP_PROT_H)
+ static char *
+ getnismaster (pam_handle_t *pamh, int flags)
+ {
+@@ -445,6 +448,7 @@
+
+ return master;
+ }
++#endif
+
+ static int
+ read_loop (int fd, char *buffer, int count)
+@@ -1095,6 +1099,7 @@
+
+ ulckpwdf ();
+ }
++#if defined(HAVE_YP_PROT_H)
+ else if (data->service == S_YP)
+ {
+ struct yppasswd yppwd;
+@@ -1137,6 +1142,7 @@
+ retval = PAM_AUTHTOK_ERR;
+ }
+ }
++#endif
+
+ return retval;
+ }
diff --git a/i486-stage2/pkg-config/DESCR b/i486-stage2/pkg-config/DESCR
new file mode 100644
index 0000000..2396ff1
--- /dev/null
+++ b/i486-stage2/pkg-config/DESCR
@@ -0,0 +1,4 @@
+# use internal glib as we cannot possibly have meson build glib!
+sed -i "/makedepends=/s/'glib2'//" PKGBUILD
+sed -i "/depends=/s/'glib2'//" PKGBUILD
+sed -i "s@./configure@./configure --with-internal-glib@g" PKGBUILD
diff --git a/i486-stage2/util-linux/DESCR b/i486-stage2/util-linux/DESCR
new file mode 100644
index 0000000..93cfeab
--- /dev/null
+++ b/i486-stage2/util-linux/DESCR
@@ -0,0 +1,21 @@
+# install two packages: libutil-linux and util-linux
+ADDITIONAL_INSTALL_PACKAGE=libutil-linux
+
+# disable some dependencies on systemd, python, libcap-ng
+sed -i "/makedepends=/s/'systemd'//" PKGBUILD
+sed -i "/makedepends=/s/'python'//" PKGBUILD
+sed -i "/makedepends=/s/'libcap-ng'//" PKGBUILD
+sed -i "/depends=/s/'libsystemd'//" PKGBUILD
+sed -i "/depends=/s/'libcap-ng'//" PKGBUILD
+
+# no python
+sed -i 's@--with-python=3@--without-python \\@g' PKGBUILD
+
+# no systemd
+sed -i '/--without-python/ a \ --without-systemd --without-systemdsystemunitdir' PKGBUILD
+sed -i "s@\(sed.*\)@#\1@" PKGBUILD
+# TODO: needed?
+# sed -i '/ListenStream/ aRuntimeDirectory=uuidd' "$pkgdir/usr/lib/systemd/system/uuidd.socket"
+
+# tty group for util-linux, later, systemd will have the group already
+# we do this in prepare_stage2_repo.sh
diff --git a/prepare_stage2_repo.sh b/prepare_stage2_repo.sh
index 5f7455a..cd745f7 100755
--- a/prepare_stage2_repo.sh
+++ b/prepare_stage2_repo.sh
@@ -28,6 +28,9 @@ if test ! -d $STAGE2_BUILD; then
#SigLevel = Never
#Server = file:///packages/$arch
+ # tty group for util-linux
+ getent group tty >/dev/null || groupadd -g 5 tty
+
echo "Prepared the stage 2 build environment."
fi