xrsh-buildroot/nix/chibicc.nix

24 lines
599 B
Nix
Raw Normal View History

2024-09-16 13:25:26 +02:00
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
pkgs.pkg-config
pkgs.gnumake # For running make
pkgs.gcc_multi # GCC with multi-lib support (32-bit and 64-bit)
pkgs.glibc_multi
pkgs.gccMultiStdenv
pkgs.binutils
];
# Set up environment variables for cross-compilation to 32-bit
shellHook = ''
export CC="gcc -m32 -static"
export CXX="g++ -m32 -static"
export LD="ld -m elf_i386"
echo "32-bit cross-compilation environment with static linking is set up."
git clone https://github.com/rui314/chibicc
cd chibicc
make
'';
}