From d4d48845954a13a311af53d2a881cedee0e7e27e Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 1 Feb 2018 17:33:40 +0100 Subject: building up to libarchive --- README | 64 ++--------------------------------------- build_stage1.sh | 3 +- build_stage1_package.sh | 4 +-- packages-i486-stage1/bzip2 | 6 ++++ packages-i486-stage1/curl | 25 ++++++++++++++++ packages-i486-stage1/e2fsprogs | 2 ++ packages-i486-stage1/expat | 8 ++++++ packages-i486-stage1/gzip | 5 ++++ packages-i486-stage1/less | 3 ++ packages-i486-stage1/libarchive | 5 ++++ packages-i486-stage1/lz4 | 12 ++++++++ packages-i486-stage1/pcre | 5 ++++ packages-i486-stage1/tar | 7 +++++ packages-i486-stage1/util-linux | 2 +- packages-i486-stage1/xz | 8 ++++++ 15 files changed, 93 insertions(+), 66 deletions(-) create mode 100644 packages-i486-stage1/bzip2 create mode 100644 packages-i486-stage1/curl create mode 100644 packages-i486-stage1/e2fsprogs create mode 100644 packages-i486-stage1/expat create mode 100644 packages-i486-stage1/gzip create mode 100644 packages-i486-stage1/less create mode 100644 packages-i486-stage1/libarchive create mode 100644 packages-i486-stage1/lz4 create mode 100644 packages-i486-stage1/pcre create mode 100644 packages-i486-stage1/tar create mode 100644 packages-i486-stage1/xz diff --git a/README b/README index 2d607f1..ed7a4bd 100644 --- a/README +++ b/README @@ -164,8 +164,7 @@ su cross ./create_ca-certificates-utils_shim.sh # basic packages PACKAGES=" \ - e2fsprogs \ -expat bzip2 lz4 xz pcre less gzip tar libarchive curl ca-certificates-utils \ + ca-certificates-utils \ archlinux-keyring archlinux32-keyring pacman-mirrorlist pacman \ sed fakeroot texinfo grep findutils file diffutils ed patch \ make mpfr gawk libmpc binutils gcc \ @@ -176,8 +175,6 @@ libedit openssh \ sysfsutils libidn nettle iputils" # libunwind -# expat, bzip2, lz4, xz for libarchive -# libarchive, curl for pacman # file (libmagic) for ... # mpfr for gawk, gcc # libnfnetlink for iptables @@ -185,7 +182,7 @@ sysfsutils libidn nettle iputils" # libedit for openssh # sysfsutils and libidn, nettle for iputils SYSROOT_PACKAGES=" \ -expat bzip2 lz4 xz pcre gzip libarchive curl \ + \ file libmpc mpfr libmnl libelf libnfnetlink iptables \ libedit sysfsutils libidn" @@ -196,64 +193,7 @@ libedit sysfsutils libidn" -# e2fsprogs -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' e2fsprogs/PKGBUILD -# remove superflous 'bc' make dependency -sed -i "/makedepends/s/'bc'//g" e2fsprogs/PKGBUILD -# expat -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' expat/PKGBUILD - -# bzip2 -sed -i "s@\( \+\)make@\1make CC=i486-unknown-linux-gnu-cc RANLIB=i486-unknown-linux-gnu-ranlib AR=i486-unknown-linux-gnu-ar@g" bzip2/PKGBUILD - -# lz4 -sed -i "s@\( \+\)make@\1make CC=i486-unknown-linux-gnu-cc RANLIB=i486-unknown-linux-gnu-ranlib AR=i486-unknown-linux-gnu-ar@g" lz4/PKGBUILD -# lz4 has a git makedepends, diffutils for unit tests -sed -i 's@makedepends\(.*\)@#makedepends\1@g' lz4/PKGBUILD -sed -i 's@checkdepends\(.*\)@#checkdepends\1@g' lz4/PKGBUILD - -# xz -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' xz/PKGBUILD -# with gcc 7.2 we get new errors -sed -i 's@--enable-werror@--disable-werror@g' xz/PKGBUILD - -# pcre -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' pcre/PKGBUILD - -# less -sed -i 's@sh configure@sh configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' less/PKGBUILD - -# gzip -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' gzip/PKGBUILD - -# tar -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' tar/PKGBUILD -# 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) -# See `config.log' for more details -sed -i 's@./configure@FORCE_UNSAFE_CONFIGURE=1 ./configure@g' tar/PKGBUILD - -# libarchive -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' libarchive/PKGBUILD - -# curl -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' curl/PKGBUILD -# build with minimal features, we don't need some libraries -sed -i "/depends=/s/'krb5'//" curl/PKGBUILD -sed -i "/depends=/s/'libssh2'//" curl/PKGBUILD -sed -i '/--prefix=\/usr/ a \ --without-libssh2 \\' curl/PKGBUILD -sed -i "/depends=/s/'libpsl'//" curl/PKGBUILD -sed -i '/--prefix=\/usr/ a \ --without-libpsl \\' curl/PKGBUILD -sed -i "/depends=/s/'libnghttp2'//" curl/PKGBUILD -sed -i '/--prefix=\/usr/ a \ --without-nghttp2 \\' curl/PKGBUILD -sed -i '/--prefix=\/usr/ a \ --without-gssapi \\' curl/PKGBUILD -# no ca-certificates, needs tons of tools to build (like p11-kit), so we -# create a fake one with certificates from the host (is this LE/BE-safe?) -# can we actually simply ommit them for now? -sed -i "/depends=/s/'ca-certificates'//" curl/PKGBUILD -# zsh, perl is used to create a completion file for curl and zsh -sed -i '/--prefix=\/usr/ a \ --without-zsh-functions-dir \\' curl/PKGBUILD # pacman-mirrorlist cp $HOME/packages32/core/pacman-mirrorlist/mirrorlist pacman-mirrorlist/. diff --git a/build_stage1.sh b/build_stage1.sh index 1446187..84bac62 100755 --- a/build_stage1.sh +++ b/build_stage1.sh @@ -11,7 +11,8 @@ PACKAGES="iana-etc filesystem linux-api-headers tzdata ncurses readline bash joe attr acl gmp gdbm db perl openssl zlib pambase cracklib libtirpc pam libcap coreutils -util-linux" +util-linux e2fsprogs +expat bzip2 lz4 xz pcre less gzip tar libarchive curl" for p in $PACKAGES; do "$SCRIPT_DIR/build_stage1_package.sh" "$p" diff --git a/build_stage1_package.sh b/build_stage1_package.sh index f685ff3..775efe2 100755 --- a/build_stage1_package.sh +++ b/build_stage1_package.sh @@ -109,9 +109,9 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" - if test "$SYSROOT_INSTALL" = 1; then cd "$XTOOLS_ARCH/$TARGET_CPU-unknown-linux-gnu/sysroot" || exit 1 - sudo bsdtar xvf $STAGE1_CHROOT/packages/$TARGET_CPU/$PACKAGE-*.pkg.tar.xz + sudo bsdtar xf $STAGE1_CHROOT/packages/$TARGET_CPU/$PACKAGE-*.pkg.tar.xz if test "x$ADDITIONAL_INSTALL_PACKAGE" != "x"; then - sudo bsdtar xvf $STAGE1_CHROOT/packages/$TARGET_CPU/$ADDITIONAL_INSTALL_PACKAGE-*.pkg.tar.xz + sudo bsdtar xf $STAGE1_CHROOT/packages/$TARGET_CPU/$ADDITIONAL_INSTALL_PACKAGE-*.pkg.tar.xz fi cd "$STAGE1_BUILD/$PACKAGE" || exit 1 fi diff --git a/packages-i486-stage1/bzip2 b/packages-i486-stage1/bzip2 new file mode 100644 index 0000000..9329744 --- /dev/null +++ b/packages-i486-stage1/bzip2 @@ -0,0 +1,6 @@ +# bzip2 is needed for libarchive +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@\( \+\)make@\1make CC=$TARGET_ARCH-cc RANLIB=$TARGET_ARCH-ranlib AR=$TARGET_ARCH-ar@g" PKGBUILD + diff --git a/packages-i486-stage1/curl b/packages-i486-stage1/curl new file mode 100644 index 0000000..1c444d8 --- /dev/null +++ b/packages-i486-stage1/curl @@ -0,0 +1,25 @@ +# curl is needed for pacman +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD + +# build with minimal features, we don't need support for those protocols +# in stage1, basic http(s), ftp is enough (other protocols draw in quite +# some dependencies otherwise) +sed -i "/depends=/s/'krb5'//" PKGBUILD +sed -i "/depends=/s/'libssh2'//" PKGBUILD +sed -i '/--prefix=\/usr/ a \ --without-libssh2 \\' PKGBUILD +sed -i "/depends=/s/'libpsl'//" PKGBUILD +sed -i '/--prefix=\/usr/ a \ --without-libpsl \\' PKGBUILD +sed -i "/depends=/s/'libnghttp2'//" PKGBUILD +sed -i '/--prefix=\/usr/ a \ --without-nghttp2 \\' PKGBUILD +sed -i '/--prefix=\/usr/ a \ --without-gssapi \\' PKGBUILD + +# no ca-certificates, needs tons of tools to build (like p11-kit), so we +# create a fake one with certificates from the host +# TODO: is this LE/BE-safe? +# sed -i "/depends=/s/'ca-certificates'//" PKGBUILD + +# zsh, perl is used to create a completion file for curl and zsh +sed -i '/--prefix=\/usr/ a \ --without-zsh-functions-dir \\' PKGBUILD diff --git a/packages-i486-stage1/e2fsprogs b/packages-i486-stage1/e2fsprogs new file mode 100644 index 0000000..1995b5a --- /dev/null +++ b/packages-i486-stage1/e2fsprogs @@ -0,0 +1,2 @@ +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD diff --git a/packages-i486-stage1/expat b/packages-i486-stage1/expat new file mode 100644 index 0000000..e8c1341 --- /dev/null +++ b/packages-i486-stage1/expat @@ -0,0 +1,8 @@ +# expat is needed for libarchive +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD + +# TODO: ./configure: line 17309: program: command not found +# most likely a harmless error when probing for some documentation build tool diff --git a/packages-i486-stage1/gzip b/packages-i486-stage1/gzip new file mode 100644 index 0000000..2a024e0 --- /dev/null +++ b/packages-i486-stage1/gzip @@ -0,0 +1,5 @@ +# gzip is needed for libarchive, (z)less +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD diff --git a/packages-i486-stage1/less b/packages-i486-stage1/less new file mode 100644 index 0000000..a4c1acd --- /dev/null +++ b/packages-i486-stage1/less @@ -0,0 +1,3 @@ +# prepare configure for cross-compilation +sed -i "s@sh configure@sh configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD + diff --git a/packages-i486-stage1/libarchive b/packages-i486-stage1/libarchive new file mode 100644 index 0000000..0a42942 --- /dev/null +++ b/packages-i486-stage1/libarchive @@ -0,0 +1,5 @@ +# libarchive is needed for pacman +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD diff --git a/packages-i486-stage1/lz4 b/packages-i486-stage1/lz4 new file mode 100644 index 0000000..2dae4e8 --- /dev/null +++ b/packages-i486-stage1/lz4 @@ -0,0 +1,12 @@ +# lz4 is needed for libarchive +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@\( \+\)make@\1make CC=$TARGET_ARCH-cc RANLIB=$TARGET_ARCH-ranlib AR=$TARGET_ARCH-ar@g" PKGBUILD + +# lz4 has a git makedepends, diffutils for unit tests +sed -i 's@makedepends\(.*\)@#makedepends\1@g' PKGBUILD +sed -i 's@checkdepends\(.*\)@#checkdepends\1@g' PKGBUILD + + + diff --git a/packages-i486-stage1/pcre b/packages-i486-stage1/pcre new file mode 100644 index 0000000..8445c25 --- /dev/null +++ b/packages-i486-stage1/pcre @@ -0,0 +1,5 @@ +# pcre is needed for grep +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD diff --git a/packages-i486-stage1/tar b/packages-i486-stage1/tar new file mode 100644 index 0000000..420e179 --- /dev/null +++ b/packages-i486-stage1/tar @@ -0,0 +1,7 @@ +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD + +# 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) +# See `config.log' for more details +sed -i 's@./configure@FORCE_UNSAFE_CONFIGURE=1 ./configure@g' PKGBUILD diff --git a/packages-i486-stage1/util-linux b/packages-i486-stage1/util-linux index 7d4d941..38e4b24 100644 --- a/packages-i486-stage1/util-linux +++ b/packages-i486-stage1/util-linux @@ -1,7 +1,7 @@ # libutil-linux is needed for e2fsprogs SYSROOT_INSTALL=1 -# TODO: install two packages libutil-linux util-linux +# install two packages: libutil-linux and util-linux ADDITIONAL_INSTALL_PACKAGE=libutil-linux # prepare configure for cross-compilation diff --git a/packages-i486-stage1/xz b/packages-i486-stage1/xz new file mode 100644 index 0000000..6b043fe --- /dev/null +++ b/packages-i486-stage1/xz @@ -0,0 +1,8 @@ +# xz is needed for libarchive +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD + +# with gcc 7.2 we get new errors, disable termination on warnings +sed -i 's@--enable-werror@--disable-werror@g' PKGBUILD -- cgit v1.2.3-70-g09d2