Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 110 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fpc, 6 lazarus, 7 atk, 8 cairo, 9 gdk-pixbuf, 10 glib, 11 gtk2-x11, 12 libX11, 13 pango, 14 hamlib, 15 mariadb, 16 tqsl, 17 xdg-utils, 18 xplanet, 19 autoPatchelfHook, 20 wrapGAppsHook3, 21}: 22 23stdenv.mkDerivation rec { 24 pname = "cqrlog"; 25 version = "2.5.2"; 26 27 src = fetchFromGitHub { 28 owner = "ok2cqr"; 29 repo = "cqrlog"; 30 rev = "v${version}"; 31 sha256 = "0zzcg0bl6mq4wfifj998x9x09w8sigbh46synpqx034fpr0swyhb"; 32 }; 33 34 # Adds the possibility to change the lazarus directory, 35 # otherwise, we would get error : "directory lcl not found" 36 patches = [ ./fix-makefile-lazarusdir.patch ]; 37 38 postPatch = '' 39 substituteInPlace Makefile \ 40 --replace @Lazarusdir@ "${lazarus}/share/lazarus" \ 41 --replace /usr "" 42 substituteInPlace src/fTRXControl.pas \ 43 --replace "/usr/bin/rigctld" "${hamlib}/bin/rigctld" 44 substituteInPlace src/fCallAttachment.pas \ 45 --replace "/usr/bin/xdg-open" "${xdg-utils}/bin/xdg-open" 46 substituteInPlace src/fRotControl.pas \ 47 --replace "/usr/bin/rotctld" "${hamlib}/bin/rotctld" 48 substituteInPlace src/fPreferences.pas \ 49 --replace "/usr/bin/rigctld" "${hamlib}/bin/rigctld" \ 50 --replace "/usr/bin/rotctld" "${hamlib}/bin/rotctld" \ 51 --replace "/usr/bin/xplanet" "${xplanet}/bin/xplanet" 52 substituteInPlace src/fLoTWExport.pas \ 53 --replace "/usr/bin/tqsl" "${tqsl}/bin/tqsl" 54 substituteInPlace src/dUtils.pas \ 55 --replace "/usr/bin/xplanet" "${xplanet}/bin/xplanet" \ 56 --replace "/usr/bin/rigctld" "${hamlib}/bin/rigctld" 57 # Order is important 58 substituteInPlace src/dData.pas \ 59 --replace "/usr/bin/mysqld_safe" "${mariadb}/bin/mysqld_safe" \ 60 --replace "/usr/bin/mysqld" "${mariadb}/bin/mysqld" 61 62 # To be fail when I need to patch a new hardcoded binary 63 ! grep -C src -RC0 "/usr" 64 ''; 65 66 nativeBuildInputs = [ 67 lazarus 68 fpc 69 autoPatchelfHook 70 wrapGAppsHook3 71 ]; 72 buildInputs = [ 73 atk 74 cairo 75 gdk-pixbuf 76 glib 77 gtk2-x11 78 libX11 79 pango 80 ]; 81 propagatedBuildInputs = [ 82 hamlib 83 mariadb 84 tqsl 85 xdg-utils 86 xplanet 87 ]; 88 89 makeFlags = [ 90 "FPC=fpc" 91 "PP=fpc" 92 "DESTDIR=$(out)" 93 ]; 94 95 postFixup = '' 96 libmysqlclient=$(find "${mariadb.client}/lib" -name "libmysqlclient.so" | tail -n1) 97 patchelf --add-needed "libmysqlclient.so" \ 98 --add-rpath "$(dirname "$libmysqlclient")" \ 99 "$out/bin/.cqrlog-wrapped" 100 ''; 101 102 meta = with lib; { 103 description = "Linux logging program for amateur radio operators"; 104 mainProgram = "cqrlog"; 105 homepage = "https://www.cqrlog.com/"; 106 license = licenses.gpl2Plus; 107 maintainers = with maintainers; [ shamilton ]; 108 platforms = platforms.linux; 109 }; 110}