Add Guix step including bootstrap bin, build guix, build iso and fix some small bug

This commit is contained in:
vxtls 2026-02-28 19:19:18 -05:00
parent fb146bbf97
commit 3178f1f9e0
36 changed files with 890 additions and 7 deletions

View file

@ -0,0 +1,23 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/bash-4.4.23-1"
src_configure() {
./configure \
--prefix="${SEED_PREFIX}" \
--without-bash-malloc \
--disable-nls \
--enable-static-link \
--build="${TARGET}" \
bash_cv_dev_stdin=absent \
bash_cv_dev_fd=whacky
}
src_compile() {
make -j1
}
src_install() {
install -D -m 0755 bash "${DESTDIR}${SEED_PREFIX}/bin/bash"
ln -sf bash "${DESTDIR}${SEED_PREFIX}/bin/sh"
}

View file

@ -0,0 +1 @@
f https://ftp.gnu.org/gnu/bash/bash-4.4.tar.gz d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb

View file

@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/bzip2-1.0.6"
src_configure() {
:
}
src_compile() {
make "${MAKEJOBS}" CFLAGS="-O2" LDFLAGS="-static"
}
src_install() {
make PREFIX="${SEED_PREFIX}" DESTDIR="${DESTDIR}" install
}

View file

@ -0,0 +1 @@
f https://sourceware.org/pub/bzip2/bzip2-1.0.6.tar.gz a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd

View file

