2021-02-04 16:58:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-02-13 11:53:55 +00:00
|
|
|
export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
|
2021-02-04 16:58:42 +00:00
|
|
|
|
|
|
|
compile_packages (){
|
|
|
|
#for pkg in ${packages[@]};do
|
|
|
|
n_packages=$(echo $packages | tr ' ' '\n')
|
|
|
|
for pkg in $n_packages; do
|
|
|
|
echo "Going to build: $pkg"
|
|
|
|
|
2021-02-06 12:46:14 +00:00
|
|
|
cd /iglunix/pkgs/${pkg}/
|
2021-02-12 16:20:35 +00:00
|
|
|
../../iglupkg.sh || exit 1
|
|
|
|
tar -xf out/${pkg}.*.tar.xz -C / || exit 1
|
2021-02-04 16:58:42 +00:00
|
|
|
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
|
|
|
|
#---------
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-12 16:20:35 +00:00
|
|
|
#Samurai|| exit 1
|
2021-02-06 12:46:14 +00:00
|
|
|
cd /iglunix/pkgs/samurai
|
2021-02-04 16:58:42 +00:00
|
|
|
cd src/samurai-*/
|
|
|
|
clang *.c -o samu
|
2021-02-06 12:46:14 +00:00
|
|
|
cp /iglunix/pkgs/samurai/out/samurai/bin/samu /usr/bin
|
|
|
|
cd /iglunix/pkgs/samurai
|
2021-02-04 16:58:42 +00:00
|
|
|
|
2021-02-06 12:46:14 +00:00
|
|
|
../../iglupkg.sh
|
2021-02-04 16:58:42 +00:00
|
|
|
rm /usr/bin/samu
|
|
|
|
tar -xf out/samurai.*.tar.xz -C /
|
|
|
|
|
|
|
|
# Libre ssl, a slight problem
|
|
|
|
# lible ssl needs cmake, but cmake needs libre ssl. :(
|
2021-02-12 16:20:35 +00:00
|
|
|
# and rsync needs cmake
|
2021-02-06 12:46:14 +00:00
|
|
|
cd /iglunix/pkgs/libressl
|
2021-02-04 16:58:42 +00:00
|
|
|
cd src/libressl-*/
|
|
|
|
./configure --prefix=/usr && make -j12 && make install
|
2021-02-12 16:20:35 +00:00
|
|
|
|
|
|
|
packages="rsync"
|
|
|
|
compile_packages
|
|
|
|
|
|
|
|
# Build the headers of linux.
|
|
|
|
# No other solutions don't work well/at all.
|
|
|
|
cd /iglunix/pkgs/linux
|
|
|
|
cd src/linux-*/
|
|
|
|
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++ YACC=yacc LLVM_IAS=1 INSTALL_HDR_PATH=/usr headers_install
|
|
|
|
|
2021-02-04 16:58:42 +00:00
|
|
|
|
2021-02-06 12:46:14 +00:00
|
|
|
cd /iglunix/pkgs/cmake
|
2021-02-04 16:58:42 +00:00
|
|
|
cd src/cmake-*/
|
|
|
|
./bootstrap \
|
|
|
|
--prefix=/usr \
|
|
|
|
--mandir=/usr/share/man \
|
2021-02-12 16:20:35 +00:00
|
|
|
--datadir=/usr/share/cmake \
|
|
|
|
--docdir=/usr/share/doc/cmake \
|
2021-02-04 16:58:42 +00:00
|
|
|
--generator=Ninja \
|
|
|
|
--no-system-libs
|
|
|
|
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
|
|
|
|
#NOTE: we recompile mksh, because now we have curl and it can download the man page!
|
2021-02-14 17:38:24 +00:00
|
|
|
packages="cmake libressl busybox toybox libffi python ca-certificates curl zlib expat kati gettext-tiny git netbsd-curses kakoune mksh linux iglunix llvm musl e2fsprogs nasm tiny-linux-bootloader"
|
2021-02-04 16:58:42 +00:00
|
|
|
compile_packages
|
|
|
|
|
2021-02-12 16:20:35 +00:00
|
|
|
|
2021-02-04 16:58:42 +00:00
|
|
|
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 :(
|
2021-02-06 12:46:14 +00:00
|
|
|
# Solution: see prepare_chroot_iglunix
|
2021-02-04 16:58:42 +00:00
|
|
|
# PLAN:
|
|
|
|
# build https://github.com/ibara/baseutils lex
|
|
|
|
# build om4
|
|
|
|
# b uild flex
|
|
|
|
# rm baseutils lex
|
2021-02-06 12:46:14 +00:00
|
|
|
cd /iglunix/tmp_pkgs/baseutils
|
2021-02-04 16:58:42 +00:00
|
|
|
make -C libopenbsd
|
|
|
|
make -C lex
|
|
|
|
cp lex /usr/bin
|
|
|
|
# Build m4
|
|
|
|
# bulid flex
|
|
|
|
#make sure to overwrite /usr/bin/lex
|
|
|
|
|