-
-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Isidor Zeuner
committed
Dec 13, 2023
1 parent
87e5690
commit 01a563f
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-11 07:50:51.522074934 +0000 | ||
+++ y/voxelio/src/stream.cpp 2023-09-11 08:02:19.105142327 +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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ lib | ||
, stdenv | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, 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 = "git@github.com:"; | ||
} | ||
); | ||
|
||
patches = [ | ||
# pull missing definitions (https://github.com/Eisenwave/voxel-io/pull/3) | ||
( | ||
fetchpatch { | ||
name = "add-std-includes.patch"; | ||
url = "https://web.archive.org/web/20230914180442/https://patch-diff.githubusercontent.com/raw/Eisenwave/voxel-io/pull/3.diff"; | ||
hash = "sha256-2JeFBx0Ds++BplWXuxOo4KOAW6gXCT/kFI74i0M0ROM="; | ||
stripLen = 1; | ||
extraPrefix = "voxelio/"; | ||
} | ||
) | ||
# fix build on aarch64-darwin (https://github.com/Eisenwave/voxel-io/pull/4) | ||
( | ||
fetchpatch { | ||
name = "fix-aarch64-darwin-type-mismatch.patch"; | ||
url = "https://web.archive.org/web/20230914180401/https://patch-diff.githubusercontent.com/raw/Eisenwave/voxel-io/pull/4.diff"; | ||
hash = "sha256-AuvjpTGBLKN0f47IoxIDkV32g9A/4RbvGBo3ToGiH/w="; | ||
stripLen = 1; | ||
extraPrefix = "voxelio/"; | ||
} | ||
) | ||
# already fixed in upstream git head | ||
./1.3.4-fix-type-mismatch.patch | ||
]; | ||
|
||
postPatch = '' | ||
echo 'install(TARGETS obj2voxel-cli DESTINATION ''${CMAKE_INSTALL_PREFIX}/bin)' >> CMakeLists.txt | ||
''; | ||
|
||
cmakeFlags = [ | ||
"-DBUILD_SHARED_LIBS=${if stdenv.targetPlatform.isStatic then "OFF" else "ON"}" | ||
]; | ||
|
||
strictDeps = true; | ||
|
||
nativeBuildInputs = [ cmake ]; | ||
|
||
meta = with lib; { | ||
description = "Convert OBJ and STL files to voxels, with support for textures"; | ||
mainProgram = "obj2voxel"; | ||
homepage = "https://github.com/Eisenwave/obj2voxel"; | ||
license = licenses.mit; | ||
platforms = platforms.unix; | ||
maintainers = [ maintainers.gm6k ]; | ||
}; | ||
}) |