nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

commit 57ed9dcea9209117e30bbe42025db3bf3fdd70ff
parent 83136baea0596ac346dbeadca7e79bbbc4ebaad9
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date:   Thu, 16 Jan 2020 01:14:33 +0300

Add openmtbmap_openvelomap_linux

Diffstat:
Mdefault.nix | 4++++
Mnix/sources.json | 12++++++++++++
Apkgs/openmtbmap_openvelomap_linux/0001-fix-path.patch | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/openmtbmap_openvelomap_linux/default.nix | 30++++++++++++++++++++++++++++++
4 files changed, 107 insertions(+), 0 deletions(-)

diff --git a/default.nix b/default.nix @@ -89,6 +89,10 @@ in rec { mercantile = python3Packages.callPackage ./pkgs/mercantile { inherit (sources) mercantile; }; + openmtbmap_openvelomap_linux = callPackage ./pkgs/openmtbmap_openvelomap_linux { + inherit gmaptool; + inherit (sources) openmtbmap_openvelomap_linux; + }; openorienteering-mapper = libsForQt5.callPackage ./pkgs/openorienteering-mapper { inherit (sources) mapper; }; diff --git a/nix/sources.json b/nix/sources.json @@ -275,6 +275,18 @@ "url": "https://github.com/mapbox/mercantile/archive/dae32795f9da7a9f39d8ea52f2321af008f35ab9.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, + "openmtbmap_openvelomap_linux": { + "branch": "master", + "description": "Linux script to extract and compile garmin *.img map files from openmtbmap.org or openvelomap.org downloads", + "homepage": "https://github.com/btittelbach/openmtbmap_openvelomap_linux", + "owner": "btittelbach", + "repo": "openmtbmap_openvelomap_linux", + "rev": "6d00e273d7391fae72fb7fd21859483db3e26c1a", + "sha256": "17az6k4z71k85ibcabka6yig6bnpk6fknmgx9ilk1x74rifaz06s", + "type": "tarball", + "url": "https://github.com/btittelbach/openmtbmap_openvelomap_linux/archive/6d00e273d7391fae72fb7fd21859483db3e26c1a.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, "pymbtiles": { "branch": "master", "description": "Python utilities for Mapbox mbtiles files", diff --git a/pkgs/openmtbmap_openvelomap_linux/0001-fix-path.patch b/pkgs/openmtbmap_openvelomap_linux/0001-fix-path.patch @@ -0,0 +1,61 @@ +diff --git i/create_omtb_garmin_img.sh w/create_omtb_garmin_img.sh +index 03a0ae6..143260d 100755 +--- i/create_omtb_garmin_img.sh ++++ w/create_omtb_garmin_img.sh +@@ -90,20 +90,20 @@ elif [[ -n ${OMTB_EXE:t} ]]; then + usage + fi + +-GMT_CMD=( ${ARGS_A[-g]}(.N,@-.) ${^path}/gmt(.N,@-.) ) ++GMT_CMD=( ${ARGS_A[-g]}(.N,@-.) %gmaptool%/bin/gmt(.N,@-.) ) + GMT_CMD="${GMT_CMD[1]:a}" + # if wine exists, this expands into e.g. /usr/bin/wine, otherwhise it will remain as string =wine + # advantage over which wine is, that it outputs only one result, namely the executable that a call to wine on the CL would actually use + WINE_EXE==wine + + # NB: If mkgmap is not found, we fall back to using gmt later. +-MKGMAP=( ${ARGS_A[-m]}(.N,@-.) /usr/share/mkgmap/mkgmap.jar(.N,@-.) /usr/local/share/mkgmap/mkgmap.jar(.N,@-.) /usr/share/java/mkgmap.jar(.N,@-.) /usr/share/java/mkgmap/mkgmap.jar(.N,@-.) ${^path}/mkgmap.jar(.N,@-.) ) ++MKGMAP=( ${ARGS_A[-m]}(.N,@-.) %mkgmap%/bin/mkgmap(.N,@-.) ) + MKGMAP="${MKGMAP[1]:a}" + +-if ! [[ -x =7z ]]; then +- print "\nERROR: 7z is not installed, but needed to extract openmtbmap downloads !" > /dev/stderr +- exit 3 +-fi ++#if ! [[ -x =7z ]]; then ++# print "\nERROR: 7z is not installed, but needed to extract openmtbmap downloads !" > /dev/stderr ++# exit 3 ++#fi + + + DESC="${OMTBORVELO}_${OMTB_NAME}" +@@ -116,7 +116,7 @@ else + [[ -n $ARGS_A[-o] ]] && {print "\nWarning: -o given but ${ARGS_A[-o]} is not a directory.\n Using ${OMTB_EXE:A:h} instead..\n"} + fi + +-if ! [[ ( -n $MKGMAP && -x =java ) || -x $WINE_EXE ]]; then ++if ! [[ ( -n $MKGMAP ) || -x $WINE_EXE ]]; then + print "\nERROR: either mkgmap (+java) or wine are required!" > /dev/stderr + exit 4 + fi +@@ -151,7 +151,7 @@ fi + FIMG_a=(${TMPDIR}/6<->.img(N[1])) + if [[ -z $FIMG_a ]] ; then + print "Extracting $OMTB_EXE ..." +- 7z e -y -o$TMPDIR ${OMTB_EXE} &>/dev/null || exit 1 ++ %7z% e -y -o$TMPDIR ${OMTB_EXE} &>/dev/null || exit 1 + #Check if extraction files are there + FIMG_a=(${TMPDIR}/6<->.img(N[1])) + [[ -z $FIMG_a ]] && {print "\nERROR: Could not find 6*.img file after extracting $OMTB_EXE" >/dev/stderr ; exit 1} +@@ -192,9 +192,9 @@ if [[ -n $MKGMAP ]]; then + print "Using mkgmap, building address search index..." + #java -Xmx1000M -jar mkgmap.jar --family-id=$FID --index --description="$DESC" --series-name="$DESC" --family-name="$DESC" --show-profiles=1 --product-id=1 --gmapsupp 6*.img 7*.img 01002468.TYP + if [[ $(grep MemTotal: /proc/meminfo | awk '{print $2}') -gt $((1024*1024*3)) ]]; then +- java -Xmx3000M -jar "$MKGMAP" --family-id=$FID --index --description="$DESC" --series-name="$DESC" --family-name="$DESC" --show-profiles=1 --product-id=1 --gmapsupp [67]*.img 01002468.TYP || exit 7 ++ $MKGMAP -Xmx3000M --family-id=$FID --index --description="$DESC" --series-name="$DESC" --family-name="$DESC" --show-profiles=1 --product-id=1 --gmapsupp [67]*.img 01002468.TYP || exit 7 + else +- java -Xmx1000M -jar "$MKGMAP" --family-id=$FID --index --description="$DESC" --series-name="$DESC" --family-name="$DESC" --show-profiles=1 --product-id=1 --gmapsupp [67]*.img 01002468.TYP || exit 7 ++ $MKGMAP -Xmx1000M --family-id=$FID --index --description="$DESC" --series-name="$DESC" --family-name="$DESC" --show-profiles=1 --product-id=1 --gmapsupp [67]*.img 01002468.TYP || exit 7 + fi + mv (#i)gmapsupp.img "${DSTFILENAME}" || exit 7 + else diff --git a/pkgs/openmtbmap_openvelomap_linux/default.nix b/pkgs/openmtbmap_openvelomap_linux/default.nix @@ -0,0 +1,30 @@ +{ stdenv, gmaptool, mkgmap, p7zip, zsh, openmtbmap_openvelomap_linux }: + +stdenv.mkDerivation rec { + pname = "openmtbmap_openvelomap_linux"; + version = stdenv.lib.substring 0 7 src.rev; + src = openmtbmap_openvelomap_linux; + + patches = [ ./0001-fix-path.patch ]; + + buildInputs = [ gmaptool mkgmap p7zip zsh ]; + + postPatch = '' + substituteInPlace create_omtb_garmin_img.sh \ + --replace "%gmaptool%" "${gmaptool}" \ + --replace "%mkgmap%" "${mkgmap}" \ + --replace "%7z%" "${p7zip}/bin/7z" + ''; + + installPhase = '' + install -Dm755 create_omtb_garmin_img.sh "$out/bin/create_omtb_garmin_img" + ''; + + meta = with stdenv.lib; { + description = openmtbmap_openvelomap_linux.description; + homepage = openmtbmap_openvelomap_linux.homepage; + license = licenses.free; + maintainers = with maintainers; [ sikmir ]; + platforms = platforms.all; + }; +}