nixpkgs/pkgs/applications/editors/code-browser/default.nix

63 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, stdenv
2020-05-21 21:10:03 +00:00
, fetchurl
, copper
, python3
, pkg-config
2021-12-12 13:23:00 +00:00
, withQt ? false, qtbase ? null, wrapQtAppsHook ? null
, withGtk2 ? false, gtk2
, withGtk3 ? false, gtk3
, mkDerivation ? stdenv.mkDerivation
2020-05-21 21:10:03 +00:00
}:
let onlyOneEnabled = xs: 1 == builtins.length (builtins.filter lib.id xs);
in assert onlyOneEnabled [ withQt withGtk2 withGtk3 ];
2021-12-12 13:23:00 +00:00
mkDerivation rec {
2020-05-21 21:10:03 +00:00
pname = "code-browser";
2021-12-12 13:23:00 +00:00
version = "8.0";
2020-05-21 21:10:03 +00:00
src = fetchurl {
url = "https://tibleiz.net/download/code-browser-${version}-src.tar.gz";
2021-12-12 13:23:00 +00:00
sha256 = "sha256-beCp4lx4MI1+hVgWp2h3piE/zu51zfwQdB5g7ImgmwY=";
2020-05-21 21:10:03 +00:00
};
postPatch = ''
substituteInPlace Makefile --replace "LFLAGS=-no-pie" "LFLAGS=-no-pie -L."
patchShebangs .
2021-12-12 13:23:00 +00:00
''
+ lib.optionalString withQt ''
substituteInPlace libs/copper-ui/Makefile --replace "moc -o" "${qtbase.dev}/bin/moc -o"
substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: qt"
''
+ lib.optionalString withGtk2 ''
substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: gtk2"
''
+ lib.optionalString withGtk3 ''
substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: gtk"
''
;
2020-05-21 21:10:03 +00:00
nativeBuildInputs = [ copper
python3
pkg-config
]
2021-12-12 13:23:00 +00:00
++ lib.optionals withGtk2 [ gtk2 ]
++ lib.optionals withGtk3 [ gtk3 ]
++ lib.optionals withQt [ qtbase wrapQtAppsHook ];
2021-01-15 13:21:58 +00:00
buildInputs = lib.optionals withQt [ qtbase ]
2021-12-12 13:23:00 +00:00
++ lib.optionals withGtk2 [ gtk2 ]
++ lib.optionals withGtk3 [ gtk3 ];
2020-05-21 21:10:03 +00:00
makeFlags = [
"prefix=$(out)"
"COPPER=${copper}/bin/copper-elf64"
"with-local-libs"
]
2021-12-12 13:23:00 +00:00
++ lib.optionals withQt [ "QINC=${qtbase.dev}/include"
"UI=qt"
]
++ lib.optionals withGtk2 [ "UI=gtk2" ]
++ lib.optionals withGtk3 [ "UI=gtk" ];
meta = with lib; {
description = "Folding text editor, designed to hierarchically structure any kind of text file and especially source code";
2020-05-21 21:10:03 +00:00
homepage = "https://tibleiz.net/code-browser/";
license = licenses.gpl2;
platforms = platforms.x86_64;
};
}