Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 boost,
6 cmake,
7 db,
8}:
9stdenv.mkDerivation {
10 pname = "benzene";
11 version = "0-unstable-2022-12-18";
12
13 src = fetchFromGitHub {
14 owner = "cgao3";
15 repo = "benzene-vanilla-cmake";
16 rev = "95614769bafc9850a3cc54974660bb1795db6086";
17 hash = "sha256-3DX/OVjKXyeOmO6P6iz1FTkNQ0n7vUFkKQ5Ac+7t3l4=";
18 };
19
20 nativeBuildInputs = [ cmake ];
21 buildInputs = [
22 boost
23 db
24 ];
25
26 postPatch = ''
27 # Fixes for boost v1.85.0+
28 # https://github.com/cgao3/benzene-vanilla-cmake/issues/18
29 substituteInPlace src/util/Misc.cpp \
30 --replace-fail '.branch_path()' '.parent_path()' \
31 --replace-fail '.normalize()' '.lexically_normal()'
32
33 substituteInPlace CMakeLists.txt \
34 --replace-fail '-DABS_TOP_SRCDIR="''${top_srcdir}"' '-DABS_TOP_SRCDIR="$ENV{out}"' \
35 --replace-fail '-DDATADIR="''${pkgdatadir}"' '-DDATADIR="$ENV{out}/share"'
36 '';
37
38 installPhase = ''
39 runHook preInstall
40 mkdir -p $out/bin
41 cp src/mohex/mohex $out/bin/mohex
42 cp src/wolve/wolve $out/bin/wolve
43 cp -r ../share $out/share/
44 runHook postInstall
45 '';
46
47 meta = {
48 description = "Software for playing and solving the game of Hex";
49 homepage = "https://github.com/cgao3/benzene-vanilla-cmake";
50 license = lib.licenses.lgpl3;
51 platforms = lib.platforms.unix;
52 maintainers = with lib.maintainers; [ eilvelia ];
53 };
54}