From 27f4a1265a667e61b76d828126af7369ca4bf7b4 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Thu, 14 Nov 2024 21:07:19 +0100 Subject: [PATCH] stl-to-obj: init at 0.3 --- pkgs/by-name/st/stl-to-obj/package.nix | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pkgs/by-name/st/stl-to-obj/package.nix diff --git a/pkgs/by-name/st/stl-to-obj/package.nix b/pkgs/by-name/st/stl-to-obj/package.nix new file mode 100644 index 000000000000..47f584d30297 --- /dev/null +++ b/pkgs/by-name/st/stl-to-obj/package.nix @@ -0,0 +1,48 @@ +{ + cmake, + fetchFromGitHub, + lib, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "stl-to-obj"; + version = "0.3"; + + src = fetchFromGitHub { + owner = "Neizvestnyj"; + repo = "stl-to-obj"; + rev = finalAttrs.version; + hash = "sha256-+R7rNpMxKFC7sLYQXZX3Ikb5MqNd57r1M8gma73kCcg="; + }; + + postPatch = '' + # Add missing cstdint include + # ref. https://github.com/Neizvestnyj/stl-to-obj/pull/12 + for filename in \ + stl2obj/src/mode.cpp \ + stl2obj/src/obj_to_stl/StlWriter.cpp \ + stl2obj/src/stl_to_obj/importstl.cpp \ + stl2obj/src/stl_to_obj/kdtree.h + do + echo "$(echo '#include '; cat $filename)" > $filename + done + + # Install main executable + # ref. https://github.com/Neizvestnyj/stl-to-obj/pull/13 + echo "install(TARGETS stl2obj DESTINATION $""{CMAKE_INSTALL_BINDIR})" >> CMakeLists.txt + ''; + + nativeBuildInputs = [ + cmake + ]; + + meta = { + description = "C++ stl to obj file converter and vice versa"; + homepage = "https://github.com/Neizvestnyj/stl-to-obj"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ nim65s ]; + mainProgram = "stl2obj"; + platforms = lib.platforms.all; + }; +})