-
-
Save bignaux/3deeca0e9171ceb8db23bc804d84162a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, fetchFromGitHub, pkgconfig, fontconfig, freetype, imlib2 | |
, SDL_image, libXmu, dbus, dbus-glib, glib | |
, librsvg, libxslt, cairo, gdk_pixbuf, pango | |
, atk, patchelf, fetchurl, bzip2, python, gettext | |
, libpng, zlib | |
, gd, cmake, fribidi, makeWrapper, pcre | |
, qtquickcontrols, qtmultimedia, qtspeech, qtsensors | |
, qtlocation, qtdeclarative, qtsvg | |
, qtSupport ? false, qtbase #need to fix qt_qpainter | |
, gtkSupport ? false, gtk2 | |
, sdlSupport ? !stdenv.hostPlatform.isWindows , SDL | |
, maptoolSupport ? false, protobufc | |
, xkbdSupport ? false, xkbd | |
, espeakSupport ? false, espeak | |
, postgresqlSupport ? false, postgresql | |
, speechdSupport ? false, speechd ? null | |
, openGLSupport ? false, libGLU_combined, freeglut, freeimage | |
}: | |
# not shipped : | |
# * gpx2navit_txt ( required shapelib) | |
assert speechdSupport -> speechd != null; | |
with stdenv.lib; | |
stdenv.mkDerivation rec { | |
pname = "navit"; | |
version = "unstable-2019-05-20"; | |
src = fetchFromGitHub { | |
owner = "navit-gps"; | |
repo = "navit"; | |
#rev = "v${version}"; | |
rev = "b2205d39d2864f4ed7fd3d931b2e6b8f06a6b38b"; | |
sha256 = "0wck3qa012x0qwcqxi7m0gkipdklsr44ig2day1li7kjp0zn3dw2"; | |
}; | |
sample_map = fetchurl { | |
url = "http://www.navit-project.org/maps/osm_bbox_11.3,47.9,11.7,48.2.osm.bz2"; | |
name = "sample_map.bz2"; | |
sha256 = "0vg6b6rhsa2cxqj4rbhfhhfss71syhnfa6f1jg2i2d7l88dm5x7d"; | |
}; | |
postPatch = '' | |
substituteInPlace CMakeLists.txt \ | |
--replace 'libspeechd.h' 'speech-dispatcher/libspeechd.h' | |
''; | |
NIX_CFLAGS_COMPILE = optional speechdSupport "-I${speechd}/include/speech-dispatcher"; | |
#DTARGET_ARCH stdenv.hostPlatform.isWindows | |
# we choose only cmdline and speech-dispatcher speech options. | |
# espeak builtins is made for non-cmdline OS as winCE | |
cmakeFlags = [ | |
"-DSAMPLE_MAP=n" "-DCMAKE_BUILD_TYPE=Release" | |
"-Dspeech/qt5_espeak=FALSE" "-Dsupport/espeak=FALSE" | |
"-DGIT_VERSION=${substring 0 8 src.rev}" | |
] ++ optional (!maptoolSupport) [ "-DBUILD_MAPTOOL=FALSE" ] | |
++ optional stdenv.hostPlatform.isWindows [ | |
"-DCMAKE_RC_COMPILER=${stdenv.cc.targetPrefix}windres" ]; | |
# gettext | |
depsBuildBuild = [ makeWrapper pkgconfig cmake patchelf bzip2 librsvg pcre libxslt ]; | |
# | |
buildInputs = [ libpng zlib ] | |
++ optionals stdenv.hostPlatform.isLinux [ | |
python gd freetype fribidi fontconfig libXmu dbus dbus-glib ] | |
++ optionals gtkSupport [ atk cairo gtk2 gdk_pixbuf pango imlib2 ] | |
++ optionals sdlSupport [ SDL_image ] | |
++ optional postgresqlSupport postgresql | |
++ optional speechdSupport speechd | |
++ optionals qtSupport [ | |
qtquickcontrols qtmultimedia qtspeech qtsensors | |
qtbase qtlocation qtdeclarative qtsvg ] | |
++ optionals openGLSupport [ freeglut libGLU_combined freeimage ] | |
# windows is build on internal stripped glib | |
++ optionals (!stdenv.hostPlatform.isWindows) [ glib ] | |
++ optional (!openGLSupport) [ (SDL.override { openglSupport = false; }).SDL ]; | |
nativeBuildInputs = [ ] | |
++ optional maptoolSupport protobufc; | |
# we dont want blank screen by default | |
postInstall = '' | |
# emulate DSAMPLE_MAP | |
mkdir -p $out/share/navit/maps/ | |
bzcat "${sample_map}" | $out/bin/maptool "$out/share/navit/maps/osm_bbox_11.3,47.9,11.7,48.2.bin" | |
''; | |
# TODO: fix upstream? | |
libPath = stdenv.lib.makeLibraryPath ([ stdenv.cc.libc ] ++ buildInputs ); | |
#libPath = stdenv.lib.makeLibraryPath ( buildInputs ); | |
postFixup = | |
'' | |
find "$out/lib" -type f -name "*.so" -exec patchelf --set-rpath $libPath {} \; | |
wrapProgram $out/bin/navit \ | |
--prefix PATH : ${makeBinPath ( | |
optional xkbdSupport xkbd | |
++ optional espeakSupport espeak | |
++ optional speechdSupport speechd ) } | |
''; | |
meta = { | |
homepage = "https://www.navit-project.org"; | |
description = "Car navigation system with routing engine using OSM maps"; | |
license = licenses.gpl2; | |
maintainers = [ maintainers.genesis ]; | |
platforms = platforms.linux; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment