Compare commits

..

No commits in common. "rawhide" and "f39" have entirely different histories.

6 changed files with 107 additions and 46 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
/wasi-libc-wasi-sdk-*.tar.gz
/wasi-libc-*-build/

View file

@ -0,0 +1,88 @@
From bf718b4d75a3a22c9e0b9426c0502fe066bd56b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
Date: Mon, 29 Aug 2022 15:07:34 +0200
Subject: [PATCH] make: don't rebuild files on `make install`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The original Makefile does not allow for clean separation of build and
install steps, and re-compiles the library on `make install`.
Using [empty target files][], the re-compilation is skipped on install.
Adapted from [Debian patch][].
[empty target files]: https://www.gnu.org/software/make/manual/make.html#Empty-Targets
[Debian patch]: https://salsa.debian.org/rust-team/wasi-libc/-/blob/master/debian/patches/dont-rebuild-install.patch
Signed-off-by: Jan Staněk <jstanek@redhat.com>
Signed-off-by: rpm-build <rpm-build>
---
Makefile | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 542b43e..7b70477 100644
--- a/Makefile
+++ b/Makefile
@@ -771,6 +771,9 @@ ifeq ($(WASI_SNAPSHOT), p2)
> "$(SYSROOT_INC)/__wasi_snapshot.h"
endif
+ # Mark this rule as done
+ touch $@
+
startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS)
#
# Install the startup files (crt1.o etc).
@@ -778,6 +781,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS)
mkdir -p "$(SYSROOT_LIB)" && \
cp $(LIBC_BOTTOM_HALF_CRT_OBJS) "$(SYSROOT_LIB)"
+ # Mark this rule finished
+ touch $@
+
# TODO: As of this writing, wasi_thread_start.s uses non-position-independent
# code, and I'm not sure how to make it position-independent. Once we've done
# that, we can enable libc.so for the wasi-threads build.
@@ -796,6 +802,7 @@ endif
endif
libc_so: include_dirs $(LIBC_SO)
+ touch $@
STATIC_LIBS = \
$(SYSROOT_LIB)/libc.a \
@@ -812,6 +819,7 @@ STATIC_LIBS += \
endif
libc: include_dirs $(STATIC_LIBS)
+ touch $@
dummy_libs:
#
@@ -821,11 +829,13 @@ dummy_libs:
for name in m rt pthread crypt util xnet resolv; do \
$(AR) crs "$(SYSROOT_LIB)/lib$${name}.a"; \
done
+ touch $@
finish: startup_files libc dummy_libs
#
# The build succeeded! The generated sysroot is in $(SYSROOT).
#
+ touch $@
ifeq ($(LTO),no)
# The check for defined and undefined symbols expects there to be a heap
@@ -1024,5 +1034,6 @@ clean:
$(RM) -r "$(BINDING_WORK_DIR)"
$(RM) -r "$(OBJDIR)"
$(RM) -r "$(SYSROOT)"
+ $(RM) include_dirs startup_files dummy_libs libc_so libc finish
-.PHONY: default startup_files libc libc_so dummy_libs finish install include_dirs clean check-symbols bindings
+.PHONY: default install clean check-symbols bindings
--
2.47.0

View file

@ -1,6 +1,6 @@
--- !Policy # testing repository
product_versions:
- fedora-rawhide
- fedora-*
decision_contexts: [bodhi_update_push_testing]
subject_type: koji_build
rules:
@ -10,7 +10,7 @@ rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional}
--- !Policy # stable repository
product_versions:
- fedora-rawhide
- fedora-*
decision_contexts: [bodhi_update_push_stable]
subject_type: koji_build
rules:
@ -19,22 +19,3 @@ rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional}
...
--- !Policy # testing repository
product_versions:
- fedora-*
decision_contexts: [bodhi_update_push_testing]
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional}
--- !Policy # stable repository
product_versions:
- fedora-*
decision_contexts: [bodhi_update_push_stable]
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional}
...

View file

