1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:37:47 +00:00

Build: add support for building on OpenBSD

This requires gcc8 from ports to build the Toolchain.
This commit is contained in:
joshua stein 2020-01-01 20:06:14 -06:00 committed by Andreas Kling
parent d61131945d
commit 5e430e4eb4
7 changed files with 81 additions and 26 deletions

View file

@ -10,7 +10,7 @@ die() {
if [ "$(id -u)" != 0 ]; then
die "this script needs to run as root"
fi
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -s)" = "Darwin" ]; then
export PATH="/usr/local/opt/e2fsprogs/bin:$PATH"
export PATH="/usr/local/opt/e2fsprogs/sbin:$PATH"
fi
@ -20,13 +20,21 @@ chown "$build_user":"$build_group" _disk_image || die "couldn't adjust permissio
echo "done"
printf "creating new filesystem... "
mke2fs -q -I 128 _disk_image || die "couldn't create filesystem"
if [ "$(uname -s)" = "OpenBSD" ]; then
VND=`vnconfig _disk_image`
(echo "e 0"; echo 83; echo n; echo 0; echo "*"; echo "quit") | fdisk -e $VND
mkfs.ext2 -I 128 -F /dev/${VND}i || die "couldn't create filesystem"
else
mke2fs -q -I 128 _disk_image || die "couldn't create filesystem"
fi
echo "done"
printf "mounting filesystem... "
mkdir -p mnt
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -s)" = "Darwin" ]; then
fuse-ext2 _disk_image mnt -o rw+,allow_other,uid=501,gid=20 || die "couldn't mount filesystem"
elif [ "$(uname -s)" = "OpenBSD" ]; then
mount -t ext2fs /dev/${VND}i mnt/ || die "couldn't mount filesystem"
else
mount _disk_image mnt/ || die "couldn't mount filesystem"
fi
@ -37,6 +45,9 @@ cleanup() {
printf "unmounting filesystem... "
umount mnt || ( sleep 1 && sync && umount mnt )
rm -rf mnt
if [ "$(uname -s)" = "OpenBSD" ]; then
vnconfig -u $VND
fi
echo "done"
fi
}

View file

@ -77,10 +77,12 @@ echo "done"
printf "installing userland... "
if [ "$(uname)" != "Darwin" ]; then
find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;
if [ "$(uname -s)" = "Darwin" ]; then
find ../Userland/ -type f -perm +111 -exec cp {} mnt/bin/ \;
elif [ "$(uname -s)" = "OpenBSD" ]; then
find ../Userland/ -type f -perm -555 -exec cp {} mnt/bin/ \;
else
find ../Userland/ -type f -perm +111 -exec cp {} mnt/bin/ \;
find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;
fi
chmod 4755 mnt/bin/su
chmod 4755 mnt/bin/ping

View file

@ -12,8 +12,14 @@ export build_group
sudo id
make -C ../ clean && \
make -C ../ && \
make -C ../ test && \
make -C ../ install &&
MAKE=make
if [ "$(uname -s)" = "OpenBSD" ]; then
MAKE=gmake
fi
$MAKE -C ../ clean && \
$MAKE -C ../ && \
$MAKE -C ../ test && \
$MAKE -C ../ install &&
sudo -E PATH="$PATH" ./build-image-qemu.sh