Skip to content

Build all dependencies with zig so we don't have to depend on vcpkg#126

Merged
dmtrKovalenko merged 27 commits intodmtrKovalenko:mainfrom
shreyassanthu77:main
Oct 5, 2025
Merged

Build all dependencies with zig so we don't have to depend on vcpkg#126
dmtrKovalenko merged 27 commits intodmtrKovalenko:mainfrom
shreyassanthu77:main

Conversation

@shreyassanthu77
Copy link
Copy Markdown
Collaborator

@shreyassanthu77 shreyassanthu77 commented Sep 9, 2025

As the title says, this is an attempt to make the build process self sufficient and make it not depend on vcpkg or any other external tools

build.zig is currently a mess but will fix it up once i get it working.
currently only tested on x86_64 linux, windows and aarch64 linux. Cross compilation tested to x86_64-macos, aarch64-macos and aarch64-windows but not sure if the binary actually works (it should tho).

for x86 systems we currently need nasm to be available but i am planning to build it from source on the fly when not available

I don't have tiff building from source yet so cross compilation does't work with it but if we disable tiff support "it just works"

Todos

  • spng
  • jpeg
  • tiff
  • Make static linking optional and allow dynamic linking at build time
  • move over the io code entirely to zig and expose a public c API from zig
  • Build nasm? (probably too far but idk lol)
  • make sure powerpc and mips builds don't fail

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

image works pretty well on my machine (arch btw)

but for whatever reason png fails on wine when i do a release build. Not sure if this is a wine thing or a windows thing (jpeg works tho which is strange)
image

@dmtrKovalenko
Copy link
Copy Markdown
Owner

this is huge thank you Shreyas!

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

btw the builds will fail for a bit cuz the pr is incomplete

don't merge it yet

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

shreyassanthu77 commented Sep 9, 2025

heyy @dmtrKovalenko do you want tiff to support WEBP, LZMA, ZSTD, JBIG, LERC, etc too? i don't think they are very common and will bloat the binary. we already pull in zlib for spng and libjeg for jpeg so we get those basically for free

what you think?

@dmtrKovalenko
Copy link
Copy Markdown
Owner

there is an issue for webp support so I think it would be cool #124

Maybe avif as well becuase I know one image lossless optimizer uses odiff as a testing tooling so it might be useful.

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

okay we can do that but I mean for the tiff itself (it's a container format that can store jpeg, lossless zlib compressed or webp etc pixel data)

Also did you look at https://github.com/zigimg/zigimg ?

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

@dmtrKovalenko
update: all deps linked statically from source and looks like all tests are passing too

but our tiff buld has

  • No support for jbig (i doubt anyone in 2025 actually use that lol)
  • no support for webp (tho if we add it to tiff we should just add support for webps in general and enable it for libtiff)
  • i haven't enabled support for some compression formats (lzma and zstd)

@dmtrKovalenko dmtrKovalenko marked this pull request as ready for review September 10, 2025 18:21
@dmtrKovalenko
Copy link
Copy Markdown
Owner

suspicious that only x86 builds are failling

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

oh probably because of nasm not being in path i think

@shreyassanthu77
Copy link
Copy Markdown
Collaborator Author

okay i went through open issues and this pr could close these

we could potentially even have a wasm build so people can use it in webcontainers or even browsers now that the file system api is actually pretty usable

Copy link
Copy Markdown
Owner

@dmtrKovalenko dmtrKovalenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's amazing work dude

@dmtrKovalenko dmtrKovalenko merged commit c117669 into dmtrKovalenko:main Oct 5, 2025
6 checks passed
dmtrKovalenko added a commit that referenced this pull request Oct 5, 2025
Co-authored-by: Dmitriy Kovalenko <dmtr.kovalenko@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants