forked from trinitrix/core
1
0
Fork 0

Build(flake): Remove dead code from cranelift build process

This commit is contained in:
Benedikt Peetz 2023-07-24 17:25:30 +02:00
parent 5e7ed3d084
commit 3d417d7e15
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
1 changed files with 3 additions and 136 deletions

139
flake.nix
View File

@ -39,19 +39,6 @@
url = "https://github.com/bjorn3/rustc_codegen_cranelift/releases/download/dev/cg_clif-x86_64-unknown-linux-gnu.tar.xz"; url = "https://github.com/bjorn3/rustc_codegen_cranelift/releases/download/dev/cg_clif-x86_64-unknown-linux-gnu.tar.xz";
flake = false; flake = false;
}; };
# # dependencies
# rust_regex ={
# url = "git+https://github.com/rust-lang/regex.git";
# flake = false;
# };
# rust_portable_simd = {
# url = "git+https://github.com/rust-lang/portable-simd.git";
# flake = false;
# };
# rust_rand = {
# url = "git+https://github.com/rust-random/rand.git";
# flake = false;
# };
}; };
outputs = { outputs = {
@ -62,129 +49,11 @@
rust-overlay, rust-overlay,
rustc_cranelift_backend, rustc_cranelift_backend,
rustc_cranelift_backend_src, rustc_cranelift_backend_src,
# rust_regex,
# rust_portable_simd,
# rust_rand,
... ...
}: }:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
rcb_deps = let
c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain"; c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain";
in rcb = pkgs.stdenv.mkDerivation {
pkgs.stdenv.mkDerivation {
pname = "rustc_cranelift_backend_dependencies";
version = "1.0";
nativeBuildInputs = with pkgs; [git curl cacert c_rust];
src = "${rustc_cranelift_backend}";
# old implementation {{{
#"${rust_regex}" "${rust_portable_simd}" "${rust_rand}"
#];
#sourceRoot = "source";
# preUnpack = ''
# #set -x;
# unpackCmdHooks=(_defaultUnpack);
# checkForHashToName() {
# case "$1" in
# "regex")
# echo source/download/regex
# ;;
# "portable-simd")
# echo source/download/portable-simd
# ;;
# "rand")
# echo source/download/rand
# ;;
# "rustc_codegen_cranelift")
# echo source
# ;;
# *)
# echo "Warning: Unable to turn hash ($1) to name!" 1>&2
# echo "Using another method" 1>&2
# echo null;
# ;;
# esac
# }
# fail() {
# echo "$@";
# exit 1;
# }
# _defaultUnpack(){
# local fn="$1"
# local destination
# local finalDestination
#
# # extrem hacky solution to turn the nix hash path to useful names:
# destination="$(sed -n '2p' "$fn/Cargo.toml" | sed 's|name = "||' | sed 's|"||')"
#
# finalDestination="$(checkForHashToName "$destination")"
# if [ "$finalDestination" = "null" ]; then
# if grep "Portable SIMD" "$fn"/README.md > /dev/null 2>&1; then
# destination="portable-simd";
# else
# echo "Can not grep readme directly"
# fi
# fi
#
# finalDestination="$(checkForHashToName "$destination")"
# if [ "$finalDestination" = "null" ]; then
# fail "No idea how to turn your hash to a name, sorry!";
# fi
#
# echo "Final destination is '$finalDestination'"
# destination="$finalDestination"
# echo "Copying '$fn' to '$destination'"
#
# mkdir --parents "$destination";
# # We can't preserve hardlinks because they may have been
# # introduced by store optimization, which might break things
# # in the build.
# cp -pr --reflink=auto -- "$fn"/. "$destination"
# chmod -R u+w "$destination"
# }
# '';
# }}}
buildPhase = ''
bash ./y.sh prepare
'';
installPhase = ''
install -d $out/
cp -r ./. $out/
'';
fixupPhase = ''
set -x
''; # skip it
CARGO = "${c_rust}/bin/cargo";
RUSTC = "${c_rust}/bin/rustc";
RUSTDOC = "${c_rust}/bin/rustdoc";
CARGO_HOME = "/build/cargo";
outputHashAlgo = "sha512";
outputHashMode = "recursive";
outputHash = "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
};
rcb = let
c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain";
in
pkgs.stdenv.mkDerivation {
pname = "rustc_cranelift_backend";
version = "1.0";
nativeBuildInputs = [c_rust];
src = "${rcb_deps}";
buildPhase = ''
bash ./y.sh build
'';
installPhase = ''
install -d $out/
cp -r ./dist/. $out/
'';
CARGO = "${c_rust}/bin/cargo";
RUSTC = "${c_rust}/bin/rustc";
RUSTDOC = "${c_rust}/bin/rustdoc";
CARGO_HOME = "/build/cargo";
};
c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain";
rcb_better = pkgs.stdenv.mkDerivation {
pname = "rustc_cranelift_backend"; pname = "rustc_cranelift_backend";
version = "1.0"; version = "1.0";
buildInputs = [c_rust]; buildInputs = [c_rust];
@ -278,11 +147,11 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
mold mold
rcb_better rcb
#self.packages."${system}".cranelift-deps
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
openssl openssl
lua54Packages.lua
]; ];
craneBuild = craneLib.buildPackage { craneBuild = craneLib.buildPackage {
@ -294,8 +163,6 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
in { in {
packages = { packages = {
default = craneBuild; default = craneBuild;
cranelift = rcb_better;
cranelift-deps = c_rust;
}; };
app.default = { app.default = {