iglunix-autobuild/dont_use_here/inside_chroot

144 lines
2.9 KiB
Text
Raw Normal View History

2021-02-04 16:58:42 +00:00
#!/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"
2021-02-06 12:46:14 +00:00
cd /iglunix/pkgs/${pkg}/
../../iglupkg.sh
2021-02-04 16:58:42 +00:00
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...
2021-02-06 12:46:14 +00:00
patch /iglunix/pkgs/linux/build.sh /linux_header_only_patch
2021-02-04 16:58:42 +00:00
#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
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 /
packages="rsync linux"
compile_packages
#---------
# Stage 3
#---------
# Libre ssl, a slight problem
# lible ssl needs cmake, but cmake needs libre ssl. :(
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
cd ../..
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 \
--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
2021-02-06 12:46:14 +00:00
patch -R /iglunix/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 iglunix llvm musl tiny-linux-bootloader"
2021-02-04 16:58:42 +00:00
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 :(
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