Skip to content

Commit

Permalink
build: nix setup for building with wasmer_wamr flag for android
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyg committed Sep 24, 2024
1 parent e4b86f1 commit 09b0211
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 48 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,33 @@
nodejs_20 # For UI development
binaryen # For WASM optimisation
# Add any other packages you need here
pkgs.llvmPackages.bintools
pkgs.llvmPackages.libclang
pkgs.cmake
pkgs.gcc8
libclang
glibc_multi
]);

shellHook = ''
export PS1='\[\033[1;34m\][holonix:\w]\$\[\033[0m\] '
export PS1='\[\033[1;34m\][holonix:\w]\$\[\033[0m\] ';
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib";
# From: https://github.com/NixOS/nixpkgs/blob/1fab95f5190d087e66a3502481e34e15d62090aa/pkgs/applications/networking/browsers/firefox/common.nix#L247-L253
# Set C flags for Rust's bindgen program. Unlike ordinary C
# compilation, bindgen does not invoke $CC directly. Instead it
# uses LLVM's libclang. To make sure all necessary flags are
# included we need to look in a few places.
export BINDGEN_EXTRA_CLANG_ARGS=" \
$(< ${pkgs.stdenv.cc}/nix-support/libc-crt1-cflags) \
$(< ${pkgs.stdenv.cc}/nix-support/libc-cflags) \
$(< ${pkgs.stdenv.cc}/nix-support/cc-cflags) \
$(< ${pkgs.stdenv.cc}/nix-support/libcxx-cxxflags) \
${pkgs.lib.optionalString pkgs.stdenv.cc.isClang " \
-idirafter ${pkgs.stdenv.cc.cc}/lib/clang/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/include"
} \
${pkgs.lib.optionalString pkgs.stdenv.cc.isGNU " \
-isystem ${pkgs.glibc_multi.dev}/include \
-isystem ${pkgs.stdenv.cc.cc}/include/c++/${pkgs.lib.getVersion pkgs.stdenv.cc.cc} \
-isystem ${pkgs.stdenv.cc.cc}/include/c++/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/${pkgs.stdenv.hostPlatform.config} \
-idirafter ${pkgs.stdenv.cc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.pkgs.lib.getVersion pkgs.stdenv.cc.cc}/include"
}";
'';
};

Expand All @@ -59,10 +78,34 @@
nodejs_20 # For UI development
binaryen # For WASM optimisation
# Add any other packages you need here
libclang
glibc_multi
]);

shellHook = ''
export PS1='\[\033[1;34m\][holonix:\w]\$\[\033[0m\] ';
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib";
# From: https://github.com/NixOS/nixpkgs/blob/1fab95f5190d087e66a3502481e34e15d62090aa/pkgs/applications/networking/browsers/firefox/common.nix#L247-L253
# Set C flags for Rust's bindgen program. Unlike ordinary C
# compilation, bindgen does not invoke $CC directly. Instead it
# uses LLVM's libclang. To make sure all necessary flags are
# included we need to look in a few places.
export BINDGEN_EXTRA_CLANG_ARGS=" \
$(< ${pkgs.stdenv.cc}/nix-support/libc-crt1-cflags) \
$(< ${pkgs.stdenv.cc}/nix-support/libc-cflags) \
$(< ${pkgs.stdenv.cc}/nix-support/cc-cflags) \
$(< ${pkgs.stdenv.cc}/nix-support/libcxx-cxxflags) \
${pkgs.lib.optionalString pkgs.stdenv.cc.isClang " \
-idirafter ${pkgs.stdenv.cc.cc}/lib/clang/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/include"
} \
${pkgs.lib.optionalString pkgs.stdenv.cc.isGNU " \
-isystem ${pkgs.glibc_multi.dev}/include \
-isystem ${pkgs.stdenv.cc.cc}/include/c++/${pkgs.lib.getVersion pkgs.stdenv.cc.cc} \
-isystem ${pkgs.stdenv.cc.cc}/include/c++/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/${pkgs.stdenv.hostPlatform.config} \
-idirafter ${pkgs.stdenv.cc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.pkgs.lib.getVersion pkgs.stdenv.cc.cc}/include"
}";
'';
};
};
Expand Down

0 comments on commit 09b0211

Please sign in to comment.