about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/clipper2
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/clipper2')
-rw-r--r--nixpkgs/pkgs/development/libraries/clipper2/0001-fix-pc-paths.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/clipper2/default.nix45
2 files changed, 59 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/clipper2/0001-fix-pc-paths.patch b/nixpkgs/pkgs/development/libraries/clipper2/0001-fix-pc-paths.patch
new file mode 100644
index 000000000000..93407d5f9ff6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clipper2/0001-fix-pc-paths.patch
@@ -0,0 +1,14 @@
+diff --git a/Clipper2.pc.cmakein b/Clipper2.pc.cmakein
+index 5632c93..0a5d6ba 100644
+--- a/Clipper2.pc.cmakein
++++ b/Clipper2.pc.cmakein
+@@ -1,7 +1,7 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=${prefix}
+-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
++libdir=@CMAKE_INSTALL_FULL_LIBDIR@
++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+
+ Name: Clipper2@PCFILE_LIB_SUFFIX@
+ Description: A Polygon Clipping and Offsetting library in C++
diff --git a/nixpkgs/pkgs/development/libraries/clipper2/default.nix b/nixpkgs/pkgs/development/libraries/clipper2/default.nix
new file mode 100644
index 000000000000..f7bb635e63d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/clipper2/default.nix
@@ -0,0 +1,45 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+}:
+
+stdenv.mkDerivation rec {
+  pname = "clipper2";
+  version = "1.2.2";
+
+  src = fetchFromGitHub {
+    owner = "AngusJohnson";
+    repo = "Clipper2";
+    rev = "Clipper2_${version}";
+    sha256 = "sha256-u/4GG1A2PAlk8VEWgJX8+EnZ5hpGhu1QbvHwct58sF4=";
+  };
+
+  sourceRoot = "${src.name}/CPP";
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  cmakeFlags = [
+    "-DCLIPPER2_EXAMPLES=OFF"
+    "-DCLIPPER2_TESTS=OFF"
+    "-DBUILD_SHARED_LIBS=ON"
+  ];
+
+  patches = [
+    ./0001-fix-pc-paths.patch
+  ];
+
+  meta = {
+    description = "Polygon Clipping and Offsetting - C++ Only";
+    longDescription = ''
+      The Clipper2 library performs intersection, union, difference and XOR boolean operations on both simple and
+      complex polygons. It also performs polygon offsetting.
+    '';
+    homepage = "https://github.com/AngusJohnson/Clipper2";
+    license = lib.licenses.boost;
+    maintainers = [ lib.maintainers.cadkin ];
+    platforms = lib.platforms.linux;
+  };
+}