1
0
mirror of git://git.2f30.org/morpheus.git synced 2024-06-24 12:48:34 +00:00

Make the build system a bit more sane

This commit is contained in:
sin 2013-09-06 09:31:51 +01:00
parent c1ed3900b3
commit be80e06d2a
13 changed files with 208 additions and 172 deletions

49
build

@ -1,44 +1,9 @@
#!/bin/sh
# Export important variables for the build scripts
top=$(pwd)
root=$top/root
mirror=http://dl.2f30.org/morpheus-pkgs
export top root mirror
# Create directory hierarchy
rm -rf $root src
mkdir -p $root/{bin,boot,dev,etc,svc,home,root,var,share,devel}
mkdir -p $root/share/man
mkdir -p $root/devel/{include,lib,src}
mkdir -p $root/var/run
mkdir -p $root/dev/shm
mkdir -p $root/{sys,proc}
pushd $root/
ln -s /bin sbin
popd
mkdir -p src
mkdir -p kernel
export pkg=musl
. cross-scripts/$pkg
PATH=$top/cross/bin:$PATH
export PATH
# Fetch packages
pkglist=$(ls pkgs)
for pkg in $pkglist; do
export pkg
. pkgs/$pkg
done
# Fetch kernel
wget -c http://dl.2f30.org/morpheus-pkgs/bzImage -O kernel/bzImage
wget -c http://dl.2f30.org/morpheus-pkgs/bzImage-config -O kernel/bzImage-config
pushd $root
find . | cpio --quiet -H newc -o | gzip -9 -n > ../rootfs.img
popd
echo OK!
. $1
(
fetch
unpack
build
install
)

@ -1,16 +0,0 @@
url=http://dl.2f30.org/morpheus-pkgs/musl-0.9.13.tar.gz
echo $url
# Fetch musl
wget -c $url -O src/musl-0.9.13.tar.gz
# Unpack musl
pushd src
[ -d musl-0.9.13 ] || tar xzf musl-0.9.13.tar.gz
popd
# Build musl
pushd src/musl-0.9.13
./configure --prefix=$top/cross
make -j2 && make install
popd

24
cross-scripts/musl-0.9.13 Normal file

@ -0,0 +1,24 @@
url=http://dl.2f30.org/morpheus-pkgs/musl-0.9.13.tar.gz
fetch() {
wget -c $url -O src/musl-0.9.13.tar.gz
}
unpack() {
pushd src
[ -d musl-0.9.13 ] || tar xzf musl-0.9.13.tar.gz
popd
}
build() {
pushd src/musl-0.9.13
./configure --prefix=$top/cross --syslibdir=$top/cross/lib
make -j2
popd
}
install() {
pushd src/musl-0.9.13
make install
popd
}

@ -23,6 +23,4 @@ ln -s /bin sbin
popd
mkdir -p src
pkg=$1
export $pkg
. pkgs/$pkg
./build pkgs/"$1"

@ -1,21 +1,25 @@
url=$mirror/$pkg
url=$mirror/busybox
# Fetch package
wget -c $url -O src/$pkg
fetch() {
wget -c $url -O src/busybox
}
# Install package
pushd src/
chmod +x $pkg
cp $pkg $root/bin
pushd $root/bin
ln -s busybox ifconfig
ln -s busybox nc
ln -s busybox getty
ln -s busybox login
ln -s busybox find
ln -s busybox du
ln -s busybox ping
ln -s busybox wget
ln -s busybox vi
popd
popd
install() {
# Install package
pushd src/
chmod +x busybox
cp busybox $root/bin
pushd $root/bin
ln -s busybox ifconfig
ln -s busybox nc
ln -s busybox getty
ln -s busybox login
ln -s busybox find
ln -s busybox du
ln -s busybox ping
ln -s busybox wget
ln -s busybox vi
popd
popd
}

23
pkgs/fs

