diff --git a/.gitignore b/.gitignore index e128b75..a330ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /wasi-libc-wasi-sdk-*.tar.gz -/wasi-libc-*-build/ diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch new file mode 100644 index 0000000..9c3c9e5 --- /dev/null +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -0,0 +1,71 @@ +From 74a068d26a61e744f607fbf6d8355f2b69e82e4e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= +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 +Signed-off-by: rpm-build +--- + Makefile | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 00dd30812884..c340da4e0153 100644 +--- a/Makefile ++++ b/Makefile +@@ -768,6 +768,7 @@ endif + endif + + libc_so: $(INCLUDE_DIRS) $(LIBC_SO) ++ touch $@ + + STATIC_LIBS = \ + $(SYSROOT_LIB)/libc.a \ +@@ -788,6 +789,7 @@ STATIC_LIBS += \ + endif + + libc: $(INCLUDE_DIRS) $(STATIC_LIBS) ++ touch $@ + + DUMMY := m rt pthread crypt util xnet resolv + DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY)) +@@ -804,6 +806,7 @@ 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 +@@ -946,6 +949,8 @@ check-symbols: $(STARTUP_FILES) libc + # This ignores whitespace because on Windows the output has CRLF line endings. + diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)" + ++ touch $@ ++ + + ##### BINDINGS ################################################################# + # The `bindings` target retrieves the necessary WIT files for the wasi-cli world +@@ -1021,5 +1026,6 @@ clean: + $(RM) -r "$(BINDING_WORK_DIR)" + $(RM) -r "$(OBJDIR)" + $(RM) -r "$(SYSROOT)" ++ $(RM) check-symbols libc_so libc finish + +-.PHONY: default libc libc_so finish install clean check-symbols bindings ++.PHONY: default install clean bindings +-- +2.48.1 + diff --git a/gating.yaml b/gating.yaml index e943849..f2f68de 100644 --- a/gating.yaml +++ b/gating.yaml @@ -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} -... diff --git a/sources b/sources index 04d9551..ed766a1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-33.tar.gz) = 7b07509db0ce6817a9616988b8b4ea9c7a87a2318e68ed350a2d0a8f7e839bb97e1cb766a568b008654149835b430a5a090f767ed9db0ca30503c4efe864a49c +SHA512 (wasi-libc-wasi-sdk-25.tar.gz) = 580716fbc152be19e2e9724f3483a0a580a168be0cd6d105d37b0ebd0d11bd36d7d9db63984eb2cc7b3aaff2fc9446d9558d1469b538a79b7de465a1113560ea diff --git a/wasi-libc.rpmlintrc b/wasi-libc.rpmlintrc deleted file mode 100644 index 70329d5..0000000 --- a/wasi-libc.rpmlintrc +++ /dev/null @@ -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") diff --git a/wasi-libc.spec b/wasi-libc.spec index ff2f0a8..67cdd2e 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 33 +Version: 25 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 @@ -36,12 +37,13 @@ BuildRequires: llvm >= 10 %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 +73,11 @@ 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} %check # Bundled version checks