1
0
mirror of git://git.2f30.org/morpheus.git synced 2024-06-30 18:52:31 +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 #!/bin/sh
# Export important variables for the build scripts . $1
top=$(pwd) (
root=$top/root fetch
mirror=http://dl.2f30.org/morpheus-pkgs unpack
export top root mirror build
install
# 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,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 popd
mkdir -p src mkdir -p src
pkg=$1 ./build pkgs/"$1"
export $pkg
. pkgs/$pkg

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

23
pkgs/fs

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

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

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

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

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

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

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