%define _source_payload w0.ufdio %global debug_package %{nil} %global system_build_flags 1 %global build_target() \ export NINJA_STATUS="[%2:%f/%t] " ; \ ninja -j %{_smp_build_ncpus} -C '%1' '%2' Name: cronet Version: 131.0.6778.108 Release: 1%?dist Summary: Networking stack of Chromium as a library License: BSD-3-Clause URL: https://chromium.googlesource.com/chromium/src/+/HEAD/components/cronet/README.md Source0: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%{VERSION}.tar.xz Patch0: chromium-127-rust-clanglib.patch Patch1: fix-unknown-warning-option-messages.diff BuildRequires: bsdtar BuildRequires: %{__python3} BuildRequires: gn BuildRequires: ninja-build BuildRequires: clang BuildRequires: compiler-rt BuildRequires: lld BuildRequires: /usr/bin/llvm-ar BuildRequires: nspr-devel BuildRequires: nss-devel BuildRequires: rustc BuildRequires: cups-devel BuildRequires: dbus-devel BuildRequires: libxkbcommon-devel BuildRequires: libdrm-devel BuildRequires: mesa-libgbm-devel BuildRequires: mesa-libGL-devel BuildRequires: libatomic %description Networking stack of Chromium as a library %package devel Summary: Development files for cronet Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Development files for cronet %prep cd %{_builddir} %global buildsubdir chromium-%{VERSION} rm -rf %{buildsubdir} bsdtar -xvf %{SOURCE0} cd %{buildsubdir} /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . %autopatch -p1 %build FLAGS=' -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-unused-command-line-argument' FLAGS+=' -Wno-unused-but-set-variable -Wno-unused-result -Wno-unused-function -Wno-unused-variable' FLAGS+=' -Wno-unused-const-variable -Wno-unneeded-internal-declaration -Wno-unknown-attributes -Wno-unknown-pragmas' %if %{system_build_flags} CFLAGS=${CFLAGS/-fexceptions} CFLAGS=${CFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS} CFLAGS="$CFLAGS $FLAGS" CXXFLAGS="$CFLAGS" %else # override system build flags CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" %endif LDFLAGS="$LDFLAGS -Wl,-z,pack-relative-relocs" RUSTFLAGS=${RUSTFLAGS/--cap-lints/-Clink-arg=-Wl,-z,pack-relative-relocs --cap-lints} export CC=clang export CXX=clang++ export AR=llvm-ar export NM=llvm-nm export READELF=llvm-readelf export CFLAGS export CXXFLAGS export LDFLAGS export RUSTFLAGS # chromium uses nightly features export RUSTC_BOOTSTRAP=1 # set rustc version rustc_version="$(rustc --version)" # set clang version clang_version="$(clang --version | sed -n 's/clang version //p' | cut -d. -f1)" clang_base_path="$(clang --version | grep InstalledDir | cut -d' ' -f2 | sed 's#/bin##')" gn_flags=('is_official_build=true') gn_flags+=('target_os="linux"' 'current_os="linux"') if [[ $(arch) == 'x86_64' ]] then gn_flags+=('target_cpu="x64"') elif [[ $(arch) == 'aarch64' ]] then gn_flags+=('target_cpu="arm64"') fi gn_flags+=('is_clang=true' "clang_base_path=\"$clang_base_path\"" "clang_version=\"$clang_version\"" 'clang_use_chrome_plugins=false' 'use_lld=true' 'is_cfi=false' 'use_thin_lto=false' 'chrome_pgo_phase=0' 'symbol_level=0' 'blink_symbol_level=0' 'is_debug=false' 'is_component_build=false' ) gn_flags+=('rust_sysroot_absolute="%{_prefix}"' 'rustc_version="'$rustc_version'"' ) gn_flags+=('use_sysroot=false' 'system_libdir="%{_libdir}"' ) gn_flags+=('dcheck_always_on=false' 'dcheck_is_configurable=false' 'use_allocator_shim=false' 'enable_backup_ref_ptr_support=false' 'enable_resource_allowlist_generation=false' 'exclude_unwind_tables=true' 'enable_trace_logging=false' 'enable_base_tracing=true' 'enable_mdns=false' 'enable_nacl=false' 'use_gio=false' 'use_gtk=false' 'use_glib=false' 'use_udev=false' 'use_pangocairo=false' 'use_qt=false' 'use_qt6=false' 'use_libpci=false' 'use_pulseaudio=false' 'use_vaapi=false' 'enable_ffmpeg_video_decoders=false' 'media_use_libvpx=false' 'media_use_ffmpeg=false' ) echo $pwd cp -af %{_bindir}/gn buildtools/linux64/gn gn gen out/Release --args="${gn_flags[*]}" %build_target out/Release cronet_package %install mkdir -p %{buildroot}%{_libdir}/pkgconfig mkdir -p %{buildroot}%{_includedir} mv out/Release/cronet/include %{buildroot}%{_includedir}/cronet mv out/Release/cronet/libcronet.%{VERSION}.so %{buildroot}%{_libdir} ln -s libcronet.%{VERSION}.so %{buildroot}%{_libdir}/libcronet.so cat > %{buildroot}%{_libdir}/pkgconfig/cronet.pc <<- "EOF" prefix=%{_prefix} exec_prefix=%{_prefix} libdir=%{_libdir} includedir=%{_includedir} Name: cronet Description: Networking stack of Chromium as a library Version: %{VERSION} Libs: -L${libdir} -lcronet EOF %files %license out/Release/cronet/LICENSE %doc out/Release/cronet/{VERSION,AUTHORS} %{_libdir}/libcronet.%{VERSION}.so %files devel %{_libdir}/libcronet.so %{_libdir}/pkgconfig/cronet.pc %{_includedir}/cronet %changelog %autochangelog