Diff zig-0.10.1-r3 with a zig-0.11.0

/usr/portage/dev-lang/zig/zig-0.11.0.ebuild 2023-10-09 14:52:29.484368350 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
LLVM_MAX_SLOT=15
6
LLVM_MAX_SLOT=16
7 7
inherit edo cmake llvm check-reqs toolchain-funcs
8 8

  
9 9
DESCRIPTION="A robust, optimal, and maintainable programming language"
......
32 32
IUSE="doc"
33 33

  
34 34
BUILD_DIR="${S}/build"
35

  
35 36
# Zig requires zstd and zlib compression support in LLVM, if using LLVM backend.
36 37
# (non-LLVM backends don't require these)
37 38
# They are not required "on their own", so please don't add them here.
......
53 54
# For now, Zig Build System doesn't support enviromental CFLAGS/LDFLAGS/etc.
54 55
QA_FLAGS_IGNORED="usr/.*/zig/${PV}/bin/zig"
55 56

  
56
# see https://ziglang.org/download/0.10.0/release-notes.html#Self-Hosted-Compiler
57
# 0.10.0 release - ~9.6 GiB, since we use compiler written in C++ for bootstrapping
58
# 0.11.0 release - ~2.8 GiB, since we will (at least according to roadmap) use self-hosted compiler
59
# (transpiled to C via C backend) for bootstrapping
60
CHECKREQS_MEMORY="10G"
61

  
62
PATCHES=(
63
	"${FILESDIR}/zig-0.10.0-build-dir-install-stage3.patch"
64
	"${FILESDIR}/zig-0.10.1-musl-1.2.4-lfs64.patch"
65
)
57
# Since commit https://github.com/ziglang/zig/commit/e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118
58
# Zig uses self-hosted compiler only
59
CHECKREQS_MEMORY="4G"
66 60

  
67 61
llvm_check_deps() {
68 62
	has_version "sys-devel/clang:${LLVM_SLOT}"
......
110 104

  
111 105
pkg_setup() {
112 106
	llvm_pkg_setup
113
	elog "This version requires 10G of memory for building compiler."
114
	elog "If you don't have enough memory, you can wait until 0.11.0 release"
115
	elog "or (if you are risky) use 9999 version (currently requires only 4GB)"
116 107
	check-reqs_pkg_setup
117 108
}
118 109

  
......
135 126

  
136 127
	if use doc; then
137 128
		cd "${BUILD_DIR}" || die
138
		edo ./zig2 run ../doc/docgen.zig -- ./zig2 ../doc/langref.html.in "${S}/langref.html"
139
		edo ./zig2 test ../lib/std/std.zig --zig-lib-dir ../lib -fno-emit-bin -femit-docs="${S}/std"
129
		edo ./stage3/bin/zig build std-docs --prefix "${S}/docgen/"
130
		edo ./stage3/bin/zig build langref --prefix "${S}/docgen/"
140 131
	fi
141 132
}
142 133

  
143 134
src_test() {
144 135
	cd "${BUILD_DIR}" || die
145 136
	local ZIG_TEST_ARGS="-Dstatic-llvm=false -Denable-llvm -Dskip-non-native \
146
		-Drelease -Dtarget=$(get_zig_target) -Dcpu=$(get_zig_mcpu)"
137
		-Doptimize=ReleaseSafe -Dtarget=$(get_zig_target) -Dcpu=$(get_zig_mcpu)"
147 138
	local ZIG_TEST_STEPS=(
148 139
		test-cases test-fmt test-behavior test-compiler-rt test-universal-libc test-compare-output
149 140
		test-standalone test-c-abi test-link test-stack-traces test-cli test-asm-link test-translate-c
......
157 148
}
158 149

  
159 150
src_install() {
160
	use doc && local HTML_DOCS=( "langref.html" "std" )
151
	use doc && local HTML_DOCS=( "docgen/doc/langref.html" "docgen/doc/std" )
161 152
	cmake_src_install
153

  
162 154
	cd "${ED}/usr/$(get_libdir)/zig/${PV}/" || die
163 155
	mv lib/zig/ lib2/ || die
164 156
	rm -rf lib/ || die
165 157
	mv lib2/ lib/ || die
166

  
167 158
	dosym -r "/usr/$(get_libdir)/zig/${PV}/bin/zig" "/usr/bin/zig-${PV}"
168 159
}
169 160

  
170 161
pkg_postinst() {
171 162
	eselect zig update ifunset
172

  
173
	elog "0.10.1 release uses self-hosted compiler by default and fixes some bugs from 0.10.0"
174
	elog "But your code still can be un-compilable since some features still not implemented or bugs not fixed"
175
	elog "Upstream recommends:"
176
	elog " * Using old compiler if experiencing such breakage (flag '-fstage1')"
177
	elog " * Waiting for release 0.11.0 with old compiler removed (these changes are already merged in 9999)"
178
	elog "Also see: https://ziglang.org/download/0.10.0/release-notes.html#Self-Hosted-Compiler"
179
	elog "and https://ziglang.org/download/0.10.0/release-notes.html#How-to-Upgrade"
180 163
}
181 164

  
182 165
pkg_postrm() {
Thank you!