Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gem5, m5ops: init at 24.1.0.1 #375739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkgs/by-name/ge/gem5/include-algorithm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/base/random.hh b/src/base/random.hh
index 0b287f95052..b3550a0f3df 100644
--- a/src/base/random.hh
+++ b/src/base/random.hh
@@ -45,6 +45,7 @@
#ifndef __BASE_RANDOM_HH__
#define __BASE_RANDOM_HH__

+#include <algorithm>
#include <random>
#include <string>
#include <type_traits>
53 changes: 53 additions & 0 deletions pkgs/by-name/ge/gem5/m5ops.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
fetchFromGitHub,
glibc,
isa ? "x86",
lib,
scons,
stdenv,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "m5ops-${isa}";
version = "24.1.0.1";

src = fetchFromGitHub {
owner = "gem5";
repo = "gem5";
tag = "v${finalAttrs.version}";
hash = "sha256-Q7+LuCGUINvsuF7GyiEC7/veADTVi1FpkUXajl2TDkA=";
};

nativeBuildInputs = [ scons ];

buildInputs = [ glibc.static ];

sourceRoot = "source/util/m5";

buildFlags = [ "build/${isa}/out/m5" ];

# Needed so the build script doesn't hide all Nix environment variables.
postPatch = ''
substituteInPlace SConstruct \
--replace-fail "Environment()" "Environment(ENV=os.environ)"
'';

installPhase = ''
runHook preInstall

mkdir -p $out/{bin,lib}
cp build/${isa}/out/m5 $out/bin/
cp build/${isa}/out/libm5.a $out/lib/
cp -r ../../include $out/include

runHook postInstall
'';

meta = {
description = "Special instructions for gem5";
homepage = "https://www.gem5.org/";
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.mtoohey ];
};
})
76 changes: 76 additions & 0 deletions pkgs/by-name/ge/gem5/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
boost,
capstone,
fetchFromGitHub,
gperftools,
hdf5-cpp,
isa ? "X86",
lib,
libpng,
m4,
protobuf_21,
python3,
scons,
stdenv,
variant ? "opt",
zlib,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "gem5-${isa}-${variant}";
version = "24.1.0.1";

src = fetchFromGitHub {
owner = "gem5";
repo = "gem5";
tag = "v${finalAttrs.version}";
hash = "sha256-Q7+LuCGUINvsuF7GyiEC7/veADTVi1FpkUXajl2TDkA=";
};

# Needed to make the current release compile, see:
# https://github.com/gem5/gem5/pull/1897 (the PR was rejected, but there is no
# release with the fix).
patches = [ ./include-algorithm.patch ];

nativeBuildInputs = [
m4
python3
scons
];

buildInputs = [
boost
capstone
gperftools # provides tcmalloc
hdf5-cpp
libpng
protobuf_21
zlib
];

buildFlags = [ "build/${isa}/gem5.${variant}" ];

enableParallelBuilding = true;

preBuild = ''
patchShebangs .
'';

installPhase = ''
runHook preInstall

mkdir -p $out/bin
cp build/${isa}/gem5.${variant} $out/bin/

runHook postInstall
'';

meta = {
description = "A modular platform for computer-system architecture research";
homepage = "https://www.gem5.org/";
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
mainProgram = "gem5.${variant}";
maintainers = [ lib.maintainers.mtoohey ];
};
})
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18352,6 +18352,8 @@ with pkgs;
erlang = erlang_25;
};

m5ops = callPackage ../by-name/ge/gem5/m5ops.nix { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried removing it and I get a missing attribute error. I think it's because I'm using a non-standard name within the gem5 parent directory. I put the package in there cause it's very closely related and should pretty much always be used with gem5 even though the builds are separate.

Should I put it in its own directory or is it fine to leave this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right, it needs to be package.nix. To be honest, I'm not sure. It probably needs its own directory, but someone more knowledgeable than me should answer that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ok. If you search for by-name.*\{ \} in all-packages.nix there are a couple other examples of this, so I'll leave it for now, but if someone has more information about the correct layout lmk.


rustdesk-flutter = callPackage ../by-name/ru/rustdesk-flutter/package.nix {
flutter = flutter324;
};
Expand Down