Update to 0.11.0
Since 0.11.0 includes a prebuilt wasm stage1, we are no longer allowed to build and tag it directly[1]. Instead, we shall do the following: * Obtain an exception from the packaging committee[2] * Build initial package completely from stage1 to stage3 with `%%bcond bootstrap 1` (this can be done in a side-tag without any changes to the spec[3]). * Use the bootstrapped package to make a clean source-only build of stage3. * Discard the ~bootstrap and send the clean build to bodhi. [1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/what-can-be-packaged/#_exceptions [2]: https://pagure.io/packaging-committee/issue/1319 [3]: https://pagure.io/packaging-committee/pull-request/1308#request_diff Co-authored-by: Jan Drögehoff <sentrycraft123@gmail.com>
This commit is contained in:
parent
39e7a7ca51
commit
8c4bf36257
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
*.tar.gz
|
||||
/zig-0.9.1.tar.xz
|
||||
/zig-0.11.0.tar.xz
|
||||
/zig-0.11.0.tar.xz.minisig
|
||||
|
66
0001-Fedora-bootstrap-and-extra-build-flags-support.patch
Normal file
66
0001-Fedora-bootstrap-and-extra-build-flags-support.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 83a3cf50d81b65809d4a4619502295b4b5ff8636 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksei Bavshin <alebastr89@gmail.org>
|
||||
Date: Fri, 20 Oct 2023 04:49:46 +0000
|
||||
Subject: [PATCH 1/2] Fedora: bootstrap and extra build flags support
|
||||
|
||||
- Allow passing ZIG_EXTRA_BUILD_FLAGS for stage3 build.
|
||||
- Allow redefining ZIG_EXECUTABLE and short-circuiting to stage3 build
|
||||
when using a prebuilt compiler from bootstrap package.
|
||||
- Bump required CMake version to 3.14 to enable generator expression
|
||||
expansion in `install(CODE ...)`.
|
||||
---
|
||||
CMakeLists.txt | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f1289e20b..031654dee 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 3.5)
|
||||
+cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||
@@ -859,6 +859,10 @@ else()
|
||||
set(ZIG_PIE_ARG "")
|
||||
endif()
|
||||
|
||||
+# Fedora customizations
|
||||
+set(ZIG_EXTRA_BUILD_ARGS "" CACHE STRING "Extra flags for stage3 build")
|
||||
+set(ZIG_EXECUTABLE "$<TARGET_FILE:zig2>" CACHE STRING "Compiler command to use for stage3 build")
|
||||
+
|
||||
# -Dno-langref is currently hardcoded because building the langref takes too damn long
|
||||
# -Dno-autodocs is currently hardcoded because the C backend generates a miscompilation
|
||||
# that prevents it from working.
|
||||
@@ -877,6 +881,7 @@ set(ZIG_BUILD_ARGS
|
||||
"-Dtarget=${ZIG_TARGET_TRIPLE}"
|
||||
"-Dcpu=${ZIG_TARGET_MCPU}"
|
||||
"-Dversion-string=${RESOLVED_ZIG_VERSION}"
|
||||
+ ${ZIG_EXTRA_BUILD_ARGS}
|
||||
)
|
||||
|
||||
add_custom_target(stage3 ALL
|
||||
@@ -885,17 +890,12 @@ add_custom_target(stage3 ALL
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_BINARY_DIR}/stage3/bin/zig"
|
||||
- COMMAND zig2 build --prefix "${CMAKE_BINARY_DIR}/stage3" ${ZIG_BUILD_ARGS}
|
||||
+ COMMAND ${ZIG_EXECUTABLE} build --prefix "${CMAKE_BINARY_DIR}/stage3" ${ZIG_BUILD_ARGS}
|
||||
COMMENT STATUS "Building stage3"
|
||||
+ DEPENDS zigcpp
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
-if(WIN32)
|
||||
- set(ZIG_EXECUTABLE "${CMAKE_BINARY_DIR}/zig2.exe")
|
||||
-else()
|
||||
- set(ZIG_EXECUTABLE "${CMAKE_BINARY_DIR}/zig2")
|
||||
-endif()
|
||||
-
|
||||
install(CODE "set(ZIG_EXECUTABLE \"${ZIG_EXECUTABLE}\")")
|
||||
install(CODE "set(ZIG_BUILD_ARGS \"${ZIG_BUILD_ARGS}\")")
|
||||
install(CODE "set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")")
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From d505ddbb7f46ba974b5d8458fd7134901930f033 Mon Sep 17 00:00:00 2001
|
||||
From: Jan200101 <sentrycraft123@gmail.com>
|
||||
Date: Thu, 17 Feb 2022 18:00:58 +0100
|
||||
Subject: [PATCH] ignore target lib dirs when invoked with -feach-lib-rpath
|
||||
|
||||
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
||||
---
|
||||
src/main.zig | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/src/main.zig b/src/main.zig
|
||||
index 7f50a7de6..a6bcf69a8 100644
|
||||
--- a/src/main.zig
|
||||
+++ b/src/main.zig
|
||||
@@ -2077,10 +2077,6 @@ fn buildOutputType(
|
||||
clang_argv.appendAssumeCapacity(framework_dir);
|
||||
framework_dirs.appendAssumeCapacity(framework_dir);
|
||||
}
|
||||
-
|
||||
- for (paths.lib_dirs.items) |lib_dir| {
|
||||
- try lib_dirs.append(lib_dir);
|
||||
- }
|
||||
for (paths.rpaths.items) |rpath| {
|
||||
try rpath_list.append(rpath);
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
25
0002-Enable-build-id-by-default.patch
Normal file
25
0002-Enable-build-id-by-default.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 4e1416ebff98155b07031790ec1afcb0035fb2ab Mon Sep 17 00:00:00 2001
|
||||
From: Aleksei Bavshin <alebastr89@gmail.org>
|
||||
Date: Fri, 20 Oct 2023 04:49:54 +0000
|
||||
Subject: [PATCH 2/2] Enable build-id by default
|
||||
|
||||
---
|
||||
src/Compilation.zig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/Compilation.zig b/src/Compilation.zig
|
||||
index a08c3e09f..95ade766a 100644
|
||||
--- a/src/Compilation.zig
|
||||
+++ b/src/Compilation.zig
|
||||
@@ -807,7 +807,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
|
||||
const unwind_tables = options.want_unwind_tables orelse
|
||||
(link_libunwind or target_util.needUnwindTables(options.target));
|
||||
const link_eh_frame_hdr = options.link_eh_frame_hdr or unwind_tables;
|
||||
- const build_id = options.build_id orelse .none;
|
||||
+ const build_id = options.build_id orelse .sha1;
|
||||
|
||||
// Make a decision on whether to use LLD or our own linker.
|
||||
const use_lld = options.use_lld orelse blk: {
|
||||
--
|
||||
2.41.0
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
# seperated build options
|
||||
%_zig_general_options --verbose
|
||||
%_zig_project_options -Dtarget=%{_zig_target} -Dcpu=%{_zig_cpu} -Drelease-safe
|
||||
%_zig_project_options -Dtarget=%{_zig_target} -Dcpu=%{_zig_cpu} -Doptimize=ReleaseSafe
|
||||
%_zig_advanced_options --cache-dir zig-cache
|
||||
|
||||
%_zig_build_options %{?_zig_general_options} %{?_zig_project_options} %{?_zig_advanced_options}
|
||||
|
3
sources
3
sources
@ -1 +1,2 @@
|
||||
SHA512 (zig-0.9.1.tar.xz) = 0b8a5f9b7e34e4252536f59bc91429f1e76b2bf8e01f024095919f6ecf34db56b5c86c554fbb94bdcb5255394c87f2c87519c8f34c631f53816927ec0882ae2d
|
||||
SHA512 (zig-0.11.0.tar.xz) = c19a8ae6d440a16dd5e77941fc77c036d1f284f1784376625e63b65f30b4acad62f9f4217bc818c401f88c2c33f8722f26fc467c3e23c29a89178c4b1882d1c4
|
||||
SHA512 (zig-0.11.0.tar.xz.minisig) = 565dd1eacb7dd697e6b1ff54517adc1e4775d2523afaeb4f9a3dd404df871b187862211ecbbcf90b42e3a03853677fc1603e7fc8fc5ba7126a054679faa601ca
|
||||
|
@ -1,4 +0,0 @@
|
||||
untrusted comment: signature from minisign secret key
|
||||
RUSGOq2NVecA2cP4/GOO4uekp9HkLStSWbZ3j8twZWAOdJSobHaH9v7516KWmVeOb/yuCma//Xhx95jK4bFuW5RQGHKDENYODgE=
|
||||
trusted comment: timestamp:1673851410 file:zig-0.9.1.tar.xz hashed
|
||||
m6gIsJ5ibJxAx6ea9+Un6uJcfNNY4Ay4UP4mAzzB7Uq+vgHljM8mMsDnSSsmeJmBmbOPGqQj950nidNu2XMRDg==
|
92
zig.spec
92
zig.spec
@ -4,24 +4,22 @@
|
||||
# Signing key from https://ziglang.org/download/
|
||||
%global public_key RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
|
||||
|
||||
%global llvm_version 13.0.0
|
||||
%define llvm_compat 13
|
||||
|
||||
%if 0%{?fedora} >= 38
|
||||
# documentation and tests do not build due to an unsupported glibc version
|
||||
%bcond_with docs
|
||||
%else
|
||||
%bcond_without docs
|
||||
# note here at which Fedora or EL release we need to use compat LLVM packages
|
||||
%if 0%{?fedora} >= 39 || 0%{?rhel} >= 9
|
||||
%define llvm_compat 16
|
||||
%endif
|
||||
|
||||
%bcond_without macro
|
||||
# Issues with tests stop them from completing successfully
|
||||
# https://github.com/ziglang/zig/issues/9738
|
||||
%bcond_with test
|
||||
%global llvm_version 16.0.0
|
||||
|
||||
|
||||
%bcond bootstrap 0
|
||||
%bcond docs %{without bootstrap}
|
||||
%bcond macro %{without bootstrap}
|
||||
%bcond test 1
|
||||
|
||||
Name: zig
|
||||
Version: 0.9.1
|
||||
Release: 6%{?dist}
|
||||
Version: 0.11.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Programming language for maintaining robust, optimal, and reusable software
|
||||
|
||||
License: MIT and NCSA and LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL and ZPLv2.1
|
||||
@ -29,9 +27,11 @@ URL: https://ziglang.org
|
||||
Source0: %{url}/download/%{version}/%{name}-%{version}.tar.xz
|
||||
Source1: %{url}/download/%{version}/%{name}-%{version}.tar.xz.minisig
|
||||
Source2: macros.%{name}
|
||||
# prevent native directories from polluting the rpath
|
||||
# https://github.com/ziglang/zig/pull/10621
|
||||
Patch0: 0001-ignore-target-lib-dirs-when-invoked-with-feach-lib-r.patch
|
||||
# Support clean build of stage3 with temporary bootstrapped package
|
||||
Patch: 0001-Fedora-bootstrap-and-extra-build-flags-support.patch
|
||||
# There's no global option for build-id so enable it by default
|
||||
# instead of patching every project's build.zig
|
||||
Patch: 0002-Enable-build-id-by-default.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
@ -39,13 +39,14 @@ BuildRequires: cmake
|
||||
BuildRequires: llvm%{?llvm_compat}-devel
|
||||
BuildRequires: clang%{?llvm_compat}-devel
|
||||
BuildRequires: lld%{?llvm_compat}-devel
|
||||
BuildRequires: zlib-devel
|
||||
# for man page generation
|
||||
BuildRequires: help2man
|
||||
# for signature verification
|
||||
BuildRequires: minisign
|
||||
|
||||
%if 0%{?llvm_compat}
|
||||
BuildRequires: sed
|
||||
%if %{without bootstrap}
|
||||
BuildRequires: %{name} = %{version}
|
||||
%endif
|
||||
|
||||
%if %{with test}
|
||||
@ -58,22 +59,22 @@ Requires: %{name}-libs = %{version}
|
||||
|
||||
# These packages are bundled as source
|
||||
|
||||
# NCSA
|
||||
# Apache-2.0 WITH LLVM-exception OR NCSA OR MIT
|
||||
Provides: bundled(compiler-rt) = %{llvm_version}
|
||||
# LGPLv2+, LGPLv2+ with exceptions, GPLv2+, GPLv2+ with exceptions, BSD, Inner-Net, ISC, Public Domain and GFDL
|
||||
Provides: bundled(glibc) = 2.34
|
||||
# NCSA
|
||||
# Apache-2.0 WITH LLVM-exception OR MIT OR NCSA
|
||||
Provides: bundled(libcxx) = %{llvm_version}
|
||||
# NCSA
|
||||
# Apache-2.0 WITH LLVM-exception OR MIT OR NCSA
|
||||
Provides: bundled(libcxxabi) = %{llvm_version}
|
||||
# NCSA
|
||||
Provides: bundled(libunwind) = %{llvm_version}
|
||||
# BSD, LGPG, ZPL
|
||||
Provides: bundled(mingw) = 9.0.0
|
||||
Provides: bundled(mingw) = 10.0.0
|
||||
# MIT
|
||||
Provides: bundled(musl) = 1.2.2
|
||||
# CC0, BSD, MIT, Apache2, Apache2 with exceptions
|
||||
Provides: bundled(wasi-libc) = 82fc2c4f449e56319112f6f2583195c7f4e714b1
|
||||
Provides: bundled(musl) = 1.2.4
|
||||
# Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause
|
||||
Provides: bundled(wasi-libc) = 3189cd1ceec8771e8f27faab58ad05d4d6c369ef
|
||||
|
||||
ExclusiveArch: %{zig_arches}
|
||||
|
||||
@ -81,7 +82,7 @@ ExclusiveArch: %{zig_arches}
|
||||
Zig is an open-source programming language designed for robustness, optimality,
|
||||
and clarity. This package provides the zig compiler and the associated runtime.
|
||||
|
||||
# the standard library contains only plain text
|
||||
# The Zig stdlib only contains uncompiled code
|
||||
%package libs
|
||||
Summary: %{name} Standard Library
|
||||
BuildArch: noarch
|
||||
@ -113,27 +114,33 @@ This package contains common RPM macros for %{name}.
|
||||
/usr/bin/minisign -V -m %{SOURCE0} -x %{SOURCE1} -P %{public_key}
|
||||
|
||||
%autosetup -p1
|
||||
|
||||
%if 0%{?llvm_compat}
|
||||
sed -i "s|/usr/lib/llvm-13|%{_libdir}/llvm%{llvm_compat}|g" cmake/Find{clang,lld,llvm}.cmake
|
||||
%if %{without bootstrap}
|
||||
# Ensure that the pre-build stage1 binary is not used
|
||||
rm -f stage1/zig1.wasm
|
||||
%endif
|
||||
|
||||
%build
|
||||
|
||||
# C_FLAGS: wasm2c output generates a lot of noise with -Wunused.
|
||||
# EXTRA_BUILD_ARGS: apply --build-id=sha1 even if running unpatched stage2 compiler.
|
||||
%cmake \
|
||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||
-DZIG_PREFER_CLANG_CPP_DYLIB=true \
|
||||
-DZIG_VERSION:STRING="%{version}"
|
||||
%cmake_build
|
||||
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="-DNDEBUG -Wno-unused" \
|
||||
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-DNDEBUG -Wno-unused" \
|
||||
-DZIG_EXTRA_BUILD_ARGS:STRING="--verbose;-Dbuild-id=sha1" \
|
||||
-DZIG_SHARED_LLVM:BOOL=true \
|
||||
-DZIG_TARGET_MCPU:STRING=baseline \
|
||||
-DZIG_TARGET_TRIPLE:STRING=native \
|
||||
-DZIG_VERSION:STRING="%{version}" \
|
||||
%{!?with_bootstrap:-DZIG_EXECUTABLE:STRING="/usr/bin/zig"}
|
||||
# Build only stage3 and dependencies. Skips stage1/2 if using /usr/bin/zig
|
||||
%cmake_build --target stage3
|
||||
|
||||
# Zig has no official manpage
|
||||
# https://github.com/ziglang/zig/issues/715
|
||||
help2man --no-discard-stderr "%{__cmake_builddir}/zig" --version-option=version --output=%{name}.1
|
||||
|
||||
ln -s lib "%{__cmake_builddir}/"
|
||||
help2man --no-discard-stderr --no-info "%{__cmake_builddir}/stage3/bin/zig" --version-option=version --output=%{name}.1
|
||||
|
||||
%if %{with docs}
|
||||
%{__cmake_builddir}/zig build docs --verbose -Dversion-string="%{version}"
|
||||
"%{__cmake_builddir}/stage3/bin/zig" build docs --verbose -Dversion-string="%{version}"
|
||||
%endif
|
||||
|
||||
%install
|
||||
@ -147,7 +154,8 @@ install -D -pv -m 0644 %{SOURCE2} %{buildroot}%{_rpmmacrodir}/macros.%{name}
|
||||
|
||||
%if %{with test}
|
||||
%check
|
||||
%{__cmake_builddir}/zig build test --verbose
|
||||
# Run reduced set of tests, based on the Zig CI
|
||||
"%{__cmake_builddir}/stage3/bin/zig" test test/behavior.zig -Itest
|
||||
%endif
|
||||
|
||||
%files
|
||||
@ -161,7 +169,8 @@ install -D -pv -m 0644 %{SOURCE2} %{buildroot}%{_rpmmacrodir}/macros.%{name}
|
||||
%if %{with docs}
|
||||
%files doc
|
||||
%doc README.md
|
||||
%doc zig-cache/langref.html
|
||||
%doc zig-out/doc/langref.html
|
||||
%doc zig-out/doc/std
|
||||
%endif
|
||||
|
||||
%if %{with macro}
|
||||
@ -170,6 +179,9 @@ install -D -pv -m 0644 %{SOURCE2} %{buildroot}%{_rpmmacrodir}/macros.%{name}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sat Jan 27 2024 Aleksei Bavshin <alebastr@fedoraproject.org> - 0.11.0-1
|
||||
- Update to 0.11.0
|
||||
|
||||
* Sat Jan 27 2024 Aleksei Bavshin <alebastr@fedoraproject.org> - 0.9.1-6
|
||||
- Fix build with `--without macro`
|
||||
- Skip %%check and test dependencies when tests are disabled
|
||||
|
Loading…
Reference in New Issue
Block a user