summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README44
-rwxr-xr-xbuild_stage1.sh3
-rwxr-xr-xbuild_stage1_package.sh29
-rw-r--r--packages-i486-stage1/cracklib11
-rw-r--r--packages-i486-stage1/libtirpc19
-rw-r--r--packages-i486-stage1/openssl12
-rw-r--r--packages-i486-stage1/pambase2
-rw-r--r--packages-i486-stage1/zlib6
-rw-r--r--patches-i486-stage1/libtirpc-1.0.2-stdint.patch11
9 files changed, 93 insertions, 44 deletions
diff --git a/README b/README
index f1ab1f6..0259cdb 100644
--- a/README
+++ b/README
@@ -164,7 +164,7 @@ su cross ./create_ca-certificates-utils_shim.sh
# basic packages
PACKAGES=" \
- openssl pambase zlib cracklib libtirpc pam libcap coreutils
+ 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 \
@@ -177,11 +177,8 @@ libedit openssh \
sysfsutils libidn nettle iputils"
# libunwind
-# libtirpc for pam
-# zlib for cracklib
-# cracklib, pam for libcap
-# openssl, libcap for coreutils
-# zlib for cracklib
+# pam for libcap
+# libcap for coreutils
# libutil-linux and util-linux for e2fsprogs
# expat, bzip2, lz4, xz for libarchive
# libarchive, curl for pacman
@@ -191,7 +188,7 @@ sysfsutils libidn nettle iputils"
# libmnl, libelf, iptables for iproute2
# libedit for openssh
# sysfsutils and libidn, nettle for iputils
-SYSROOT_PACKAGES="zlib cracklib libtirpc pam libcap openssl \
+SYSROOT_PACKAGES=" pam libcap \
libutil-linux util-linux \
expat bzip2 lz4 xz pcre gzip libarchive curl \
file libmpc mpfr libmnl libelf libnfnetlink iptables \
@@ -226,40 +223,7 @@ sed -i '2!N; /prepare() *{ *\n *cd/ a \ patch -Np1 < ${srcdir}/libcap-2.25-gper
-# openssl
-sed -i "s@'i686'@'i486'@g" openssl/PKGBUILD
-# https://how-to-build-for-arm.wikispaces.com/openssl
-sed -i "s@'linux-elf'@'linux-generic32'@g" openssl/PKGBUILD
-sed -i 's@shared no-ssl3-method ${optflags}@shared ${optflags}@' openssl/PKGBUILD
-sed -i "s@make@make TARGETMACH=i486-unknown-linux-gnu BUILDMACH=x86_64-pc-linux-gnu CROSS=i486-unknown-linux-gnu CC=i486-unknown-linux-gnu-cc LD=i486-unknown-linux-gnu-ld AS=i486-unknown-linux-gnu-as@g" openssl/PKGBUILD
-# TODO: bc is needed in the chroot to rebuild bc later, either build bc
-# inside chroot or cross-compile here
-# zlib
-sed -i '1!N; /autoreconf.*\n/ s@./configure@./configure -host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@' zlib/PKGBUILD
-sed -i "s@make@make TARGETMACH=i486-unknown-linux-gnu BUILDMACH=x86_64-pc-linux-gnu CROSS=i486-unknown-linux-gnu CC=i486-unknown-linux-gnu-cc LD=i486-unknown-linux-gnu-ld AS=i486-unknown-linux-gnu-as@g" zlib/PKGBUILD
-
-# cracklib
-sed -i 's@./configure@./configure -host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@' cracklib/PKGBUILD
-# the dictionary cannot be created while packaging by calling the cross-compiled tool!
-# we are not interested in an actually running cracklib doing some security checks, just in the library
-#./util/cracklib-packer: line 117: /home/cross/build/cracklib/src/cracklib-2.9.6/util/.libs/lt-cracklib-packer: No such file or directory
-sed -i 's/\( \+sh\)/#\1/g' cracklib/PKGBUILD
-sed -i 's/\( \+ | sh\)/#\1/g' cracklib/PKGBUILD
-
-# libtirpc
-sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' libtirpc/PKGBUILD
-# disable Kerberos
-sed -i "/depends=/s/'krb5'//" libtirpc/PKGBUILD
-# gssapi seems also to be a dependency, not in PKBUILD, disable it
-sed -i 's@./configure@./configure --disable-gssapi@g' libtirpc/PKGBUILD
-# doens't really like to be cross-compiled..
-# xdr_sizeof.c:93:13: error: 'uintptr_t' undeclared (first use in this function); did you mean '__intptr_t'?
-# => https://bugzilla.redhat.com/show_bug.cgi?id=1482063
-# => libtirpc-1.0.2-stdint.patch
-sed -i 's@source=(@source=(libtirpc-1.0.2-stdint.patch @' libtirpc/PKGBUILD
-sed -i "s@sha1sums=(@sha1sums=('0322752c231884c5434b4e56a3c376d7bfedf9d9' @" libtirpc/PKGBUILD
-sed -i '/build()/ i \ prepare() { \n\ cd ${pkgname}-${pkgver}\n\ patch -Np1 < ${srcdir}/libtirpc-1.0.2-stdint.patch \n }' libtirpc/PKGBUILD
# pam
# no flex, w3m, docboox-xml/xsl (no docu and take flex from the host)
diff --git a/build_stage1.sh b/build_stage1.sh
index f445e54..9cf932e 100755
--- a/build_stage1.sh
+++ b/build_stage1.sh
@@ -9,7 +9,8 @@
PACKAGES="iana-etc filesystem linux-api-headers tzdata
ncurses readline bash joe
-attr acl gmp gdbm db perl"
+attr acl gmp gdbm db perl openssl
+zlib pambase cracklib libtirpc"
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 d37a611..7513611 100755
--- a/build_stage1_package.sh
+++ b/build_stage1_package.sh
@@ -11,8 +11,12 @@ fi
PACKAGE=$1
+# set PATH to use the proper cross-compiler binaries
+
export PATH="$XTOOLS_ARCH/bin:${PATH}"
+# draw in default values for build variables
+
. "$SCRIPT_DIR/packages-$TARGET_CPU-stage1/template"
if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Q | cut -f 1 -d ' ' | grep -c "^${PACKAGE}$") = 0; then
@@ -20,9 +24,14 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
cd $STAGE1_BUILD || exit 1
+ # clean up old build
+
sudo rm -rf "$PACKAGE"
rm -f $STAGE1_PACKAGES/$PACKAGE-*pkg.tar.xz
+ # check out the package build information from the upstream git rep
+ # 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 =)
@@ -38,8 +47,8 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
# attach our destination platform to be a supported architecture
sed -i "/^arch=[^#]*any/!{/^arch=(/s/(/($TARGET_CPU /}" PKGBUILD
- # if exists packages32 diff-PKGBUILD, attach at the end
- # (we assume, we build only 'core' packages)
+ # if there is a packages32 diff-PKGBUILD, attach it at the end
+ # (we assume, we build only 'core' packages during stage1)
DIFF_PKGBUILD="$ARCHLINUX32_PACKAGES/core/$PACKAGE/PKGBUILD"
if test -f "$DIFF_PKGBUILD"; then
cat "$DIFF_PKGBUILD" >> PKGBUILD
@@ -51,7 +60,12 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
if test -f "$PACKAGE_CONF"; then
. "$PACKAGE_CONF"
fi
+
+ # copy bigger patches into the build area
+ cp $SCRIPT_DIR/patches-$TARGET_CPU-stage1/$PACKAGE-*.patch .
+ # disable or enable parallel builds
+
if test "$NOPARALLEL_BUILD" = 0; then
CPUS=$(nproc)
else
@@ -59,6 +73,8 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
fi
sed -i "s@^.*MAKEFLAGS=.*@MAKEFLAGS=\"-j$CPUS\"@" $STAGE1_BUILD/makepkg-$TARGET_CPU.conf
+ # building the actual package
+
$STAGE1_BUILD/makepkg-$TARGET_CPU -C --config $STAGE1_BUILD/makepkg-$TARGET_CPU.conf \
--skipchecksums --skippgpcheck --nocheck > "$PACKAGE.log" 2>&1
RES=$?
@@ -66,20 +82,27 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
tail "$PACKAGE.log"
if test $RES = 0; then
+
+ # copy to our package folder in the first stage chroot
+
rm -f ./*debug*.pkg.tar.xz
cp -v ./*.pkg.tar.xz $STAGE1_CHROOT/packages/$TARGET_CPU/.
- # redo the whole cache
+ # redo the whole pacman cache and repo (always running into trouble
+ # there, packages seem to reappear in old versions)
+
rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
repo-add $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
# install into chroot via pacman
+
sudo pacman --noconfirm --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Syy "$PACKAGE"
pacman --noconfirm --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Q
# optionally install into cross-compiler sysroot with bsdtar
+
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
diff --git a/packages-i486-stage1/cracklib b/packages-i486-stage1/cracklib
new file mode 100644
index 0000000..318e22a
--- /dev/null
+++ b/packages-i486-stage1/cracklib
@@ -0,0 +1,11 @@
+# cracklib is needed by pam
+SYSROOT_INSTALL=1
+
+# prepare configure for cross-compilation
+sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD
+
+# the dictionary cannot be created while packaging by calling the cross-compiled tool!
+# we are not interested in an actually running cracklib doing some security checks, just in the library
+#./util/cracklib-packer: line 117: /home/cross/build/cracklib/src/cracklib-2.9.6/util/.libs/lt-cracklib-packer: No such file or directory
+sed -i 's/\( \+sh\)/#\1/g' PKGBUILD
+sed -i 's/\( \+ | sh\)/#\1/g' PKGBUILD
diff --git a/packages-i486-stage1/libtirpc b/packages-i486-stage1/libtirpc
new file mode 100644
index 0000000..58b2b4f
--- /dev/null
+++ b/packages-i486-stage1/libtirpc
@@ -0,0 +1,19 @@
+# libtirpc is needed by pam
+SYSROOT_INSTALL=1
+
+# prepare configure for cross-compilation
+sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD
+
+# 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
+
+# doens't really like to be cross-compiled..
+# xdr_sizeof.c:93:13: error: 'uintptr_t' undeclared (first use in this function); did you mean '__intptr_t'?
+# => https://bugzilla.redhat.com/show_bug.cgi?id=1482063
+# => libtirpc-1.0.2-stdint.patch
+sed -i 's@source=(@source=(libtirpc-1.0.2-stdint.patch @' PKGBUILD
+sed -i "s@sha1sums=(@sha1sums=('0322752c231884c5434b4e56a3c376d7bfedf9d9' @" PKGBUILD
+sed -i '/build()/ i \ prepare() { \n\ cd ${pkgname}-${pkgver}\n\ patch -Np1 < ${srcdir}/libtirpc-1.0.2-stdint.patch \n }' PKGBUILD
diff --git a/packages-i486-stage1/openssl b/packages-i486-stage1/openssl
new file mode 100644
index 0000000..6e67468
--- /dev/null
+++ b/packages-i486-stage1/openssl
@@ -0,0 +1,12 @@
+# openssl is needed for a lot of packages, most prominently for 'coreutils'
+SYSROOT_INSTALL=1
+
+# prepare configure for cross-compilation
+# see https://how-to-build-for-arm.wikispaces.com/openssl
+sed -i "s@'i686'@'$TARGET_CPU'@g" PKGBUILD
+sed -i "s@'linux-elf'@'linux-generic32'@g" PKGBUILD
+sed -i 's@shared no-ssl3-method ${optflags}@shared ${optflags}@' PKGBUILD
+sed -i "s@make@make TARGETMACH=$TARGET_ARCH BUILDMACH=$BUILD_ARCH CROSS=$TARGET_ARCH CC=$TARGET_ARCH-cc LD=$TARGET_ARCH-ld AS=$TARGET_ARCH-as@g" PKGBUILD
+
+# TODO: bc is needed in the chroot to rebuild bc later, either build bc
+# inside chroot or cross-compile here
diff --git a/packages-i486-stage1/pambase b/packages-i486-stage1/pambase
new file mode 100644
index 0000000..5cdb578
--- /dev/null
+++ b/packages-i486-stage1/pambase
@@ -0,0 +1,2 @@
+# pambase is needed by pam
+SYSROOT_INSTALL=1
diff --git a/packages-i486-stage1/zlib b/packages-i486-stage1/zlib
new file mode 100644
index 0000000..32df420
--- /dev/null
+++ b/packages-i486-stage1/zlib
@@ -0,0 +1,6 @@
+# zlib is needed by cracklib, binutils, curl, file, libarchive, ...
+SYSROOT_INSTALL=1
+
+# prepare configure for cross-compilation
+sed -i "1!N; /autoreconf.*\n/ s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@" PKGBUILD
+sed -i "s@make@make TARGETMACH=$TARGET_ARCH BUILDMACH=$BUILD_ARCH CROSS=$TARGET_ARCH CC=$TARGET_ARCH-cc LD=$TARGET_ARCH-ld AS=$TARGET_ARCH-as@g" PKGBUILD
diff --git a/patches-i486-stage1/libtirpc-1.0.2-stdint.patch b/patches-i486-stage1/libtirpc-1.0.2-stdint.patch
new file mode 100644
index 0000000..5d65359
--- /dev/null
+++ b/patches-i486-stage1/libtirpc-1.0.2-stdint.patch
@@ -0,0 +1,11 @@
+diff -rauN libtirpc-1.0.2/src/xdr_sizeof.c libtirpc-1.0.2-stdint-patch/src/xdr_sizeof.c
+--- libtirpc-1.0.2/src/xdr_sizeof.c 2017-07-05 17:02:23.000000000 +0200
++++ libtirpc-1.0.2-stdint-patch/src/xdr_sizeof.c 2017-12-18 21:54:34.938360673 +0100
+@@ -39,6 +39,7 @@
+ #include <rpc/xdr.h>
+ #include <sys/types.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include "un-namespace.h"
+
+ /* ARGSUSED */