1{ lib, stdenv, fetchFromGitHub, fetchpatch, buildPackages, cmake, installShellFiles
2, boost, lua, protobuf, rapidjson, shapelib, sqlite, zlib, testers }:
3
4stdenv.mkDerivation (finalAttrs: {
5 pname = "tilemaker";
6 version = "2.4.0";
7
8 src = fetchFromGitHub {
9 owner = "systemed";
10 repo = "tilemaker";
11 rev = "v${finalAttrs.version}";
12 hash = "sha256-xpOF/0qFuvTUWQ1I8x/gy5qSLKzSgcQahS47PG+bTRA=";
13 };
14
15 postPatch = ''
16 substituteInPlace src/tilemaker.cpp \
17 --replace "config.json" "$out/share/tilemaker/config-openmaptiles.json" \
18 --replace "process.lua" "$out/share/tilemaker/process-openmaptiles.lua"
19 '';
20
21 nativeBuildInputs = [ cmake installShellFiles ];
22
23 buildInputs = [ boost lua protobuf rapidjson shapelib sqlite zlib ];
24
25 cmakeFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
26 "-DPROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc";
27
28 env.NIX_CFLAGS_COMPILE = toString [ "-DTM_VERSION=${finalAttrs.version}" ];
29
30 postInstall = ''
31 installManPage ../docs/man/tilemaker.1
32 install -Dm644 ../resources/* -t $out/share/tilemaker
33 '';
34
35 passthru.tests.version = testers.testVersion {
36 package = finalAttrs.finalPackage;
37 command = "tilemaker --help";
38 };
39
40 meta = with lib; {
41 description = "Make OpenStreetMap vector tiles without the stack";
42 homepage = "https://tilemaker.org/";
43 changelog = "https://github.com/systemed/tilemaker/blob/v${version}/CHANGELOG.md";
44 license = licenses.free; # FTWPL
45 maintainers = with maintainers; [ sikmir ];
46 platforms = platforms.unix;
47 };
48})