unix-sdk

Sysroots, examples and tests for classic commercial UNIX systems, built with clang from clang-retro/llvm. Each system has its own directory:

Directory System Targets State
irix/ SGI IRIX 5.3 and 6.x mips-sgi-irix (o32), mips64-sgi-irix (n32, 64) static programs work, tested in qemu-irix
solaris/ Solaris 2.5 to 11.4 sparc-sun-solaris (32-bit SPARC, V8 and V8+), i386-pc-solaris (32-bit x86) static programs work, tested in qemu-solaris and qemu-solarisx86
bsd/ FreeBSD 3.0 and later, NetBSD 1.5 and later i386-unknown-freebsd, i386-unknown-netbsd (32-bit x86) static programs work, tested in bsdrun
haiku/ Haiku R1 x86_64-unknown-haiku, i586-pc-haiku programs with Haiku's own libraries work, tested in Haiku in QEMU

OpenBSD, then SCO UnixWare and OpenServer, are next.

Everything here was written for this project and is under the AGPL (see License), so it can be redistributed. The C library is picolibc with a layer for each system that makes its system calls directly, so static programs need nothing from the vendor. Programs that link against the system's own shared libraries need its headers and libraries, which can't be redistributed: each system has a script that copies them from your own copy of the system into a separate sysroot.

IRIX in short

BIN=.../bin LLVM_SRC=llvm PICOLIBC_SRC=picolibc \
  irix/build-sysroot.sh <bin>/../mips-sgi-irix
clang --target=mips-sgi-irix6.5 -static hello.c -o hello           # o32
clang --target=mips64-sgi-irix6.5 -mabi=n32 -static hello.c -o hello
clang --target=mips64-sgi-irix6.5 -mabi=64 -static hello.c -o hello
irix/tools/build-qemu-irix.sh qemu && qemu/qemu-irixn32 ./hello

See irix/README.md.

Solaris in short

BIN=.../bin LLVM_SRC=llvm PICOLIBC_SRC=picolibc \
  solaris/build-sysroot.sh <bin>/../sparc-sun-solaris
clang --target=sparc-sun-solaris -mcpu=v8 -static hello.c -o hello
irix/tools/build-qemu-irix.sh qemu && qemu/qemu-solaris ./hello

For x86, ARCH=i386 and i386-pc-solaris, -march=i486 and qemu-solarisx86.

See solaris/README.md.

FreeBSD and NetBSD in short

BIN=.../bin LLVM_SRC=llvm PICOLIBC_SRC=picolibc \
  bsd/build-sysroot.sh freebsd-sysroot
clang --target=i386-unknown-freebsd -march=i486 --sysroot=freebsd-sysroot \
  -static hello.c -o hello
cc -o bsdrun bsd/tools/bsdrun.c && ./bsdrun ./hello

For NetBSD, BSD=netbsd and i386-unknown-netbsd, with -fuse-ld=lld.

See bsd/README.md.

Haiku in short

haiku/build-sysroot.sh haiku-sysroot
clang++ --target=x86_64-unknown-haiku --sysroot=haiku-sysroot -fuse-ld=lld \
  haiku/examples/hello.cpp -lbe -o hello

Haiku's headers and libraries are free software, so the script gets them from Haiku's package repositories. See haiku/README.md.

License

Copyright (C) clang-retro contributors.

The clang-retro UNIX SDK is free software under the GNU Affero General Public License, version 3 only (AGPL-3.0-only); the full text is in LICENSE. If you distribute a program built with it, or let people use a modified version over a network, you must offer the program's complete source under the same license.

Each contributor keeps the copyright in their own work and contributes it under the same license; see CONTRIBUTING.md.

picolibc, compiler-rt and qemu-irix, which the scripts build, have their own licenses (BSD-style, Apache 2.0 with LLVM exceptions, and GPL 2). IRIX is SGI's and Solaris is Oracle's: none of either is in this repository.

S
Description
No description provided
Readme AGPL-3.0
170 KiB
0 Stars 1 Watchers 0 Forks
Languages
Shell 41.2%
Python 30%
C 28.3%
C++ 0.5%