From ca2c47155352983fdeb608eb13b2fcc809b074d6 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Apr 04 2024 19:04:06 +0000 Subject: Don't use rpm for the wasi-sdk but build it as bundled --- diff --git a/firefox.spec b/firefox.spec index 4412717..04c2962 100644 --- a/firefox.spec +++ b/firefox.spec @@ -228,7 +228,10 @@ Source46: org.mozilla.firefox.SearchProvider.service Source47: org.mozilla.firefox.desktop Source48: org.mozilla.firefox.appdata.xml.in Source49: wasi.patch.template -Source50: wasi-sdk-20-1.fc39.src.rpm +# Created by: +# git clone --recursive https://github.com/WebAssembly/wasi-sdk.git +# cd wasi-sdk && git-archive-all --force-submodules wasi-sdk-20.tar.gz +Source50: wasi-sdk-20.tar.gz # Build patches #Patch3: mozilla-build-arm.patch @@ -543,6 +546,9 @@ This package contains results of tests executed during build. %prep %setup -q -n %{tarballdir} +%if %{with wasi_sdk} +%setup -q -T -D -a 50 +%endif # Build patches, can't change backup suffix from default because during build # there is a compare of config and js/config directories and .orig suffix is @@ -559,8 +565,7 @@ This package contains results of tests executed during build. # We need to create the wasi.patch with the correct path to the wasm libclang_rt. %if %{with wasi_sdk} -export LIBCLANG_RT=%{_topdir}/BUILDROOT/usr/share/wasi-sysroot/lib/libclang_rt.builtins-wasm32.a; cat %{SOURCE49} | envsubst > %{_sourcedir}/wasi.patch -cat %{_sourcedir}/wasi.patch +export LIBCLANG_RT=`pwd`/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.builtins-wasm32.a; cat %{SOURCE49} | envsubst > %{_sourcedir}/wasi.patch %patch80 -p1 -b .wasi %endif @@ -737,33 +742,8 @@ chmod a-x third_party/rust/ash/src/extensions/nv/*.rs #WASI SDK %if %{with wasi_sdk} -function install_rpms_to_current_dir() { - PACKAGE_RPM=$(eval echo $1) - #PACKAGE_DIR=%{_rpmdir} - PACKAGE_DIR=%{_topdir}/RPMS - - if [ ! -f $PACKAGE_DIR/$PACKAGE_RPM ]; then - # Hack for tps tests - ARCH_STR=%{_arch} - %ifarch %{ix86} - ARCH_STR="i?86" - %endif - PACKAGE_DIR="$PACKAGE_DIR/$ARCH_STR" - fi - - for package in $(ls $PACKAGE_DIR/$PACKAGE_RPM) - do - echo "$package" - rpm2cpio "$package" | cpio -idu - rm -f "$package" - done -} - - -rpm -ivh %{SOURCE50} -rpmbuild --nodeps -bb --noclean %{_topdir}/SPECS/wasi-sdk.spec -pushd %{_buildrootdir} -install_rpms_to_current_dir wasi-sdk-20*.rpm +pushd wasi-sdk-20 +NINJA_FLAGS=-v CC=clang CXX=clang++ env -u CFLAGS -u CXXFLAGS -u FFLAGS -u VALFLAGS -u RUSTFLAGS -u LDFLAGS -u LT_SYS_LIBRARY_PATH make package popd %endif # ^ with wasi_sdk @@ -883,7 +863,7 @@ echo "ac_add_options MOZ_PGO=1" >> .mozconfig %endif %if %{with wasi_sdk} -echo "ac_add_options --with-wasi-sysroot=%{_topdir}/BUILDROOT/usr/share/wasi-sysroot" >> .mozconfig +echo "ac_add_options --with-wasi-sysroot=`pwd`/wasi-sdk-20/build/install/opt/wasi-sdk/share/wasi-sysroot" >> .mozconfig %else echo "ac_add_options --without-sysroot" >> .mozconfig echo "ac_add_options --without-wasm-sandboxed-libraries" >> .mozconfig diff --git a/sources b/sources index 7fe770a..8df460d 100644 --- a/sources +++ b/sources @@ -1,6 +1,6 @@ SHA512 (mochitest-python.tar.gz) = 089b1593068b76f4572af0086eaccf52a6a1299bfffb58593206d19bf021ae381f2380bbfeb4371586cd53706ff6dde3d240238b2caf19b96c57dfc2f4524e36 SHA512 (cbindgen-vendor.tar.xz) = 3e7eaff088db918e95f5505e5feeb06e8b7b95cc62042a6d163a708fc76baea43d21bf49cf7e02bc64fdfc61e8d7704057dbb225098de56e110783104d166c54 SHA512 (dump_syms-vendor.tar.xz) = 5769c052fa874a965eb8837776b01fb097e8930f45d0d0d2a93997c4fae8726184a192aee52302bde62e62897801b1463cae9283563d9d60e8b8ee80a250f2a3 -SHA512 (wasi-sdk-20-1.fc39.src.rpm) = a640db0a431657e134ab2bf6fe5ef1c32ccf9e4268e81e8d8da3c111bfb93ea8ec5c7185519601b05649f3343b61278afc8e0de89a7d059628c419aa50b279eb SHA512 (firefox-124.0.2.source.tar.xz) = 8cf340de6e34812f8ae3363265859a263330af770d981c3dd1ca1e7e0cfe513604d3e68184d4aa1446569aefbdf359d561fbc200faf19a5ed020a1709d9ef10e SHA512 (firefox-langpacks-124.0.2-20240404.tar.xz) = ac50445a026eb6515b9d891fde22eb41659417ee1daea3d941e370108861349edbceae4ab5ed8947c03c3202eb802d01d051de1a98603243568f755d62b9eab3 +SHA512 (wasi-sdk-20.tar.gz) = 95be9d9b41ed1f7884e9cd68bad22abbb355b049fd09731c89b9e36666d0205b1a16ec9c21820adf0c5a34e2048015cbfbef0542170d466fa3336c636873c405 diff --git a/wasi.patch b/wasi.patch index b47b496..33ab037 100644 --- a/wasi.patch +++ b/wasi.patch @@ -6,7 +6,30 @@ diff -up firefox-121.0.1/toolkit/moz.configure.wasi firefox-121.0.1/toolkit/moz. if wasi_sysroot: log.info("Using wasi sysroot in %s", wasi_sysroot) - return ["--sysroot=%s" % wasi_sysroot] -+ return ["--sysroot=%s" % wasi_sysroot, "-nodefaultlibs", "-lc", "-lwasi-emulated-process-clocks", "-lc++", "-lc++abi", "/home/jhorak/rpmbuild/BUILDROOT/usr/share/wasi-sysroot/lib/libclang_rt.builtins-wasm32.a"] ++ return ["--sysroot=%s" % wasi_sysroot, "-nodefaultlibs", "-lc", "-lwasi-emulated-process-clocks", "-lc++", "-lc++abi", "/home/jhorak/f/firefox/firefox-124.0.2/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.builtins-wasm32.a"] return [] set_config("WASI_SYSROOT", wasi_sysroot) +diff -up firefox-121.0.1/wasi-sdk-20/Makefile.fedora firefox-121.0.1/wasi-sdk-20/Makefile +--- firefox-121.0.1/wasi-sdk-20/Makefile.fedora 2024-03-04 13:20:56.903403496 +0100 ++++ firefox-121.0.1/wasi-sdk-20/Makefile 2024-03-04 13:19:59.381140045 +0100 +@@ -44,7 +44,7 @@ endif + + # Only the major version is needed for Clang, see https://reviews.llvm.org/D125860. + CLANG_VERSION=$(shell $(BASH) ./llvm_version_major.sh $(LLVM_PROJ_DIR)) +-VERSION:=$(shell $(BASH) ./version.sh) ++VERSION:=20 #$(shell $(BASH) ./version.sh) + DEBUG_PREFIX_MAP=-fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION) + + default: build +@@ -262,8 +262,8 @@ package: build/package.BUILT + + build/package.BUILT: build strip + mkdir -p dist +- ./deb_from_installation.sh $(shell pwd)/dist "$(VERSION)" "$(BUILD_PREFIX)" +- ./tar_from_installation.sh "$(shell pwd)/dist" "$(VERSION)" "$(BUILD_PREFIX)" ++ #./deb_from_installation.sh $(shell pwd)/dist "$(VERSION)" "$(BUILD_PREFIX)" ++ #./tar_from_installation.sh "$(shell pwd)/dist" "$(VERSION)" "$(BUILD_PREFIX)" + touch build/package.BUILT + + .PHONY: default clean build strip package check diff --git a/wasi.patch.template b/wasi.patch.template index aa2838e..daaad77 100644 --- a/wasi.patch.template +++ b/wasi.patch.template @@ -10,3 +10,26 @@ diff -up firefox-121.0.1/toolkit/moz.configure.wasi firefox-121.0.1/toolkit/moz. return [] set_config("WASI_SYSROOT", wasi_sysroot) +diff -up firefox-121.0.1/wasi-sdk-20/Makefile.fedora firefox-121.0.1/wasi-sdk-20/Makefile +--- firefox-121.0.1/wasi-sdk-20/Makefile.fedora 2024-03-04 13:20:56.903403496 +0100 ++++ firefox-121.0.1/wasi-sdk-20/Makefile 2024-03-04 13:19:59.381140045 +0100 +@@ -44,7 +44,7 @@ endif + + # Only the major version is needed for Clang, see https://reviews.llvm.org/D125860. + CLANG_VERSION=$(shell $(BASH) ./llvm_version_major.sh $(LLVM_PROJ_DIR)) +-VERSION:=$(shell $(BASH) ./version.sh) ++VERSION:=20 #$(shell $(BASH) ./version.sh) + DEBUG_PREFIX_MAP=-fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION) + + default: build +@@ -262,8 +262,8 @@ package: build/package.BUILT + + build/package.BUILT: build strip + mkdir -p dist +- ./deb_from_installation.sh $(shell pwd)/dist "$(VERSION)" "$(BUILD_PREFIX)" +- ./tar_from_installation.sh "$(shell pwd)/dist" "$(VERSION)" "$(BUILD_PREFIX)" ++ #./deb_from_installation.sh $(shell pwd)/dist "$(VERSION)" "$(BUILD_PREFIX)" ++ #./tar_from_installation.sh "$(shell pwd)/dist" "$(VERSION)" "$(BUILD_PREFIX)" + touch build/package.BUILT + + .PHONY: default clean build strip package check