Skip to content

Commit

Permalink
obj2voxel: init at 1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Isidor Zeuner committed Sep 10, 2023
1 parent 2fab4f2 commit f24f468
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkgs/by-name/ob/obj2voxel/fix-type-mismatch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff -Naurd x/voxelio/src/stream.cpp y/voxelio/src/stream.cpp
--- x/voxelio/src/stream.cpp 2023-09-10 08:24:22.517224933 +0000
+++ y/voxelio/src/stream.cpp 2023-09-10 11:46:50.774061409 +0000
@@ -117,7 +117,8 @@
return;
}

- size_t overwriteLength = std::min(size() - pos, length);
+ size_t const remaining = size() - pos;
+ size_t overwriteLength = std::min(remaining, length);
size_t pushLength = length - overwriteLength;

auto overwriteTarget = static_cast<std::vector<u8> *>(sink)->begin() + static_cast<ptrdiff_t>(pos);
54 changes: 54 additions & 0 deletions pkgs/by-name/ob/obj2voxel/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ lib
, stdenv
, fetchFromGitHub
, static ? stdenv.hostPlatform.isStatic
, config
, cmake
}:

stdenv.mkDerivation (finalAttrs: {
pname = "obj2voxel";
version = "1.3.4";

src = (
fetchFromGitHub {
owner = "Eisenwave";
repo = finalAttrs.pname;
rev = "refs/tags/v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-FkGQjYm15le1Na+2U1TgK4nNOZNs5bME5J87pjVFpDs=";
}
).overrideAttrs (
_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "[email protected]:";
}
);

patches = [
# pull missing definitions (https://github.com/Eisenwave/voxel-io/pull/3)
./stdlib-defs.patch
# fix compile error on aarch64-darwin
./fix-type-mismatch.patch
];

postPatch = ''
echo 'install(TARGETS obj2voxel-cli DESTINATION ''${CMAKE_INSTALL_PREFIX}/bin)' >> CMakeLists.txt
'';

cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
];

strictDeps = true;

nativeBuildInputs = [ cmake ];

meta = with lib; {
description = "Convert OBJ and STL files to voxels, with support for textures";
license = licenses.mit;
platforms = platforms.all;
maintainers = [ maintainers.gm6k ];
};
})
44 changes: 44 additions & 0 deletions pkgs/by-name/ob/obj2voxel/stdlib-defs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff -Naurd x/voxelio/include/voxelio/sstreamwrap.hpp y/voxelio/include/voxelio/sstreamwrap.hpp
--- x/voxelio/include/voxelio/sstreamwrap.hpp 2023-09-10 08:24:15.545222068 +0000
+++ y/voxelio/include/voxelio/sstreamwrap.hpp 2023-09-10 08:26:08.037270383 +0000
@@ -1,6 +1,7 @@
#ifndef VXIO_SSTREAMWRAP_HPP
#define VXIO_SSTREAMWRAP_HPP

+#include <ios>
#include <iosfwd>
#include <string>

diff -Naurd x/voxelio/include/voxelio/stringify.hpp y/voxelio/include/voxelio/stringify.hpp
--- x/voxelio/include/voxelio/stringify.hpp 2023-09-10 08:24:15.545222068 +0000
+++ y/voxelio/include/voxelio/stringify.hpp 2023-09-10 08:25:03.665242188 +0000
@@ -15,6 +15,7 @@
#include <cmath>
#include <iosfwd>
#include <string>
+#include <ios>

namespace voxelio {

diff -Naurd x/voxelio/src/3rd_party/miniz_cpp.cpp y/voxelio/src/3rd_party/miniz_cpp.cpp
--- x/voxelio/src/3rd_party/miniz_cpp.cpp 2023-09-10 08:24:15.625222101 +0000
+++ y/voxelio/src/3rd_party/miniz_cpp.cpp 2023-09-10 08:25:03.665242188 +0000
@@ -6,6 +6,7 @@
#include <iostream>
#include <fstream>
#include <cstring>
+#include <limits>

namespace miniz_cpp {

diff -Naurd x/voxelio/src/assert.cpp y/voxelio/src/assert.cpp
--- x/voxelio/src/assert.cpp 2023-09-10 08:24:15.625222101 +0000
+++ y/voxelio/src/assert.cpp 2023-09-10 08:25:03.665242188 +0000
@@ -5,6 +5,7 @@
#include "voxelio/log.hpp"

#include <vector>
+#include <exception>

namespace voxelio {

0 comments on commit f24f468

Please sign in to comment.