From 96306251769086a8e9ff933d2d7d1560bf55df7b Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 30 Jan 2018 21:27:25 +0100 Subject: building up to perl, perl itself fails --- README | 56 ++++--------------------------------------- build_stage1.sh | 3 ++- build_stage1_package.sh | 4 ++-- default.conf | 2 +- packages-i486-stage1/acl | 6 +++++ packages-i486-stage1/attr | 8 +++++++ packages-i486-stage1/bash | 2 ++ packages-i486-stage1/db | 5 ++++ packages-i486-stage1/gdbm | 5 ++++ packages-i486-stage1/gmp | 8 +++++++ packages-i486-stage1/joe | 2 ++ packages-i486-stage1/ncurses | 1 + packages-i486-stage1/perl | 22 +++++++++++++++++ packages-i486-stage1/readline | 3 +-- 14 files changed, 70 insertions(+), 57 deletions(-) create mode 100644 packages-i486-stage1/acl create mode 100644 packages-i486-stage1/attr create mode 100644 packages-i486-stage1/bash create mode 100644 packages-i486-stage1/db create mode 100644 packages-i486-stage1/gdbm create mode 100644 packages-i486-stage1/gmp create mode 100644 packages-i486-stage1/joe diff --git a/README b/README index 5f97f94..f1ab1f6 100644 --- a/README +++ b/README @@ -163,9 +163,8 @@ su cross ./create_ca-certificates-utils_shim.sh # basic packages -PACKAGES=" bash \ -joe \ -attr acl gmp gdbm db perl openssl pambase zlib cracklib libtirpc pam libcap coreutils +PACKAGES=" \ + openssl pambase zlib cracklib libtirpc pam libcap coreutils util-linux e2fsprogs \ expat bzip2 lz4 xz pcre less gzip tar libarchive curl ca-certificates-utils \ archlinux-keyring archlinux32-keyring pacman-mirrorlist pacman \ @@ -178,23 +177,21 @@ libedit openssh \ sysfsutils libidn nettle iputils" # libunwind -# attr for acl -# gdbm, db for perl # libtirpc for pam # zlib for cracklib # cracklib, pam for libcap -# gmp, openssl, libcap for coreutils +# openssl, libcap for coreutils # zlib for cracklib # libutil-linux and util-linux for e2fsprogs # expat, bzip2, lz4, xz for libarchive # libarchive, curl for pacman # file (libmagic) for ... -# gmp, mpfr for gawk, gcc +# mpfr for gawk, gcc # libnfnetlink for iptables # libmnl, libelf, iptables for iproute2 # libedit for openssh # sysfsutils and libidn, nettle for iputils -SYSROOT_PACKAGES=" attr acl gmp gdbm db zlib cracklib libtirpc pam libcap openssl \ +SYSROOT_PACKAGES="zlib cracklib libtirpc pam libcap openssl \ libutil-linux util-linux \ expat bzip2 lz4 xz pcre gzip libarchive curl \ file libmpc mpfr libmnl libelf libnfnetlink iptables \ @@ -206,16 +203,8 @@ libedit sysfsutils libidn" ################################### -# bash -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' bash/PKGBUILD -# joe -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' joe/PKGBUILD -# gmp -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' gmp/PKGBUILD -# remove explicit CHOST for build host -sed -i 's@--build=${CHOST}@@g' gmp/PKGBUILD # libcap sed -i 's@KERNEL_HEADERS=/usr/include@BUILD_CC=gcc CC=i486-unknown-linux-gnu-gcc AR=i486-unknown-linux-gnu-ar RANLIB=i486-unknown-linux-gnu-ranlib KERNEL_HEADERS=/usr/include@' libcap/PKGBUILD @@ -235,42 +224,7 @@ sed -i '2!N; /prepare() *{ *\n *cd/ a \ patch -Np1 < ${srcdir}/libcap-2.25-gper # #include # => add pam as dependency and build it -# attr -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' attr/PKGBUILD -# no gettext -sed -i 's@^makedepends\(.*\)@#makedepends\1@g' attr/PKGBUILD - -# acl -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' acl/PKGBUILD - -# gdbm -#??? https://how-to-build-for-arm.wikispaces.com/gdbm: really needed? we should have configure support -# let's try configure: -sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' gdbm/PKGBUILD -# db -sed -i 's@\.\./dist/configure@../dist/configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' db/PKGBUILD - -# perl -# the official cross-compilation support in Perl is weird and needs a -# running remote SSH access to the real machine: -# https://stackoverflow.com/questions/5464538/cross-compile-perl-for-arm -# -# we go with https://arsv.github.io/perl-cross/ -sed -i '/source=/ a\ https://github.com/arsv/perl-cross/releases/download/1.1.8/perl-cross-1.1.8.tar.gz' perl/PKGBUILD -sed -i "/md5sums=/ a\ 'SKIP'" perl/PKGBUILD -sed -i '1!N; /prepare() *{\n *cd/ a \ tar --strip-components=1 -zxf ${srcdir}/perl-cross-1.1.8.tar.gz' perl/PKGBUILD -sed -i 's@./Configure -des@./configure --target=i486-unknown-linux-gnu@' perl/PKGBUILD -#rm: cannot remove '/home/cross/build/perl/pkg/perl/usr/bin/perl5.26.1': No such file or directory -sed -i 's@\(rm "$pkgdir/usr/bin/perl$pkgver\)@#\1@g' perl/PKGBUILD -# the hook fails as we lack some findtools and sed -# pacman does not have a --no-execute-hooks mode -#Can't open /dev/null: No such file or directory -#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 8: find: command not found -#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 19: pacman: command not found -#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 19: wc: command not found -#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 25: wc: command not found -#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 13: sed: command not found # openssl sed -i "s@'i686'@'i486'@g" openssl/PKGBUILD diff --git a/build_stage1.sh b/build_stage1.sh index 525d4cd..f445e54 100755 --- a/build_stage1.sh +++ b/build_stage1.sh @@ -8,7 +8,8 @@ # the sysroot of the specific cross compiler in $XTOOLS_ARCH PACKAGES="iana-etc filesystem linux-api-headers tzdata -ncurses readline" +ncurses readline bash joe +attr acl gmp gdbm db perl" 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 2fe6bc1..ddb3645 100755 --- a/build_stage1_package.sh +++ b/build_stage1_package.sh @@ -15,12 +15,12 @@ export PATH="$XTOOLS_ARCH/bin:${PATH}" . "$SCRIPT_DIR/packages-$TARGET_CPU-stage1/template" -if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Q | grep -c "$PACKAGE") = 0; then +if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Q | cut -f 1 -d ' ' | grep -c "^${PACKAGE}$") = 0; then echo "Building package $PACKAGE." cd $STAGE1_BUILD || exit 1 - rm -rf "$PACKAGE" + sudo rm -rf "$PACKAGE" rm -f $STAGE1_PACKAGES/$PACKAGE-*pkg.tar.xz PACKAGE_CONF="$SCRIPT_DIR/packages-$TARGET_CPU-stage1/$PACKAGE" diff --git a/default.conf b/default.conf index 7e7d626..c177825 100644 --- a/default.conf +++ b/default.conf @@ -41,7 +41,7 @@ GIT_URL_ARCHLINUX32_PACKAGES=https://github.com/archlinux32/packages.git ARCHLINUX32_PACKAGES=$CROSS_HOME/packages32 # uncomment to debug scripts -set -x +#set -x # some default variables, not to be changed SCRIPT=$(sudo realpath -s "$0") diff --git a/packages-i486-stage1/acl b/packages-i486-stage1/acl new file mode 100644 index 0000000..f34036f --- /dev/null +++ b/packages-i486-stage1/acl @@ -0,0 +1,6 @@ +# acl is needed by almost all packages dealing with the filesystem, most +# prominently 'coreutils' +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/attr b/packages-i486-stage1/attr new file mode 100644 index 0000000..dfe2f65 --- /dev/null +++ b/packages-i486-stage1/attr @@ -0,0 +1,8 @@ +# attr is needed by acl +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD + +# no gettext +sed -i 's@^makedepends\(.*\)@#makedepends\1@g' PKGBUILD diff --git a/packages-i486-stage1/bash b/packages-i486-stage1/bash new file mode 100644 index 0000000..8ed7de8 --- /dev/null +++ b/packages-i486-stage1/bash @@ -0,0 +1,2 @@ +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD diff --git a/packages-i486-stage1/db b/packages-i486-stage1/db new file mode 100644 index 0000000..fe5a83a --- /dev/null +++ b/packages-i486-stage1/db @@ -0,0 +1,5 @@ +# db is needed by perl +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@\.\./dist/configure@../dist/configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD diff --git a/packages-i486-stage1/gdbm b/packages-i486-stage1/gdbm new file mode 100644 index 0000000..73ce19a --- /dev/null +++ b/packages-i486-stage1/gdbm @@ -0,0 +1,5 @@ +# gdbm is needed by perl +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/gmp b/packages-i486-stage1/gmp new file mode 100644 index 0000000..73a6530 --- /dev/null +++ b/packages-i486-stage1/gmp @@ -0,0 +1,8 @@ +# gmp is needed by coreutils (later for gawk, gcc) +SYSROOT_INSTALL=1 + +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD + +# remove explicit CHOST for build host +sed -i 's@--build=${CHOST}@@g' PKGBUILD diff --git a/packages-i486-stage1/joe b/packages-i486-stage1/joe new file mode 100644 index 0000000..8ed7de8 --- /dev/null +++ b/packages-i486-stage1/joe @@ -0,0 +1,2 @@ +# prepare configure for cross-compilation +sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD diff --git a/packages-i486-stage1/ncurses b/packages-i486-stage1/ncurses index e0508d6..f74cd4e 100644 --- a/packages-i486-stage1/ncurses +++ b/packages-i486-stage1/ncurses @@ -1,4 +1,5 @@ # ncurses is needed by bash 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/perl b/packages-i486-stage1/perl index 1225990..6626e6b 100644 --- a/packages-i486-stage1/perl +++ b/packages-i486-stage1/perl @@ -1,2 +1,24 @@ # cross-compiling perl doesn't work in parallel NOPARALLEL_BUILD=1 + +# the official cross-compilation support in Perl is weird and needs a +# running remote SSH access to the real machine: +# https://stackoverflow.com/questions/5464538/cross-compile-perl-for-arm +# +# we go with https://arsv.github.io/perl-cross/ +sed -i '/source=/ a\ https://github.com/arsv/perl-cross/releases/download/1.1.8/perl-cross-1.1.8.tar.gz' PKGBUILD +sed -i "/md5sums=/ a\ 'SKIP'" PKGBUILD +sed -i '1!N; /prepare() *{\n *cd/ a \ tar --strip-components=1 -zxf ${srcdir}/perl-cross-1.1.8.tar.gz' PKGBUILD +sed -i "s@./Configure -des@./configure --target=$TARGET_ARCH@" PKGBUILD + +# rm: cannot remove '/home/cross/build/perl/pkg/perl/usr/bin/perl5.26.1': No such file or directory +sed -i 's@\(rm "$pkgdir/usr/bin/perl$pkgver\)@#\1@g' PKGBUILD + +# the hook fails as we lack some findtools and sed +# pacman does not have a --no-execute-hooks mode +#Can't open /dev/null: No such file or directory +#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 8: find: command not found +#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 19: pacman: command not found +#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 19: wc: command not found +#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 25: wc: command not found +#/usr/share/libalpm/scripts/detect-old-perl-modules.sh: line 13: sed: command not found diff --git a/packages-i486-stage1/readline b/packages-i486-stage1/readline index 0edad31..205f8d5 100644 --- a/packages-i486-stage1/readline +++ b/packages-i486-stage1/readline @@ -1,6 +1,5 @@ # libreadline is needed by bash SYSROOT_INSTALL=1 -NOPARALLEL_BUILD=1 - +# prepare configure for cross-compilation sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD -- cgit v1.2.3