commit b9d1298099cccb6314c0f90f63b5a95de0f4a62d
Author: Daniel Bainton <dpb@driftaway.org>
Date: Wed, 26 Mar 2014 20:32:08 +0000
Add stage0 packages
Diffstat:
38 files changed, 798 insertions(+), 0 deletions(-)
diff --git a/file/file.mk b/file/file.mk
@@ -0,0 +1,108 @@
+v = 5.17
+BIN = file
+OBJ = `{ls *.c | sed 's/.$/o/'}
+TARG = magic.mgc
+INSTALL_BIN = file
+INSTALL_OTHER1 = ../magic/magic.mgc
+INSTALL_OTHER1_DIR = /share/file
+DEPS = zlib
+
+CLEAN_FILES = ../magic/magic.mgc
+
+MAGIC = $PREFIX/share/file/magic
+LOCAL_CFLAGS = \
+ -DBUILTIN_ELF=1 \
+ -DELFCORE=1 \
+ -DHAVE_ASCTIME_R=1 \
+ -DHAVE_ASPRINTF=1 \
+ -DHAVE_CTIME_R=1 \
+ -DHAVE_DAYLIGHT=1 \
+ -DHAVE_DECL_DAYLIGHT=1 \
+ -DHAVE_DECL_TZNAME=1 \
+ -DHAVE_DLFCN_H=1 \
+ -DHAVE_ERR_H=1 \
+ -DHAVE_FCNTL_H=1 \
+ -DHAVE_FORK=1 \
+ -DHAVE_FSEEKO=1 \
+ -DHAVE_GETLINE=1 \
+ -DHAVE_GETOPT_H=1 \
+ -DHAVE_GETOPT_LONG=1 \
+ -DHAVE_GETPAGESIZE=1 \
+ -DHAVE_INTTYPES_H=1 \
+ -DHAVE_LIBZ=1 \
+ -DHAVE_LIMITS_H=1 \
+ -DHAVE_LOCALE_H=1 \
+ -DHAVE_MBRTOWC=1 \
+ -DHAVE_MBSTATE_T=1 \
+ -DHAVE_MEMORY_H=1 \
+ -DHAVE_MKOSTEMP=1 \
+ -DHAVE_MKSTEMP=1 \
+ -DHAVE_MMAP=1 \
+ -DHAVE_PREAD=1 \
+ -DHAVE_STDDEF_H=1 \
+ -DHAVE_STDINT_H=1 \
+ -DHAVE_STDLIB_H=1 \
+ -DHAVE_STRCASESTR=1 \
+ -DHAVE_STRERROR=1 \
+ -DHAVE_STRINGS_H=1 \
+ -DHAVE_STRING_H=1 \
+ -DHAVE_STRNDUP=1 \
+ -DHAVE_STRTOF=1 \
+ -DHAVE_STRTOUL=1 \
+ -DHAVE_STRUCT_OPTION=1 \
+ -DHAVE_STRUCT_STAT_ST_RDEV=1 \
+ -DHAVE_STRUCT_TM_TM_ZONE=1 \
+ -DHAVE_SYS_MMAN_H=1 \
+ -DHAVE_SYS_PARAM_H=1 \
+ -DHAVE_SYS_STAT_H=1 \
+ -DHAVE_SYS_TIME_H=1 \
+ -DHAVE_SYS_TYPES_H=1 \
+ -DHAVE_SYS_WAIT_H=1 \
+ -DHAVE_TM_ISDST=1 \
+ -DHAVE_TM_ZONE=1 \
+ -DHAVE_TZNAME=1 \
+ -DHAVE_UNISTD_H=1 \
+ -DHAVE_UTIME=1 \
+ -DHAVE_UTIMES=1 \
+ -DHAVE_UTIME_H=1 \
+ -DHAVE_VASPRINTF=1 \
+ -DHAVE_VFORK=1 \
+ -DHAVE_VISIBILITY=1 \
+ -DHAVE_WCHAR_H=1 \
+ -DHAVE_WCTYPE_H=1 \
+ -DHAVE_WCWIDTH=1 \
+ -DHAVE_WORKING_FORK=1 \
+ -DHAVE_WORKING_VFORK=1 \
+ -DHAVE_ZLIB_H=1 \
+ -DPACKAGE="file" \
+ -DPACKAGE_BUGREPORT="christos@astron.com" \
+ -DPACKAGE_NAME="file" \
+ -DPACKAGE_TARNAME="file" \
+ -DPACKAGE_URL="" \
+ -DPACKAGE_VERSION=\"$v\" \
+ -DSTDC_HEADERS=1 \
+ -D_ALL_SOURCE=1 \
+ -D_GNU_SOURCE=1 \
+ -D_POSIX_PTHREAD_SEMANTICS=1 \
+ -D_TANDEM_SOURCE=1 \
+ -D__EXTENSIONS__=1 \
+ -DVERSION=\"$v\" \
+ -DMAGIC=\"$MAGIC\"
+
+<$mkbuild/mk.common
+
+file: $OBJ
+
+strcasestr.c:QV:
+ printf "\n#ifndef _INTPTR_T_DEFINED\n#define _INTPTR_T_DEFINED\n#define intptr_t int\n#endif\n" > strcasestr.c.tmp
+ cat strcasestr.c >> strcasestr.c.tmp
+ mv strcasestr.c.tmp strcasestr.c
+
+magic.h:Q:
+ sed -e "s/X.YY/$(echo $v | sed -e "s|\.||g")/" < magic.h.in > magic.h
+
+magic.mgc:Q: file
+ cd ../magic
+ mkdir -p magic
+ cp Header Localstuff Magdir/* magic/
+ ../src/file -C -m magic
diff --git a/file/mkfile b/file/mkfile
@@ -0,0 +1,6 @@
+<$mkbuild/mk.3rdparty
+
+v = 5.17
+src = file-$v/src
+url = $mirror/file-$v.tar.gz
+mkfile = ../../file.mk
diff --git a/fs/bin/poweroff b/fs/bin/poweroff
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/bin/kill -s USR1 1
diff --git a/fs/bin/rc.init b/fs/bin/rc.init
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+PATH=/bin
+export PATH
+
+umask 022
+
+. /etc/rc.conf
+
+echo
+echo
+echo " Morpheus booting"
+echo
+echo
+
+# Soft reboot on ctrl-alt-del
+ctrlaltdel -s
+
+mkdir -p /proc
+mkdir -p /sys
+mount -n -t proc -o nosuid,noexec,nodev proc /proc
+mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys
+
+mount -n -t tmpfs -o nosuid,mode=0755 dev /dev
+mkdir -p /dev/pts
+mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts
+
+grep -q " verbose" /proc/cmdline && dmesg -n 8 || dmesg -n 3
+
+mount -o remount,ro /
+
+echo Running smdev
+smdev -s
+
+echo Setting smdev as the kernel hotplug
+echo /bin/smdev > /proc/sys/kernel/hotplug
+
+echo Checking filesystems
+fsck -ATa
+if [ $? -eq 1 ]; then
+ echo Filesystem errors exist, fix manually.
+ sh
+ halt -r
+fi
+
+echo Remounting root as read-write
+mount -o remount,rw /
+
+echo Mounting filesystems
+mount -a
+
+echo "Setting hostname to $HOSTNAME"
+hostname $HOSTNAME
+
+echo Bringing up the lo interface
+ifconfig lo up
+
+HWCLOCK_PARAMS="-s"
+case $HARDWARECLOCK in
+ "")
+ ;;
+ UTC)
+ HWCLOCK_PARAMS="-u $HWCLOCK_PARAMS"
+ ;;
+ localtime)
+ HWCLOCK_PARAMS="-l $HWCLOCK_PARAMS"
+ ;;
+ *)
+ HWCLOCK_PARAMS=""
+ ;;
+esac
+
+if [ -n "$HWCLOCK_PARAMS" ]; then
+ echo Setting hwclock
+ [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE"
+ hwclock $HWCLOCK_PARAMS
+ unset TZ
+fi
+
+echo Setting random seed
+[ -f /etc/random-seed ] && cat /etc/random-seed >/dev/urandom
+dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null
+
+echo Storing dmesg output to /var/log/dmesg.log
+dmesg > /var/log/dmesg.log
+if [ -e /proc/sys/kernel/dmesg_restrict ] && [ $(cat /proc/sys/kernel/dmesg_restrict) = "1" ];
+then
+ chmod 0600 /var/log/dmesg.log
+else
+ chmod 0644 /var/log/dmesg.log
+fi
+
+if [ -x /bin/rc.modules ]; then
+ echo Running rc.modules
+ /bin/rc.modules
+fi
+
+if [ -x /bin/rc.svc ]; then
+ echo Running rc.svc
+ /bin/rc.svc
+fi
+
+echo
+sh -c 'respawn getty /dev/tty1 linux' &
+sh -c 'respawn getty /dev/tty2 linux' &
+sh -c 'respawn getty /dev/tty3 linux' &
+sh -c 'respawn getty /dev/tty4 linux' &
diff --git a/fs/bin/rc.local b/fs/bin/rc.local
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/fs/bin/rc.modules b/fs/bin/rc.modules
diff --git a/fs/bin/rc.shutdown b/fs/bin/rc.shutdown
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+PATH=/bin
+export PATH
+
+umask 022
+
+. /etc/rc.conf
+
+case "$1" in
+reboot|poweroff)
+ ;;
+*)
+ echo "Invalid action '$1' for rc.shutdown" 1>&2
+ exit 1
+ ;;
+esac
+
+# Set linefeed mode to avoid staircase effect
+echo; stty onlcr
+
+echo Shutting down
+
+HWCLOCK_PARAMS="-w"
+case $HARDWARECLOCK in
+ "")
+ ;;
+ UTC)
+ HWCLOCK_PARAMS="-u $HWCLOCK_PARAMS"
+ ;;
+ localtime)
+ HWCLOCK_PARAMS="-l $HWCLOCK_PARAMS"
+ ;;
+ *)
+ HWCLOCK_PARAMS=""
+ ;;
+esac
+
+if [ -n "$HWCLOCK_PARAMS" ]; then
+ echo Saving system clock
+ [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE"
+ hwclock $HWCLOCK_PARAMS
+ unset TZ
+fi
+
+echo Storing random seed
+dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null
+
+svc -k
+
+killall5 -s TERM
+sleep 3
+killall5 -s KILL
+
+echo Remounting root as read-only
+mount -o remount,ro /
+
+echo Unmounting filesystems
+umount -a
+
+sync
+sleep 3
+wait
+
+echo bye
+
+case "$1" in
+reboot)
+ halt -r
+ ;;
+poweroff)
+ halt -p
+ ;;
+esac
diff --git a/fs/bin/rc.svc b/fs/bin/rc.svc
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. /etc/rc.conf
+
+svc -c
+svc -s
+
+if [ -x /bin/rc.local ]; then
+ echo Running rc.local
+ /bin/rc.local
+fi
diff --git a/fs/bin/reboot b/fs/bin/reboot
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/bin/kill -s INT 1
diff --git a/fs/bin/respawn b/fs/bin/respawn
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+usage() {
+ echo "usage $(basename $0) [-d delay] cmd arg..." 1>&2
+ exit 1
+}
+
+delay=0
+while getopts ":d:" opt; do
+ case $opt in
+ d)
+ delay=$OPTARG
+ ;;
+ \?|:)
+ usage
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
+
+if test -z $1; then
+ usage
+fi
+
+while :; do
+ $*
+ sleep $delay
+done
diff --git a/fs/bin/svc b/fs/bin/svc
@@ -0,0 +1,144 @@
+#!/bin/sh
+#
+#MIT/X Consortium License
+#
+#© 2012-14 Christoph Lohmann <20h@r-36.net>
+#
+#Permission is hereby granted, free of charge, to any person obtaining a
+#copy of this software and associated documentation files (the "Software"),
+#to deal in the Software without restriction, including without limitation
+#the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#and/or sell copies of the Software, and to permit persons to whom the
+#Software is furnished to do so, subject to the following conditions:
+#
+#The above copyright notice and this permission notice shall be included in
+#all copies or substantial portions of the Software.
+#
+#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+#FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+#DEALINGS IN THE SOFTWARE.
+#
+# % svc -a # list all links in /bin/svc.d/run (all activated services)
+# % svc -a ser # activate service to be run on startup
+# % svc -c # create the basic directories of svc (configure)
+# % svc -d ser # deactivate service
+# % svc -k # kill all services linked to /bin/svc.d/run
+# % svc -k ser # kill service
+# % svc -s # run all services linked to /bin/svc.d/run
+# % svc -s ser # run service
+# % svc -l # list all services in /bin/svc.d/avail
+# % svc -r ser # restart service
+
+BASEDIR="/bin/svc.d"
+BASENAME="$(basename $0)"
+
+[ -d "$BASEDIR" ] || mkdir -p "$BASEDIR"
+cd $BASEDIR
+
+usage() {
+ printf "usage: %s [-acdklrs] [service]\n" "$BASENAME" >&2
+ exit 1
+}
+
+if [ $# -lt 1 ];
+then
+ usage
+fi
+
+runservice() {
+ service="$1"
+ dir="$2"
+ cmd="$3"
+
+ if [ $(ls -la "$dir/$service" | awk '{print $5}') -eq 0 ];
+ then
+ "./bare.sh" "$service" "$cmd" 2>&1 >/dev/null &
+ else
+ "$dir/$service" "$cmd" 2>&1 >/dev/null &
+ fi
+}
+
+doservice() {
+ cmd="$1"
+ service="$2"
+
+ if [ -z "${service}" ];
+ then
+ services=$(ls run)
+ for s in ${services};
+ do
+ runservice "$s" run "$cmd"
+ printf "%s: '%s' %s.\n" \
+ "$BASENAME" "$s" "$cmd"
+ done
+ else
+ if [ -x "avail/$service" ];
+ then
+ runservice "$service" avail "$cmd"
+ printf "%s: '%s' %s.\n" \
+ "$BASENAME" "$service" "$cmd"
+ else
+ printf "%s: '%s' is not available or executable.\n" \
+ "$BASENAME" "$service" >&2
+ exit 1
+ fi
+ fi
+}
+
+case "$1" in
+ -a)
+ if [ $# -gt 1 ] && [ -e "avail/$2" ];
+ then
+ ln -sf "../avail/$2" "run/$2"
+ printf "%s: '%s' activated.\n" \
+ "$BASENAME" "$2"
+ else
+ cd run
+ ls .
+ fi
+ ;;
+ -c)
+ [ -d "$BASEDIR" ] || mkdir -p "$BASEDIR"
+ [ -d "$BASEDIR/avail" ] || mkdir -p "$BASEDIR/avail"
+ [ -d "$BASEDIR/default" ] || mkdir -p "$BASEDIR/default"
+ [ -d "$BASEDIR/run" ] || mkdir -p "$BASEDIR/run"
+ ;;
+ -d)
+ if [ $# -gt 1 ] && [ -e "run/$2" ];
+ then
+ rm -f "run/$2"
+ printf "%s: '%s' deactivated.\n" \
+ "$BASENAME" "$2"
+ else
+ printf "%s: No service given or service is not marked as to run.\n" \
+ "$BASENAME" >&2
+ exit 1
+ fi
+ ;;
+ -k|-s)
+ doservice "$1" "$2"
+ ;;
+ -l)
+ cd avail
+ ls .
+ ;;
+ -r)
+ if [ $# -gt 1 ];
+ then
+ set -x
+ svc -k "$2"
+ svc -s "$2"
+ else
+ printf "%s: please give a service name.\n" \
+ "$BASENAME" >&2
+ exit 1
+ fi
+ ;;
+ *)
+ usage
+ ;;
+esac
diff --git a/fs/etc/fstab b/fs/etc/fstab
@@ -0,0 +1,6 @@
+#
+# /etc/fstab: static file system information
+#
+# <file system> <dir> <type> <options> <dump> <pass>
+/dev/sda1 / ext4 defaults 0 1
+tmp /tmp tmpfs nosuid,noexec 0 0
diff --git a/fs/etc/group b/fs/etc/group
@@ -0,0 +1,11 @@
+root:x:0:root
+bin:x:1:root,bin,daemon
+daemon:x:2:root,bin,daemon
+sys:x:3:root,bin
+adm:x:4:root,daemon
+tty:x:5:
+disk:x:6:root
+cdrom:x:7:root
+video:x:8:root
+audio:x:9:root
+nogroup:x:65534:
diff --git a/fs/etc/hosts b/fs/etc/hosts
@@ -0,0 +1,10 @@
+#
+# /etc/hosts: static lookup table for host names
+#
+
+#<ip-address> <hostname.domain.org> <hostname>
+127.0.0.1 localhost.localdomain localhost
+::1 localhost.localdomain localhost
+
+# End of file
+127.0.0.1 morpheus
diff --git a/fs/etc/issue b/fs/etc/issue
@@ -0,0 +1 @@
+Morpheus (\s \m \r) (\l)
diff --git a/fs/etc/motd b/fs/etc/motd
diff --git a/fs/etc/passwd b/fs/etc/passwd
@@ -0,0 +1,4 @@
+root::0:0:root:/root:/bin/mksh
+bin:x:1:1:bin:/bin:/bin/false
+daemon:x:2:2:daemon:/sbin:/bin/false
+nobody:x:65534:65534:nobody:/nonexistent:/bin/false
diff --git a/fs/etc/profile b/fs/etc/profile
@@ -0,0 +1,5 @@
+PATH=/bin
+MANPATH=/share/man
+export PATH MANPATH
+
+umask 022
diff --git a/fs/etc/rc.conf b/fs/etc/rc.conf
@@ -0,0 +1,4 @@
+HOSTNAME=morpheus
+INTERFACE=eth0
+HARDWARECLOCK="UTC"
+TIMEZONE="Europe/London"
diff --git a/fs/etc/resolv.conf b/fs/etc/resolv.conf
@@ -0,0 +1 @@
+nameserver 208.67.222.222
diff --git a/fs/etc/shells b/fs/etc/shells
@@ -0,0 +1,2 @@
+/bin/sh
+/bin/mksh
diff --git a/fs/mkfile b/fs/mkfile
@@ -0,0 +1,40 @@
+INSTALL_DIRS = \
+ /boot \
+ /bin \
+ /dev \
+ /etc \
+ /home \
+ /mnt \
+ /opt \
+ /proc \
+ /root \
+ /share \
+ /src \
+ /sys \
+ /tmp \
+ /var \
+ /var/empty \
+ /var/log \
+ /var/run \
+ /bin/svc.d/avail \
+ /bin/svc.d/default
+
+INSTALL_BIN = `{ls bin}
+
+INSTALL_SYMLINKS = \
+ . /usr \
+ bin /sbin \
+ ../tmp /var/tmp
+
+INSTALL_OTHER1 = `{ls svc.d}
+INSTALL_OTHER1_DIR = /bin/svc.d
+INSTALL_OTHER2 = `{ls etc/}
+INSTALL_OTHER2_DIR = /etc
+INSTALL_OTHER3 = `{ls skel}
+INSTALL_OTHER3_DIR = /etc/skel
+
+INSTALL_PERMISSIONS = \
+ 1777 /tmp \
+ 700 /root
+
+<$mkbuild/mk.common
diff --git a/fs/skel/.mkshrc b/fs/skel/.mkshrc
@@ -0,0 +1,4 @@
+PS1='# '
+
+# C-l should clear the screen
+bind -m '^L'='^U'clear'^J''^Y'
diff --git a/fs/skel/.profile b/fs/skel/.profile
@@ -0,0 +1,14 @@
+PATH=/bin
+TERM=linux
+HISTFILE=~/.mksh_history
+EDITOR=jmacs
+PAGER=less
+ENV=~/.mkshrc
+export PATH TERM HISTFILE EDITOR PAGER ENV
+
+set -o emacs
+set -o bgnice
+set -o notify
+set -o utf8-mode
+
+umask 022
diff --git a/fs/skel/.xinitrc b/fs/skel/.xinitrc
@@ -0,0 +1,3 @@
+xsetroot -solid black &
+uuterm-x11 &
+exec dwm
diff --git a/fs/svc.d/bare.sh b/fs/svc.d/bare.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+[ $# -eq 0 ] && SERVICE="$0"
+
+if [ $# -gt 0 ];
+then
+ SERVICE="$1"
+ shift 1
+fi
+
+[ -e "/bin/svc.d/default/$SERVICE" ] && . "/bin/svc.d/default/$SERVICE"
+
+BIN=""
+for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin;
+do
+ if [ -x "$p/$SERVICE" ];
+ then
+ BIN="$p/$SERVICE"
+ break
+ fi
+done
+[ -z "$BIN" ] && exit 1
+
+PID=$(pidof -o %PPID $BIN)
+
+case $1 in
+ -s)
+ [ -z "$PID" ] && $BIN $PARAMS;
+ ;;
+ -k)
+ [ -n "$PID" ] && kill -9 $PID &> /dev/null;
+ ;;
+ *)
+ echo "usage: $0 -s|-k"
+ exit 1
+esac
+
diff --git a/hbase/mkfile b/hbase/mkfile
@@ -0,0 +1,5 @@
+<$mkbuild/mk.3rdparty
+
+src = hbase
+git = git://git.2f30.org/hbase
+mkfile = mkfile
diff --git a/mksh/mkfile b/mksh/mkfile
@@ -0,0 +1,6 @@
+<$mkbuild/mk.3rdparty
+
+src = mksh
+url = $mirror/mksh-R47.tar.gz
+mkfile = ../mksh.mk
+
diff --git a/mksh/mksh.mk b/mksh/mksh.mk
@@ -0,0 +1,85 @@
+BIN = mksh
+OBJ = \
+ edit.o \
+ eval.o \
+ exec.o \
+ expr.o \
+ funcs.o \
+ histrap.o \
+ jobs.o \
+ lalloc.o \
+ lex.o \
+ main.o \
+ misc.o \
+ shf.o \
+ strlcpy.o \
+ syn.o \
+ tree.o \
+ var.o
+
+<$mkbuild/mk.default
+
+INSTALL_BIN = mksh
+INSTALL_MAN1 = mksh.1
+INSTALL_SYMLINK = \
+ mksh $BINDIR/sh \
+ mksh.1 $MANDIR/man1/sh.1 \
+ mksh $BINDIR/ksh \
+ mksh.1 $MANDIR/man1/ksh.1
+LOCAL_CFLAGS = "\
+ -I. -DMKSH_BUILDSH -D_GNU_SOURCE -DSETUID_CAN_FAIL_WITH_EAGAIN \
+ -DHAVE_ATTRIBUTE_BOUNDED=0 -DHAVE_ATTRIBUTE_FORMAT=1 \
+ -DHAVE_ATTRIBUTE_NORETURN=1 -DHAVE_ATTRIBUTE_UNUSED=1 \
+ -DHAVE_ATTRIBUTE_USED=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TIME_H=1 \
+ -DHAVE_BOTH_TIME_H=1 -DHAVE_SYS_BSDTYPES_H=0 -DHAVE_SYS_FILE_H=1 \
+ -DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_PARAM_H=1 \
+ -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SYSMACROS_H=1 \
+ -DHAVE_BSTRING_H=0 -DHAVE_GRP_H=1 -DHAVE_LIBGEN_H=1 -DHAVE_LIBUTIL_H=0 \
+ -DHAVE_PATHS_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_TERMIOS_H=1 \
+ -DHAVE_ULIMIT_H=1 -DHAVE_VALUES_H=1 -DHAVE_CAN_INTTYPES=1 \
+ -DHAVE_CAN_UCBINTS=1 -DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 \
+ -DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 -DHAVE_SYS_ERRLIST=0 -DHAVE_SYS_SIGNAME=0 \
+ -DHAVE_SYS_SIGLIST=0 -DHAVE_FLOCK=1 -DHAVE_LOCK_FCNTL=1 -DHAVE_GETRUSAGE=1 \
+ -DHAVE_GETTIMEOFDAY=1 -DHAVE_KILLPG=1 -DHAVE_MEMMOVE=1 -DHAVE_MKNOD=0 \
+ -DHAVE_MMAP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=0 -DHAVE_SETLOCALE_CTYPE=1 \
+ -DHAVE_LANGINFO_CODESET=1 -DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 \
+ -DHAVE_SETGROUPS=1 -DHAVE_STRERROR=1 -DHAVE_STRSIGNAL=1 -DHAVE_STRLCPY=1 \
+ -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 -DHAVE_SYS_ERRLIST_DECL=0 \
+ -DHAVE_SYS_SIGLIST_DECL=0 -DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=471"
+
+histrap.o: signames.inc
+
+signames.inc:
+ cat > signames.inc << EOF
+ { "INT", 2 },
+ { "SEGV", 11 },
+ { "ABRT", 6 },
+ { "KILL", 9 },
+ { "ALRM", 14 },
+ { "BUS", 7 },
+ { "CHLD", 17 },
+ { "CONT", 18 },
+ { "FPE", 8 },
+ { "HUP", 1 },
+ { "ILL", 4 },
+ { "IO", 29 },
+ { "PIPE", 13 },
+ { "PROF", 27 },
+ { "PWR", 30 },
+ { "QUIT", 3 },
+ { "STOP", 19 },
+ { "SYS", 31 },
+ { "TERM", 15 },
+ { "TRAP", 5 },
+ { "TSTP", 20 },
+ { "TTIN", 21 },
+ { "TTOU", 22 },
+ { "URG", 23 },
+ { "USR1", 10 },
+ { "USR2", 12 },
+ { "VTALRM", 26 },
+ { "WINCH", 28 },
+ { "XCPU", 24 },
+ { "XFSZ", 25 },
+ { "STKFLT", 16 },
+ EOF
diff --git a/sbase/mkfile b/sbase/mkfile
@@ -0,0 +1,5 @@
+<$mkbuild/mk.3rdparty
+
+src = sbase
+git = git://git.2f30.org/sbase
+mkfile = ../sbase.mk
diff --git a/sbase/sbase.mk b/sbase/sbase.mk
@@ -0,0 +1,14 @@
+BIN = `{ls *.c | sed 's/..$//' | grep -v '^cp$\|^tar$\|^grep$'}
+OBJ = ${BIN:%=%.o}
+LIB = util.a
+LOBJ = `{ls util/*.c | sed 's/.$/o/'}
+INSTALL_BIN = `{ls *.c | sed 's/..$//' | grep -v '^cp$\|^tar$\|^grep$'}
+INSTALL_MAN1 = `{ls *.1}
+NPROC = 2
+
+<$mkbuild/mk.common
+
+&:n: &.o $LIB
+
+$LIB: $LOBJ
+
diff --git a/sinit/mkfile b/sinit/mkfile
@@ -0,0 +1,5 @@
+<$mkbuild/mk.3rdparty
+
+src = sinit
+git = git://git.2f30.org/sinit
+mkfile = ../sinit.mk
diff --git a/sinit/sinit.mk b/sinit/sinit.mk
@@ -0,0 +1,12 @@
+BIN = sinit
+OBJ = sinit.o
+INSTALL_BIN = sinit
+INSTALL_SYMLINK = sinit /bin/init
+
+<$mkbuild/mk.default
+
+%.h: %.def.h
+ cp -f $prereq $target
+
+sinit.o: config.h
+
diff --git a/ubase/mkfile b/ubase/mkfile
@@ -0,0 +1,5 @@
+<$mkbuild/mk.3rdparty
+
+src = ubase
+git = git://git.2f30.org/ubase
+mkfile = ../ubase.mk
diff --git a/ubase/ubase.mk b/ubase/ubase.mk
@@ -0,0 +1,18 @@
+BIN = `{ls *.c | sed 's/..$//' | grep -v '^ps$'}
+OBJ = ${BIN:%=%.o}
+LIB = util.a
+LOBJ = `{ls util/*.c | sed 's/.$/o/'}
+INSTALL_BIN = `{ls *.c | sed 's/..$//' | grep -v '^ps$'}
+INSTALL_MAN1 = `{ls *.1}
+NPROC = 2
+
+<$mkbuild/mk.common
+
+&:n: &.o $LIB
+
+$LIB: $LOBJ
+
+%.h: %.def.h
+ cp -f $prereq $target
+
+su: config.h
diff --git a/zlib/depsinc.mk b/zlib/depsinc.mk
@@ -0,0 +1,3 @@
+
+DEPS_CFLAGS = $DEPS_CFLAGS -I$zlib_DEPDIR/zlib-1.2.8
+DEPS_LDFLAGS = $DEPS_LDFLAGS -L$zlib_DEPDIR/zlib-1.2.8 -lz
diff --git a/zlib/mkfile b/zlib/mkfile
@@ -0,0 +1,6 @@
+<$mkbuild/mk.3rdparty
+
+v = 1.2.8
+src = zlib-$v
+url = $mirror/zlib-$v.tar.gz
+mkfile = ../zlib.mk
diff --git a/zlib/zlib.mk b/zlib/zlib.mk
@@ -0,0 +1,6 @@
+LIB = libz.a
+LOBJ = `{ls *.c | sed 's/.$/o/'}
+NPROC = 2
+
+<$mkbuild/mk.default
+