Init lazy-autobuild

This commit is contained in:
aheirman 2021-02-04 17:58:42 +01:00
commit eca12bc30e
19 changed files with 739 additions and 0 deletions

16
dont_use_here/bootup_script Executable file
View file

@ -0,0 +1,16 @@
#! /bin/sh
trap "exit" SIGINT SIGTERM
#No need to keep that file around.
rm init_custom_container
export DISTCC_CMDLIST="/distccd_cmd_list"
distccd --daemon --allow 10.0.1.0 --stats -j20 --job-lifetime 10000 -N 0
#distccd --daemon --allow 10.0.1.79 --stats -j20 --job-lifetime 10000 -N 0 --listen 10.0.1.80
#distccd --daemon --allow 10.0.1.56 --stats --listen 10.0.1.57 --no-fork --no-detach --log-stderr
# Your compiles may take at most a day...
# TODO: fix?
sleep 1d

36
dont_use_here/compile Executable file
View file

@ -0,0 +1,36 @@
#! /bin/sh
export PATH="/usr/lib/distcc/bin:$PATH"
export DISTCC_HOSTS="localhost 10.0.1.57/10"
export DISTCC_CMDLIST="/distccd_cmd_list"
git clone https://github.com/Ella-0/lazybox.git
#---
#cd /
#git clone https://github.com/landley/toybox.git
#Can't build toybox
#Need ln -r for llvm :(
wget http://landley.net/toybox/bin/toybox-x86_64
chmod +x ./toybox-x86_64
mv toybox-x86_64 /bin/toybox
rm /bin/ln
/bin/toybox ln -s /bin/toybox /bin/ln
#---
cd lazybox/pkgs/llvm
../../lazypkg.sh
cd ../musl
../../lazypkg.sh
cd ../mksh
../../lazypkg.sh

View file

@ -0,0 +1,12 @@
/usr/bin/clang
/usr/bin/clang++
clang
clang++
/usr/bin/cc
/usr/bin/c89
/usr/bin/c99
/usr/bin/c++
cc
c89
c99
c++

View file

@ -0,0 +1,9 @@
#! /bin/sh
echo Intitiating container upgrade
apk update &&
apk upgrade &&
apk add distcc samurai cmake python3

16
dont_use_here/inittab Normal file
View file

@ -0,0 +1,16 @@
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
#l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

143
dont_use_here/inside_chroot Executable file
View file

@ -0,0 +1,143 @@
#!/bin/sh
export PATH=$PATH:/bin:/usr/bin:/usr/sbin
compile_packages (){
#for pkg in ${packages[@]};do
n_packages=$(echo $packages | tr ' ' '\n')
for pkg in $n_packages; do
echo "Going to build: $pkg"
cd /lazybox/pkgs/${pkg}/
../../lazypkg.sh
tar -xf out/${pkg}.*.tar.xz -C /
tar -xf out/${pkg}-dev.*.tar.xz -C / 2> /dev/null
tar -xf out/${pkg}-doc.*.tar.xz -C / 2> /dev/null
done
}
#need to replace ln from busybox by toybox
rm /bin/ln
/bin/toybox ln -s /bin/toybox /bin/ln
echo "replaced ln from busybox by toybox"
ln -s /usr/bin/ld.lld /usr/bin/ld
echo "Linked ld.lld (from llvm) to ld"
ln -s /bin/busybox /usr/bin/fdisk
echo "Added fdisk from busybox"
mkdir /etc
touch /etc/passwd
echo "root:x:0:0::/root:/bin/sh" > /etc/passwd
touch /etc/group
echo "root:x:0:root" > /etc/group
#----
# Building spooky
#----
#---------
# Stage 1
#---------
#Apply the only headers patch for linux, we can't build it yet...
patch /lazybox/pkgs/linux/build.sh /linux_header_only_patch
#Stub lex
printf "#!/bin/sh\necho lex go brr\n" > /usr/bin/lex
chmod +x /usr/bin/lex
#Yes om4 has to be build twice
packages="mksh bmake gmake byacc om4 om4"
compile_packages
#---------
# Stage 2
#---------
rm /usr/bin/lex
packages="flex zlib expat"
compile_packages
#Samurai
cd /lazybox/pkgs/samurai
cd src/samurai-*/
clang *.c -o samu
cp /lazybox/pkgs/samurai/out/samurai/bin/samu /usr/bin
cd /lazybox/pkgs/samurai
../../lazypkg.sh
rm /usr/bin/samu
tar -xf out/samurai.*.tar.xz -C /
packages="rsync linux"
compile_packages
#---------
# Stage 3
#---------
# Libre ssl, a slight problem
# lible ssl needs cmake, but cmake needs libre ssl. :(
cd /lazybox/pkgs/libressl
cd src/libressl-*/
./configure --prefix=/usr && make -j12 && make install
cd ../..
cd /lazybox/pkgs/cmake
cd src/cmake-*/
./bootstrap \
--prefix=/usr \
--mandir=/usr/share/man \
--datadir=/usr/share/$pkgname \
--docdir=/usr/share/doc/$pkgname \
--generator=Ninja \
--no-system-libs
cd ../..
#NOTE: we recompile mksh, because now we have curl and it can download the man page!
#We remove the linux headers only patch
patch -R /lazybox/pkgs/linux/build.sh /linux_header_only_patch
packages="cmake libressl busybox toybox libffi python ca-certificates curl zlib expat kati gettext-tiny git netbsd-curses kakoune mksh linux lazybox llvm musl tiny-linux-bootloader"
compile_packages
echo "finished"
exit
#--------------
#--------------
# GARBAGE
#--------------
#--------------
# om4 and flex have a circular dependency
# NOTE: THIS DOES NOT WORK
# The lex file in om4 is compiled on the host :(
# Solution: see prepare_chroot_lazy
# PLAN:
# build https://github.com/ibara/baseutils lex
# build om4
# b uild flex
# rm baseutils lex
cd /lazybox/tmp_pkgs/baseutils
make -C libopenbsd
make -C lex
cp lex /usr/bin
# Build m4
# bulid flex
#make sure to overwrite /usr/bin/lex

View file

@ -0,0 +1,17 @@
--- build.sh
+++ build.sh
@@ -16,10 +16,10 @@
build() {
cd $pkgname-$pkgver
#gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ YACC=yacc LLVM_IAS=1 defconfig
- gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ LEX=lex YACC=yacc LLVM_IAS=1 oldconfig
- gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ LEX=lex YACC=yacc LLVM_IAS=1 menuconfig
- cp .config ../../x86_64.config.new
- gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ LEX=lex YACC=yacc LLVM_IAS=1
+ #gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ LEX=lex YACC=yacc LLVM_IAS=1 oldconfig
+ #gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ LEX=lex YACC=yacc LLVM_IAS=1 menuconfig
+ #cp .config ../../x86_64.config.new
+ #gmake CC=cc CXX=c++ HOSTCC=cc HOSTCXX=c++ LEX=lex YACC=yacc LLVM_IAS=1
}
package() {