Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPackages,
6 fetchpatch,
7 cmake,
8 installShellFiles,
9 boost,
10 lua,
11 protobuf_21,
12 rapidjson,
13 shapelib,
14 sqlite,
15 zlib,
16 testers,
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "tilemaker";
21 version = "3.0.0";
22
23 src = fetchFromGitHub {
24 owner = "systemed";
25 repo = "tilemaker";
26 rev = "v${finalAttrs.version}";
27 hash = "sha256-rB5oP03yaIzklwkGsIeS9ELbHOY9AObwjRrK9HBQFI4=";
28 };
29
30 patches = [
31 # fixes for Boost 1.86
32 (fetchpatch {
33 url = "https://github.com/systemed/tilemaker/commit/6509f0cf50943a90b36b5c6802118b72124b1e7a.patch";
34 hash = "sha256-C4aCUGTTUtY24oARihMnljjRbw80xRdMUyvu/b1Nsdw=";
35 })
36 ];
37
38 postPatch = ''
39 substituteInPlace src/options_parser.cpp \
40 --replace-fail "config.json" "$out/share/tilemaker/config-openmaptiles.json" \
41 --replace-fail "process.lua" "$out/share/tilemaker/process-openmaptiles.lua"
42 substituteInPlace server/server.cpp \
43 --replace-fail "default_value(\"static\")" "default_value(\"$out/share/tilemaker/static\")"
44 '';
45
46 nativeBuildInputs = [
47 cmake
48 installShellFiles
49 ];
50
51 buildInputs = [
52 boost
53 lua
54 protobuf_21
55 rapidjson
56 shapelib
57 sqlite
58 zlib
59 ];
60
61 cmakeFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) (
62 lib.cmakeFeature "PROTOBUF_PROTOC_EXECUTABLE" "${buildPackages.protobuf}/bin/protoc"
63 );
64
65 env.NIX_CFLAGS_COMPILE = toString [ "-DTM_VERSION=${finalAttrs.version}" ];
66
67 postInstall = ''
68 installManPage ../docs/man/tilemaker.1
69 install -Dm644 ../resources/*.{json,lua} -t $out/share/tilemaker
70 cp -r ../server/static $out/share/tilemaker
71 '';
72
73 passthru.tests.version = testers.testVersion {
74 package = finalAttrs.finalPackage;
75 command = "tilemaker --help";
76 };
77
78 meta = with lib; {
79 description = "Make OpenStreetMap vector tiles without the stack";
80 homepage = "https://tilemaker.org/";
81 changelog = "https://github.com/systemed/tilemaker/blob/v${finalAttrs.version}/CHANGELOG.md";
82 license = licenses.free; # FTWPL
83 maintainers = with maintainers; [ sikmir ];
84 platforms = platforms.unix;
85 mainProgram = "tilemaker";
86 };
87})