Refactor ports builds

This commit is contained in:
2022-03-04 19:32:31 +01:00
parent 12c7adeb0e
commit 04f8b61a9d
5 changed files with 2 additions and 4 deletions

28
toolchain/ports/musl/build.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh -e
TARGET=x86_64-elf
SYSROOT=/opt/sysroot
# Pull or update musl libc
mkdir -p /opt/external && cd /opt/external
[ -d musl ] || git clone --depth=1 git://git.musl-libc.org/musl
cd musl
git reset --hard
git pull
# Apply patches
[ -d /opt/src/patch-musl ] && rsync -a /opt/src/patch-musl/ /opt/external/musl/
# Build and install
mkdir -p /opt/external/build-musl && cd /opt/external/build-musl
rm -r *
../musl/configure \
--target=${TARGET} \
--prefix=${SYSROOT}/usr \
--disable-shared \
--enable-debug \
CFLAGS="-O0 -mcmodel=large -mno-red-zone"
make
make install-headers
make install

View File

@@ -0,0 +1,45 @@
#!/bin/sh -e
# Download and convert the Unicode VGA font by Dmitry Yu. Bolkhovityanov
# https://www.inp.nsk.su/~bolkhov/files/fonts/univga/
mkdir -p /opt/external && cd /opt/external
[ -f "uni-vga.tgz" ] || wget "https://www.inp.nsk.su/~bolkhov/files/fonts/univga/uni-vga.tgz"
[ -d "uni_vga" ] || tar -xf uni-vga.tgz
cd uni_vga
python3 - << EOF
codepoint = 0
reading = False
chars = {}
with open("u_vga16.bdf") as fp:
while line := fp.readline():
if line.startswith("ENCODING"):
codepoint = int(line.split()[1])
continue
if line.startswith("BITMAP"):
values = []
while True:
line = fp.readline()
if line.startswith("ENDCHAR"):
break
values.append(int(line, 16))
chars[codepoint] = values
with open("u_vga16.termfont.inc", "w") as fp:
fp.write("// THIS FILE IS GENERATED BY toolchain/build-univga-font.sh\n")
fp.write(f"unsigned char font[{127-32}][16] =")
fp.write("{\n")
for codepoint in range(32, 127): # ONLY SAVE ASCII (for now)
fp.write("\t{" + ", ".join([f"0x{v:02X}" for v in chars.get(codepoint, [])]) + "},\n")
fp.write("};")
EOF
cp u_vga16.termfont.inc ${BUILDROOT}/src/libmittos/graphics/.