Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-01-28 21:39:15 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-01-28 21:39:15 +0100
commiteeefbe0d6b4f602b6e70d093b287aed8b5e9501f (patch)
tree1eb850e38e4c53da4f161275085c52fd60c40145
parent7478bb7a8eaefdd53e26372810d8580b8509b0c7 (diff)
some more packages, readline fails, no clue
-rw-r--r--README14
-rwxr-xr-xbuild_stage1.sh3
-rwxr-xr-xbuild_stage1_package.sh31
-rw-r--r--default.conf9
-rw-r--r--packages-i486-stage1/linux-api-headers4
-rw-r--r--packages-i486-stage1/ncurses4
-rw-r--r--packages-i486-stage1/readline6
-rw-r--r--packages-i486-stage1/uinit1
-rwxr-xr-xprepare_stage1_repo.sh5
9 files changed, 51 insertions, 26 deletions
diff --git a/README b/README
index 4c800ba..5f97f94 100644
--- a/README
+++ b/README
@@ -163,7 +163,7 @@ su cross ./create_ca-certificates-utils_shim.sh
# basic packages
-PACKAGES="iana-etc filesystem linux-api-headers tzdata ncurses readline bash \
+PACKAGES=" bash \
joe \
attr acl gmp gdbm db perl openssl pambase zlib cracklib libtirpc pam libcap coreutils
util-linux e2fsprogs \
@@ -178,7 +178,6 @@ libedit openssh \
sysfsutils libidn nettle iputils"
# libunwind
-# for ncurses, readline for bash
# attr for acl
# gdbm, db for perl
# libtirpc for pam
@@ -195,7 +194,7 @@ sysfsutils libidn nettle iputils"
# libmnl, libelf, iptables for iproute2
# libedit for openssh
# sysfsutils and libidn, nettle for iputils
-SYSROOT_PACKAGES="ncurses readline attr acl gmp gdbm db zlib cracklib libtirpc pam libcap openssl \
+SYSROOT_PACKAGES=" attr acl gmp gdbm db 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,14 +205,6 @@ libedit sysfsutils libidn"
# special patches for some packages
###################################
-# linux-api-headers
-sed -i 's@make@make ARCH=i386 CROSS_COMPILE=$HOME/x-tools/i486-unknown-linux-gnu/bin/i486-unknown-linux-gnu-@g' linux-api-headers/PKGBUILD
-
-# ncurses
-sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' ncurses/PKGBUILD
-
-# readline
-sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' readline/PKGBUILD
# bash
sed -i 's@./configure@./configure --host=i486-unknown-linux-gnu --build=x86_64-pc-linux-gnu@g' bash/PKGBUILD
@@ -347,6 +338,7 @@ sed -i 's@source=(@source=(coreutils-8.28-noman.patch @' coreutils/PKGBUILD
sed -i "s@md5sums=(@md5sums=('SKIP' @" coreutils/PKGBUILD
# util-linux
+# TODO: in statage1 build script install additional packages: for util-linux also libutil-linux
# disable some dependencies on systemd, python, libcap-ng
sed -i 's@makedepends\(.*\)@#makedepends\1@g' util-linux/PKGBUILD
sed -i 's@ \+depends\(.*\)@#depends\1@g' util-linux/PKGBUILD
diff --git a/build_stage1.sh b/build_stage1.sh
index 33ad94b..525d4cd 100755
--- a/build_stage1.sh
+++ b/build_stage1.sh
@@ -7,7 +7,8 @@
# for cross-compiling packages will be installed with bsdtar into
# the sysroot of the specific cross compiler in $XTOOLS_ARCH
-PACKAGES="iana-etc filesystem tzdata"
+PACKAGES="iana-etc filesystem linux-api-headers tzdata
+ncurses readline"
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 060a582..bd2de31 100755
--- a/build_stage1_package.sh
+++ b/build_stage1_package.sh
@@ -15,29 +15,28 @@ export PATH="$XTOOLS_ARCH/bin:${PATH}"
. "$SCRIPT_DIR/packages-$TARGET_CPU-stage1/template"
-if test $(pacman --noconfirm --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 | grep -c "$PACKAGE") = 0; then
echo "Building package $PACKAGE."
cd $STAGE1_BUILD || exit 1
rm -rf "$PACKAGE"
-
- # source the package specific configuration
-
- PACKAGE_CONF="$SCRIPT_DIR/packages-$TARGET_CPU-stage1/$PACKAGE"
- if test -f "$PACKAGE_CONF"; then
- . "$PACKAGE_CONF"
- fi
- # get the package build description
-
+ 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 =)
+ fi
if test "$NEEDS_YAOURT"; then
yaourt -G "$PACKAGE"
else
asp export "$PACKAGE"
fi
+
cd "$PACKAGE" || exit 1
+ # 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)
DIFF_PKGBUILD="$ARCHLINUX32_PACKAGES/core/$PACKAGE/PKGBUILD"
@@ -45,7 +44,12 @@ if test $(pacman --noconfirm --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAG
cat "$DIFF_PKGBUILD" >> PKGBUILD
fi
- sed -i "/^arch=[^#]*any/!{/^arch=(/s/(/($TARGET_CPU /}" PKGBUILD
+ # source package descriptions, sets variables for this script
+ # and executes whatever is needed to build the package
+
+ if test -f "$PACKAGE_CONF"; then
+ . "$PACKAGE_CONF"
+ fi
if test "$NOPARALLEL_BUILD" = 0; then
CPUS=$(nproc)
@@ -70,13 +74,14 @@ if test $(pacman --noconfirm --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAG
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
- # for util-linux also libutil-linux
+ # 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"
+ sudo bsdtar xvf $STAGE1_CHROOT/packages/$TARGET_CPU/$PACKAGE-*.pkg.tar.xz
cd "$STAGE1_BUILD/$PACKAGE" || exit 1
fi
diff --git a/default.conf b/default.conf
index 81b913d..02d529b 100644
--- a/default.conf
+++ b/default.conf
@@ -1,5 +1,8 @@
# configuration
+# build platform (the host)
+BUILD_ARCH=x86_64-pc-linux-gnu
+
# target architecture
TARGET_ARCH=i486-unknown-linux-gnu
@@ -15,6 +18,12 @@ XTOOLS_HOME=$CROSS_HOME/x-tools
# where is the cross compiler of our target architecture installed
XTOOLS_ARCH=$XTOOLS_HOME/$TARGET_ARCH
+# full prefix of the cross compilation tools
+XTOOLS_ARCH_PREFIX=$XTOOLS_ARCH/bin/$TARGET_ARCH-
+
+# kernel architecture
+KERNEL_ARCH=i386
+
# the chroot of stage 1
STAGE1_CHROOT=$CROSS_HOME/$TARGET_CPU-root
diff --git a/packages-i486-stage1/linux-api-headers b/packages-i486-stage1/linux-api-headers
new file mode 100644
index 0000000..2b9a2e2
--- /dev/null
+++ b/packages-i486-stage1/linux-api-headers
@@ -0,0 +1,4 @@
+# the Linux kernel has it's own way for cross compilations, we need
+# only the header files for glibc later, but it's better to make sure
+# to pick the correct target archicture right away
+sed -i "s@make@make ARCH=$KERNEL_ARCH CROSS_COMPILE=$XTOOLS_ARCH_PREFIX@g" PKGBUILD
diff --git a/packages-i486-stage1/ncurses b/packages-i486-stage1/ncurses
new file mode 100644
index 0000000..e0508d6
--- /dev/null
+++ b/packages-i486-stage1/ncurses
@@ -0,0 +1,4 @@
+# ncurses is needed by bash
+SYSROOT_INSTALL=1
+
+sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD
diff --git a/packages-i486-stage1/readline b/packages-i486-stage1/readline
new file mode 100644
index 0000000..0edad31
--- /dev/null
+++ b/packages-i486-stage1/readline
@@ -0,0 +1,6 @@
+# libreadline is needed by bash
+SYSROOT_INSTALL=1
+
+NOPARALLEL_BUILD=1
+
+sed -i "s@./configure@./configure --host=$TARGET_ARCH --build=$BUILD_ARCH@g" PKGBUILD
diff --git a/packages-i486-stage1/uinit b/packages-i486-stage1/uinit
index 6818abe..34a987d 100644
--- a/packages-i486-stage1/uinit
+++ b/packages-i486-stage1/uinit
@@ -1 +1,2 @@
+# uinit as temporary systemd replacement for PID 1, lives in the AUR
NEEDS_YAOURT=1
diff --git a/prepare_stage1_repo.sh b/prepare_stage1_repo.sh
index d7df4e2..1596b74 100755
--- a/prepare_stage1_repo.sh
+++ b/prepare_stage1_repo.sh
@@ -23,6 +23,9 @@ if test ! -d $STAGE1_CHROOT; then
# into the chroot
cp /etc/pacman.conf $STAGE1_CHROOT/etc/.
+
+ sed -i '/\[archlinuxfr\]/,// d' $STAGE1_CHROOT/etc/pacman.conf
+ sed -i '/\[multilib\]/,// d' $STAGE1_CHROOT/etc/pacman.conf
sed -i 's@^Architecture.*@Architecture = i486@g' $STAGE1_CHROOT/etc/pacman.conf
@@ -81,7 +84,7 @@ if test ! -d $STAGE1_BUILD; then
sed -i "s@^CHOST=.*@CHOST=\"${TARGET_ARCH}\"@" makepkg-i486.conf
CPUS=$(nproc)
sed -i "s@^#MAKEFLAGS=.*@MAKEFLAGS=\"-j$CPUS\"@" makepkg-i486.conf
- sed -i "s@-march=x86-64 -mtune=generic @-march=i486 @" makepkg-i486.conf
+ sed -i "s@-march=x86-64 -mtune=generic @@" makepkg-i486.conf
echo "Prepared the stage 1 build environment."
fi