1{ lib, stdenv
2, fetchFromGitHub
3, pkg-config
4, cmake
5, python3
6, fixDarwinDylibNames
7}:
8
9stdenv.mkDerivation rec {
10 pname = "keystone";
11 version = "0.9.2";
12
13 src = fetchFromGitHub {
14 owner = "keystone-engine";
15 repo = pname;
16 rev = version;
17 sha256 = "020d1l1aqb82g36l8lyfn2j8c660mm6sh1nl4haiykwgdl9xnxfa";
18 };
19
20 cmakeFlags = [
21 "-DBUILD_SHARED_LIBS=ON"
22 "-DCMAKE_INSTALL_LIBDIR=lib"
23 ];
24
25 nativeBuildInputs = [
26 pkg-config
27 cmake
28 python3
29 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
30 # TODO: could be replaced by setting CMAKE_INSTALL_NAME_DIR?
31 fixDarwinDylibNames
32 ];
33
34 meta = with lib; {
35 description = "Lightweight multi-platform, multi-architecture assembler framework";
36 homepage = "https://www.keystone-engine.org";
37 license = licenses.gpl2Only;
38 maintainers = with maintainers; [ luc65r ];
39 mainProgram = "kstool";
40 platforms = platforms.unix;
41 };
42}