nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 libxml2,
5 curl,
6 libxslt,
7 pkg-config,
8 cmake,
9 fetchFromGitHub,
10 perl,
11 bison,
12 flex,
13 fetchpatch,
14 static ? stdenv.hostPlatform.isStatic,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "raptor2";
19 version = "2.0.16";
20 underscoredVersion = lib.strings.replaceStrings [ "." ] [ "_" ] version;
21
22 src = fetchFromGitHub {
23 owner = "dajobe";
24 repo = "raptor";
25 rev = "${pname}_${underscoredVersion}";
26 sha256 = "sha256-Eic63pV2p154YkSmkqWr86fGTr+XmVGy5l5/6q14LQM=";
27 };
28
29 cmakeFlags = [
30 # Build defaults to static libraries.
31 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
32 ];
33
34 patches = [
35 # pull upstream fix for libxml2-2.11 API compatibility, part of unreleased 2.0.17
36 # https://github.com/dajobe/raptor/pull/58
37 (fetchpatch {
38 name = "libxml2-2.11.patch";
39 url = "https://github.com/dajobe/raptor/commit/4dbc4c1da2a033c497d84a1291c46f416a9cac51.patch";
40 hash = "sha256-fHfvncGymzMtxjwtakCNSr/Lem12UPIHAAcAac648w4=";
41 })
42 ];
43
44 nativeBuildInputs = [
45 pkg-config
46 cmake
47 perl
48 bison
49 flex
50 ];
51 buildInputs = [
52 curl
53 libxml2
54 libxslt
55 ];
56
57 # Fix the build with CMake 4.
58 #
59 # See: <https://github.com/dajobe/raptor/issues/75>
60 postPatch = ''
61 substituteInPlace CMakeLists.txt \
62 --replace-fail \
63 'CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)' \
64 'CMAKE_MINIMUM_REQUIRED(VERSION 3.10)'
65 '';
66
67 meta = {
68 description = "RDF Parser Toolkit";
69 mainProgram = "rapper";
70 homepage = "https://librdf.org/raptor";
71 license = with lib.licenses; [
72 lgpl21
73 asl20
74 ];
75 maintainers = with lib.maintainers; [ marcweber ];
76 platforms = lib.platforms.unix;
77 };
78}