diff --git a/_service b/_service
deleted file mode 100644
index 9a7a611..0000000
--- a/_service
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- https://github.com/WebAssembly/wasi-libc
- git
- 0.1
- 9886d3d6200fcc3726329966860fc058707406cd
-
-
-
- *.tar
- xz
-
-
-
diff --git a/undefine-gcc-macros.patch b/undefine-gcc-macros.patch
new file mode 100644
index 0000000..bd7de60
--- /dev/null
+++ b/undefine-gcc-macros.patch
@@ -0,0 +1,16 @@
+Undefine some macros because the build isn't happy about them.
+diff --git a/Makefile b/Makefile
+index 563f59f..6d478e9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -688,6 +688,10 @@ check-symbols: startup_files libc
+ -U__clang_wide_literal_encoding__ \
+ -U__wasm_mutable_globals__ \
+ -U__wasm_sign_ext__ \
++ -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 \
++ -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 \
++ -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 \
++ -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 \
+ -U__GNUC__ \
+ -U__GNUC_MINOR__ \
+ -U__GNUC_PATCHLEVEL__ \
diff --git a/wasi-libc-0.1.1652147647.9886d3d.obscpio b/wasi-libc-0.1.1652147647.9886d3d.obscpio
deleted file mode 100644
index 90e6fee..0000000
--- a/wasi-libc-0.1.1652147647.9886d3d.obscpio
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:711cc039b0f8f238a7fc2981c470369d1671c48e7b2bf14175f0c42074b09656
-size 5555725
diff --git a/wasi-libc-0.1.1652147647.9886d3d.tar.xz b/wasi-libc-0.1.1652147647.9886d3d.tar.xz
deleted file mode 100644
index 8a2dae6..0000000
--- a/wasi-libc-0.1.1652147647.9886d3d.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2213d324a38dd2e899e834e6263671b99912e50b61e651020e698da717098654
-size 931424
diff --git a/wasi-libc-19.tar.gz b/wasi-libc-19.tar.gz
new file mode 100644
index 0000000..9e770a0
--- /dev/null
+++ b/wasi-libc-19.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1d251a44bfa978ad625c98bd5770942c5246999b5eeea2f089fec05ba88212ec
+size 1311353
diff --git a/wasi-libc-rpmlintrc b/wasi-libc-rpmlintrc
index c1666b7..8a7745d 100644
--- a/wasi-libc-rpmlintrc
+++ b/wasi-libc-rpmlintrc
@@ -5,6 +5,7 @@ addFilter("static-library-without-debuginfo .*")
addFilter("readelf-failed .*")
addFilter("zero-length .*")
addFilter("arch-dependent-file-in-usr-share .*")
+addFilter("arch-independent-package-contains-binary-or-object .*")
# There are empty dummy-files in the sysroot
addFilter('lto-no-text-in-archive .*')
addFilter('devel-file-in-non-devel-package .*')
diff --git a/wasi-libc.changes b/wasi-libc.changes
index f840e59..ff7b24f 100644
--- a/wasi-libc.changes
+++ b/wasi-libc.changes
@@ -1,3 +1,13 @@
+-------------------------------------------------------------------
+Wed Mar 22 22:23:36 UTC 2023 - Aaron Puchert
+
+- 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 00:34:36 UTC 2022 - William Brown
diff --git a/wasi-libc.obsinfo b/wasi-libc.obsinfo
deleted file mode 100644
index c28fbbe..0000000
--- a/wasi-libc.obsinfo
+++ /dev/null
@@ -1,4 +0,0 @@
-name: wasi-libc
-version: 0.1.1652147647.9886d3d
-mtime: 1652147647
-commit: 9886d3d6200fcc3726329966860fc058707406cd
diff --git a/wasi-libc.spec b/wasi-libc.spec
index 9fc9bfe..647f0c5 100644
--- a/wasi-libc.spec
+++ b/wasi-libc.spec
@@ -1,7 +1,7 @@
#
# spec file for package wasi-libc
#
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,24 +17,27 @@
Name: wasi-libc
-Version: 0.1.1652147647.9886d3d
+Version: 19
Release: 0
-Summary: WASI libc implementation for WebAssembly
+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: %{name}-%{version}.tar.xz
+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: undefine-gcc-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
-%setup -q
+%setup -q -n wasi-libc-wasi-sdk-%{version}
%patch1 -p1
+%patch2 -p1
%build
export CC=clang
@@ -46,7 +49,7 @@ export NM=llvm-nm
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
+# 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
diff --git a/workaround-broken-makefile.patch b/workaround-broken-makefile.patch
index fea6bf8..ad0c130 100644
--- a/workaround-broken-makefile.patch
+++ b/workaround-broken-makefile.patch
@@ -1,14 +1,14 @@
# Workaround as per https://github.com/WebAssembly/wasi-libc/issues/156
diff --git a/Makefile b/Makefile
-index b9f3c00..cd044b0 100644
+index 46229f9..563f59f 100644
--- a/Makefile
+++ b/Makefile
-@@ -565,7 +565,7 @@ check-symbols: startup_files libc
+@@ -706,7 +706,7 @@ check-symbols: startup_files libc
# This ignores whitespace because on Windows the output has CRLF line endings.
- diff -wur "$(CURDIR)/expected/$(MULTIARCH_TRIPLE)" "$(SYSROOT_SHARE)"
+ diff -wur "$(CURDIR)/expected/$(TARGET_TRIPLE)" "$(SYSROOT_SHARE)"
-install: finish
-+install:
++install:
mkdir -p "$(INSTALL_DIR)"
cp -r "$(SYSROOT)/lib" "$(SYSROOT)/share" "$(SYSROOT)/include" "$(INSTALL_DIR)"