@ -0,0 +1,23 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/coreutils-8.30"
src_configure() {
FORCE_UNSAFE_CONFIGURE=1 ./configure \
--prefix="${SEED_PREFIX}" \
--disable-nls \
--disable-silent-rules \
--enable-no-install-program=stdbuf,libstdbuf.so \
CFLAGS="-Os -g0" \
LDFLAGS="-static -pthread" \
gl_cv_func_getcwd_path_max="no, but it is partly working" \
gl_cv_prog_perl="no"
}
src_compile() {
make "${MAKEJOBS}" MAKEINFO=true GPERF=true
}
src_install() {
make DESTDIR="${DESTDIR}" MAKEINFO=true install
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/coreutils/coreutils-8.30.tar.xz e831b3a86091496cdba720411f9748de81507798f6130adeaef872d206e1b057

View file

@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/gawk-4.2.1"
src_prepare() {
default
}
src_configure() {
CFLAGS="-O2" LDFLAGS="-static" ./configure \
--prefix="${SEED_PREFIX}" \
--disable-nls \
--disable-shared
}
src_compile() {
default_src_compile
}
src_install() {
make DESTDIR="${DESTDIR}" install
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/gawk/gawk-4.2.1.tar.xz d1119785e746d46a8209d28b2de404a57f983aa48670f4e225531d3bdc175551

View file

@ -5,16 +5,11 @@ src_prepare() {
}
src_configure() {
local host_triplet
host_triplet="$(gcc -dumpmachine)"
PATH="${PREFIX}/bin:/usr/bin:/bin" \
./configure \
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--includedir="${PREFIX}/include" \
--host="${host_triplet}" \
--build="${host_triplet}" \
--enable-static \
--enable-shared
}

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/grep-3.1"
src_configure() {
CFLAGS="-O2" LDFLAGS="-static" ./configure \
--prefix="${SEED_PREFIX}" \
--disable-perl-regexp \
--disable-shared
}
src_compile() {
default_src_compile
}
src_install() {
make DESTDIR="${DESTDIR}" install
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/grep/grep-3.1.tar.xz db625c7ab3bb3ee757b3926a5cfa8d9e1c3991ad24707a83dde8a5ef2bf7a07e

View file

@ -0,0 +1,26 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/guile-2.2.4"
src_prepare() {
default
}
src_configure() {
./configure \
--prefix="${SEED_PREFIX}" \
--disable-shared \
--enable-static
}
src_compile() {
default_src_compile
}
src_install() {
local stage
stage="${DESTDIR}${SEED_PREFIX}"
make DESTDIR="${DESTDIR}" install
seed_make_repro_tar_xz "${stage}" "${DISTFILES}/guile-static-stripped-2.2.4-i686-linux.tar.xz"
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/guile/guile-2.2.4.tar.xz d9e8b94af7b206fcf52bec6501b921bd7d0bd7a31fb7e896a35ba8253678e31e

66
steps-guix/guix-1.5.0/pass1.sh Executable file
View file

@ -0,0 +1,66 @@
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
local bootstrap_scm patch_template rendered_patch
default
if [ ! -f /tmp/guix-bootstrap-seeds.env ]; then
echo "Missing /tmp/guix-bootstrap-seeds.env" >&2
false
fi
. /tmp/guix-bootstrap-seeds.env
bootstrap_scm="gnu/packages/bootstrap.scm"
patch_template="${base_dir}/patches/bootstrap-local-seeds.patch.in"
rendered_patch="/tmp/guix-bootstrap-local-seeds.patch"
if [ ! -f "${patch_template}" ]; then
echo "Missing patch template: ${patch_template}" >&2
false
fi
sed \
-e "s|@EXEC_BASH_HASH@|${EXEC_BASH_HASH}|g" \
-e "s|@EXEC_MKDIR_HASH@|${EXEC_MKDIR_HASH}|g" \
-e "s|@EXEC_TAR_HASH@|${EXEC_TAR_HASH}|g" \
-e "s|@EXEC_XZ_HASH@|${EXEC_XZ_HASH}|g" \
-e "s|@STATIC_BINARIES_SEED_HASH@|${STATIC_BINARIES_SEED_HASH}|g" \
-e "s|@GUILE_SEED_HASH@|${GUILE_SEED_HASH}|g" \
"${patch_template}" > "${rendered_patch}"
if grep -Eq '@[A-Z0-9_]+@' "${rendered_patch}"; then
echo "Unexpanded placeholder found in ${rendered_patch}" >&2
false
fi
patch --dry-run -p1 < "${rendered_patch}"
patch -p1 < "${rendered_patch}"
grep -q 'file:///external/distfiles/' "${bootstrap_scm}"
grep -q "${EXEC_BASH_HASH}" "${bootstrap_scm}"
grep -q "${STATIC_BINARIES_SEED_HASH}" "${bootstrap_scm}"
grep -q "${GUILE_SEED_HASH}" "${bootstrap_scm}"
grep -q "All bootstrap binaries must come from local, reproducible distfiles." "${bootstrap_scm}"
grep -q "%bootstrap-linux-headers-base-urls" "${bootstrap_scm}"
grep -q "Offline bootstrap environment: require explicit channels." guix/channels.scm
}
src_configure() {
local host_triplet
host_triplet="$(gcc -dumpmachine)"
./configure \
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--host="${host_triplet}" \
--build="${host_triplet}"
}
src_compile() {
default_src_compile
}
src_install() {
default_src_install
}

View file

@ -0,0 +1,112 @@
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -109,13 +109,13 @@
,(base32 "1cqqavghjfr0iwxqf61lrssv27wfigysgq2rs4rm1gkmn04yn1k3")))
("i686-linux"
("bash"
- ,(base32 "0rjaxyzjdllfkf1abczvgaf3cdcc7mmahyvdbkjmjzhgz92pv23g"))
+ ,(base32 "@EXEC_BASH_HASH@"))
("mkdir"
- ,(base32 "133ybmfpkmsnysrzbngwvbysqnsmfi8is8zifs7i7n6n600h4s1w"))
+ ,(base32 "@EXEC_MKDIR_HASH@"))
("tar"
- ,(base32 "07830bx29ad5i0l1ykj0g0b1jayjdblf01sr3ww9wbnwdbzinqms"))
+ ,(base32 "@EXEC_TAR_HASH@"))
("xz"
- ,(base32 "0i9kxdi17bm5gxfi2xzm0y73p3ii0cqxli1sbljm6rh2fjgyn90k")))
+ ,(base32 "@EXEC_XZ_HASH@")))
("i586-gnu"
("bash"
,(base32 "1as8649aqaibahhhrvkj10ci8shpi4hq5n7gnik8rhhy0dc1jarg"))
@@ -164,15 +164,12 @@
(define %bootstrap-executable-base-urls
;; This is where the bootstrap executables come from.
- '("https://ftpmirror.gnu.org/guix/bootstrap/"
- "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/"
- "https://alpha.gnu.org/gnu/guix/bootstrap/"
- "http://flashner.co.il/guix/bootstrap/"
- "http://lilypond.org/janneke/guix/"))
+ '("file:///external/distfiles/"))
(define (bootstrap-executable-file-name system program)
"Return the FILE-NAME part of url where PROGRAM can be found for SYSTEM."
(match system
+ ("i686-linux" (string-append "i686-linux/bootstrap-exec-" program "-i686-linux"))
("powerpc64le-linux" (string-append system "/20210106/" program))
("i586-gnu" (string-append system "/20200326/" program))
("x86_64-gnu" (string-append system "/20241122/" program))
@@ -388,15 +385,15 @@
("riscv64-linux"
"/20210725/guile-3.0.2.tar.xz")
(_
- "/20131110/guile-2.0.9.tar.xz"))))
+ "/guile-static-stripped-2.2.4-i686-linux.tar.xz"))))
(define (bootstrap-guile-hash system)
"Return the SHA256 hash of the Guile bootstrap tarball for SYSTEM."
(match system
("x86_64-linux"
- (base32 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3"))
+ (base32 "@GUILE_SEED_HASH@"))
("i686-linux"
- (base32 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp"))
+ (base32 "@GUILE_SEED_HASH@"))
("mips64el-linux"
(base32 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr"))
("armhf-linux"
@@ -458,8 +455,8 @@
(lambda (p)
(format p "\
#!~a
-export GUILE_SYSTEM_PATH=~a/share/guile/2.0
-export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
+export GUILE_SYSTEM_PATH=~a/share/guile/2.2
+export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.2/ccache
exec -a \"~a0\" ~a \"~a@\"\n"
bash out out dollar guile-real dollar)))
(chmod guile #o555)
@@ -480,8 +477,8 @@
~a -dc < $GUILE_TARBALL | ~a xv
# Use the bootstrap guile to create its own wrapper to set the load path.
-GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
-GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
+GUILE_SYSTEM_PATH=$out/share/guile/2.2 \
+GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.2/ccache \
$out/bin/guile -c ~s $out ~a
# Sanity check.
@@ -625,16 +622,16 @@
("riscv64-linux"
"/20210725/static-binaries.tar.xz")
(_
- "/20131110/static-binaries.tar.xz")))
+ "/static-binaries-0-i686-linux.tar.xz")))
%bootstrap-base-urls))
(sha256
(match system
("x86_64-linux"
(base32
- "0c533p9dhczzcsa1117gmfq3pc8w362g4mx84ik36srpr7cx2bg4"))
+ "@STATIC_BINARIES_SEED_HASH@"))
("i686-linux"
(base32
- "0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
+ "@STATIC_BINARIES_SEED_HASH@"))
("armhf-linux"
(base32
"0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -194,8 +194,8 @@
(introduction %guix-channel-introduction)))
(define %default-channels
- ;; Default list of channels.
- (list %default-guix-channel))
+ ;; Offline bootstrap environment: require explicit channels.
+ '())
(define (guix-channel? channel)
"Return true if CHANNEL is the 'guix' channel."

View file

@ -0,0 +1,34 @@
--- guix-1.5.0/gnu/packages/bootstrap.scm
+++ guix-1.5.0/gnu/packages/bootstrap.scm
@@ -357,8 +357,9 @@
;;; Bootstrap packages.
;;;
-(define %bootstrap-base-urls
- ;; This is where the initial binaries come from.
+(define %bootstrap-linux-headers-base-urls
+ ;; Keep linux headers as an explicit exception: text headers can still come
+ ;; from the historical bootstrap mirrors.
'("https://ftpmirror.gnu.org/guix/bootstrap/"
"https://ftp.gnu.org/gnu/guix/bootstrap"
"https://alpha.gnu.org/gnu/guix/bootstrap"
@@ -369,6 +370,10 @@
"http://flashner.co.il/guix/bootstrap"
"http://lilypond.org/janneke/guix/"))
+(define %bootstrap-base-urls
+ ;; All bootstrap binaries must come from local, reproducible distfiles.
+ '("file:///external/distfiles"))
+
(define (bootstrap-guile-url-path system)
"Return the URI for FILE."
(string-append "/" system
@@ -684,7 +689,7 @@
(uri (map (cute string-append <>
"/i686-linux/20190815/"
"linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz")
- %bootstrap-base-urls))
+ %bootstrap-linux-headers-base-urls))
(sha256
(base32
"0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"))))

