zig/0001-Fedora-bootstrap-and-extra-build-flags-support.patch
Aleksei Bavshin 8c4bf36257
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>
2024-01-27 13:21:36 -08:00

67 lines
2.3 KiB
Diff

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