1{ lib, stdenv, fetchFromGitHub, fetchpatch
2, python3
3}:
4
5stdenv.mkDerivation rec {
6 pname = "libinjection";
7 version = "3.10.0";
8
9 src = fetchFromGitHub {
10 owner = "client9";
11 repo = pname;
12 rev = "refs/tags/v${version}";
13 sha256 = "0chsgam5dqr9vjfhdcp8cgk7la6nf3lq44zs6z6si98cq743550g";
14 };
15
16 nativeBuildInputs = [ python3 ];
17
18 strictDeps = true;
19
20 patches = [
21 (fetchpatch {
22 name = "support-python3-for-building";
23 url = "https://raw.githubusercontent.com/sysown/proxysql/bed58f92917eb651b80fd8ffa627a485eb320805/deps/libinjection/update-build-py3.diff";
24 hash = "sha256-SPdf57FIDDNpatWe5pjhAiZl5yPMDEv50k0Wj+eWTEM=";
25 })
26 ];
27
28 postPatch = ''
29 patchShebangs src
30 substituteInPlace src/Makefile \
31 --replace /usr/local $out
32 '';
33
34 configurePhase = "cd src";
35 buildPhase = "make all";
36
37 # no binaries, so out = library, dev = headers
38 outputs = [ "out" "dev" ];
39
40 meta = with lib; {
41 description = "SQL / SQLI tokenizer parser analyzer";
42 homepage = "https://github.com/client9/libinjection";
43 license = licenses.bsd3;
44 platforms = platforms.all;
45 maintainers = with maintainers; [ thoughtpolice ];
46 };
47}