View file

@ -0,0 +1 @@
f https://ftpmirror.gnu.org/gnu/guix/guix-1.5.0.tar.gz df2102eed00aff0b17275654a42f094c8a1117ec065884eb1ff76005e47415c5

View file

@ -0,0 +1,34 @@
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default
}
src_configure() {
:
}
src_compile() {
:
}
src_install() {
local compat_src
compat_src="${DESTDIR}/usr/libexec/guix-hash-compat/guix-1.5.0"
mkdir -p "${compat_src}"
cp -a . "${compat_src}/"
install -D -m 0755 /dev/stdin "${DESTDIR}/usr/bin/guix-hash-compat" <<'EOS'
#!/bin/sh
set -e
src_dir="/usr/libexec/guix-hash-compat/guix-1.5.0"
if [ -d /tmp/guix-1.5.0 ]; then
src_dir="/tmp/guix-1.5.0"
fi
cd "${src_dir}"
exec ./pre-inst-env guix hash "$@"
EOS
}

View file

@ -0,0 +1 @@
f https://ftpmirror.gnu.org/gnu/guix/guix-1.5.0.tar.gz df2102eed00aff0b17275654a42f094c8a1117ec065884eb1ff76005e47415c5

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/gzip-1.9"
src_configure() {
CFLAGS="-O2" LDFLAGS="-static" ./configure \
--prefix="${SEED_PREFIX}" \
--disable-nls \
ac_cv_prog_LESS="less"
}
src_compile() {
default_src_compile
}
src_install() {
make DESTDIR="${DESTDIR}" install
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/gzip/gzip-1.9.tar.xz ae506144fc198bd8f81f1f4ad19ce63d5a2d65e42333255977cf1dcf1479089a

View file

@ -615,3 +615,48 @@ sysroot_src_install_default() {
prefix="${KERNEL_SYSROOT}" \
libdir="${KERNEL_SYSROOT}/lib"
}
seed_require_file() {
local path="$1"
if [ ! -e "${path}" ]; then
echo "Missing required seed input: ${path}" >&2
false
fi
}
seed_make_repro_tar_xz() {
local src_dir="$1"
local out_file="$2"
local tmp_dir
local tmp_tar
seed_require_file "${src_dir}"
mkdir -p "$(dirname "${out_file}")"
tmp_dir="$(mktemp -d /tmp/seed-tar.XXXXXX)"
tmp_tar="$(mktemp /tmp/seed-tarball.XXXXXX.tar)"
cp -a "${src_dir}/." "${tmp_dir}/"
(
cd "${tmp_dir}"
reset_timestamp
tar --sort=name --hard-dereference \
--numeric-owner --owner=0 --group=0 --mode=go=rX,u+rw \
-cf "${tmp_tar}" .
)
touch -t 197001010000.00 "${tmp_tar}"
xz -T1 -c "${tmp_tar}" > "${out_file}"
touch -t 197001010000.00 "${out_file}"
rm -rf "${tmp_dir}"
rm -f "${tmp_tar}"
}
seed_install_exec() {
local src="$1"
local dst="$2"
seed_require_file "${src}"
mkdir -p "$(dirname "${dst}")"
install -m 0755 "${src}" "${dst}"
}

View file

@ -2,4 +2,21 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
exec /steps/improve/after.sh
set -e
. /steps/bootstrap.cfg
. /steps/env
if [ "${INTERACTIVE}" = True ]; then
env - PATH=${PREFIX}/bin PS1="\w # " setsid openvt -fec1 -- bash -i
fi
if [ "${CHROOT}" = False ]; then
# Ignore errors due to missing swap/fstab.
swapoff -a >/dev/null 2>&1 || true
sync
echo u > /proc/sysrq-trigger
mount -o remount,ro /
echo o > /proc/sysrq-trigger
while true; do sleep 1; done
fi

View file

@ -0,0 +1,76 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
dist="${DISTFILES:-/external/distfiles}"
env_out="/tmp/guix-bootstrap-seeds.env"
required_files="
${dist}/static-binaries-0-i686-linux.tar.xz
${dist}/guile-static-stripped-2.2.4-i686-linux.tar.xz
${dist}/mes-minimal-stripped-0.19-i686-linux.tar.xz
${dist}/mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz
${dist}/bootstrap-exec-bash-i686-linux
${dist}/bootstrap-exec-mkdir-i686-linux
${dist}/bootstrap-exec-tar-i686-linux
${dist}/bootstrap-exec-xz-i686-linux
"
for f in ${required_files}; do
if [ ! -e "${f}" ]; then
echo "Missing required seed artifact: ${f}" >&2
exit 1
fi
done
if [ ! -x /usr/bin/guix-hash-compat ]; then
echo "Missing /usr/bin/guix-hash-compat" >&2
exit 1
fi
# Prepare file layout expected by bootstrap.scm for i686/x86_64.
mkdir -p "${dist}/i686-linux" "${dist}/x86_64-linux"
cp -f "${dist}/static-binaries-0-i686-linux.tar.xz" \
"${dist}/i686-linux/static-binaries-0-i686-linux.tar.xz"
cp -f "${dist}/static-binaries-0-i686-linux.tar.xz" \
"${dist}/x86_64-linux/static-binaries-0-i686-linux.tar.xz"
cp -f "${dist}/guile-static-stripped-2.2.4-i686-linux.tar.xz" \
"${dist}/i686-linux/guile-static-stripped-2.2.4-i686-linux.tar.xz"
cp -f "${dist}/guile-static-stripped-2.2.4-i686-linux.tar.xz" \
"${dist}/x86_64-linux/guile-static-stripped-2.2.4-i686-linux.tar.xz"
cp -f "${dist}/bootstrap-exec-bash-i686-linux" \
"${dist}/i686-linux/bootstrap-exec-bash-i686-linux"
cp -f "${dist}/bootstrap-exec-mkdir-i686-linux" \
"${dist}/i686-linux/bootstrap-exec-mkdir-i686-linux"
cp -f "${dist}/bootstrap-exec-tar-i686-linux" \
"${dist}/i686-linux/bootstrap-exec-tar-i686-linux"
cp -f "${dist}/bootstrap-exec-xz-i686-linux" \
"${dist}/i686-linux/bootstrap-exec-xz-i686-linux"
static_binaries_hash="$(/usr/bin/guix-hash-compat "${dist}/static-binaries-0-i686-linux.tar.xz")"
guile_seed_hash="$(/usr/bin/guix-hash-compat "${dist}/guile-static-stripped-2.2.4-i686-linux.tar.xz")"
mes_minimal_hash="$(/usr/bin/guix-hash-compat "${dist}/mes-minimal-stripped-0.19-i686-linux.tar.xz")"
mescc_tools_hash="$(/usr/bin/guix-hash-compat "${dist}/mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz")"
exec_bash_hash="$(/usr/bin/guix-hash-compat -r "${dist}/bootstrap-exec-bash-i686-linux")"
exec_mkdir_hash="$(/usr/bin/guix-hash-compat -r "${dist}/bootstrap-exec-mkdir-i686-linux")"
exec_tar_hash="$(/usr/bin/guix-hash-compat -r "${dist}/bootstrap-exec-tar-i686-linux")"
exec_xz_hash="$(/usr/bin/guix-hash-compat -r "${dist}/bootstrap-exec-xz-i686-linux")"
cat > "${env_out}" <<ENVEOF
DISTFILES=${dist}
STATIC_BINARIES_SEED_FILE=static-binaries-0-i686-linux.tar.xz
STATIC_BINARIES_SEED_HASH=${static_binaries_hash}
GUILE_SEED_FILE=guile-static-stripped-2.2.4-i686-linux.tar.xz
GUILE_SEED_HASH=${guile_seed_hash}
MES_MINIMAL_SEED_FILE=mes-minimal-stripped-0.19-i686-linux.tar.xz
MES_MINIMAL_SEED_HASH=${mes_minimal_hash}
MESCC_TOOLS_SEED_FILE=mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz
MESCC_TOOLS_SEED_HASH=${mescc_tools_hash}
EXEC_BASH_HASH=${exec_bash_hash}
EXEC_MKDIR_HASH=${exec_mkdir_hash}
EXEC_TAR_HASH=${exec_tar_hash}
EXEC_XZ_HASH=${exec_xz_hash}
ENVEOF
chmod 0644 "${env_out}"

View file

@ -0,0 +1,31 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
. /steps/bootstrap.cfg
. /steps/env
daemon_socket="/var/guix/daemon-socket/socket"
out_dir="/external/guix-images"
if [ ! -S "${daemon_socket}" ]; then
echo "guix-daemon socket is missing: ${daemon_socket}" >&2
echo "Run improve/guix-daemon-and-pull.sh first." >&2
exit 1
fi
mkdir -p "${out_dir}"
iso_store_path="$(guix system image \
--system=x86_64-linux \
-t iso9660 \
-e '(@@ (gnu system install) installation-os)' \
--no-substitutes)"
if [ ! -e "${iso_store_path}" ]; then
echo "guix system image did not return a valid path: ${iso_store_path}" >&2
exit 1
fi
ln -sfn "${iso_store_path}" "${out_dir}/guix-system-install-x86_64.iso"

View file

@ -0,0 +1,144 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
. /steps/bootstrap.cfg
. /steps/env
daemon_socket="/var/guix/daemon-socket/socket"
channel_root="/var/lib/guix/local-channels"
channel_repo="${channel_root}/guix"
channel_work="/tmp/guix-local-channel-work"
channels_file="/root/.config/guix/channels.scm"
distfiles="${DISTFILES:-/external/distfiles}"
PATH="/usr/sbin:/sbin:${PATH}"
have_group() {
if command -v getent >/dev/null 2>&1; then
getent group "$1" >/dev/null 2>&1
else
grep -q "^$1:" /etc/group
fi
}
have_user() {
if command -v getent >/dev/null 2>&1; then
getent passwd "$1" >/dev/null 2>&1
else
grep -q "^$1:" /etc/passwd
fi
}
mkdir -p /proc /sys /dev /var/guix/daemon-socket /var/lib/guix /root/.config/guix
mount | grep ' on /proc ' >/dev/null 2>&1 || mount -t proc proc /proc
mount | grep ' on /sys ' >/dev/null 2>&1 || mount -t sysfs sysfs /sys
mount | grep ' on /dev ' >/dev/null 2>&1 || mount -t devtmpfs devtmpfs /dev
if ! have_group guixbuild; then
groupadd --system guixbuild
fi
nologin_bin="$(command -v nologin || true)"
if [ -z "${nologin_bin}" ]; then
if [ -x /usr/sbin/nologin ]; then
nologin_bin=/usr/sbin/nologin
elif [ -x /sbin/nologin ]; then
nologin_bin=/sbin/nologin
else
echo "Could not find nologin binary." >&2
exit 1
fi
fi
i=1
while [ "${i}" -le 10 ]; do
idp="$(printf '%02d' "${i}")"
user="guixbuilder${idp}"
if ! have_user "${user}"; then
useradd -g guixbuild -G guixbuild \
-d /var/empty -s "${nologin_bin}" \
-c "Guix build user ${idp}" --system \
"${user}"
fi
i=$((i + 1))
done
if [ ! -S "${daemon_socket}" ]; then
guix-daemon \
--build-users-group=guixbuild \
--listen="${daemon_socket}" \
>/tmp/guix-daemon.log 2>&1 &
fi
retry=0
while [ "${retry}" -lt 60 ]; do
if [ -S "${daemon_socket}" ]; then
break
fi
retry=$((retry + 1))
sleep 1
done
if [ ! -S "${daemon_socket}" ]; then
echo "guix-daemon did not become ready: ${daemon_socket}" >&2
exit 1
fi
src_tar=""
for f in "${distfiles}"/guix-1.5.0*.tar.* "${distfiles}"/guix-v1.5.0*.tar.*; do
if [ -f "${f}" ]; then
src_tar="${f}"
break
fi
done
if [ -z "${src_tar}" ]; then
echo "Could not find Guix 1.5.0 source tarball in ${distfiles}" >&2
exit 1
fi
rm -rf "${channel_work}" "${channel_repo}"
mkdir -p "${channel_work}" "${channel_root}"
case "${src_tar}" in
*.tar.gz|*.tgz) tar -C "${channel_work}" -xzf "${src_tar}" ;;
*.tar.xz) tar -C "${channel_work}" -xJf "${src_tar}" ;;
*.tar.bz2) tar -C "${channel_work}" -xjf "${src_tar}" ;;
*.tar) tar -C "${channel_work}" -xf "${src_tar}" ;;
*)
echo "Unsupported tarball format: ${src_tar}" >&2
exit 1
;;
esac
src_dir="$(find "${channel_work}" -mindepth 1 -maxdepth 1 -type d | head -n 1)"
if [ -z "${src_dir}" ]; then
echo "Failed to unpack Guix source from ${src_tar}" >&2
exit 1
fi
mv "${src_dir}" "${channel_repo}"
(
cd "${channel_repo}"
git init -q
git add -A
git -c user.name='guix-local' -c user.email='guix-local@example.invalid' commit -q -m 'local guix channel snapshot'
)
channel_commit="$(git -C "${channel_repo}" rev-parse HEAD)"
cat > "${channels_file}" <<EOF
(use-modules (guix channels))
(list
(channel
(name 'guix)
(url "file://${channel_repo}")
(branch "master")
(commit "${channel_commit}")))
EOF
chmod 0644 "${channels_file}"
guix pull --bootstrap --no-substitutes

View file

@ -42,5 +42,28 @@ build: guile-avahi-0.4.1
build: guile-git-0.10.0
build: guile-json-4.7.3
# End of Guix Dependencies
# Build Guix Bootstrap seeds
# Build Guix Bootstrap seeds (All flowing must be static)
# Build static-binaries-0-i686-linux.tar.xz
build: coreutils-8.30
build: gawk-4.2.1
build: grep-3.1
build: tar-1.30
build: xz-5.2.4
build: gzip-1.9
build: bzip2-1.0.6
build: patch-2.7.6
build: bash-4.4.23-1
build: static-binaries-0-i686-linux
# Build guile-static-stripped-2.2.4-i686-linux.tar.xz
build: guile-2.2.4
# Build mes-minimal-stripped-0.19-i686-linux.tar.xz
build: mes-minimal-stripped-0.19-i686-linux
# Build mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz
build: mescc-tools-static-stripped-0.5.2-i686-linux
build: guix-hash-compat-1.5.0
improve: guix-1.5.0
build: guix-1.5.0
improve: guix-daemon-and-pull
improve: guix-build-iso
improve: after

View file

@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-3.0-or-later
src_get() { :; }
src_unpack() { :; }
src_prepare() { :; }
src_configure() { :; }
src_compile() {
local stage
stage="/tmp/mes-minimal-stripped-0.19-i686-linux"
rm -rf "${stage}"
mkdir -p "${stage}/bin"
seed_install_exec /usr/bin/mes "${stage}/bin/mes"
seed_make_repro_tar_xz "${stage}" "${DISTFILES}/mes-minimal-stripped-0.19-i686-linux.tar.xz"
}
src_install() {
install -D -m 0644 /dev/null "${DESTDIR}/usr/share/guix-seeds/mes-minimal-stripped-0.19-i686-linux"
}

View file

@ -0,0 +1,33 @@
# SPDX-License-Identifier: GPL-3.0-or-later
src_get() { :; }
src_unpack() { :; }
src_prepare() { :; }
src_configure() { :; }
src_compile() {
local stage copied
stage="/tmp/mescc-tools-static-stripped-0.5.2-i686-linux"
copied=0
rm -rf "${stage}"
mkdir -p "${stage}/bin"
for f in M1 hex2 blood-elf kaem M2-Planet M2-Mesoplanet get_machine; do
if [ -x "/usr/bin/${f}" ]; then
seed_install_exec "/usr/bin/${f}" "${stage}/bin/${f}"
copied=1
fi
done
if [ "${copied}" -ne 1 ]; then
echo "No mescc-tools binaries were found under /usr/bin." >&2
false
fi
seed_make_repro_tar_xz "${stage}" "${DISTFILES}/mescc-tools-static-stripped-0.5.2-i686-linux.tar.xz"
}
src_install() {
install -D -m 0644 /dev/null "${DESTDIR}/usr/share/guix-seeds/mescc-tools-static-stripped-0.5.2-i686-linux"
}

View file

@ -0,0 +1,17 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/patch-2.7.6"
src_configure() {
CFLAGS="-O2" LDFLAGS="-static" ./configure \
--prefix="${SEED_PREFIX}" \
gl_cv_func_working_mktime=yes
}
src_compile() {
make "${MAKEJOBS}" MAKEINFO=true
}
src_install() {
make DESTDIR="${DESTDIR}" MAKEINFO=true install
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/patch/patch-2.7.6.tar.xz ac610bda97abe0d9f6b7c963255a11dcb196c25e337c61f94e4778d632f1d8fd

View file

@ -0,0 +1,41 @@
# SPDX-License-Identifier: GPL-3.0-or-later
src_get() { :; }
src_unpack() { :; }
src_prepare() { :; }
src_configure() { :; }
src_compile() {
local stage dist
stage="/tmp/static-binaries-0-i686-linux"
dist="${DISTFILES}"
rm -rf "${stage}"
mkdir -p "${stage}/bin"
cp -a /bootstrap-seeds/coreutils-8.30/bin/. "${stage}/bin/"
cp -a /bootstrap-seeds/gawk-4.2.1/bin/gawk "${stage}/bin/"
cp -a /bootstrap-seeds/grep-3.1/bin/grep "${stage}/bin/"
cp -a /bootstrap-seeds/grep-3.1/bin/egrep "${stage}/bin/"
cp -a /bootstrap-seeds/grep-3.1/bin/fgrep "${stage}/bin/"
cp -a /bootstrap-seeds/tar-1.30/bin/tar "${stage}/bin/"
cp -a /bootstrap-seeds/xz-5.2.4/bin/xz "${stage}/bin/"
cp -a /bootstrap-seeds/gzip-1.9/bin/gzip "${stage}/bin/"
cp -a /bootstrap-seeds/bzip2-1.0.6/bin/bzip2 "${stage}/bin/"
cp -a /bootstrap-seeds/patch-2.7.6/bin/patch "${stage}/bin/"
cp -a /bootstrap-seeds/bash-4.4.23-1/bin/bash "${stage}/bin/"
ln -sf bash "${stage}/bin/sh"
ln -sf gawk "${stage}/bin/awk"
seed_make_repro_tar_xz "${stage}" "${dist}/static-binaries-0-i686-linux.tar.xz"
seed_install_exec "${stage}/bin/bash" "${dist}/bootstrap-exec-bash-i686-linux"
seed_install_exec "${stage}/bin/mkdir" "${dist}/bootstrap-exec-mkdir-i686-linux"
seed_install_exec "${stage}/bin/tar" "${dist}/bootstrap-exec-tar-i686-linux"
seed_install_exec "${stage}/bin/xz" "${dist}/bootstrap-exec-xz-i686-linux"
}
src_install() {
install -D -m 0644 /dev/null "${DESTDIR}/usr/share/guix-seeds/static-binaries-0-i686-linux"
}

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/tar-1.30"
src_configure() {
FORCE_UNSAFE_CONFIGURE=1 CFLAGS="-O2" LDFLAGS="-static" ./configure \
--prefix="${SEED_PREFIX}" \
--disable-nls \
gl_cv_func_getcwd_path_max="no, but it is partly working"
}
src_compile() {
make "${MAKEJOBS}" MAKEINFO=true
}
src_install() {
make DESTDIR="${DESTDIR}" MAKEINFO=true install
}

View file

@ -0,0 +1 @@
f https://mirrors.kernel.org/gnu/tar/tar-1.30.tar.xz f1bf92dbb1e1ab27911a861ea8dde8208ee774866c46c0bb6ead41f4d1f4d2d3

View file

@ -0,0 +1,19 @@
# SPDX-License-Identifier: GPL-3.0-or-later
SEED_PREFIX="/bootstrap-seeds/xz-5.2.4"
src_configure() {
./configure \
--prefix="${SEED_PREFIX}" \
--disable-shared \
--enable-static \
--disable-nls
}
src_compile() {
default_src_compile
}
src_install() {
make DESTDIR="${DESTDIR}" install
}

View file

@ -0,0 +1 @@
f https://tukaani.org/xz/xz-5.2.4.tar.gz b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145