2021-01-29 01:31:56 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
2022-03-07 07:58:20 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
2021-03-17 17:27:19 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
2021-05-18 12:37:34 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
2021-02-18 07:29:58 +00:00
|
|
|
#
|
2021-01-29 01:31:56 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-05-04 00:48:02 +01:00
|
|
|
# Get a list of files
|
|
|
|
get_files() {
|
2023-02-19 00:10:00 +00:00
|
|
|
echo "."
|
|
|
|
_get_files "${1}"
|
|
|
|
}
|
|
|
|
|
|
|
|
_get_files() {
|
2022-05-04 00:48:02 +01:00
|
|
|
local prefix
|
|
|
|
prefix="${1}"
|
|
|
|
fs=
|
|
|
|
if [ -n "$(ls 2>/dev/null)" ]; then
|
2023-02-19 00:10:00 +00:00
|
|
|
# This can be removed once Debian 12 is stable
|
|
|
|
# shellcheck disable=SC2035
|
|
|
|
fs=$(echo *)
|
2022-05-04 00:48:02 +01:00
|
|
|
fi
|
|
|
|
if [ -n "$(ls .[0-z]* 2>/dev/null)" ]; then
|
|
|
|
fs="${fs} $(echo .[0-z]*)"
|
|
|
|
fi
|
|
|
|
for f in ${fs}; do
|
2023-02-02 04:40:26 +00:00
|
|
|
# Archive symlinks to directories as symlinks
|
2023-02-19 00:10:00 +00:00
|
|
|
echo "${prefix}/${f}"
|
2023-02-02 04:40:26 +00:00
|
|
|
if [ -d "${f}" ] && ! [ -h "${f}" ]; then
|
2022-05-04 00:48:02 +01:00
|
|
|
cd "${f}"
|
2023-02-19 00:10:00 +00:00
|
|
|
_get_files "${prefix}/${f}"
|
2022-05-04 00:48:02 +01:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-01-14 11:02:08 +00:00
|
|
|
# Reset all timestamps to unix time 0
|
|
|
|
reset_timestamp() {
|
2022-02-23 09:59:57 +00:00
|
|
|
if command -v find >/dev/null 2>&1; then
|
2022-02-19 00:57:51 +00:00
|
|
|
# find does not error out on exec error
|
2022-05-17 01:01:48 +01:00
|
|
|
find . -print0 | xargs -0 touch -h -t 197001010000.00
|
2022-02-10 10:55:06 +00:00
|
|
|
else
|
|
|
|
# A rudimentary find implementation that does the trick
|
|
|
|
fs=
|
2022-02-23 09:59:57 +00:00
|
|
|
if [ -n "$(ls 2>/dev/null)" ]; then
|
2022-03-07 07:58:20 +00:00
|
|
|
fs=$(echo ./*)
|
2022-01-14 11:02:08 +00:00
|
|
|
fi
|
2022-02-23 09:59:57 +00:00
|
|
|
if [ -n "$(ls .[0-z]* 2>/dev/null)" ]; then
|
2022-02-10 10:55:06 +00:00
|
|
|
fs="${fs} $(echo .[0-z]*)"
|
2022-01-14 11:02:08 +00:00
|
|
|
fi
|
2022-02-10 10:55:06 +00:00
|
|
|
for f in ${fs}; do
|
2022-05-17 01:01:48 +01:00
|
|
|
touch -h -t 197001010000.00 "${f}"
|
2022-02-10 10:55:06 +00:00
|
|
|
if [ -d "${f}" ]; then
|
|
|
|
cd "${f}"
|
|
|
|
reset_timestamp
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2022-01-14 11:02:08 +00:00
|
|
|
}
|
|
|
|
|
2022-02-23 09:59:57 +00:00
|
|
|
# Fake grep
|
2022-04-04 11:50:35 +01:00
|
|
|
_grep() {
|
2022-05-17 01:01:48 +01:00
|
|
|
local text="${1}"
|
|
|
|
local fname="${2}"
|
2022-04-04 11:50:35 +01:00
|
|
|
if command -v grep >/dev/null 2>&1; then
|
|
|
|
grep "${text}" "${fname}"
|
|
|
|
else
|
|
|
|
# shellcheck disable=SC2162
|
|
|
|
while read line; do
|
|
|
|
case "${line}" in *"${text}"*)
|
|
|
|
echo "${line}" ;;
|
|
|
|
esac
|
|
|
|
done < "${fname}"
|
|
|
|
fi
|
2022-02-23 09:59:57 +00:00
|
|
|
}
|
|
|
|
|
2022-05-24 23:00:47 +01:00
|
|
|
get_revision() {
|
|
|
|
local pkg=$1
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd "/external/repo"
|
2022-05-24 23:00:47 +01:00
|
|
|
# Get revision (n time this package has been built)
|
2023-01-07 08:12:50 +00:00
|
|
|
revision=$( (ls -1 "${pkg}"* 2>/dev/null || true) | wc -l | sed 's/ *//g')
|
2022-05-24 23:00:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Installs binary packages from an earlier run
|
|
|
|
# This is useful to speed up development cycle
|
|
|
|
bin_preseed() {
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
if [ -d "/external/repo-preseeded" ]; then
|
2022-05-24 23:00:47 +01:00
|
|
|
get_revision "${pkg}"
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd "/external/repo-preseeded"
|
2022-10-23 00:16:35 +01:00
|
|
|
if [ "${UPDATE_CHECKSUMS}" = "True" ] || src_checksum "${pkg}" $((revision)); then
|
2022-05-24 23:00:47 +01:00
|
|
|
echo "${pkg}: installing prebuilt package."
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
mv "${pkg}_${revision}"* /external/repo || return 1
|
2022-05-24 23:00:47 +01:00
|
|
|
if [[ "${pkg}" == bash-* ]]; then
|
|
|
|
# tar does not like overwriting running bash
|
|
|
|
# shellcheck disable=SC2153
|
|
|
|
rm -f "${PREFIX}/bin/bash" "${PREFIX}/bin/sh"
|
|
|
|
fi
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd "/external/repo"
|
2022-10-02 23:39:25 +01:00
|
|
|
rm -f /tmp/filelist.txt
|
2022-05-24 23:00:47 +01:00
|
|
|
src_apply "${pkg}" $((revision))
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd "${SRCDIR}"
|
2022-06-02 20:25:23 +01:00
|
|
|
return 0
|
2022-05-24 23:00:47 +01:00
|
|
|
fi
|
|
|
|
fi
|
2022-06-02 20:25:23 +01:00
|
|
|
return 1
|
2022-05-24 23:00:47 +01:00
|
|
|
}
|
|
|
|
|
2021-01-29 01:31:56 +00:00
|
|
|
# Common build steps
|
|
|
|
# Build function provides a few common stages with default implementation
|
|
|
|
# that can be overridden on per package basis in the build script.
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
# build takes two arguments:
|
2021-01-29 01:31:56 +00:00
|
|
|
# 1) name-version of the package
|
|
|
|
# 2) optionally specify build script. Default is name-version.sh
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
# 3) optionally specify directory to cd into
|
2022-01-14 11:02:08 +00:00
|
|
|
build() {
|
2021-01-29 01:31:56 +00:00
|
|
|
pkg=$1
|
|
|
|
script_name=${2:-${pkg}.sh}
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
dirname=${3:-${pkg}}
|
2021-01-29 01:31:56 +00:00
|
|
|
|
2022-11-28 19:10:30 +00:00
|
|
|
# shellcheck disable=SC2015
|
2022-10-02 23:39:25 +01:00
|
|
|
bin_preseed && return || true # Normal build if preseed fails
|
2022-05-24 23:00:47 +01:00
|
|
|
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd "${SRCDIR}/${pkg}" || (echo "Cannot cd into ${pkg}!"; kill $$)
|
2021-01-28 18:53:44 +00:00
|
|
|
echo "${pkg}: beginning build using script ${script_name}"
|
2021-01-29 01:31:56 +00:00
|
|
|
base_dir="${PWD}"
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
if [ -e "${base_dir}/patches-$(basename "${script_name}" .sh)" ]; then
|
|
|
|
patch_dir="${base_dir}/patches-$(basename "${script_name}" .sh)"
|
|
|
|
else
|
|
|
|
patch_dir="${base_dir}/patches"
|
|
|
|
fi
|
2021-01-29 01:31:56 +00:00
|
|
|
mk_dir="${base_dir}/mk"
|
2021-01-28 18:53:44 +00:00
|
|
|
files_dir="${base_dir}/files"
|
2021-01-29 01:31:56 +00:00
|
|
|
|
2022-04-13 00:08:29 +01:00
|
|
|
rm -rf "build"
|
|
|
|
mkdir "build"
|
2021-01-29 01:31:56 +00:00
|
|
|
cd "build"
|
|
|
|
|
|
|
|
build_script="${base_dir}/${script_name}"
|
|
|
|
if test -e "${build_script}"; then
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
. "${build_script}"
|
|
|
|
fi
|
2021-02-03 21:30:02 +00:00
|
|
|
|
2022-05-12 10:50:28 +01:00
|
|
|
echo "${pkg}: getting sources."
|
|
|
|
build_stage=src_get
|
|
|
|
call $build_stage
|
|
|
|
|
2021-02-03 21:30:02 +00:00
|
|
|
echo "${pkg}: unpacking source."
|
2021-05-03 23:48:06 +01:00
|
|
|
build_stage=src_unpack
|
|
|
|
call $build_stage
|
2022-04-24 04:59:17 +01:00
|
|
|
unset EXTRA_DISTFILES
|
2021-02-03 21:30:02 +00:00
|
|
|
|
2021-04-13 13:34:11 +01:00
|
|
|
cd "${dirname}" || (echo "Cannot cd into build/${dirname}!"; kill $$)
|
2021-01-29 01:31:56 +00:00
|
|
|
|
|
|
|
echo "${pkg}: preparing source."
|
2021-05-03 23:48:06 +01:00
|
|
|
build_stage=src_prepare
|
|
|
|
call $build_stage
|
2021-01-29 01:31:56 +00:00
|
|
|
|
|
|
|
echo "${pkg}: configuring source."
|
2021-05-03 23:48:06 +01:00
|
|
|
build_stage=src_configure
|
|
|
|
call $build_stage
|
2021-01-29 01:31:56 +00:00
|
|
|
|
|
|
|
echo "${pkg}: compiling source."
|
2021-05-03 23:48:06 +01:00
|
|
|
build_stage=src_compile
|
|
|
|
call $build_stage
|
2021-01-29 01:31:56 +00:00
|
|
|
|
2022-01-14 11:02:08 +00:00
|
|
|
echo "${pkg}: install to fakeroot."
|
2021-05-03 23:48:06 +01:00
|
|
|
build_stage=src_install
|
|
|
|
call $build_stage
|
2021-01-29 01:31:56 +00:00
|
|
|
|
2023-02-26 09:41:59 +00:00
|
|
|
echo "${pkg}: postprocess binaries."
|
|
|
|
build_stage=src_postprocess
|
|
|
|
call $build_stage
|
|
|
|
|
2022-01-14 11:02:08 +00:00
|
|
|
echo "${pkg}: creating package."
|
2022-05-24 23:00:47 +01:00
|
|
|
get_revision "${pkg}"
|
2022-04-04 11:50:35 +01:00
|
|
|
cd "${DESTDIR}"
|
|
|
|
src_pkg
|
2022-01-14 11:02:08 +00:00
|
|
|
|
2022-05-24 23:00:47 +01:00
|
|
|
src_checksum "${pkg}" "${revision}"
|
2021-02-18 07:29:58 +00:00
|
|
|
|
2021-06-10 11:24:50 +01:00
|
|
|
echo "${pkg}: cleaning up."
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
rm -rf "${SRCDIR}/${pkg}/build"
|
2022-04-13 00:08:29 +01:00
|
|
|
rm -rf "${DESTDIR}"
|
|
|
|
mkdir -p "${DESTDIR}"
|
2022-01-14 11:02:08 +00:00
|
|
|
|
|
|
|
echo "${pkg}: installing package."
|
2022-05-24 23:00:47 +01:00
|
|
|
src_apply "${pkg}" "${revision}"
|
2021-06-10 11:24:50 +01:00
|
|
|
|
2021-01-29 01:31:56 +00:00
|
|
|
echo "${pkg}: build successful"
|
2022-01-14 11:02:08 +00:00
|
|
|
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd "${SRCDIR}"
|
2021-02-03 22:09:21 +00:00
|
|
|
|
2023-02-26 09:41:59 +00:00
|
|
|
unset -f src_unpack src_prepare src_configure src_compile src_install src_postprocess
|
2023-11-28 00:44:05 +00:00
|
|
|
unset extract
|
2021-01-29 01:31:56 +00:00
|
|
|
}
|
|
|
|
|
2022-09-29 11:35:31 +01:00
|
|
|
interpret_source_line() {
|
|
|
|
url="${1}"
|
|
|
|
checksum="${2}"
|
|
|
|
fname="${3}"
|
|
|
|
# Default to basename of url if not given
|
|
|
|
fname="${fname:-$(basename "${url}")}"
|
|
|
|
if ! [ -e "${fname}" ]; then
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
curl --fail --retry 5 --location "${url}" --output "${fname}"
|
2022-09-29 11:35:31 +01:00
|
|
|
fi
|
2022-12-05 18:14:19 +00:00
|
|
|
echo "${checksum} ${fname}" > "${fname}.sum"
|
|
|
|
sha256sum -c "${fname}.sum"
|
|
|
|
rm "${fname}.sum"
|
2022-09-29 11:35:31 +01:00
|
|
|
}
|
|
|
|
|
2022-05-12 10:50:28 +01:00
|
|
|
# Default get function that downloads source tarballs.
|
|
|
|
default_src_get() {
|
2022-05-23 06:56:18 +01:00
|
|
|
# shellcheck disable=SC2153
|
|
|
|
cd "${DISTFILES}"
|
2022-09-29 11:35:31 +01:00
|
|
|
# shellcheck disable=SC2162
|
|
|
|
while read line; do
|
|
|
|
# This is intentional - we want to split out ${line} into separate arguments.
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
interpret_source_line ${line}
|
|
|
|
done < "${base_dir}/sources"
|
2022-05-23 06:56:18 +01:00
|
|
|
cd -
|
2022-05-12 10:50:28 +01:00
|
|
|
}
|
|
|
|
|
2022-09-29 11:35:31 +01:00
|
|
|
# Intelligently extracts a file based upon its filetype.
|
|
|
|
extract_file() {
|
2022-10-23 00:17:05 +01:00
|
|
|
f="${3:-$(basename "${1}")}"
|
2022-09-29 11:35:31 +01:00
|
|
|
# shellcheck disable=SC2154
|
|
|
|
case "${noextract}" in
|
|
|
|
*${f}*)
|
|
|
|
cp "${DISTFILES}/${f}" .
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
case "${f}" in
|
2022-10-02 23:39:58 +01:00
|
|
|
*.tar* | *.tgz)
|
2022-09-29 11:35:31 +01:00
|
|
|
if test -e "${PREFIX}/libexec/rmt"; then
|
|
|
|
# Again, we want to split out into words.
|
|
|
|
# shellcheck disable=SC2086
|
2022-10-10 12:23:04 +01:00
|
|
|
tar --no-same-owner -xf "${DISTFILES}/${f}" ${extract}
|
2022-09-29 11:35:31 +01:00
|
|
|
else
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
case "${f}" in
|
2022-10-10 12:23:04 +01:00
|
|
|
*.tar.gz) tar -xzf "${DISTFILES}/${f}" ${extract} ;;
|
2022-09-29 11:35:31 +01:00
|
|
|
*.tar.bz2)
|
|
|
|
# Initial bzip2 built against meslibc has broken pipes
|
2022-10-10 12:23:04 +01:00
|
|
|
bzip2 -dc "${DISTFILES}/${f}" | tar -xf - ${extract} ;;
|
2022-09-29 11:35:31 +01:00
|
|
|
*.tar.xz)
|
2022-10-10 12:23:04 +01:00
|
|
|
tar -xf "${DISTFILES}/${f}" --use-compress-program=xz ${extract} ;;
|
2022-09-29 11:35:31 +01:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cp "${DISTFILES}/${f}" .
|
|
|
|
;;
|
2022-04-13 00:08:29 +01:00
|
|
|
esac
|
2022-09-29 11:35:31 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# Default unpacking function that unpacks all sources.
|
|
|
|
default_src_unpack() {
|
|
|
|
# Handle the first one differently
|
|
|
|
first_line=$(head -n 1 ../sources)
|
|
|
|
# Again, we want to split out into words.
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
extract_file ${first_line}
|
|
|
|
# This assumes there is only one directory in the tarball
|
|
|
|
# Get the dirname "smartly"
|
|
|
|
if ! [ -e "${dirname}" ]; then
|
|
|
|
for i in *; do
|
|
|
|
if [ -d "${i}" ]; then
|
|
|
|
dirname="${i}"
|
|
|
|
break
|
|
|
|
fi
|
2021-05-08 12:32:40 +01:00
|
|
|
done
|
|
|
|
fi
|
2022-09-29 11:35:31 +01:00
|
|
|
# shellcheck disable=SC2162
|
|
|
|
tail -n +2 ../sources | while read line; do
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
extract_file ${line}
|
|
|
|
done
|
2021-01-29 01:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Default function to prepare source code.
|
|
|
|
# It applies all patches from patch_dir (at the moment only -p0 patches are supported).
|
2021-01-28 18:53:44 +00:00
|
|
|
# Then it copies our custom makefile and any other custom files from files directory.
|
2021-01-29 01:31:56 +00:00
|
|
|
default_src_prepare() {
|
|
|
|
if test -d "${patch_dir}"; then
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
if ls "${patch_dir}"/*.patch 2>&1 >/dev/null; then
|
|
|
|
for p in "${patch_dir}"/*.patch; do
|
|
|
|
echo "Applying patch: ${p}"
|
|
|
|
patch -Np0 < "${p}"
|
|
|
|
done
|
|
|
|
fi
|
2021-01-29 01:31:56 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
makefile="${mk_dir}/main.mk"
|
|
|
|
if test -e "${makefile}"; then
|
|
|
|
cp "${makefile}" Makefile
|
|
|
|
fi
|
2021-01-28 18:53:44 +00:00
|
|
|
|
|
|
|
if test -d "${files_dir}"; then
|
2023-01-02 05:43:03 +00:00
|
|
|
cp --no-preserve=mode "${files_dir}"/* "${PWD}/"
|
2021-01-28 18:53:44 +00:00
|
|
|
fi
|
2021-01-29 01:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Default function for configuring source.
|
|
|
|
default_src_configure() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
# Default function for compiling source. It simply runs make without any parameters.
|
|
|
|
default_src_compile() {
|
2023-04-10 06:30:16 +01:00
|
|
|
make "${MAKEJOBS}" -f Makefile PREFIX="${PREFIX}"
|
2021-01-29 01:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Default installing function. PREFIX should be set by run.sh script.
|
|
|
|
# Note that upstream makefiles might ignore PREFIX and have to be configured in configure stage.
|
|
|
|
default_src_install() {
|
2021-04-02 12:24:40 +01:00
|
|
|
make -f Makefile install PREFIX="${PREFIX}" DESTDIR="${DESTDIR}"
|
2021-01-29 01:31:56 +00:00
|
|
|
}
|
|
|
|
|
2023-02-26 09:41:59 +00:00
|
|
|
# Default function for postprocessing binaries.
|
|
|
|
default_src_postprocess() {
|
|
|
|
if (command -v find && command -v file && command -v strip) >/dev/null 2>&1; then
|
|
|
|
# Logic largely taken from void linux 06-strip-and-debug-pkgs.sh
|
|
|
|
# shellcheck disable=SC2162
|
|
|
|
find "${DESTDIR}" -type f | while read f; do
|
|
|
|
case "$(file -bi "${f}")" in
|
|
|
|
application/x-executable*) strip "${f}" ;;
|
|
|
|
application/x-sharedlib*|application/x-pie-executable*)
|
|
|
|
machine_set="$(file -b "${f}")"
|
|
|
|
case "${machine_set}" in
|
|
|
|
*no\ machine*) ;; # don't strip ELF container-only
|
|
|
|
*) strip --strip-unneeded "${f}" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
application/x-archive*) strip --strip-debug "${f}" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-11-13 03:46:44 +00:00
|
|
|
src_pkg() {
|
|
|
|
touch -t 197001010000.00 .
|
|
|
|
reset_timestamp
|
|
|
|
|
2023-02-19 00:10:00 +00:00
|
|
|
local tar_basename="${pkg}_${revision}.tar"
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
local dest_tar="/external/repo/${tar_basename}"
|
2023-02-19 00:10:00 +00:00
|
|
|
local filelist=/tmp/filelist.txt
|
|
|
|
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd /external/repo
|
2022-04-05 18:43:23 +01:00
|
|
|
# If grep is unavailable, then tar --sort is unavailable.
|
2022-04-04 11:50:35 +01:00
|
|
|
# So this does not need a command -v grep.
|
|
|
|
if tar --help | grep ' \-\-sort' >/dev/null 2>&1; then
|
2022-05-13 10:45:23 +01:00
|
|
|
tar -C "${DESTDIR}" --sort=name --hard-dereference \
|
2022-05-18 23:58:01 +01:00
|
|
|
--numeric-owner --owner=0 --group=0 --mode=go=rX,u+rw,a-s -cf "${dest_tar}" .
|
2022-04-04 11:50:35 +01:00
|
|
|
else
|
2023-02-19 00:10:00 +00:00
|
|
|
local olddir
|
|
|
|
olddir=$PWD
|
2022-05-04 00:48:02 +01:00
|
|
|
cd "${DESTDIR}"
|
2023-02-19 00:10:00 +00:00
|
|
|
local null
|
|
|
|
if command -v find >/dev/null 2>&1 && command -v sort >/dev/null 2>&1; then
|
|
|
|
find . -print0 | LC_ALL=C sort -z > "${filelist}"
|
|
|
|
null="--null"
|
|
|
|
elif command -v sort >/dev/null 2>&1; then
|
|
|
|
get_files . | LC_ALL=C sort > "${filelist}"
|
|
|
|
else
|
|
|
|
get_files . > ${filelist}
|
|
|
|
fi
|
|
|
|
tar --no-recursion ${null} --files-from "${filelist}" \
|
|
|
|
--numeric-owner --owner=0 --group=0 --mode=go=rX,u+rw,a-s -cf "${dest_tar}"
|
|
|
|
rm -f "$filelist"
|
|
|
|
cd "$olddir"
|
2022-04-04 11:50:35 +01:00
|
|
|
fi
|
2022-05-18 23:58:01 +01:00
|
|
|
touch -t 197001010000.00 "${tar_basename}"
|
|
|
|
bzip2 --best "${tar_basename}"
|
2022-04-04 11:50:35 +01:00
|
|
|
}
|
|
|
|
|
2022-04-07 00:09:45 +01:00
|
|
|
src_checksum() {
|
2022-05-24 23:00:47 +01:00
|
|
|
local pkg=$1 revision=$2
|
|
|
|
local rval=0
|
2022-04-07 00:09:45 +01:00
|
|
|
if ! [ "$UPDATE_CHECKSUMS" = True ] ; then
|
2022-05-17 01:01:48 +01:00
|
|
|
# We avoid using pipes as that is not supported by initial sha256sum from mescc-tools-extra
|
|
|
|
local checksum_file=/tmp/checksum
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
_grep "${pkg}_${revision}" "${SRCDIR}/SHA256SUMS.pkgs" > "${checksum_file}" || true
|
2022-10-23 00:17:05 +01:00
|
|
|
# Check there is something in checksum_file
|
|
|
|
if ! [ -s "${checksum_file}" ]; then
|
|
|
|
echo "${pkg}: no checksum stored!"
|
|
|
|
false
|
|
|
|
fi
|
2022-05-24 23:00:47 +01:00
|
|
|
echo "${pkg}: checksumming created package."
|
|
|
|
sha256sum -c "${checksum_file}" || rval=$?
|
2022-05-17 01:01:48 +01:00
|
|
|
rm "${checksum_file}"
|
2022-04-07 00:09:45 +01:00
|
|
|
fi
|
2022-05-24 23:00:47 +01:00
|
|
|
return "${rval}"
|
2022-04-07 00:09:45 +01:00
|
|
|
}
|
|
|
|
|
2022-04-04 11:50:35 +01:00
|
|
|
src_apply() {
|
2022-05-24 23:00:47 +01:00
|
|
|
local pkg="${1}" revision="${2}"
|
2023-02-19 00:10:00 +00:00
|
|
|
local TAR_PREFIX BZIP2_PREFIX
|
2023-01-13 01:09:57 +00:00
|
|
|
|
|
|
|
# Make sure we have at least one copy of tar
|
|
|
|
if [[ "${pkg}" == tar-* ]]; then
|
|
|
|
mkdir -p /tmp
|
|
|
|
cp "${PREFIX}/bin/tar" "/tmp/tar"
|
|
|
|
TAR_PREFIX="/tmp/"
|
|
|
|
fi
|
|
|
|
|
2022-05-08 20:04:29 +01:00
|
|
|
# Overwriting files is mega busted, so do it manually
|
|
|
|
# shellcheck disable=SC2162
|
|
|
|
if [ -e /tmp/filelist.txt ]; then
|
|
|
|
while IFS= read -d $'\0' file; do
|
|
|
|
rm -f "/${file}" >/dev/null 2>&1 || true
|
|
|
|
done < /tmp/filelist.txt
|
2022-04-04 11:50:35 +01:00
|
|
|
fi
|
2022-05-17 01:01:48 +01:00
|
|
|
|
|
|
|
# Bzip2 does not like to be overwritten
|
|
|
|
if [[ "${pkg}" == bzip2-* ]]; then
|
|
|
|
mkdir -p /tmp
|
|
|
|
mv "${PREFIX}/bin/bzip2" "/tmp/bzip2"
|
|
|
|
BZIP2_PREFIX="/tmp/"
|
|
|
|
fi
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
"${BZIP2_PREFIX}bzip2" -dc "/external/repo/${pkg}_${revision}.tar.bz2" | \
|
2023-01-13 01:09:57 +00:00
|
|
|
"${TAR_PREFIX}tar" -C / -xpf -
|
|
|
|
rm -f "/tmp/bzip2" "/tmp/tar"
|
2022-04-04 11:50:35 +01:00
|
|
|
}
|
|
|
|
|
2021-01-29 01:31:56 +00:00
|
|
|
# Check if bash function exists
|
|
|
|
fn_exists() {
|
|
|
|
test "$(type -t "$1")" == 'function'
|
|
|
|
}
|
|
|
|
|
|
|
|
# Call package specific function or default implementation.
|
|
|
|
call() {
|
|
|
|
if fn_exists "$1"; then
|
|
|
|
$1
|
|
|
|
else
|
|
|
|
default_"${1}"
|
|
|
|
fi
|
|
|
|
}
|
2021-05-03 23:48:06 +01:00
|
|
|
|
|
|
|
# Call default build stage function
|
|
|
|
default() {
|
|
|
|
"default_${build_stage}"
|
|
|
|
}
|