morpheus

suckless linux distro
git clone git://git.2f30.org/morpheus.git
Log | Files | Refs | Submodules | README | LICENSE

commit 4b1709f90a5b08fcf2b2dc64601bdccb991134a5
parent e62c2a7619e560010822e7faa1e12b3efd3a697f
Author: sin <sin@2f30.org>
Date:   Mon, 17 Feb 2014 16:01:37 +0000

List dependencies explicitly

This is by far the simplest approach as packages previously
in cross-scripts/ could also depend on other packages.

Diffstat:
DEPS | 3---
cross-scripts/crossmusl | 17-----------------
cross-scripts/libevent | 24------------------------
cross-scripts/ncurses | 28----------------------------
cross-scripts/tinyxlib | 25-------------------------
cross-scripts/zlib | 24------------------------
pkgbuild | 6++++--
pkgs/crossmusl | 17+++++++++++++++++
pkgs/libevent | 24++++++++++++++++++++++++
pkgs/ncurses | 28++++++++++++++++++++++++++++
pkgs/tinyxlib | 25+++++++++++++++++++++++++
pkgs/zlib | 24++++++++++++++++++++++++
stage0 | 78++++++++++++++++++++++++------------------------------------------------------
13 files changed, 146 insertions(+), 177 deletions(-)

