1
0
mirror of git://git.2f30.org/morpheus.git synced 2024-06-26 04:08:33 +00:00
morpheus/stage0

60 lines
1.0 KiB
Plaintext
Raw Normal View History

2013-09-06 08:31:51 +00:00
#!/bin/sh
2013-09-24 15:43:30 +00:00
#
# This is the stage0 script, it prepares a basic usable system
# in $root.
2013-09-06 08:31:51 +00:00
2013-09-17 14:26:52 +00:00
. ./prepare-env
2013-09-06 08:31:51 +00:00
2014-02-03 12:18:52 +00:00
if test "$(uname -m)" != "$arch"; then
2013-09-25 09:20:05 +00:00
echo You need an $arch host to build morpheus 1>&2
exit 1
fi
2013-09-26 19:41:09 +00:00
rm -rf root morpheus.log
2013-09-25 09:20:05 +00:00
. ./prepare-root
mkdir -p src
2013-09-06 08:31:51 +00:00
2013-09-25 16:06:02 +00:00
# Fetch and install our musl cross-compiler
./build cross-scripts/crossmusl
2013-09-17 10:37:13 +00:00
installed_deps=
2013-09-24 15:43:30 +00:00
build_pkg_dep() {
pkg=$1; deps=$2
# Build dependencies for package in order
for d in $deps; do
install=1
for i in $installed_deps; do
if [ "$i" = "$d" ]; then
2013-09-24 15:43:30 +00:00
# If already installed, then skip it
install=0
break
fi
done
if [ $install -eq 1 ]; then
./build cross-scripts/$d
installed_deps="$installed_deps $d"
fi
done
}
build_pkg_deps() {
pkg=$1
while read line; do
2014-02-03 12:18:52 +00:00
if test "$(echo $line | cut -d' ' -f1)" != "$pkg"; then
continue
fi
deps=$(echo $line | cut -d' ' -f2-)
2013-09-25 13:12:49 +00:00
build_pkg_dep "$pkg" "$deps"
2013-09-24 15:43:30 +00:00
break
done < DEPS
2013-09-24 15:43:30 +00:00
}
build_pkg() {
build_pkg_deps $(basename $1) && ./build $1
2013-09-24 15:43:30 +00:00
}
# Build stage0 packages
2014-02-05 12:43:01 +00:00
for pkg in pkgs/*; do
build_pkg $pkg
2013-09-06 08:31:51 +00:00
done