add linux-posix + linux-baremetal recipes
This commit is contained in:
100
flake.nix
100
flake.nix
@ -273,8 +273,14 @@ rec {
|
||||
'';
|
||||
};
|
||||
|
||||
libiwasm = buildtype: flags:
|
||||
i386_pkgs.stdenv.mkDerivation {
|
||||
mkLibiwasm = {
|
||||
buildenv,
|
||||
platform,
|
||||
buildtype,
|
||||
cflags,
|
||||
extraCmakeFlags ? [],
|
||||
}:
|
||||
buildenv.mkDerivation {
|
||||
pname = "libiwasm";
|
||||
version = "2.4.4";
|
||||
|
||||
@ -289,33 +295,64 @@ rec {
|
||||
nativeBuildInputs = with pkgs; [cmake];
|
||||
|
||||
cmakeBuildType = buildtype;
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_SYSTEM_NAME=Generic"
|
||||
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
cmakeFlags =
|
||||
extraCmakeFlags
|
||||
++ [
|
||||
"-DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
"-DCMAKE_COLOR_DIAGNOSTICS=ON"
|
||||
|
||||
"-DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
"-DCMAKE_COLOR_DIAGNOSTICS=ON"
|
||||
|
||||
"-DWAMR_BUILD_PLATFORM=baremetal"
|
||||
"-DWAMR_BUILD_TARGET=X86_32"
|
||||
"-DWAMR_BUILD_AOT=1"
|
||||
"-DWAMR_BUILD_WAMR_COMPILER=0"
|
||||
"-DWAMR_BUILD_INTERP=1"
|
||||
"-DWAMR_BUILD_FAST_INTERP=0"
|
||||
"-DWAMR_BUILD_JIT=0"
|
||||
"-DWAMR_BUILD_FAST_JIT=0"
|
||||
"-DWAMR_BUILD_LIBC_BUILTIN=1"
|
||||
"-DWAMR_BUILD_LIBC_WASI=0"
|
||||
"-DWAMR_BUILD_SIMD=0"
|
||||
];
|
||||
"-DWAMR_BUILD_PLATFORM=${platform}"
|
||||
"-DWAMR_BUILD_TARGET=X86_32"
|
||||
"-DWAMR_BUILD_AOT=1"
|
||||
"-DWAMR_BUILD_WAMR_COMPILER=0"
|
||||
"-DWAMR_BUILD_INTERP=1"
|
||||
"-DWAMR_BUILD_FAST_INTERP=0"
|
||||
"-DWAMR_BUILD_JIT=0"
|
||||
"-DWAMR_BUILD_FAST_JIT=0"
|
||||
"-DWAMR_BUILD_LIBC_BUILTIN=1"
|
||||
"-DWAMR_BUILD_LIBC_WASI=0"
|
||||
"-DWAMR_BUILD_SIMD=0"
|
||||
];
|
||||
|
||||
# Since GCC 15, implicit declarations are an error. Disable this.
|
||||
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration " + flags;
|
||||
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration " + cflags;
|
||||
};
|
||||
|
||||
libiwasm_debug = libiwasm "Debug" "-O0 -ggdb";
|
||||
libiwasm_release = libiwasm "Release" "-O2 -ggdb -DNDEBUG";
|
||||
libiwasm-baremetal-debug = mkLibiwasm {
|
||||
buildenv = i386_pkgs.stdenv;
|
||||
platform = "baremetal";
|
||||
buildtype = "Debug";
|
||||
cflags = "-O0 -ggdb";
|
||||
extraCmakeFlags = [
|
||||
"-DCMAKE_SYSTEM_NAME=Generic"
|
||||
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
];
|
||||
};
|
||||
libiwasm-baremetal-release = mkLibiwasm {
|
||||
buildenv = i386_pkgs.stdenv;
|
||||
platform = "baremetal";
|
||||
buildtype = "Release";
|
||||
cflags = "-O2 -ggdb -DNDEBUG";
|
||||
extraCmakeFlags = [
|
||||
"-DCMAKE_SYSTEM_NAME=Generic"
|
||||
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
];
|
||||
};
|
||||
|
||||
libiwasm-linux-debug = mkLibiwasm {
|
||||
buildenv = pkgs.multiStdenv;
|
||||
platform = "linux";
|
||||
buildtype = "Debug";
|
||||
cflags = "-O0 -ggdb";
|
||||
};
|
||||
libiwasm-linux-release = mkLibiwasm {
|
||||
buildenv = pkgs.multiStdenv;
|
||||
platform = "linux";
|
||||
buildtype = "Release";
|
||||
cflags = "-O2 -ggdb -DNDEBUG";
|
||||
};
|
||||
|
||||
# ===========================================================================================
|
||||
# Specify dependencies
|
||||
@ -329,6 +366,7 @@ rec {
|
||||
# - Interpreters needed by patchShebangs for build scripts (with the --build flag), which can be the case for e.g. perl
|
||||
nativeBuildInputs = with pkgs; [
|
||||
just
|
||||
gdb
|
||||
xxd
|
||||
wabt
|
||||
grub2
|
||||
@ -398,7 +436,6 @@ rec {
|
||||
wasi-sdk = wasi-sdk;
|
||||
iwasm = iwasm;
|
||||
wamrc = wamrc;
|
||||
libiwasm = libiwasm_release;
|
||||
};
|
||||
apps = {
|
||||
default = flake-utils.lib.mkApp {drv = fail-bin;};
|
||||
@ -406,7 +443,6 @@ rec {
|
||||
wasi-sdk = wasi-sdk;
|
||||
iwasm = iwasm;
|
||||
wamrc = wamrc;
|
||||
libiwasm = libiwasm_release;
|
||||
};
|
||||
|
||||
devShells = {
|
||||
@ -427,10 +463,14 @@ rec {
|
||||
FAIL_SHARE = "${fail-bin}/share";
|
||||
WASI_ROOT = wasi-sdk;
|
||||
WAMR_ROOT = wamr;
|
||||
LIBIWASM_DEBUG = "${libiwasm_debug}/lib";
|
||||
LIBIWASM_RELEASE = "${libiwasm_release}/lib";
|
||||
CROSSCC = "${i386_pkgs.buildPackages.gcc}/bin/i386-elf-gcc";
|
||||
CROSSCXX = "${i386_pkgs.buildPackages.gcc}/bin/i386-elf-g++";
|
||||
LIBIWASM_DEBUG = "${libiwasm-baremetal-debug}/lib";
|
||||
LIBIWASM_RELEASE = "${libiwasm-baremetal-release}/lib";
|
||||
LIBIWASM_LINUX_DEBUG = "${libiwasm-linux-debug}/lib";
|
||||
LIBIWASM_LINUX_RELEASE = "${libiwasm-linux-release}/lib";
|
||||
CROSS_CC = "${i386_pkgs.stdenv.cc}/bin/i386-elf-gcc";
|
||||
CROSS_CXX = "${i386_pkgs.stdenv.cc}/bin/i386-elf-g++";
|
||||
LINUX_CC = "${pkgs.multiStdenv.cc}/bin/gcc";
|
||||
LINUX_CXX = "${pkgs.multiStdenv.cc}/bin/g++";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user