diff --git a/DEPS b/DEPS @@ -1,3 +0,0 @@ -irc ncurses -tinyxserver tinyxlib -tmux libevent ncurses diff --git a/cross-scripts/crossmusl b/cross-scripts/crossmusl @@ -1,17 +0,0 @@ -url=$mirror/crossx86-x86_64-linux-musl-0.9.15.tar.xz - -fetch() { - wget -c $url -O src/crossx86-x86_64-linux-musl-0.9.15.tar.xz -} - -install() { - tar xJf src/crossx86-x86_64-linux-musl-0.9.15.tar.xz -C $root/opt/cross - mv $root/opt/cross/x86_64-linux-musl/x86_64-linux-musl/lib64/* $root/opt/cross/x86_64-linux-musl/x86_64-linux-musl/lib - cd $root/bin - targets="ar as c++ g++ gcc ld ld.bfd nm objcopy objdump ranlib strip" - for t in $targets; do - ln -sf /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-$t $t - done - ln -sf gcc cc - cd - -} diff --git a/cross-scripts/libevent b/cross-scripts/libevent @@ -1,24 +0,0 @@ -url=$mirror/libevent-2.0.21-stable.tar.gz - -fetch() { - wget -c $url -O src/libevent-2.0.21-stable.tar.gz -} - -unpack() { - cd src - [ -d libevent-2.0.21-stable ] || tar xzf libevent-2.0.21-stable.tar.gz - cd - -} - -build() { - cd src/libevent-2.0.21-stable - CC="x86_64-linux-musl-gcc -static" ./configure --prefix=$libcroot --disable-shared --enable-static || return 1 - make -j$nprocs || return 1 - cd - -} - -install() { - cd src/libevent-2.0.21-stable - make install || return 1 - cd - -} diff --git a/cross-scripts/ncurses b/cross-scripts/ncurses @@ -1,28 +0,0 @@ -url=$mirror/ncurses.tar.gz - -fetch() { - wget -c $url -O src/ncurses.tar.gz -} - -unpack() { - cd src - [ -d ncurses-5.9 ] || tar xzf ncurses.tar.gz - cd - -} - -build() { - cd src/ncurses-5.9 - cp $top/stuff/ncurses-fallback.c ncurses/fallback.c - CC="x86_64-linux-musl-gcc -static" ./configure --prefix=$libcroot --without-tests \ - --with-normal --enable-sigwinch --disable-nls --without-dlsym \ - --without-cxx-binding \ - --with-fallbacks="linux vt100 xterm xterm256-color" </dev/ptmx || return 1 - make -j$nprocs || return 1 - cd - -} - -install() { - cd src/ncurses-5.9 - make install || return 1 - cd - -} diff --git a/cross-scripts/tinyxlib b/cross-scripts/tinyxlib @@ -1,25 +0,0 @@ -url=$mirror/tinyxlib.tar.gz - -fetch() { - wget -c $url -O src/tinyxlib.tar.gz -} - -unpack() { - cd src - [ -d tinyxlib ] || tar xzf tinyxlib.tar.gz - cd - -} - -build() { - cd src/tinyxlib - make clean - make CC=x86_64-linux-musl-gcc BINDIR="/bin" LIBDIR="/lib" STATIC=1 \ - FONT_ENCODINGS_DIRECTORY="/usr/share/fonts/encodings/encodings.dir" - cd - -} - -install() { - cd src/tinyxlib - make DESTDIR="$libcroot" BINDIR="/bin" LIBDIR="/lib" STATIC=1 install - cd - -} diff --git a/cross-scripts/zlib b/cross-scripts/zlib @@ -1,24 +0,0 @@ -url=$mirror/zlib-1.2.8.tar.gz - -fetch() { - wget -c $url -O src/zlib-1.2.8.tar.gz -} - -unpack() { - cd src - [ -d zlib-1.2.8 ] || tar xzf zlib-1.2.8.tar.gz - cd - -} - -build() { - cd src/zlib-1.2.8 - CC=x86_64-linux-musl-gcc ./configure --prefix=$libcroot --static || return 1 - make -j$nprocs || return 1 - cd - -} - -install() { - cd src/zlib-1.2.8 - make install || return 1 - cd - -} diff --git a/pkgbuild b/pkgbuild @@ -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 diff --git a/pkgs/crossmusl b/pkgs/crossmusl @@ -0,0 +1,17 @@ +url=$mirror/crossx86-x86_64-linux-musl-0.9.15.tar.xz + +fetch() { + wget -c $url -O src/crossx86-x86_64-linux-musl-0.9.15.tar.xz +} + +install() { + tar xJf src/crossx86-x86_64-linux-musl-0.9.15.tar.xz -C $root/opt/cross + mv $root/opt/cross/x86_64-linux-musl/x86_64-linux-musl/lib64/* $root/opt/cross/x86_64-linux-musl/x86_64-linux-musl/lib + cd $root/bin + targets="ar as c++ g++ gcc ld ld.bfd nm objcopy objdump ranlib strip" + for t in $targets; do + ln -sf /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-$t $t + done + ln -sf gcc cc + cd - +} diff --git a/pkgs/libevent b/pkgs/libevent @@ -0,0 +1,24 @@ +url=$mirror/libevent-2.0.21-stable.tar.gz + +fetch() { + wget -c $url -O src/libevent-2.0.21-stable.tar.gz +} + +unpack() { + cd src + [ -d libevent-2.0.21-stable ] || tar xzf libevent-2.0.21-stable.tar.gz + cd - +} + +build() { + cd src/libevent-2.0.21-stable + CC="x86_64-linux-musl-gcc -static" ./configure --prefix=$libcroot --disable-shared --enable-static || return 1 + make -j$nprocs || return 1 + cd - +} + +install() { + cd src/libevent-2.0.21-stable + make install || return 1 + cd - +} diff --git a/pkgs/ncurses b/pkgs/ncurses @@ -0,0 +1,28 @@ +url=$mirror/ncurses.tar.gz + +fetch() { + wget -c $url -O src/ncurses.tar.gz +} + +unpack() { + cd src + [ -d ncurses-5.9 ] || tar xzf ncurses.tar.gz + cd - +} + +build() { + cd src/ncurses-5.9 + cp $top/stuff/ncurses-fallback.c ncurses/fallback.c + CC="x86_64-linux-musl-gcc -static" ./configure --prefix=$libcroot --without-tests \ + --with-normal --enable-sigwinch --disable-nls --without-dlsym \ + --without-cxx-binding \ + --with-fallbacks="linux vt100 xterm xterm256-color" </dev/ptmx || return 1 + make -j$nprocs || return 1 + cd - +} + +install() { + cd src/ncurses-5.9 + make install || return 1 + cd - +} diff --git a/pkgs/tinyxlib b/pkgs/tinyxlib @@ -0,0 +1,25 @@ +url=$mirror/tinyxlib.tar.gz + +fetch() { + wget -c $url -O src/tinyxlib.tar.gz +} + +unpack() { + cd src + [ -d tinyxlib ] || tar xzf tinyxlib.tar.gz + cd - +} + +build() { + cd src/tinyxlib + make clean + make CC=x86_64-linux-musl-gcc BINDIR="/bin" LIBDIR="/lib" STATIC=1 \ + FONT_ENCODINGS_DIRECTORY="/usr/share/fonts/encodings/encodings.dir" + cd - +} + +install() { + cd src/tinyxlib + make DESTDIR="$libcroot" BINDIR="/bin" LIBDIR="/lib" STATIC=1 install + cd - +} diff --git a/pkgs/zlib b/pkgs/zlib @@ -0,0 +1,24 @@ +url=$mirror/zlib-1.2.8.tar.gz + +fetch() { + wget -c $url -O src/zlib-1.2.8.tar.gz +} + +unpack() { + cd src + [ -d zlib-1.2.8 ] || tar xzf zlib-1.2.8.tar.gz + cd - +} + +build() { + cd src/zlib-1.2.8 + CC=x86_64-linux-musl-gcc ./configure --prefix=$libcroot --static || return 1 + make -j$nprocs || return 1 + cd - +} + +install() { + cd src/zlib-1.2.8 + make install || return 1 + cd - +} diff --git a/stage0 b/stage0 @@ -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 - -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 +packages="crossmusl + ncurses + libevent + zlib + tinyxlib + kernel + emul + busybox + fs + make + man + mksh + rsync + sbase + sdhcp + sic + sinit + smdev + syslinux + tinyxserver + tmux + ubase" + +./pkgbuild $packages