about summary refs log tree commit diff
path: root/pkgs/development/libraries/xed/default.nix
blob: 1fb634a80b90eb9932875c4f29659dd6f1060b2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ lib, stdenv, fetchFromGitHub, python3Packages, llvmPackages }:

let
  # mbuild is a custom build system used only to build xed
  mbuild = python3Packages.buildPythonPackage rec {
    pname = "mbuild";
    version = "2022.07.28";

    src = fetchFromGitHub {
      owner = "intelxed";
      repo = "mbuild";
      rev = "v${version}";
      sha256 = "sha256-nVHHiaPbf+b+RntjUGjLLGS53e6c+seXIBx7AcTtiWU=";
    };
  };

in stdenv.mkDerivation rec {
  pname = "xed";
  version = "2024.02.22";

  src = fetchFromGitHub {
    owner = "intelxed";
    repo = "xed";
    rev = "v${version}";
    sha256 = "sha256-LF4iJ1/Z3OifCiir/kU3ufZqtiRLeaJeAwuBqP2BCF4=";
  };

  nativeBuildInputs = [ mbuild ] ++ lib.optionals stdenv.isDarwin [ llvmPackages.bintools ];

  buildPhase = ''
    patchShebangs mfile.py

    # this will build, test and install
    ./mfile.py test --prefix $out
    ./mfile.py examples
    mkdir -p $out/bin
    cp ./obj/wkit/examples/obj/xed $out/bin/
  '';

  dontInstall = true; # already installed during buildPhase

  meta = with lib; {
    broken = stdenv.isAarch64;
    description = "Intel X86 Encoder Decoder (Intel XED)";
    homepage    = "https://intelxed.github.io/";
    license     = licenses.asl20;
    platforms   = platforms.unix;
    maintainers = with maintainers; [ arturcygan ];
  };
}