144 lines
2.9 KiB
Text
144 lines
2.9 KiB
Text
|
#!/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
|
||
|
|