From c8da20fa5e4e05d1a439af7282a74ee215630112 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sat, 7 Mar 2015 11:31:50 +0000 Subject: [PATCH] osrm-backend: patch to hardcode path to default lua profiles once installed into $out --- .../4.5.0-default-profile-path.template.patch | 13 +++++++++++++ pkgs/servers/osrm-backend/default.nix | 11 +++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 pkgs/servers/osrm-backend/4.5.0-default-profile-path.template.patch diff --git a/pkgs/servers/osrm-backend/4.5.0-default-profile-path.template.patch b/pkgs/servers/osrm-backend/4.5.0-default-profile-path.template.patch new file mode 100644 index 000000000000..12fcdb4fd02c --- /dev/null +++ b/pkgs/servers/osrm-backend/4.5.0-default-profile-path.template.patch @@ -0,0 +1,13 @@ +diff --git a/extractor/extractor_options.cpp b/extractor/extractor_options.cpp +index d14d8d9..c64d7fd 100644 +--- a/extractor/extractor_options.cpp ++++ b/extractor/extractor_options.cpp +@@ -50,7 +50,7 @@ bool ExtractorOptions::ParseArguments(int argc, char *argv[], ExtractorConfig &e + boost::program_options::options_description config_options("Configuration"); + config_options.add_options()("profile,p", + boost::program_options::value( +- &extractor_config.profile_path)->default_value("profile.lua"), ++ &extractor_config.profile_path)->default_value("@out@/profiles/car.lua"), + "Path to LUA routing profile")( + "threads,t", + boost::program_options::value(&extractor_config.requested_num_threads) diff --git a/pkgs/servers/osrm-backend/default.nix b/pkgs/servers/osrm-backend/default.nix index 035ba9658a63..8e33d6e30b99 100644 --- a/pkgs/servers/osrm-backend/default.nix +++ b/pkgs/servers/osrm-backend/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, cmake, luabind, libosmpbf, stxxl, tbb, boost, expat, protobuf, bzip2, zlib}: +{stdenv, fetchurl, cmake, luabind, libosmpbf, stxxl, tbb, boost, expat, protobuf, bzip2, zlib, substituteAll}: stdenv.mkDerivation rec { name = "osrm-backend-4.5.0"; @@ -8,10 +8,17 @@ stdenv.mkDerivation rec { sha256 = "af61e883051f2ecb73520ace6f17cc6da30edc413208ff7cf3d87992eca0756c"; }; - patches = [ ./4.5.0-openmp.patch ]; + patches = [ + ./4.5.0-openmp.patch + (substituteAll { + src = ./4.5.0-default-profile-path.template.patch; + }) + ]; buildInputs = [ cmake luabind luabind.lua libosmpbf stxxl tbb boost expat protobuf bzip2 zlib ]; + postInstall = "mkdir -p $out/share/osrm-backend && cp -r ../profiles $out/share/osrm-backend/profiles"; + meta = { homepage = https://github.com/Project-OSRM/osrm-backend/wiki; description = "Open Source Routing Machine computes shortest paths in a graph. It was designed to run well with map data from the Openstreetmap Project.";