Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / ti / tilemaker / package.nix
blob7e7714635c891d80c8f22004bf5bc305a9959619
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , buildPackages
5 , cmake
6 , installShellFiles
7 , boost
8 , lua
9 , protobuf_21
10 , rapidjson
11 , shapelib
12 , sqlite
13 , zlib
14 , testers
17 stdenv.mkDerivation (finalAttrs: {
18   pname = "tilemaker";
19   version = "3.0.0";
21   src = fetchFromGitHub {
22     owner = "systemed";
23     repo = "tilemaker";
24     rev = "v${finalAttrs.version}";
25     hash = "sha256-rB5oP03yaIzklwkGsIeS9ELbHOY9AObwjRrK9HBQFI4=";
26   };
28   postPatch = ''
29     substituteInPlace src/options_parser.cpp \
30       --replace-fail "config.json" "$out/share/tilemaker/config-openmaptiles.json" \
31       --replace-fail "process.lua" "$out/share/tilemaker/process-openmaptiles.lua"
32     substituteInPlace server/server.cpp \
33       --replace-fail "default_value(\"static\")" "default_value(\"$out/share/tilemaker/static\")"
34   '';
36   nativeBuildInputs = [ cmake installShellFiles ];
38   buildInputs = [ boost lua protobuf_21 rapidjson shapelib sqlite zlib ];
40   cmakeFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
41     (lib.cmakeFeature "PROTOBUF_PROTOC_EXECUTABLE" "${buildPackages.protobuf}/bin/protoc");
43   env.NIX_CFLAGS_COMPILE = toString [ "-DTM_VERSION=${finalAttrs.version}" ];
45   postInstall = ''
46     installManPage ../docs/man/tilemaker.1
47     install -Dm644 ../resources/*.{json,lua} -t $out/share/tilemaker
48     cp -r ../server/static $out/share/tilemaker
49   '';
51   passthru.tests.version = testers.testVersion {
52     package = finalAttrs.finalPackage;
53     command = "tilemaker --help";
54   };
56   meta = with lib; {
57     description = "Make OpenStreetMap vector tiles without the stack";
58     homepage = "https://tilemaker.org/";
59     changelog = "https://github.com/systemed/tilemaker/blob/v${finalAttrs.version}/CHANGELOG.md";
60     license = licenses.free; # FTWPL
61     maintainers = with maintainers; [ sikmir ];
62     platforms = platforms.unix;
63     mainProgram = "tilemaker";
64   };