File wasi-libc.spec of Package wasi-libc

#
# spec file for package wasi-libc
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           wasi-libc
Version:        25
Release:        1.1
Summary:        WASI libc implementation for WebAssembly
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:        MIT
URL:            https://github.com/WebAssembly/wasi-libc
Source:         https://github.com/WebAssembly/wasi-libc/archive/refs/tags/wasi-sdk-%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        wasi-libc-rpmlintrc
Patch1:         workaround-broken-makefile.patch
Patch2:         ignore-intc-macros.patch
BuildRequires:  clang > 10
BuildRequires:  llvm > 10
BuildArch:      noarch

%description
WASI libc allows cross platform binaries to be created and executed on a variety of platforms

%prep
%autosetup -p1 -n wasi-libc-wasi-sdk-%{version}

%build
export CC=clang
export AR=llvm-ar
export NM=llvm-nm
%make_build

%install
export CC=clang
export AR=llvm-ar
export NM=llvm-nm
# The makefile is stupid and compiles everything again if we do `make install`, so we
# do it only once
%make_install INSTALL_DIR="%{buildroot}/%{_datadir}/wasi-sysroot"
# brp-15-strip-debug and -ar call system-strip and ar, which are not wasm-aware, so they will break wasm-files
export NO_BRP_AR=true
export NO_BRP_STRIP_DEBUG=true

%files
%license LICENSE
%{_datadir}/wasi-sysroot/

%changelog
* Wed Mar 19 2025 Aaron Puchert <aaronpuchert@alice-dsl.net>
- Update to version (wasi-sdk-)25.
  * Initial FTS support.
  * Remove extra lock-taking in preopen setup.
  * Update `_POSIX_THREAD_XX` macro definitions.
  * `dlmalloc`: account the footprint of the initial heap.
  * Ignore the `__tls_base` undefined symbol.
  * Extend wasi-emulated-mman with `mprotect`.
  * include pthread.h for all targets.
  * timezone `__secs_to_zone` stub: guard against null pointer
    dereference.
  * `times` should always return 0 for `tms_cutime`.
  * 0-initialize thread-specific data upon thread creation.
  * iconv/wctomb: fix memory corruption related to CURRENT_UTF8
    implementation.
  * Improve some pthreads stub functions.
  * `getaddrinfo`: improve the service/port resolution.
  * Implement a stub pthreads library for `THREAD_MODEL=single`.
- Drop obsolete patches:
  * ignore-gcc-con-destructive-size-macros.patch
  * ignore-norm-max-macros.patch
  * ignore-stdc-embed-macros.patch
  * ignore-wasm-macros-indirect-function-table.patch
- Rebase workaround-broken-makefile.patch.
- Backport upstream patch ignore-intc-macros.patch to fix build
  with Clang 20.
* Sat Sep 21 2024 Aaron Puchert <aaronpuchert@alice-dsl.net>
- Update to version (wasi-sdk-)22.
  * Add support for some network APIs.
- Rebase workaround-broken-makefile.patch.
- Backport upstream patches to fix build with Clang 19:
  * ignore-gcc-con-destructive-size-macros.patch
  * ignore-norm-max-macros.patch
  * ignore-stdc-embed-macros.patch
  * ignore-wasm-macros-indirect-function-table.patch
* Thu Feb 22 2024 Aaron Puchert <aaronpuchert@alice-dsl.net>
- Update to version (wasi-sdk-)21.
  * Compatibility with Clang 18.
  * Add shared library support.
- Drop obsolete ignore-fpclass-macros.patch.
* Tue Feb 20 2024 Dominique Leuenberger <dimstar@opensuse.org>
- Use %%autosetup macro. Allows to eliminate the usage of deprecated
  %%patchN
* Fri Sep 22 2023 Aaron Puchert <aaronpuchert@alice-dsl.net>
- Update to version (wasi-sdk-)20.
  * Compatibility with Clang 16.
  * Rename triple wasm32-wasi-pthread to wasm32-wasi-threads.
  * Implement support for spinlock.
  * Improve performance in dlmalloc.
- Rebase workaround-broken-makefile.patch.
- Drop obsolete undefine-gcc-macros.patch. (Has been solved
  upstream in gh#WebAssembly/wasi-libc#379.)
- Add ignore-fpclass-macros.patch to ignore __FPCLASS_* macros that
  are new with Clang 17.
* Wed Mar 22 2023 Aaron Puchert <aaronpuchert@alice-dsl.net>
- Update to version (wasi-sdk-)19.
- Rebase workaround-broken-makefile.patch.
- Add undefine-gcc-macros.patch: ignore new macros for now to fix
  build with Clang 16.
- Declare the package as noarch: the binaries are for WebAssembly,
  not the host architecture.
* Fri Jul 29 2022 William Brown <william.brown@suse.com>
- Update services to comply with OBS
- Fix rpmlintrc
* Wed Apr 20 2022 Martin Sirringhaus <martin.sirringhaus@suse.com>
- Add rpmlintrc to suppress errors for now
- Add workaround-broken-makefile.patch for cleaner build/install
  separation
* Wed Apr 20 2022 Martin Sirringhaus <martin.sirringhaus@suse.com>
- Initial commit
openSUSE Build Service is sponsored by