1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 libdivsufsort,
6 pkg-config,
7
8 withGTK3 ? !stdenv.hostPlatform.isDarwin,
9 gtk3,
10 llvmPackages,
11 wrapGAppsHook3,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "flips";
16 version = "198";
17
18 src = fetchFromGitHub {
19 owner = "Alcaro";
20 repo = "Flips";
21 tag = "v${version}";
22 hash = "sha256-zYGDcUbtzstk1sTKgX2Mna0rzH7z6Dic+OvjZLI1umI=";
23 };
24
25 nativeBuildInputs = [
26 pkg-config
27 ]
28 ++ lib.optional withGTK3 wrapGAppsHook3;
29
30 buildInputs = [
31 libdivsufsort
32 ]
33 ++ lib.optional withGTK3 gtk3
34 ++ lib.optional (withGTK3 && stdenv.hostPlatform.isDarwin) llvmPackages.openmp;
35
36 patches = [ ./use-system-libdivsufsort.patch ];
37
38 makeFlags = [
39 "PREFIX=${placeholder "out"}"
40 "TARGET=${if withGTK3 then "gtk" else "cli"}"
41 ];
42
43 installPhase = lib.optionalString (!withGTK3) ''
44 runHook preInstall
45 install -Dm755 flips -t $out/bin
46 runHook postInstall
47 '';
48
49 meta = {
50 description = "Patcher for IPS and BPS files";
51 homepage = "https://github.com/Alcaro/Flips";
52 license = lib.licenses.gpl3Plus;
53 maintainers = with lib.maintainers; [ aleksana ];
54 platforms = lib.platforms.unix;
55 mainProgram = "flips";
56 };
57}