diff options
Diffstat (limited to 'scripts/build.sh')
-rwxr-xr-x | scripts/build.sh | 202 |
1 files changed, 102 insertions, 100 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index d8a1bdd..f2e8d4c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,8 +18,8 @@ set -e SCRIPT=$(readlink -f "$0") BASE=$(dirname ${SCRIPT})/.. -#CPUS=$(nproc) -CPUS=1 +CPUS=$(nproc) +#CPUS=1 . "${BASE}/configs/versions" @@ -30,7 +30,7 @@ echo "Building in base directory '$BASE'" # stage 0 ######### -cd "${BASE}/src/stage0" +cd "${BASE}/src/stage0" || exit 1 # stage 0 host, build a 64-bit cross-compiler for i386, the host might # not have a packaged tcc at all or one not built for cross-compilation @@ -40,13 +40,13 @@ cd "${BASE}/src/stage0" if [ ! -x "${BASE}/build/stage0/bin/i386-tcc" ]; then rm -rf "tinycc-${TINYCC_VERSION}" tar xf "${BASE}/downloads/tinycc-${TINYCC_VERSION}.tar.gz" - cd "tinycc-${TINYCC_VERSION}" + cd "tinycc-${TINYCC_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/tcc-asm.patch" ./configure --enable-static --prefix="${BASE}/build/stage0" \ --config-musl --enable-cross make -j$CPUS make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage0 tcc-i386 binary exists" fi @@ -57,53 +57,28 @@ fi if [ ! -f "${BASE}/build/stage0/lib/libc.a" ]; then rm -rf "musl-${MUSL_VERSION}" tar xf "${BASE}/downloads/musl-${MUSL_VERSION}.tar.gz" - cd "musl-${MUSL_VERSION}" + cd "musl-${MUSL_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/musl-tcc.patch" CC="${BASE}/build/stage0/bin/i386-tcc" ./configure \ --prefix="${BASE}/build/stage0" \ --target=i386-linux-musl --disable-shared make -j$CPUS AR="${BASE}/build/stage0/bin/i386-tcc -ar" RANLIB=echo make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage0 musl C library exists" fi -# tools on the host (assuming we use i386 code compiled with tcc and run -# on a AMD64/i386 host) - -cd "${BASE}" - -if [ ! -x "${BASE}/tools/rdev" ]; then - "${BASE}/build/stage1/bin/i386-tcc" -static -o tools/rdev tools/rdev.c -else - echo "tool rdev exists" -fi - -cd "${BASE}/src/stage1" - -if [ ! -f "${BASE}/tools/bdftopcf" ]; then - rm -rf "bdftopcf-${BDFTOPCF_VERSION}" - tar xf "${BASE}/downloads/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" - cd "bdftopcf-${BDFTOPCF_VERSION}" - patch -Np1 < "${BASE}/patches/bdftopcf-tcc.patch" - "${BASE}/build/stage1/bin/i386-tcc" -static -I. -DPACKAGE_STRING='"bdftopdf ${BDFTOPCF_VERSION}"' -o "${BASE}/tools/bdftopcf" *.c - cd .. -else - echo "tool bdftopcf exists" -fi - -cd .. # build tcc with tcc from stage1 against musl from stage0, it should # have no dependencies on the host anymore -cd "${BASE}/src/stage1" +cd "${BASE}/src/stage1" || exit 1 if [ ! -x "${BASE}/build/stage1/bin/i386-tcc" ]; then rm -rf "tinycc-${TINYCC_VERSION}" tar xf "${BASE}/downloads/tinycc-${TINYCC_VERSION}.tar.gz" - cd "tinycc-${TINYCC_VERSION}" + cd "tinycc-${TINYCC_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/tcc-asm.patch" patch -Np1 < "${BASE}/patches/tcc-stage1.patch" sed -i "s|@@BASE@@|${BASE}|g" Makefile configure config-extra.mak @@ -114,7 +89,7 @@ if [ ! -x "${BASE}/build/stage1/bin/i386-tcc" ]; then make -j$CPUS make -j$CPUS install ln -fs tcc/i386-libtcc1.a "${BASE}/build/stage1/lib/." - cd .. + cd .. || exit 1 else echo "stage1 tcc-i386 binary exists" fi @@ -127,7 +102,7 @@ fi if [ ! -f "${BASE}/build/stage1/lib/libc.a" ]; then rm -rf "musl-${MUSL_VERSION}" tar xf "${BASE}/downloads/musl-${MUSL_VERSION}.tar.gz" - cd "musl-${MUSL_VERSION}" + cd "musl-${MUSL_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/musl-tcc.patch" CC="${BASE}/build/stage1/bin/i386-tcc" ARCH=i386 \ ./configure \ @@ -135,7 +110,7 @@ if [ ! -f "${BASE}/build/stage1/lib/libc.a" ]; then --target=i386-linux-musl --disable-shared make -j$CPUS AR="${BASE}/build/stage1/bin/i386-tcc -ar" RANLIB=echo make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 musl C library exists" fi @@ -146,9 +121,9 @@ fi if [ ! -d "${BASE}/build/stage1/include/linux" ]; then rm -rf "linux-${LINUX_KERNEL_VERSION}" tar xf "${BASE}/downloads/linux-${LINUX_KERNEL_VERSION}.tar.gz" - cd "linux-${LINUX_KERNEL_VERSION}" + cd "linux-${LINUX_KERNEL_VERSION}" || exit 1 CC=false make -j$CPUS ARCH=x86 INSTALL_HDR_PATH="${BASE}/build/stage1" headers_install - cd .. + cd .. || exit 1 else echo "stage1 kernel headers exist" fi @@ -169,7 +144,7 @@ fi if [ ! -x "${BASE}/build/stage1/bin/oksh" ]; then rm -rf "oksh-${_OKSH_VERSION}" tar xf "${BASE}/downloads/oksh-${_OKSH_VERSION}.tar.gz" - cd "oksh-${_OKSH_VERSION}" + cd "oksh-${_OKSH_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure \ --prefix="${BASE}/build/stage1" \ @@ -177,7 +152,7 @@ if [ ! -x "${BASE}/build/stage1/bin/oksh" ]; then make -j$CPUS LDFLAGS=-static make -j$CPUS install ln -s oksh "${BASE}/build/stage1/bin/sh" - cd .. + cd .. || exit 1 else echo "stage1 oksh exists" fi @@ -185,10 +160,10 @@ fi if [ ! -x "${BASE}/build/stage1/bin/sbase-box" ]; then rm -rf "sbase-${SBASE_VERSION}" tar xf "${BASE}/downloads/sbase-${SBASE_VERSION}.tar.gz" - cd "sbase-${SBASE_VERSION}" + cd "sbase-${SBASE_VERSION}" || exit 1 make -j$CPUS sbase-box CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static make -j$CPUS sbase-box-install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 sbase exists" fi @@ -196,11 +171,11 @@ fi if [ ! -x "${BASE}/build/stage1/bin/ubase-box" ]; then rm -rf "ubase-${UBASE_VERSION}" tar xf "${BASE}/downloads/ubase-${UBASE_VERSION}.tar.gz" - cd "ubase-${UBASE_VERSION}" + cd "ubase-${UBASE_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/ubase-sysmacros.patch" make -j$CPUS ubase-box CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static make -j$CPUS ubase-box-install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 ubase exists" fi @@ -208,11 +183,11 @@ fi if [ ! -x "${BASE}/build/stage1/bin/smdev" ]; then rm -rf "smdev-${SMDEV_VERSION}" tar xf "${BASE}/downloads/smdev-${SMDEV_VERSION}.tar.gz" - cd "smdev-${SMDEV_VERSION}" + cd "smdev-${SMDEV_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/smdev-sysmacros.patch" make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static make -j$CPUS install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 smdev exists" fi @@ -220,11 +195,11 @@ fi if [ ! -x "${BASE}/build/stage1/bin/sinit" ]; then rm -rf "sinit-${SINIT_VERSION}" tar xf "${BASE}/downloads/sinit-${SINIT_VERSION}.tar.gz" - cd "sinit-${SINIT_VERSION}" + cd "sinit-${SINIT_VERSION}" || exit 1 cp "${BASE}/configs/sinit-config.h" config.h make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static make -j$CPUS install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 smdev exists" fi @@ -232,12 +207,12 @@ fi if [ ! -x "${BASE}/build/stage1/bin/sdhcp" ]; then rm -rf "sdhcp-${SDHCP_VERSION}" tar xf "${BASE}/downloads/sdhcp-${SDHCP_VERSION}.tar.gz" - cd "sdhcp-${SDHCP_VERSION}" + cd "sdhcp-${SDHCP_VERSION}" || exit 1 make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static make -j$CPUS install PREFIX="${BASE}/build/stage1" mv "${BASE}/build/stage1/sbin/sdhcp" "${BASE}/build/stage1/bin" rmdir "${BASE}/build/stage1/sbin" - cd .. + cd .. || exit 1 else echo "stage1 sdhcp exists" fi @@ -246,12 +221,12 @@ fi if [ ! -f "${BASE}/build/stage1/lib/libncurses.a" ]; then rm -rf "netbsd-curses-${NETBSD_NCURSES_VERSION}" tar xf "${BASE}/downloads/netbsd-curses-${NETBSD_NCURSES_VERSION}.tar.gz" - cd "netbsd-curses-${NETBSD_NCURSES_VERSION}" + cd "netbsd-curses-${NETBSD_NCURSES_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/netbsd-curses-attributes.patch" CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS='-static' make -j$CPUS all-static CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS='-static' make -j$CPUS install-static \ PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 netbsd-curses exists" fi @@ -260,14 +235,14 @@ fi if [ ! -f "${BASE}/build/stage1/lib/libtermkey.a" ]; then rm -rf "libtermkey-${LIBTERMKEY_VERSION}" tar xf "${BASE}/downloads/libtermkey-${LIBTERMKEY_VERSION}.tar.gz" - cd "libtermkey-${LIBTERMKEY_VERSION}" + cd "libtermkey-${LIBTERMKEY_VERSION}" || exit 1 "${BASE}/build/stage1/bin/i386-tcc" -c termkey.c "${BASE}/build/stage1/bin/i386-tcc" -c driver-ti.c "${BASE}/build/stage1/bin/i386-tcc" -c driver-csi.c "${BASE}/build/stage1/bin/i386-tcc" -ar libtermkey.a termkey.o driver-ti.o driver-csi.o cp libtermkey.a "${BASE}/build/stage1/lib" cp termkey.h "${BASE}/build/stage1/include" - cd .. + cd .. || exit 1 else echo "stage1 libtermkey exists" fi @@ -276,13 +251,13 @@ fi if [ ! -f "${BASE}/build/stage1/lib/libevent.a" ]; then rm -rf "libevent-${LIBEVENT_VERSION}" tar xf "${BASE}/downloads/libevent-${LIBEVENT_VERSION}.tar.gz" - cd "libevent-${LIBEVENT_VERSION}" + cd "libevent-${LIBEVENT_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --prefix="${BASE}/build/stage1" \ --enable-static --disable-shared --disable-openssl make -j$CPUS make -j$CPUS install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 libevent exists" fi @@ -290,7 +265,7 @@ fi if [ ! -x "${BASE}/build/stage1/bin/vi" ]; then rm -rf "vis-${VIS_VERSION}" tar xf "${BASE}/downloads/vis-${VIS_VERSION}.tar.gz" - cd "vis-${VIS_VERSION}" + cd "vis-${VIS_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/vis-no-pkgconfig-for-ncurses.patch" LDFLAGS=-L"${BASE}/build/stage1/lib" \ CFLAGS=-I"${BASE}/build/stage1/include" \ @@ -299,7 +274,7 @@ if [ ! -x "${BASE}/build/stage1/bin/vi" ]; then --disable-lua make -j$CPUS LDFLAGS=-static cp vis "${BASE}/build/stage1/bin/vi" - cd .. + cd .. || exit 1 else echo "stage1 vis exists" fi @@ -307,13 +282,13 @@ fi if [ ! -x "${BASE}/build/stage1/bin/tmux" ]; then rm -rf "tmux-${TMUX_VERSION}" tar xf "${BASE}/downloads/tmux-${TMUX_VERSION}.tar.gz" - cd "tmux-${TMUX_VERSION}" + cd "tmux-${TMUX_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --prefix="${BASE}/build/stage1" \ --enable-static make -j$CPUS LIBS="-lncursesw -levent_core -lterminfo" make -j$CPUS install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 tmux exists" fi @@ -322,7 +297,7 @@ fi if [ ! -f "${BASE}/build/stage1/lib/libz.a" ]; then rm -rf "zlib-${ZLIB_VERSION}" tar xf "${BASE}/downloads/zlib-${ZLIB_VERSION}.tar.gz" - cd "zlib-${ZLIB_VERSION}" + cd "zlib-${ZLIB_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --prefix="${BASE}/build/stage1" \ --static @@ -333,7 +308,7 @@ if [ ! -f "${BASE}/build/stage1/lib/libz.a" ]; then #~ make CC=/data/work/i486/build/stage1/bin/i386-tcc CFLAGS=-static #~ cp minizip /data/work/i486/build/stage1/bin/zip #~ cp miniunz /data/work/i486/build/stage1/bin/unzip - cd .. + cd .. || exit 1 else echo "stage1 zlib exists" fi @@ -341,7 +316,7 @@ fi if [ ! -x "${BASE}/build/stage1/bin/man" ]; then rm -rf "mandoc-${MANDOC_VERSION}" tar xf "${BASE}/downloads/mandoc-${MANDOC_VERSION}.tar.gz" - cd "mandoc-${MANDOC_VERSION}" + cd "mandoc-${MANDOC_VERSION}" || exit 1 cat >configure.local <<EOF PREFIX=${BASE}/build/stage1 BINDIR=/bin @@ -356,7 +331,7 @@ EOF ./configure make -j$CPUS make -j$CPUS install DESTDIR="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 mandoc exists" fi @@ -364,10 +339,10 @@ fi if [ ! -x "${BASE}/build/stage1/bin/abase-box" ]; then rm -rf "abase-${ABASE_VERSION}" tar xf "${BASE}/downloads/abase-${ABASE_VERSION}.tar.gz" - cd "abase-${ABASE_VERSION}" + cd "abase-${ABASE_VERSION}" || exit 1 make -j$CPUS abase-box CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static make -j$CPUS abase-box-install PREFIX="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 abase exists" fi @@ -375,7 +350,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/nbd-client" ]; then rm -rf "nbd-${NBD_VERSION}" tar xf "${BASE}/downloads/nbd-${NBD_VERSION}.tar.gz" - cd "nbd-${NBD_VERSION}" + cd "nbd-${NBD_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --prefix="${BASE}/build/stage1" \ --enable-static --disable-shared \ @@ -386,7 +361,7 @@ if [ ! -f "${BASE}/build/stage1/bin/nbd-client" ]; then -DNOTLS -DPROG_NAME=\"nbd-client\" \ -o nbd-client nbd_client-nbd-client.o ./.libs/libcliserv.a ./.libs/libnbdclt.a cp nbd-client "${BASE}/build/stage1/bin/." - cd .. + cd .. || exit 1 else echo "stage1 nbd-client exists" fi @@ -394,11 +369,11 @@ fi if [ ! -f "${BASE}/build/stage1/bin/samu" ]; then rm -rf "samurai-${SAMURAI_VERSION}" tar xf "${BASE}/downloads/samurai-${SAMURAI_VERSION}.tar.gz" - cd "samurai-${SAMURAI_VERSION}" + cd "samurai-${SAMURAI_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" LDFLAGS=-static \ make -j$CPUS samu make -j$CPUS install DESTDIR="${BASE}/build/stage1" PREFIX=/ - cd .. + cd .. || exit 1 else echo "stage1 samurai exists" fi @@ -406,13 +381,13 @@ fi if [ ! -f "${BASE}/build/stage1/bin/joe" ]; then rm -rf "joe-${JOE_VERSION}" tar xf "${BASE}/downloads/joe-${JOE_VERSION}.tar.gz" - cd "joe-${JOE_VERSION}" + cd "joe-${JOE_VERSION}" || exit 1 CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --prefix="${BASE}/build/stage1" \ --enable-static --disable-shared make -j$CPUS LDFLAGS=-static make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 joe exists" fi @@ -420,7 +395,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/dropbearmulti" ]; then rm -rf "dropbear-${DROPBEAR_VERSION}" tar xf "${BASE}/downloads/dropbear-${DROPBEAR_VERSION}.tar.bz2" - cd "dropbear-${DROPBEAR_VERSION}" + cd "dropbear-${DROPBEAR_VERSION}" || exit patch -Np1 < "${BASE}/patches/dropbear-path.patch" CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --prefix="${BASE}/build/stage1" \ @@ -443,7 +418,7 @@ if [ ! -f "${BASE}/build/stage1/bin/dropbearmulti" ]; then "${BASE}/build/stage1/bin/dropbearkey" -t dss -f "${BASE}/build/stage1//etc/dropbear/dropbear_dss_host_key" "${BASE}/build/stage1/bin/dropbearkey" -t ecdsa -f "${BASE}/build/stage1//etc/dropbear/dropbear_ecdsa_host_key" "${BASE}/build/stage1/bin/dropbearkey" -t ed25519 -f "${BASE}/build/stage1//etc/dropbear/dropbear_ed25519_host_key" - cd .. + cd .. || exit 1 else echo "stage1 dropbear exists" fi @@ -451,14 +426,14 @@ fi if [ ! -f "${BASE}/build/stage1/lib/libX11.a" ]; then rm -rf "tinyxlib-${TINYXLIB_VERSION}" tar xf "${BASE}/downloads/tinyxlib-${TINYXLIB_VERSION}.tar.gz" - cd "tinyxlib-${TINYXLIB_VERSION}" + cd "tinyxlib-${TINYXLIB_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/tinyxlib-tcc.patch" make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" \ COMPFLAGS="-Os -march=i486 -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -fno-strength-reduce -nostdlib -fno-strict-aliasing -I. -ffunction-sections -fdata-sections" \ LDFLAGS="" mkdir -p "${BASE}/build/stage1/share/X11" make -j$CPUS DESTDIR="${BASE}/build/stage1" PREDIR=/ -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 tinyxlib exists" fi @@ -466,15 +441,30 @@ fi if [ ! -f "${BASE}/build/stage1/bin/Xfbdev" ]; then rm -rf "tinyxserver-${TINYXSERVER_VERSION}" tar xf "${BASE}/downloads/tinyxserver-${TINYXSERVER_VERSION}.tar.gz" - cd "tinyxserver-${TINYXSERVER_VERSION}" + cd "tinyxserver-${TINYXSERVER_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/tinyxserver-tcc.patch" make -j$CPUS BASE="${BASE}" core Xfbdev xinit make -j$CPUS BASE="${BASE}" DESTDIR="${BASE}/build/stage1" PREDIR=/ -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 Xfbdev exists" fi +cd "${BASE}/src/stage1" || exit 1 + +if [ ! -f "${BASE}/tools/bdftopcf" ]; then + rm -rf "bdftopcf-${BDFTOPCF_VERSION}" + tar xf "${BASE}/downloads/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" + cd "bdftopcf-${BDFTOPCF_VERSION}" + patch -Np1 < "${BASE}/patches/bdftopcf-tcc.patch" + "${BASE}/build/stage1/bin/i386-tcc" -static -I. -DPACKAGE_STRING='"bdftopdf ${BDFTOPCF_VERSION}"' -o "${BASE}/tools/bdftopcf" *.c + cd .. +else + echo "tool bdftopcf exists" +fi + +cd "${BASE}/src/stage1" || exit 1 + # generate fonts and install them if [ ! -d "${BASE}/build/stage1/share/X11/fonts" ]; then rm -rf "font-cursor-misc-${FONT_CURSOR_MISC_VERSION}" @@ -492,7 +482,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/rxvt" ]; then rm -rf "rxvt-${RXVT_VERSION}" tar xf "${BASE}/downloads/rxvt-${RXVT_VERSION}.tar.gz" - cd "rxvt-${RXVT_VERSION}" + cd "rxvt-${RXVT_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/rxvt-font.patch" CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --enable-static --prefix="${BASE}/build/stage1" \ @@ -500,7 +490,7 @@ if [ ! -f "${BASE}/build/stage1/bin/rxvt" ]; then --x-libraries="${BASE}/build/stage1/lib" make -j$CPUS LDFLAGS="-static" make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 rxvt exists" fi @@ -508,7 +498,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/xauth" ]; then rm -rf "xauth-${XAUTH_VERSION}" tar xf "${BASE}/downloads/xauth-${XAUTH_VERSION}.tar.gz" - cd "xauth-${XAUTH_VERSION}" + cd "xauth-${XAUTH_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/xauth-ipv6.patch" CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --enable-static --prefix="${BASE}/build/stage1" \ @@ -516,7 +506,7 @@ if [ ! -f "${BASE}/build/stage1/bin/xauth" ]; then --x-libraries="${BASE}/build/stage1/lib" make -j$CPUS LDFLAGS="-static" make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 xauth exists" fi @@ -524,7 +514,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/xhost" ]; then rm -rf "xhost-${XHOST_VERSION}" tar xf "${BASE}/downloads/xhost-${XHOST_VERSION}.tar.gz" - cd "xhost-${XHOST_VERSION}" + cd "xhost-${XHOST_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/xhost-ipv6.patch" CC="${BASE}/build/stage1/bin/i386-tcc" \ ./configure --enable-static --prefix="${BASE}/build/stage1" \ @@ -532,7 +522,7 @@ if [ ! -f "${BASE}/build/stage1/bin/xhost" ]; then --x-libraries="${BASE}/build/stage1/lib" make -j$CPUS LDFLAGS="-static" make -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 xhost exists" fi @@ -540,14 +530,14 @@ fi if [ ! -f "${BASE}/build/stage1/bin/meh" ]; then rm -rf "meh-${MEH_VERSION}" tar xf "${BASE}/downloads/meh-${MEH_VERSION}.tar.gz" - cd "meh-${MEH_VERSION}" + cd "meh-${MEH_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/meh-tcc.patch" make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" \ CFLAGS="-Os -I${BASE}/build/stage1/include" \ LDFLAGS="-static" \ LIBS="${BASE}/build/stage1/lib/libXext.a ${BASE}/build/stage1/lib/libX11.a" make -j$CPUS DESTDIR="${BASE}/build/stage1" PREFIX="" install - cd .. + cd .. || exit 1 else echo "stage1 meh exists" fi @@ -555,7 +545,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/slock" ]; then rm -rf "slock-${SLOCK_VERSION}" tar xf "${BASE}/downloads/slock-${SLOCK_VERSION}.tar.gz" - cd "slock-${SLOCK_VERSION}" + cd "slock-${SLOCK_VERSION}" || exit 1 cp config.def.h config.h patch -Np1 < "${BASE}/patches/slock-tcc.patch" patch -Np1 < "${BASE}/patches/slock-no-xrandr.patch" @@ -564,7 +554,7 @@ if [ ! -f "${BASE}/build/stage1/bin/slock" ]; then CFLAGS="-Os -DVERSION= -I${BASE}/build/stage1/include" \ LDFLAGS="-static ${BASE}/build/stage1/lib/libXext.a ${BASE}/build/stage1/lib/libX11.a" make -j$CPUS DESTDIR="${BASE}/build/stage1" PREFIX="" install - cd .. + cd .. || exit 1 else echo "stage1 slock exists" fi @@ -572,12 +562,12 @@ fi if [ ! -f "${BASE}/build/stage1/bin/lua" ]; then rm -rf "lua-${LUA_VERSION}" tar xf "${BASE}/downloads/lua-${LUA_VERSION}.tar.gz" - cd "lua-${LUA_VERSION}" + cd "lua-${LUA_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/lua51-no-readline.patch" make -j$CPUS linux CC="${BASE}/build/stage1/bin/i386-tcc" \ MYLDFLAGS=-static AR="${BASE}/build/stage1/bin/i386-tcc -ar" RANLIB=echo make -j$CPUS install INSTALL_TOP="${BASE}/build/stage1" - cd .. + cd .. || exit 1 else echo "stage1 lua exists" fi @@ -585,7 +575,7 @@ fi if [ ! -f "${BASE}/build/stage1/bin/notion" ]; then rm -rf "notion-${NOTION_VERSION}" tar xf "${BASE}/downloads/notion-${NOTION_VERSION}.tar.gz" - cd "notion-${NOTION_VERSION}" + cd "notion-${NOTION_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/notion-minimal.patch" sed -i "s|@@BASE@@|${BASE}|g" \ mod_sm/Makefile notion/Makefile \ @@ -620,15 +610,16 @@ if [ ! -f "${BASE}/build/stage1/bin/notion" ]; then PRELOAD_MODULES=1 \ LUA_VERSION=5.1 PREFIX=/ ETCDIR=/etc/notion make -j$CPUS DESTDIR="${BASE}/build/stage1" PRELOAD_MODULES=1 PREFIX=/ -j$CPUS install - cd .. + cd .. || exit 1 else echo "stage1 notion exists" fi + #~ if [ ! -f "${BASE}/build/stage1/bin/wg" ]; then #~ rm -rf "wordgrinder-${WORDGRINDER_VERSION}" #~ tar xf "${BASE}/downloads/wordgrinder-${WORDGRINDER_VERSION}.tar.gz" - #~ cd "wordgrinder-${WORDGRINDER_VERSION}" + #~ cd "wordgrinder-${WORDGRINDER_VERSION}" || exit 1 #~ patch -Np1 < "${BASE}/patches/wordgrinder-tcc.patch" #~ sed -i "s|@@BASE@@|${BASE}|g" Makefile src/c/emu/lpeg/makefile #~ make -j$CPUS \ @@ -639,7 +630,7 @@ fi #~ CC="${BASE}/build/stage1/bin/i386-tcc" \ #~ LDFLAGS="-static" #~ make -j$CPUS install PREFIX= DESTDIR="${BASE}/build/stage1" - #~ cd .. + #~ cd .. || exit 1 #~ else #~ echo "stage1 lua exists" #~ fi @@ -701,7 +692,7 @@ if [ ! -f "${BASE}/build/stage1/boot/bzImage" ]; then echo "Building the Linux kernel.." rm -rf "linux-${LINUX_KERNEL_VERSION}" tar xf "${BASE}/downloads/linux-${LINUX_KERNEL_VERSION}.tar.gz" - cd "linux-${LINUX_KERNEL_VERSION}" + cd "linux-${LINUX_KERNEL_VERSION}" || exit 1 # this configuration is based on tinyconfig, then enabling things as # specified in the README cp "${BASE}/configs/linux-config" .config @@ -712,7 +703,7 @@ if [ ! -f "${BASE}/build/stage1/boot/bzImage" ]; then rm -rf "${BASE}/build/stage1/lib/modules" mkdir "${BASE}/build/stage1/lib/modules" find . -name '*.ko' | xargs tar -cf - | tar -C "${BASE}/build/stage1/lib/modules" -xf - - cd .. + cd .. || exit 1 else echo "stage1 kernel exists" fi @@ -722,17 +713,17 @@ fi if [ ! -f "${BASE}/build/stage1/boot/boot.img" ]; then rm -rf "uflbbl-${UFLBBL_VERSION}" tar xf "${BASE}/downloads/uflbbl-${UFLBBL_VERSION}.tar.gz" - cd "uflbbl-${UFLBBL_VERSION}" + cd "uflbbl-${UFLBBL_VERSION}" || exit 1 patch -Np1 < "${BASE}/patches/uflbbl-boot-options.patch" cd src nasm -o boot.img boot.asm cp boot.img "${BASE}/build/stage1/boot/boot.img" - cd .. + cd .. || exit 1 else echo "stage1 uflbbl exists" fi -cd ../.. +cd ../.. || exit 1 # ramdisk @@ -752,6 +743,17 @@ else echo "root image exists" fi +# tools on the host (assuming we use i386 code compiled with tcc and run +# on a AMD64/i386 host) + +cd "${BASE}" || exit 1 + +if [ ! -x "${BASE}/tools/rdev" ]; then + "${BASE}/build/stage1/bin/i386-tcc" -static -o tools/rdev tools/rdev.c +else + echo "tool rdev exists" +fi + # create boot floppies if [ ! -f "${BASE}/floppy.img" ]; then |