List dependencies explicitly

This is by far the simplest approach as packages previously
in cross-scripts/ could also depend on other packages.
This commit is contained in:
sin 2014-02-17 16:01:37 +00:00
parent e62c2a7619
commit 4b1709f90a
8 changed files with 27 additions and 58 deletions

3
DEPS
View File

@ -1,3 +0,0 @@
irc ncurses
tinyxserver tinyxlib
tmux libevent ncurses

View File

@ -1,7 +1,9 @@
#!/bin/sh
umask 022
if test -z "$1"; then
echo usage: $0 pkgpath... 1>&2
echo usage: $0 pkg... 1>&2
exit 1
fi
@ -16,6 +18,6 @@ fi
mkdir -p src
while [ $# -gt 0 ]; do
./build "$1"
./build "pkgs/$1"
shift
done

76
stage0
View File

@ -3,59 +3,29 @@
# This is the stage0 script, it prepares a basic usable system
# in $root.
umask 022
. ./prepare-env
if test "$(uname -m)" != "$arch"; then
echo You need an $arch host to build morpheus 1>&2
exit 1
fi
rm -rf root morpheus.log
. ./prepare-root
mkdir -p src
# Fetch and install our musl cross-compiler
./build cross-scripts/crossmusl
packages="crossmusl
ncurses
libevent
zlib
tinyxlib
kernel
emul
busybox
fs
make
man
mksh
rsync
sbase
sdhcp
sic
sinit
smdev
syslinux
tinyxserver
tmux
ubase"
installed_deps=
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
# 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
if test "$(echo $line | cut -d' ' -f1)" != "$pkg"; then
continue
fi
deps=$(echo $line | cut -d' ' -f2-)
build_pkg_dep "$pkg" "$deps"
break
done < DEPS
}
build_pkg() {
build_pkg_deps $(basename $1) && ./build $1
}
# Build stage0 packages
for pkg in pkgs/*; do
build_pkg $pkg
done
./pkgbuild $packages