build
There are two possibilities :
- You are building Stanix on itself (self building).
- You are building Stanix from another OS (e.g. GNU/Linux or any other Unix-like OS) (cross-building). In both cases the process is similar.
[!NOTE] If building from Windows, use WSL.
Required software
To build Stanix, you need the following software.
gitgccldarandas(tcc, or any other C compiler with GNU extensions, might work, but is untested)makenasmcoreutilsgdisk(for hdd images)mtools(for hdd images)xorriso(for iso images)pkg-config
Required software for cross-compiling
If cross-compiling from an OS other than Stanix, you will also need the following software to build a cross-compiler.
- a C and C++ compiler (e.g.
gccandg++) MPC(libmpc-dev)GMP(libgmp-dev)MPFR(libmpfr-dev)bisonflextexinfoautomakeautoconf(2.71 or change version in the script)- a shell (e.g.
sh,bash,dash,ksh, …) coreutilsmake
On Ubuntu you can get everything by running
sudo apt install build-essential bison flex texinfo libmpc-dev libgmp-dev libmpfr-dev automake autoconf
Cloning
First, clone the repository.
git clone https://github.com/tayoky/stanix --recurse-submodules
cd stanix
Configure
Then, run the configure script. It will detect whether you are cross-compiling and build the toolchain if needed.
./configure --host="x86_64-stanix"
See configuration options for all supported options
[!NOTE] Compiling the cross toolchain the first time (that contains GCC) may take some time.
[!NOTE]
Supported values for--hostarex86_64-stanix,i386-stanixandaarch64-stanix
Compiling
Run make build-all and then run make image-all for all images or
make image-hddFor hdd image.make image-isoFor iso image.make test-qemuCreate an hdd image and automatically launch it with QEMU. Domake targetsto get a list of all targets.
Configuration options
All options supported by the ./configure script.
--cc=CCSet the C compiler.--cxx=CXXSet the C++ compiler.--as=ASSet the assembler.--ar=ARSet the archiver.--ld=LDSet the linker.--objcopy=OBJCOPYSet the object copy utility.--strip=STRIPSet the stripper.--nm=NMSet the nm.--pkgconfig=PKGCONFIGSet the pkg-config.--cflags=CFLAGSSet custom flags for C compilation.--cxxflags=CXXFLAGSSet custom flags for C++ compilation.--asflags=ASFLAGSSet the flags for assembling.--arflags=ARFLAGSSet the flags for archiving.--ldflags=LDFLAGSSet the flags for linking.--host=HOSTSet the OS to build, this should always bex86_64-stanix,i386-stanix,aarch64-stanixor omitted.--build=BUILDSet the build OS, can be set if tconf cannot determine the build OS.--clear-cacheClear the cache before doing anything.--prefix=PREFIXSet the prefix.--sysroot=SYSROOT,--with-sysroot=SYSROOTSet the sysroot.--debugCompile with debug options activated.--helpShow help and exit.--enable-cross-toolchainForce the configure script to build a cross toolchain, even when building from Stanix.--disable-cross-toolchainForce the configure script to not build a cross toolchain, even when cross-compiling (can be used to use a custom cross-compiler).
Installing programs
For now, any program you want to install must be put into ./initrd/bin/ in the repo.
Then redo make build-initrd and make image-hdd.
You can install a port by entering into the ports directory then running ./build.sh XXX and ./install.sh XXX.
Example with Doom :
cd ports
./build.sh doomgeneric
./install.sh doomgeneric
A list of ports is available here.