Byblos
Byblos SDK | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Created by | Alexander Nicholi | ||||||||||
Initial release | unreleased | ||||||||||
Written in | ANSI C, Make, POSIX sh | ||||||||||
OSes | Darwin/XNU, GNU/Linux | ||||||||||
ISAs | Apple silicon, x86-64 | ||||||||||
Licence | ASL 1.1 |
Byblos is a software development kit developed for Sirius DOS, A* and Unix-based servers, with distinction for MILOTIX and Linux, BSD and Darwin (pan-Unix) support. It is divided into two versions: Byblos 1, a provisional SDK that uses existing compiler toolchains and host infrastructure of Unix-like operating systems, and Byblos 2, the proper SDK that provides its own C compiler, assembler, and the first C* compiler.
Byblos 1
Byblos 1 is the provisional Byblos SDK, running on GNU/Linux with musl libc, either on x86-64 or AArch64. These two platforms are the only supported hosts, and on them Byblos can target the following platforms:
- GNU/Linux with glibc on x86-64
- GNU/Linux with glibc on AArch64
- GNU/Linux with glibc on ARMv7HF
- GNU/Linux with musl on x86-64
- GNU/Linux with musl on AArch64
- GNU/Linux with musl on ARMv7HF
- Microsoft Windows 95, 98 and Me on i386
- Microsoft Windows NT 4.0+ on i386
- Microsoft Windows NT 5.1+ on x64
- Apple macOS 10.4+ on Intel 64
- Apple macOS 11.0+ on AArch64
All GNU/Linux targets use GCC cross-compilers, while all Windows targets use a single MinGW-W64 cross-compiler and all Apple targets use two clang compilers to generate fat binaries with lipo
. Even though Clang is inherently a cross-compiler, two versions of it must be provided since maximal compatibility necessitates using different versions of the proprietary Apple SDK for each microarchitecture: 10.4 provides the earliest x86-64 SDK while 11.0 provides the earliest AArch64 SDK.
Later, support may be added for the following platforms, pending integration of devkitARM and OpenWatcom 2:
- Nintendo Game Boy Advance on ARMv4T
- Microsoft Windows 3.1 on i286
- MS-DOS 5.0+ on i286
All target platforms support console-type applications as well as graphical ones with OpenGL hardware acceleration. Supported languages include ANSI C, C++14, and GNU assembler. Platforms that use OpenWatcom 2 lose C++ support, and both OpenWatcom 2 and devkitARM dependent platforms lack OpenGL support.
Supported targets
i | Target | Full name | ISA | Host | ASM | C | C++ | bin | Notes |
---|---|---|---|---|---|---|---|---|---|
agbhb | GBA homebrew | ARMv4T | ✖ | ✔ | ✔ | ✔ | ✔ | Scratch-building GBA ROMs. | |
agbsp | GBA sourcepatch | ARMv4T | ✖ | ✔ | ✔ | ✔ | ✔ | Source-patching existing GBA ROMs. | |
astar | Anodyne A* | unknown | ✖ | ✖ | ✖ | ✖ | ✖ | Too early to specify. | |
darwin | macOS | x86-64 v1 and ARMv8 | ✖ | – | ✔ | ✔ | – | ||
glinuxa64 | GNU/Linux + glibc | ARMv8.0 | ✖ | ✔ | ✔ | ✔ | – | Assumes VFPv2 hard float support. | |
glinuxx64 | GNU/Linux + glibc | x86-64 v1 | ✖ | ✔ | ✔ | ✔ | – | ||
mlinuxa64 | GNU/Linux + musl | ARMv8.0 | ✔ | ✔ | ✔ | ✔ | – | Assumes VFPv2 hard float support. | |
mlinuxx64 | GNU/Linux + musl | x86-64 v1 | ✔ | ✔ | ✔ | ✔ | – | ||
pcdos | MS-DOS 5.0+ | Intel i286 | ✖ | ✔ | ✔ | ✖ | ✔ | ||
win311 | Windows 3.11 | Intel i286 | ✖ | ✔ | ✔ | ✖ | ✔ | ||
win95 | Windows 95, 98 & Me | Intel i386 | ✖ | ✔ | ✔ | ✔ | – | ||
winnt32 | Windows NT 4.0 32-bit | Intel i386 | ✖ | ✔ | ✔ | ✔ | – | ||
winnt64 | Windows NT 5.1 64-bit | x86-64 v1 | ✖ | ✔ | ✔ | ✔ | – |
Notes
- binpacking is a highly portable method of compiling assets statically into binaries
- For assembly, uncertainty exists about toolchain support on macOS
- For binpacking, it may eventually work but needs further research
Programs list
i | Utility | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Hinterlib | ✔ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Inbound | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Outbound | ✖ | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ | ✖ | ✖ | |
Rebound | ✖ | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ | ✖ | ✖ | |
Earthbound | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Forerunner | ✖ | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ | ✖ | ✖ | |
Precursor | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Simbel | ✖ | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ | ✖ | ✖ | |
Oración | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
FCC | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Quindle | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Gauntlet | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Senusret's | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
Sirius C* | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
NatPython | ✖ | ✖ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Installing the SDK
Byblos 1 can only be run on a musl based installation of GNU/Linux, either on the x86-64 or AArch64 microarchitectures. Use of a VM is recommended when this is not directly available on a machine.
The /opt/byblos
root has the following hierarchy:
- /opt/byblos/ – SDK root
- /opt/byblos/conf/ – configuration settings
- /opt/byblos/include/ – header files (.h) and assembly headers (.inc)
- /opt/byblos/man/ – manuals
- /opt/byblos/sbin/ – script binaries (architecture independent)
- /opt/byblos/share/ – shared resources and miscellanea
- /opt/byblos/slib/ – script dependencies/libraries (architecture independent)
- /opt/byblos/system/ – private folder for internal SDK business
- /opt/byblos/target/$t/ – parent folder for target-specific sub-hierarchies ($t is the target ident)
- /opt/byblos/target/$t/bin/ – runnable binaries
- /opt/byblos/target/$t/lib/ – static libraries
- /opt/byblos/target/$t/share/ – target-specific miscellanea (e.g. associated production materials, emulator settings, etc.)
- /opt/byblos/tc/$tc/ – toolchain sysroots
Byblos 1 entirely avoids pre-compiling native programs, instead leaning on the externally-provided toolchains to run C code and Vala code in utilities as necessary. So, it lacks a host bin/
folder or associated lib/
folder, which are replaced by sbin/
and slib/
respectively. Hashbangs are used to achieve program invocation.
Xion Megatrends offers an installation shell script that initialises the above directories, downloads the toolchains and downloads additional SDK files as necessary.
About the toolchains
Byblos 1 depends on specially compiled versions of GCC to compile code for the various targets it supports. In total, there are 9 compilers for each host, for a total of 18:
- GCC aarch64-linux-musl
- GCC arm-linux-musl
- GCC x86_64-linux-musl
- GCC aarch64-linux-gnu
- GCC arm-linux-gnu
- GCC x86_64-linux-gnu
- Clang for macOS SDK 10.4
- Clang for macOS SDK 11.0
- MinGW-W64
Xion Megatrends offers pre-built binaries of all of these, compiled to run from /opt/byblos/tc/<ident>
, where <ident>
is the Byblos target platform identifier, $TP
. An exception to this naming rule is for darwin
, where instead darwinx64
is used for x86-64 code and the 10.4 SDK and darwina64
is used for AArch64 code and the 11.0 SDK. Another exception is for win95
, winnt32
and winnt64
, which all use a single MinGW install available at /opt/byblos/tc/mingw64
.
Byblos 2
Byblos 2 is a purpose-built SDK that includes dedicated stand-alone tools for compiling code and assets for all supported targets. Initially it will run on the same hosts supported by Byblos 1, with wider support to coincide with the porting of Vala to liberate it from conventional host support structures. Its core is comprised of the following programs:
- Oración, an assembler and desymboliser
- Intel 8086, i286, i486, i686, x86-64 v1-v4, ARMv4T, ARMv5TE, ARMv6, ARMv7, ARMv8, SPARC64 V9, Motorola 68000, MOS 6502, MOS 65816, and Itanium/IA-64 are the supported architectures
- FCC, an expressly non-optimising ANSI C compiler
- Uses Oración as its backend
- Sirius C*, a provisional C* compiler
- Derived from FCC, also uses Oración as its backend
- Inbound, a software build system
- Derived from Make, uses a cut-down in-house derivative
- Outbound, a software packaging system
- NatPython, a scripting interpreter
- Hard fork of Python 3.3
- Simbel, a documentation authoring and generation toolset
- Precursor, a hub-and-spoke version control system
- Forerunner, a source code management system built on top of Precursor
- Gauntlet, a public key cryptosystem for signing and verifying code
- Quindle, a graphical editor program for authoring code
- Cigarbochs, an emulator for debugging and testing code
- Various helper utilities for sanitising and analysing code
Language classes
The Byblos compiler suite has a rigidly-dictated list of "first-class programming languages", chosen holistically for their combination of ubiquity, expressive power and heritage. Currently, they are as follows:
- ANSI C
- C*
- FORTRAN, revision 1977 (F77)
- Verilog, revision 2005 (V05)