@ -1,13 +1,16 @@
file=$pkg.tar.gz
url=$mirror/$file
url=$mirror/fs.tar.gz
# Fetch package
wget -c $url -O src/$file
fetch() {
# Fetch package
wget -c $url -O src/fs.tar.gz
}
# Unpack package
pushd src
[ -d $pkg ] || tar xzf $file
popd
unpack() {
pushd src
[ -d fs ] || tar xzf fs.tar.gz
popd
}
# Install package
cp -r src/$pkg/* $root/
install() {
cp -r src/fs/* $root/
}

@ -1,21 +1,24 @@
file=$pkg.tar.gz
url=$mirror/$file
url=$mirror/mksh-R47.tar.gz
# Fetch package
wget -c $url -O src/$file
fetch() {
wget -c $url -O src/mksh-R47.tar.gz
}
# Unpack package
pushd src
[ -d mksh ] || tar xzf $file
popd
unpack() {
pushd src
[ -d mksh ] || tar xzf mksh-R47.tar.gz
popd
}
# Build package
pushd src/mksh
CC=musl-gcc LDFLAGS+=-static sh Build.sh
popd
build() {
pushd src/mksh
CC=musl-gcc LDFLAGS+=-static sh Build.sh
popd
}
# Install package
cp src/mksh/mksh $root/bin
pushd $root/bin
ln -s /bin/mksh sh
popd
install() {
cp src/mksh/mksh $root/bin
pushd $root/bin
ln -s /bin/mksh sh
popd
}

@ -1,15 +1,18 @@
url=git://git.2f30.org/$pkg
url=git://git.2f30.org/sbase
# Fetch package
git clone $url src/$pkg
fetch() {
git clone $url src/sbase
}
# Build package
pushd src/$pkg
make clean
make CC=musl-gcc LDFLAGS=-static
popd
build() {
pushd src/sbase
make clean
make CC=musl-gcc LDFLAGS=-static
popd
}
# Install package
pushd src/$pkg
make PREFIX=$root install
popd
install() {
pushd src/sbase
make PREFIX=$root install
popd
}

@ -1,19 +1,22 @@
file=$pkg.tar.gz
url=$mirror/$file
url=$mirror/sdhcp.tar.gz
# Fetch package
wget -c $url -O src/$file
fetch() {
wget -c $url -O src/sdhcp.tar.gz
}
# Unpack package
pushd src
[ -d $pkg ] || tar xzf $file
popd
unpack() {
pushd src
[ -d sdhcp ] || tar xzf sdhcp.tar.gz
popd
}
# Build package
pushd src/$pkg
make clean
make CC=musl-gcc LDFLAGS=-static
popd
build() {
pushd src/sdhcp
make clean
make CC=musl-gcc LDFLAGS=-static
popd
}
# Install package
cp src/$pkg/sdhcp $root/bin
install() {
cp src/sdhcp/sdhcp $root/bin
}

@ -1,19 +1,22 @@
file=$pkg.tar.gz
url=$mirror/$file
url=$mirror/sic.tar.gz
# Fetch package
wget -c $url -O src/$file
fetch() {
wget -c $url -O src/sic.tar.gz
}
# Unpack package
pushd src
[ -d $pkg ] || tar xzf $file
popd
unpack() {
pushd src
[ -d sic ] || tar xzf sic.tar.gz
popd
}
# Build package
pushd src/$pkg
make clean
make CC=musl-gcc LDFLAGS=-static
popd
build() {
pushd src/sic
make clean
make CC=musl-gcc LDFLAGS=-static
popd
}
# Install package
cp src/$pkg/sic $root/bin
install() {
cp src/sic/sic $root/bin
}

@ -1,15 +1,18 @@
url=git://git.2f30.org/$pkg
url=git://git.2f30.org/smdev
# Fetch package
git clone $url src/$pkg
fetch() {
git clone $url src/smdev
}
# Build package
pushd src/$pkg
make clean
make CC=musl-gcc LDFLAGS=-static
popd
build() {
pushd src/smdev
make clean
make CC=musl-gcc LDFLAGS=-static
popd
}
# Install package
pushd src/$pkg
make PREFIX=$root install
popd
install() {
pushd src/smdev
make PREFIX=$root install
popd
}

@ -1,15 +1,18 @@
url=git://git.2f30.org/$pkg
url=git://git.2f30.org/ubase
# Fetch package
git clone $url src/$pkg
fetch() {
git clone $url src/ubase
}
# Build package
pushd src/$pkg
make clean
make CC=musl-gcc LDFLAGS=-static
popd
build() {
pushd src/ubase
make clean
make CC=musl-gcc LDFLAGS=-static
popd
}
# Install package
pushd src/$pkg
make PREFIX=$root install
popd
install() {
pushd src/ubase
make PREFIX=$root install
popd
}

40
stage0 Executable file

@ -0,0 +1,40 @@
#!/bin/sh
# Export important variables for the build scripts
top=$(pwd)
root=$top/root
mirror=http://dl.2f30.org/morpheus-pkgs
export top root mirror
# Create directory hierarchy
rm -rf $root src
mkdir -p $root/{bin,boot,dev,etc,svc,home,root,var,share,devel,sys,proc}
mkdir -p $root/dev/shm
mkdir -p $root/devel/{include,lib,src}
mkdir -p $root/share/man
pushd $root/
ln -s /bin sbin
popd
mkdir -p src
mkdir -p kernel
./build cross-scripts/musl-0.9.13
PATH=$top/cross/bin:$PATH
export PATH
# Build stage0 packages
pkglist=$(ls pkgs)
for pkg in $pkglist; do
./build pkgs/$pkg
done
# Fetch kernel
wget -c http://dl.2f30.org/morpheus-pkgs/bzImage -O kernel/bzImage
wget -c http://dl.2f30.org/morpheus-pkgs/bzImage-config -O kernel/bzImage-config
pushd $root
find . | cpio --quiet -H newc -o | gzip -9 -n > ../rootfs.img
popd
echo OK!