Open kassane opened 1 year ago
I will look at it in 2.8.6
Can you provide a full project example with zig packages? and provide the whole fetch commands or makefile.
a full project example with zig packages? and provide the whole fetch commands or makefile.
e.g: https://github.com/kassane/cppfront-zigbuild (need zig v0.12.0-dev - uses zig-pkg [git support]) get pkg: https://github.com/kassane/cppfront-zigbuild/blob/120c89f77ea1c634e89a8c94f1ef3b8201efb10f/build.zig#L7-L10
Use makefile:
# default: $HOME/.cache
# Set the output directory for Zig packages (overwrited)
export ZIG_GLOBAL_CACHE_DIR := $(PWD)/.zig-pkg
# Fetch the package and get its hash
PKG_HASH := $(shell zig fetch git+https://github.com/hsutter/cppfront#789cd382ed4c2fb1a9e306e73b6876228d22207d)
# Build the executable
cppfront: $(PWD)/.zig-pkg/p/$(PKG_HASH)/source/cppfront.cpp
clang++ -std=c++20 -O3 -o cppfront -I$(PWD)/.zig-pkg/p/$(PKG_HASH)/include -I$(PWD)/.zig-pkg/p/$(PKG_HASH)/source $(PWD)/.zig-pkg/p/$(PKG_HASH)/source/cppfront.cpp
# Target to fetch the package
fetch:
zig fetch git+https://github.com/hsutter/cppfront#789cd382ed4c2fb1a9e306e73b6876228d22207d
# Clean the build
clean:
rm -f cppfront
# PHONY targets to prevent conflicts with filenames
.PHONY: fetch clean
zig fetch
seems to be just curl + unzip
I don't know what I need to support.
zig fetch
seems to be just curl + unzip
zig-pkg
is WiP, can get more features later! It may seem like it, although it doesn't require git installed to work.
Can you guarantee the same result on all platforms (Win|Unix-like) without zig fetch
sample?
Maybe I should wait for zig-pkg to support it again.
Can you guarantee the same result on all platforms (Win|Unix-like) without sample?zig fetch
?
Maybe I should wait for zig-pkg to support it again.
Ok.
Currently, 0.11.0 zig-pkg
only supports projects that have build.zig
to be built.
Version 0.12.0 allows you to get packages without build.zig
and just use them in your project.
And CMake's idea would be to support it without the need for build.zig
and build.zig.zon
.
?
Sorry! I asked about alternatives.
Is your feature request related to a problem? Please describe.
Hi @waruqi,
This is also the case with pkg-managers for other languages such as dub, conan, vcpkg, cargo...
zig 0.12.0-dev
already has a fetch command to download packages and print the hash (multihash - sha256-2)progress to release: https://github.com/ziglang/zig/milestone/23
Help:
Wrong command:
Command fixed:
Describe the solution you'd like
I would suggest adding support for
zig fetch
without the need forbuild.zig
andbuild.zig.zon
.New
zig env
get:Overwrite
ZIG_GLOBAL_CACHE_DIR
toxmake
Describe alternatives you've considered
No response
Additional context
References