From d717823cde98d4c534ccbb52329ff98f8719ab36 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 1 Feb 2018 22:38:44 +0100 Subject: bugfixing, complete rebuild added a todo list building up to shadow, net-tools still breaks --- README | 13 +++---------- TODOS | 8 ++++++++ build_cross.sh | 2 +- build_stage1.sh | 6 ++++-- build_stage1_package.sh | 16 ++++++++++++---- packages-i486-stage1/net-tools | 15 +++++++++++++++ packages-i486-stage1/shadow | 6 ++++++ patches-i486-stage1/net-tools-1.60-if_tunnel.patch | 11 +++++++++++ 8 files changed, 60 insertions(+), 17 deletions(-) create mode 100644 TODOS create mode 100644 packages-i486-stage1/net-tools create mode 100644 patches-i486-stage1/net-tools-1.60-if_tunnel.patch diff --git a/README b/README index 1908dc8..aa85121 100644 --- a/README +++ b/README @@ -169,7 +169,7 @@ archlinux-keyring archlinux32-keyring pacman-mirrorlist pacman \ make mpfr gawk libmpc binutils gcc \ linux uinit \ glibc \ -net-tools libmnl elfutils libnfnetlink iptables iproute2 \ + libmnl elfutils libnfnetlink iptables iproute2 \ libedit openssh \ sysfsutils libidn nettle iputils" # libunwind @@ -341,15 +341,8 @@ cat ~/packages32/core/glibc/PKGBUILD >> PKGBUILD sed -i "/makedepends/s/lib32-gcc-libs//g" PKGBUILD sed -i "/pkgname/s/lib32-glibc//g" PKGBUILD -# net-tools -sed -i "s@make @make CC=i486-unknown-linux-gnu-cc LD=i486-unknown-linux-gnu-ld@g" net-tools/PKGBUILD -sed -i "s@make\$@make CC=i486-unknown-linux-gnu-cc LD=i486-unknown-linux-gnu-ld @g" net-tools/PKGBUILD -# git for release checkouts, a bad idea IMHO, current git+https is commented out in trunk anyway -sed -i "/makedepends/s/git//g" net-tools/PKGBUILD -# apply patch for double definitons in ip.h -sed -i 's@source=(@source=(net-tools-1.60-if_tunnel.patch @' net-tools/PKGBUILD -sed -i "s@sha1sums=(@sha1sums=('SKIP' @" net-tools/PKGBUILD -sed -i '2!N; /prepare() {/ a \ pushd ${srcdir}/${pkgname}; patch -Np1 < ${srcdir}/net-tools-1.60-if_tunnel.patch; popd' PKGBUILD + + # libmnl sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' libmnl/PKGBUILD diff --git a/TODOS b/TODOS new file mode 100644 index 0000000..dea9adb --- /dev/null +++ b/TODOS @@ -0,0 +1,8 @@ +- how to clean up sysroot nicely without having to rebuild the cross-compiler? + for now only removing and stowing a copy somewhere before building stage1 + helps. +- pacman with a '--no-execute-hooks' option +- makepkg with an 'alternate root' option (which doens't collide with + pacman's options), avoids patching -r and --config into makepkg for + stage1 + diff --git a/build_cross.sh b/build_cross.sh index dffb1c4..790dbb8 100755 --- a/build_cross.sh +++ b/build_cross.sh @@ -26,7 +26,7 @@ fi if test ! -f "$CROSS_HOME/.ssh/id_rsa.pub"; then cp "$HOME/.ssh/id_rsa.pub" "$CROSS_HOME/.ssh/." cp "$HOME/.ssh/id_rsa" "$CROSS_HOME/.ssh/." - chown cross:cross "$CROSS_HOME/.ssh/id_rsa*" + chown cross:cross $CROSS_HOME/.ssh/id_rsa* fi if test ! -x /usr/local/bin/ct-ng; then diff --git a/build_stage1.sh b/build_stage1.sh index 7e62520..1ed6758 100755 --- a/build_stage1.sh +++ b/build_stage1.sh @@ -15,9 +15,11 @@ util-linux e2fsprogs expat bzip2 lz4 xz pcre less gzip tar libarchive curl sed texinfo grep findutils file diffutils ed patch -kbd procps-ng shadow" +kbd procps-ng shadow + +net-tools" for p in $PACKAGES; do - "$SCRIPT_DIR/build_stage1_package.sh" "$p" + "$SCRIPT_DIR/build_stage1_package.sh" "$p" || exit 1 done diff --git a/build_stage1_package.sh b/build_stage1_package.sh index 775efe2..1b9465e 100755 --- a/build_stage1_package.sh +++ b/build_stage1_package.sh @@ -33,8 +33,10 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" - # using asp (or from the AUR using yaourt) PACKAGE_CONF="$SCRIPT_DIR/packages-$TARGET_CPU-stage1/$PACKAGE" - if test $(grep -c NEEDS_YAOURT $PACKAGE_CONF) = 1; then - NEEDS_YAOURT=$(grep NEEDS_YAOURT $PACKAGE_CONF | cut -f 2 -d =) + if test -f $PACKAGE_CONF; then + if test $(grep -c NEEDS_YAOURT $PACKAGE_CONF) = 1; then + NEEDS_YAOURT=$(grep NEEDS_YAOURT $PACKAGE_CONF | cut -f 2 -d =) + fi fi if test "$NEEDS_YAOURT"; then yaourt -G "$PACKAGE" @@ -62,7 +64,7 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" - fi # copy bigger patches into the build area - if test $(find SCRIPT_DIR/patches-$TARGET_CPU-stage1/$PACKAGE-*.patch 2>/dev/null | grep -q .); then + if test $(find $SCRIPT_DIR/patches-$TARGET_CPU-stage1/$PACKAGE-*.patch 2>/dev/null | wc -l) != 0; then cp $SCRIPT_DIR/patches-$TARGET_CPU-stage1/$PACKAGE-*.patch . fi @@ -116,10 +118,16 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" - cd "$STAGE1_BUILD/$PACKAGE" || exit 1 fi + echo "Built package $PACKAGE." + + else + echo "ERROR building package $PACKAGE" + exit 1 fi cd $STAGE1_BUILD || exit 1 +else + echo "$PACKAGE exists." fi -echo "Built package $PACKAGE." diff --git a/packages-i486-stage1/net-tools b/packages-i486-stage1/net-tools new file mode 100644 index 0000000..821bb63 --- /dev/null +++ b/packages-i486-stage1/net-tools @@ -0,0 +1,15 @@ +# prepare configure for cross-compilation +sed -i "s@make @make CC=$TARGET_ARCH-cc LD=$TARGET_ARCH-ld@g" PKGBUILD +sed -i "s@make\$@make CC=$TARGET_ARCH-cc LD=$TARGET_ARCH-ld @g" PKGBUILD + +# git for release checkouts, using the one from host +sed -i "/makedepends/s/git//g" PKGBUILD + +# apply patch for double definitons in ip.h +sed -i 's@source=(@source=(net-tools-1.60-if_tunnel.patch @' PKGBUILD +sed -i "s@sha1sums=(@sha1sums=('SKIP' @" PKGBUILD +sed -i '2!N; /prepare() {/ a \ pushd ${srcdir}/${pkgname}; patch -Np1 < ${srcdir}/net-tools-1.60-if_tunnel.patch; popd' PKGBUILD + +# TODO: wrong installation pathes, should be /usr/bin +# install: cannot create regular file '/bin/ifconfig': Permission denied +# make: *** [Makefile:216: installbin] Error 1 diff --git a/packages-i486-stage1/shadow b/packages-i486-stage1/shadow index 7c71673..ff12a87 100644 --- a/packages-i486-stage1/shadow +++ b/packages-i486-stage1/shadow @@ -8,5 +8,11 @@ sed -i 's@makedepends\(.*\)@#makedepends\1@g' PKGBUILD sed -i 's@--enable-man@--disable-man@g' PKGBUILD sed -i '/find/,/-delete/{s/\(.*\)/#\1/g}' PKGBUILD sed -i '/rmdir/,/man8/{s/\(.*\)/#\1/g}' PKGBUILD +# counterspells, yes I know, I'm bad with sed sed -i 's/^#}/}/' PKGBUILD +# shadow: /usr/sbin exists in filesystem +# revert last rmdir commenting of /usr/sbin removal +sed -i 's@^# \+rmdir \+"$pkgdir/usr/sbin"@ rmdir "$pkgdir/usr/sbin"@' PKGBUILD + sed -i '2!N; /prepare()/ a \ sed -i "/SUBDIRS/s/man//g" Makefile.am' PKGBUILD + diff --git a/patches-i486-stage1/net-tools-1.60-if_tunnel.patch b/patches-i486-stage1/net-tools-1.60-if_tunnel.patch new file mode 100644 index 0000000..82aa34b --- /dev/null +++ b/patches-i486-stage1/net-tools-1.60-if_tunnel.patch @@ -0,0 +1,11 @@ +diff -rauN net-tools-1.60-115f1af2/iptunnel.c net-tools-1.60-115f1af2-no-ip-header-patch/iptunnel.c +--- net-tools-1.60-115f1af2/iptunnel.c 2017-12-26 21:14:18.650935837 +0100 ++++ net-tools-1.60-115f1af2-no-ip-header-patch/iptunnel.c 2017-12-26 21:15:45.088534518 +0100 +@@ -26,7 +26,6 @@ + #include + #include + #include +-#include + #include + #include + #include -- cgit v1.2.3-54-g00ecf