@ -1 +1 @@
SHA512 (wasi-libc-wasi-sdk-33.tar.gz) = 7b07509db0ce6817a9616988b8b4ea9c7a87a2318e68ed350a2d0a8f7e839bb97e1cb766a568b008654149835b430a5a090f767ed9db0ca30503c4efe864a49c
SHA512 (wasi-libc-wasi-sdk-24.tar.gz) = ab9322dbcd0bb151ba3f5a8b722e04d39ea5d7632d0322257c3b67e4193d0de1b0820dd4db84923e7967f24189d02dd242693ea95ad184a309eec4d27df8ba21

View file

@ -1,4 +0,0 @@
# cross-compilation files are expected
addFilter(r"\barch-independent-package-contains-binary-or-object /usr/wasm32-wasi/.*")
# some header files are empty, and that's expected
addFilter(r"\bzero-length /usr/wasm32-wasi/include/wasm32-wasi/bits/.*\.h")

View file

@ -1,6 +1,6 @@
Name: wasi-libc
Summary: C library implementation for WebAssembly System Interface
Version: 33
Version: 24
Release: %autorelease
License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause
@ -8,10 +8,11 @@ URL: https://github.com/WebAssembly/wasi-libc/
Source: %{url}/archive/refs/tags/wasi-sdk-%{version}.tar.gz#/%{name}-wasi-sdk-%{version}.tar.gz
Source1: smoke-test.c
# Compatibility patches from upstream main
# Allow using artifacts from %%build in %%install instead of recompiling
Patch: 0001-make-don-t-rebuild-files-on-make-install.patch
# This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities
%global musl_version 1.2.5
%global musl_version 1.2.3
# Although these packages provide binary files, they are not targeted
# for the build platform, but for wasm32-wasi.
@ -21,9 +22,9 @@ Source1: smoke-test.c
BuildArch: noarch
BuildRequires: clang >= 10
BuildRequires: cmake >= 3.26
BuildRequires: git-core
BuildRequires: llvm >= 10
BuildRequires: make
%global toolchain clang
# Re-packaging the static library tends to overwrite files
@ -31,17 +32,14 @@ BuildRequires: llvm >= 10
# See rhbz#2228297 for details.
%global __brp_llvm_compile_lto_elf %{nil}
# brp-strip-static-archive breaks the archive index for wasm
%global __brp_strip_static_archive %{nil}
%global __brp_strip_lto %{nil}
# WASI is a specific architecture; host (build machine) arch flags should not apply by default
%global build_cflags -O2 --target=wasm32-wasi -fstack-protector
%global build_cflags --target=wasm32-wasi -fstack-protector
# Define cross-compiling prefix
%global wasi_prefix %{_prefix}/wasm32-wasi
%global wasi_datadir %{wasi_prefix}/share
%global wasi_includedir %{wasi_prefix}/include
%global wasi_libdir %{wasi_prefix}/lib
%global wasi_make_flags MALLOC_IMPL=emmalloc INSTALL_DIR='%{buildroot}%{wasi_prefix}' SYSROOT='%{_builddir}/sysroot'
%global _description %{expand:
WASI Libc is a libc for WebAssembly programs built on top of WASI system calls.
@ -71,18 +69,17 @@ Summary: C library for WASI - headers and development files
cp -p libc-bottom-half/cloudlibc/LICENSE LICENSE-cloudlibc
%build
%cmake \
-DCMAKE_INSTALL_PREFIX='%{wasi_prefix}' \
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
-DBUILD_SHARED=OFF \
-DCHECK_SYMBOLS=ON \
-DMALLOC=emmalloc \
-DTARGET_TRIPLE=wasm32-wasi
%cmake_build
%make_build %{wasi_make_flags}
make %{?_smp_mflags} %{wasi_make_flags} check-symbols
%install
%cmake_install
cp -av -t '%{buildroot}%{wasi_prefix}' '%{__cmake_builddir}/sysroot/share'
%make_install %{wasi_make_flags}
# brp-strip-static-archive breaks the archive index for wasm
%global __os_install_post %{expand:
%__os_install_post
find %{buildroot}%{wasi_libdir} -type f -regex '.*\\.\\(a\\|rlib\\)' -print -exec llvm-ranlib '{}' ';'
}
%check
# Bundled version checks