diff --git a/.gitignore b/.gitignore index e128b75..2b2e21d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -/wasi-libc-wasi-sdk-*.tar.gz -/wasi-libc-*-build/ +/wasi-libc-wasi-sdk-20.tar.gz +/wasi-libc-wasi-sdk-21.tar.gz +/wasi-libc-wasi-sdk-22.tar.gz 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..92fa6c2 --- /dev/null +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -0,0 +1,83 @@ +From bbbeca0fe770b7014eb16e9e88d8d1ca85f6adeb 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 | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 2f9e9fd..e83ca57 100644 +--- a/Makefile ++++ b/Makefile +@@ -743,6 +743,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). +@@ -750,6 +753,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. +@@ -768,6 +774,7 @@ endif + endif + + libc_so: include_dirs $(LIBC_SO) ++ touch $@ + + STATIC_LIBS = \ + $(SYSROOT_LIB)/libc.a \ +@@ -784,6 +791,7 @@ STATIC_LIBS += \ + endif + + libc: include_dirs $(STATIC_LIBS) ++ touch $@ + + finish: startup_files libc + # +@@ -797,6 +805,8 @@ finish: startup_files libc + # The build succeeded! The generated sysroot is in $(SYSROOT). + # + ++ touch $@ ++ + # The check for defined and undefined symbols expects there to be a heap + # alloctor (providing malloc, calloc, free, etc). Skip this step if the build + # is done without a malloc implementation. +@@ -982,5 +992,6 @@ clean: + $(RM) -r "$(BINDING_WORK_DIR)" + $(RM) -r "$(OBJDIR)" + $(RM) -r "$(SYSROOT)" ++ $(RM) include_dirs startup_files libc_so libc finish + +-.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols bindings ++.PHONY: default install clean check-symbols bindings +-- +2.45.0 + 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..9b4ec90 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-33.tar.gz) = 7b07509db0ce6817a9616988b8b4ea9c7a87a2318e68ed350a2d0a8f7e839bb97e1cb766a568b008654149835b430a5a090f767ed9db0ca30503c4efe864a49c +SHA512 (wasi-libc-wasi-sdk-22.tar.gz) = 3fcd5d6c0e09d824702165d8f1236e400b1d5e95fad14f1821d40de05340a044f0ec8a587d8478854252cc938a663aa9f854e6a5e683ef8f8349c60dc6c628ed 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..a546467 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: 22 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