1DOLLY 82PACKAGE zig-llvm3REQUIRES HOST runtime@04# What Zig builds runs threads unless it is single-threaded: zig build's runner.5REQUIRES HOST threads@067# Zig 0.17 with its LLVM backend: zig-llvm-build's objects linked, as8# upstream's CMake build links zig2, with Zig's C++ glue (zigcpp) and LLVM,9# Clang and LLD 22, which the build uses and installers do not get.10FROM /demos/zig/Dollyfile-zig-llvm-build 4ce2bddbb37d85dc421a72699aa55bade71e76d3dfd3e27d641ba9abf999c98511USE /demos/llvm/Dollyfile-llvm22 d4674665ae5cabf1dd4cdc90251f2512d119906cc9de7473dcaefa0fc4683c4312# Zig links a program for this target with cc (zig-0.17.0-dolly-llvm.patch).13INSTALL /Dollyfile-cc 3c50048026aec1c0c21ac6c0b74d93f53b5c0a3fa83b5c9930d86924a3b59eaa14# find, for the times of the cache's sources (below).15USE /Dollyfile-posix bd721815ffc3d3b9d887f57c3260749cb1db05ed2fe3f46a38b37e00ee66391b16REQUIRES TOOL   c++17REQUIRES TOOL   ar18REQUIRES TOOL   find1920# zigcpp, with upstream's flags (CMakeLists.txt, "zigcpp target"), LLVM's21# headers where its llvm-config says (cmake/Findllvm.cmake), and the endian.h22# that llvm22's build includes for them.23SLOP CWD /usr/lib/zig-llvm-build slop -c 'for unit in zig_llvm zig_llvm-ar zig_clang_driver zig_clang_cc1_main zig_clang_cc1as_main; do \24  c++ -c -O2 -std=c++17 -fno-exceptions -fno-rtti -fvisibility-inlines-hidden \25  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE \26  -DLLVM_BUILD_STATIC -DCLANG_BUILD_STATIC -include endian.h -I $(/usr/lib/llvm22/bin/llvm-config --includedir) $unit.cpp -o $unit.o; done'27SLOP CWD /usr/lib/zig-llvm-build ar rcs libzigcpp.a zig_llvm.o zig_llvm-ar.o zig_clang_driver.o zig_clang_cc1_main.o zig_clang_cc1as_main.o28# Clang's and LLD's libraries by name and LLVM's as its llvm-config lists them,29# as upstream's Findclang, Findlld and Findllvm do. The stack is what upstream30# gives the compiler it ships (46 MB, build.zig) rounded up; with 58 MB of data31# that is 128 MB of initial memory.32SLOP CWD /usr/lib/zig-llvm-build slop -c 'mkdir -p /usr/lib/zig-llvm && c++ -o /usr/lib/zig-llvm/zig -Wl,-z,stack-size=50331648 -Wl,--initial-memory=134217728 zig2.o compiler_rt.o libzigcpp.a -L $(/usr/lib/llvm22/bin/llvm-config --libdir) \33  -lclangFrontendTool -lclangCodeGen -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangCrossTU -lclangFrontend -lclangDriver -lclangOptions -lclangSerialization -lclangSema -lclangAnalysisLifetimeSafety -lclangAnalysis -lclangASTMatchers -lclangParse -lclangAPINotes -lclangEdit -lclangLex -lclangRewriteFrontend -lclangRewrite -lclangIndex -lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangExtractAPI -lclangSupport -lclangInstallAPI -lclangAST -lclangBasic -llldMinGW -llldELF -llldCOFF -llldWasm -llldMachO -llldCommon \34  $(/usr/lib/llvm22/bin/llvm-config --link-static --libs) $(/usr/lib/llvm22/bin/llvm-config --link-static --system-libs)'35FILE /usr/lib/zig-llvm/zig36# /usr/bin/zig starts it with its lib directory and the libc below, where the37# caller names none: a session that installs it has them at once, where a38# package's variables apply once the session is next loaded.39FILE /usr/bin/zig40    #!/bin/slop41    export ZIG_LIB_DIR="${ZIG_LIB_DIR:-/usr/lib/zig}"42    export ZIG_LIBC="${ZIG_LIBC:-/usr/lib/zig/libc.txt}"43    exec /usr/lib/zig-llvm/zig "$@"44SLOP zig version4546EXPORTS TOOL   zig47EXPORTS FOLDER zig-lib     /usr/lib/zig48# The libc Zig links for this target, which it does not find by asking cc:49# Emscripten's headers (below), which C compiled for Emscripten includes, and50# the crt directory, which Zig does not look for on this host; cc's link adds51# the libc itself.52FILE /usr/lib/zig/libc.txt53    include_dir=/usr/include54    sys_include_dir=/usr/include/wasm64-emscripten55    crt_dir=/usr/lib/dolly/process56    msvc_lib_dir=57    kernel32_lib_dir=58    cc_dir=59    darwin_sdk_dir=60# Emscripten's headers for that target (demos/zig/prepare-sources.sh).61SOURCE /dist/static/zig-llvm/emscripten-headers.tar 4249acab21ed33264dd5a0bde210003c8b1f47b2c6938ff60a7c8766bc0d2484 /tmp/emscripten-headers.tar62SLOP tar -xf /tmp/emscripten-headers.tar -C /63FOLDER /usr/include/wasm64-emscripten64FILE /usr/share/licenses/zig/LICENSE65SLOP zig --help > /usr/share/man/cat1/zig.166FILE /usr/share/man/cat1/zig.167# Zig compiles the tools it runs as programs of their own into its global68# cache, HOME's, the first time each runs: zig build, init, fetch and libc's69# maker (lib/compiler/Maker.zig) in ReleaseSafe, translate-c's (and70# @cImport's) translator in ReleaseFast. That is upstream's first-time setup,71# once a machine, which every session would repeat; it is done here, the72# translation itself in a cache of its own. A session needs the manifests (h),73# builtin modules (b) and outputs (o): Zig reads a cached source (z) only for a74# file of the same inode, which an installed file is not, and the objects75# (_zcu.o) went into the links. A manifest records each source's time, which76# would be the build's: the lib's are its base's restore, the builtin modules'77# their writing. Both get the one every image file has in a session78# (kernel/system-snapshot.c, 1980-01-02): the lib's first, the builtin modules'79# after a first run that writes them, and the setup runs again from them.80SLOP find /usr/lib/zig -exec touch -t 198001020000 {} +81SLOP CWD /tmp : > zig-setup.h && zig init --help > /dev/null && zig translate-c --cache-dir zig-setup zig-setup.h > /dev/null82SLOP find /home/dolly/.cache/zig/b -exec touch -t 198001020000 {} + && rm -r /home/dolly/.cache/zig/h /home/dolly/.cache/zig/o /tmp/zig-setup83SLOP CWD /tmp zig init --help > /dev/null && zig translate-c --cache-dir zig-setup zig-setup.h > /dev/null84SLOP rm -r /home/dolly/.cache/zig/z /home/dolly/.cache/zig/tmp /home/dolly/.cache/zig/o/*/*_zcu.o85FOLDER /home/dolly/.cache/zig86