nur-packages

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

commit 8c818af8a89047df08988c4fda04251d214e325d
parent e456da8fbb0c82f7b18e45a0d9e49b07082aea97
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date:   Fri,  1 Jan 2021 03:41:58 +0300

Add polyvectorization

Diffstat:
Mnix/sources.json | 14++++++++++++++
Mpkgs/default.nix | 5++++-
Apkgs/tools/graphics/polyvectorization/default.nix | 31+++++++++++++++++++++++++++++++
Apkgs/tools/graphics/polyvectorization/with-gui.patch | 39+++++++++++++++++++++++++++++++++++++++
4 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/nix/sources.json b/nix/sources.json @@ -843,6 +843,20 @@ "url": "https://github.com/wladich/ozi_map/archive/4d6bd3f234960ba90d82e6d58da9c1bf4677eb16.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, + "polyvectorization": { + "branch": "master", + "builtin": false, + "date": "2019-08-23T14:52:46Z", + "description": "Reference implementation of Vectorization of Line Drawings via PolyVector Fields", + "homepage": "https://github.com/bmpix/PolyVectorization", + "owner": "bmpix", + "repo": "PolyVectorization", + "rev": "bceb8e2a08cca29cef1df074eb1a1f6450cc163f", + "sha256": "0d8281q3rdxzrxr5y9bxjkq2s2sfl8fgkk9kqpmpp3z5hxg893jq", + "type": "tarball", + "url": "https://github.com/bmpix/PolyVectorization/archive/bceb8e2a08cca29cef1df074eb1a1f6450cc163f.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, "py-staticmaps": { "branch": "master", "builtin": false, diff --git a/pkgs/default.nix b/pkgs/default.nix @@ -189,9 +189,12 @@ lib.makeScope newScope ( inherit sources; inherit (perlPackages) GeoOpenstreetmapParser MatchSimple MathPolygon MathPolygonTree TreeR; }; - py-staticmaps = callPackage ./tools/geo/py-staticmaps { }; phyghtmap = callPackage ./tools/geo/phyghtmap { }; + polyvectorization = libsForQt5.callPackage ./tools/graphics/polyvectorization { + inherit sources; + }; ptunnel = callPackage ./tools/networking/ptunnel { }; + py-staticmaps = callPackage ./tools/geo/py-staticmaps { }; saait = callPackage ./tools/misc/saait { }; sendmap20 = callPackage ./tools/geo/sendmap20 { }; stagit = callPackage ./tools/misc/stagit { }; diff --git a/pkgs/tools/graphics/polyvectorization/default.nix b/pkgs/tools/graphics/polyvectorization/default.nix @@ -0,0 +1,30 @@ +{ lib, mkDerivation, cmake, boost165, eigen, opencv2, sources }: + +mkDerivation { + pname = "polyvectorization"; + version = lib.substring 0 10 sources.polyvectorization.date; + + src = sources.polyvectorization; + + patches = [ ./with-gui.patch ]; + + postPatch = '' + substituteInPlace src/main.cpp \ + --replace "#define WITH_GUI 1" "//#define WITH_GUI 1" + ''; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ boost165 eigen opencv2 ]; + + NIX_CFLAGS_COMPILE = "-fpermissive"; + + installPhase = "install -Dm755 polyvector_thing -t $out/bin"; + + meta = with lib; { + inherit (sources.polyvectorization) description homepage; + license = licenses.mit; + maintainers = [ maintainers.sikmir ]; + platforms = platforms.unix; + }; +}+ \ No newline at end of file diff --git a/pkgs/tools/graphics/polyvectorization/with-gui.patch b/pkgs/tools/graphics/polyvectorization/with-gui.patch @@ -0,0 +1,39 @@ +diff --git i/src/main.cpp w/src/main.cpp +index 5ccdfa9..1d04516 100644 +--- i/src/main.cpp ++++ w/src/main.cpp +@@ -1,6 +1,6 @@ + #include "stdafx.h" + #define WITH_GUI 1 +-#ifdef _WIN32 ++#if 1 + #include <QtCore/QCoreApplication> + #include "mainwindow.h" + #include <QElapsedTimer> +@@ -263,7 +263,7 @@ std::string type2str(int type) { + + int main(int argc, char *argv[]) + { +-#ifdef _WIN32 ++#if 1 + QApplication a(argc, argv); + #endif + using namespace cv; +@@ -292,7 +292,7 @@ int main(int argc, char *argv[]) + bwImg = Scalar(255) - bwImg; + m = bwImg.rows; n = bwImg.cols; //m: height, n: width + +-#ifdef _WIN32 ++#if 1 + QElapsedTimer timer; + timer.start(); + #else +@@ -548,7 +548,7 @@ int main(int argc, char *argv[]) + #ifdef WITH_GUI + mw.setVectorization("Final", newVectorization); + #endif +-#ifdef _WIN32 ++#if 1 + std::cout << "Total time: " << timer.elapsed()/1000 << " s" << std::endl; + #endif + svg::Image bgImg(filename, n, m, -0.5, 0, 0.6);