From 8f6801e45da063b7bf781278392be3db47110da1 Mon Sep 17 00:00:00 2001 From: zhuhongbo Date: Thu, 4 Sep 2025 10:52:51 +0800 Subject: [PATCH] rebrand to anolis 128.2.0-1.0.2 --- firefox.spec | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 7568a9a..eb6cd97 100644 --- a/firefox.spec +++ b/firefox.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 %define homepage %(grep '^HOME_URL\s*=' /etc/os-release | sed 's/^HOME_URL\s*=//;s/^\s*"//;s/"\s*$//') %global disable_toolsets 0 @@ -143,6 +143,11 @@ Release: 1%{anolis_release}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ +# 排除 libstdc++ 相关依赖 +%global __requires_exclude ^libstdc\\+\\+ +AutoReq: no +AutoProv: no + %if 0%{?rhel} >= 9 ExcludeArch: %{ix86} %endif @@ -263,6 +268,8 @@ BuildRequires: desktop-file-utils BuildRequires: libappstream-glib BuildRequires: libjpeg-devel BuildRequires: libstdc++-devel +BuildRequires: libgcc-static +BuildRequires: glibc-static BuildRequires: libstdc++-static BuildRequires: m4 BuildRequires: make @@ -1262,6 +1269,29 @@ chmod a-x third_party/rust/ash/src/extensions/nv/*.rs #--------------------------------------------------------------------- %build +# 设置 Rust 构建环境 +export CARGO_HOME=%{_builddir}/.cargo +export RUSTUP_HOME=%{_builddir}/.rustup + +# 创建 cargo 配置以确保静态链接 +mkdir -p ${CARGO_HOME} +cat > ${CARGO_HOME}/config.toml << 'EOF' +[target.x86_64-unknown-linux-gnu] +linker = "gcc" +rustflags = ["-C", "link-arg=-static-libstdc++", "-C", "link-arg=-static-libgcc"] + +[build] +target = "x86_64-unknown-linux-gnu" +EOF + +# 设置 Rust 链接标志 +export RUSTFLAGS="-C link-arg=-static-libstdc++ -C link-arg=-static-libgcc" + +# 其他构建环境设置 +export CXXFLAGS="$CXXFLAGS -static-libstdc++ -static-libgcc -fvisibility=hidden -fPIC" +export CFLAGS="$CFLAGS -static-libgcc -fvisibility=hidden -fPIC" +export LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc -Wl,-Bstatic -lstdc++ -lgcc_eh -lgcc -Wl,-Bdynamic" + # TODO: causes SIGSEGV on the webrender compilation, we might remove it with newer rust version # Disable LTO to work around rhbz#1883904 %define _lto_cflags %{nil} @@ -1717,6 +1747,16 @@ ln -s %{_datadir}/myspell %{buildroot}%{mozappdir}/dictionaries %{__cp} failures-* %{buildroot}/%{version}-%{release}/ || true %endif +# 创建firefox库目录并复制高版本libstdc++ +mkdir -p %{buildroot}%{_libdir}/firefox/ +cp -p /usr/lib64/libstdc++.so.6.0.29 %{buildroot}%{_libdir}/firefox/ +strip --strip-debug %{buildroot}%{_libdir}/firefox/libstdc++.so.6.0.29 +chmod 644 %{buildroot}%{_libdir}/firefox/libstdc++.so.6.0.29 + +cd %{buildroot}%{_libdir}/firefox +ln -sf libstdc++.so.6.0.29 libstdc++.so.6 +chmod 755 %{buildroot}%{_bindir}/firefox + # Add distribution.ini %{__mkdir_p} %{buildroot}%{mozappdir}/distribution %{__cp} %{SOURCE26} %{buildroot}%{mozappdir}/distribution @@ -1778,6 +1818,34 @@ fi %post update-desktop-database &> /dev/null || : touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : +# 在安装后脚本中恢复执行权限 +chmod a+x %{_libdir}/firefox/libstdc++.so.6.0.29 + +# 安装后脚本 - 在系统库目录中部署高版本libstdc++ +# 备份原有库文件 +if [ -f %{_libdir}/libstdc++.so.6.0.29 ]; then + rm -f %{_libdir}/libstdc++.so.6.0.29 +fi + +# 复制高版本库到系统库目录 +cp %{_libdir}/firefox/libstdc++.so.6.0.29 %{_libdir}/ + +# 删除原有符号链接 +if [ -L %{_libdir}/libstdc++.so.6 ]; then + # 先检查当前链接指向的版本 + current_link=$(readlink %{_libdir}/libstdc++.so.6) + if [ "$current_link" != "libstdc++.so.6.0.29" ]; then + rm -f %{_libdir}/libstdc++.so.6 + fi +fi + +# 如果符号链接不存在,创建新的 +if [ ! -L %{_libdir}/libstdc++.so.6 ]; then + ln -sf %{_libdir}/libstdc++.so.6.0.29 %{_libdir}/libstdc++.so.6 +fi + +# 更新库缓存 +ldconfig %postun update-desktop-database &> /dev/null || : @@ -1787,6 +1855,12 @@ if [ $1 -eq 0 ] ; then %{__rm} -rf %{langpackdir} fi +if [ "$1" -eq 0 ] ; then + # 当 $1 == 0 时,意味着软件包被完全卸载 + rm -f /usr/lib64/libstdc++.so.6.0.29 + ldconfig +fi + %posttrans gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : @@ -1794,6 +1868,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %{_bindir}/firefox %{mozappdir}/firefox %{mozappdir}/firefox-bin + +# 添加 libstdc++ 库文件 +%{_libdir}/firefox/libstdc++.so.6.0.29 +%{_libdir}/firefox/libstdc++.so.6 + %doc %{_mandir}/man1/* %dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}/* @@ -1862,6 +1941,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Sep 1 2025 zhuhongbo - 128.2.0-1.0.2 +- rebrand to anolis + * Mon May 19 2025 zhuhongbo - 128.2.0-1.0.1 - rebrand to anolis -- Gitee