librewolf/librewolf.spec

262 lines
7.1 KiB
RPMSpec
Raw Normal View History

%global optflags %{optflags} -g1
2023-08-19 07:47:56 +00:00
%global real_version 116.0.3-1
%global rpm_version %(echo %{real_version} | sed -e "s/-/_/")
#========= switches of system libraries ==========
#=================================================
##
# in the 202110 platform,
# the nss version is lower
####
%if %{mdvver} < 202310
%bcond_with nss
%else
2023-08-19 07:47:56 +00:00
%bcond_without nss
%endif
2023-08-19 07:47:56 +00:00
%bcond_without nspr
%bcond_with icu
%bcond_without libevent
%bcond_without libvpx
%bcond_without webp
%bcond_without zlib
#=================================================
##
# switches with alternative python 3 and llvm
####
2023-08-19 07:47:56 +00:00
%bcond_with py3_alt
%bcond_without clang_alt
#=================================================
%bcond_with verbose
%bcond_without debug
#=================================================
%global llvm_alt_ver 17
2023-08-19 07:47:56 +00:00
%global llvm_alt_path /opt/llvm%{llvm_alt_ver}
#=================================================
%global wolfdir %{_libdir}/%{name}
%global _privatelibs mozsqlite3.*|mozgtk.*|ipcclientcerts.*|xul.*
%global _privatelibs %{_privatelibs}|softokn3.*|mozsandbox.*|nss3.*
%global _privatelibs %{_privatelibs}|mozavutil.*|smime3.*|mozwayland.*
%global _privatelibs %{_privatelibs}|plds4.*|nssutil3.*|ssl3.*
%global _privatelibs %{_privatelibs}|clearkey.*|nspr4.*|lgpllibs.*
%global _privatelibs %{_privatelibs}|mozavcodec.*|nssckbi.*|freeblpriv3.*
%global _privatelibs %{_privatelibs}|plc4.*
%global __provides_exclude ^lib(%{_privatelibs}).so.++$
%global __requires_exclude ^lib(%{_privatelibs}).so.++$
%global __provides_exclude_from ^(%{_libdir}/%{name}/.*\\.so.*)$
2023-08-19 07:47:56 +00:00
Summary: A custom version of Firefox, focused on privacy, security and freedom
Name: librewolf
Version: %{rpm_version}
Release: 1
License: MPL 2.0 and GNU AGPL 3.0
Group: Networking/WWW
Url: https://gitlab.com/librewolf-community/browser/source
# generate source %%{SOURCE1}
Source0: %{name}-%{real_version}.source.tar.gz
Source1: %{name}_get_source
Source2: cbindgen-vendor.tar.xz
Source3: %{name}.desktop
Source4: %{name}.rpmlintrc
2023-08-19 07:47:56 +00:00
BuildRequires: atomic-devel
%if %{without clang_alt}
BuildRequires: clang-devel
%else
BuildRequires: llvm%{llvm_alt_ver}
%endif
BuildRequires: cargo
BuildRequires: nss-static-devel
BuildRequires: nodejs
%if %{with py3_alt}
BuildRequires: pkgconfig(python-3.10)
%else
BuildRequires: pkgconfig(python3)
%endif
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtk+-unix-print-3.0)
%if %{with libevent}
BuildRequires: pkgconfig(libevent)
%endif
2023-08-19 07:47:56 +00:00
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(pango)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xcomposite)
BuildRequires: pkgconfig(xcursor)
BuildRequires: pkgconfig(xdamage)
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(xtst)
BuildRequires: rust rustfmt
%if %{with libvpx}
BuildRequires: pkgconfig(vpx) >= 1.10.0
%endif
%if %{with webp}
BuildRequires: pkgconfig(libwebp) >= 1.0.2
%endif
2023-08-19 07:47:56 +00:00
%description
This project is a custom and independent version of Firefox,
with the primary goals of privacy, security and user freedom.
LibreWolf is designed to increase protection against tracking
and fingerprinting techniques, while also including
a few security improvements.
his is achieved through our privacy and security oriented
settings and patches. LibreWolf also aims to remove all the telemetry,
data collection and annoyances,as well as disabling
anti-freedom features like DRM.
%files
%license LICENSE
%doc README.txt
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_iconsdir}/hicolor/*/apps/%{name}.png
%dir %{wolfdir}
%{wolfdir}/*
2023-08-19 07:47:56 +00:00
#------------------------------------------------------------------
%prep
%autosetup -p1 -n %{name}-%{real_version}
echo "#===========================================" >> mozconfig
echo "# options build rosa linux" >> mozconfig
echo "#===========================================" >> mozconfig
echo "export MOZCONFIG="`pwd`"/mozconfig" >> mozconfig
echo "mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-%{name}" >> mozconfig
echo "ac_add_options --host=%{_host}" >> mozconfig
echo "ac_add_options --prefix=%{_prefix}" >> mozconfig
echo "ac_add_options --libdir=%{_libdir}" >> mozconfig
2023-08-19 07:47:56 +00:00
echo "mk_add_options MOZ_PARALLEL_BUILD=%{_smp_build_ncpus}" >> mozconfig
echo "ac_add_options --enable-default-toolkit=cairo-gtk3-x11-wayland" >> mozconfig
2023-08-19 07:47:56 +00:00
%if %{with nss}
echo "ac_add_options --with-system-nss" >> mozconfig
%else
echo "ac_add_options --without-system-nss" >> mozconfig
%endif
%if %{with nspr}
echo "ac_add_options --with-system-nspr" >> mozconfig
%else
echo "ac_add_options --without-system-nspr" >> mozconfig
%endif
%if %{with icu}
echo "ac_add_options --with-system-icu" >> mozconfig
%else
echo "ac_add_options --without-system-icu" >> mozconfig
%endif
%if %{with libevent}
echo "ac_add_options --with-system-libevent" >> mozconfig
%else
echo "ac_add_options --without-system-libevent" >> mozconfig
%endif
%if %{with libvpx}
echo "ac_add_options --with-system-libvpx" >> mozconfig
%else
echo "ac_add_options --without-system-libvpx" >> mozconfig
%endif
%if %{with webp}
echo "ac_add_options --with-system-webp" >> mozconfig
%else
echo "ac_add_options --without-system-webp" >> mozconfig
%endif
2023-08-19 07:47:56 +00:00
%if %{with zlib}
echo "ac_add_options --with-system-zlib" >> mozconfig
%else
echo "ac_add_options --without-system-zlib" >> mozconfig
2023-08-19 07:47:56 +00:00
%endif
echo "ac_add_options --without-sysroot" >> mozconfig
2023-08-19 07:47:56 +00:00
echo "ac_add_options --without-wasm-sandboxed-libraries" >> mozconfig
%{__sed} -i -e "s|enable-bootstrap|disable-bootstrap|" mozconfig
%if %{with debug}
%{__sed} -i -e "s|disable-debug|enable-debug|" mozconfig
%endif
2023-08-19 07:47:56 +00:00
%build
%setup_compile_flags
2023-08-19 07:47:56 +00:00
%if %{with clang_alt}
export PATH="%{llvm_alt_path}/bin:$PATH"
export CC="%{llvm_alt_path}/bin/clang"
export CXX="%{llvm_alt_path}/bin/clang++"
export AR="%{llvm_alt_path}/bin/llvm-ar"
export NM="%{llvm_alt_path}/bin/llvm-nm"
export RANLIB="%{llvm_alt_path}/bin/llvm-ranlib"
%endif
export LDFLAGS="%{ldflags} -Wl,--no-keep-memory"
%{__mkdir_p} my_rust_vendor
cd my_rust_vendor
%{__tar} xf %{SOURCE2}
mkdir -p .cargo
cat > .cargo/config <<EOL
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "`pwd`"
EOL
env CARGO_HOME=.cargo cargo install cbindgen
export PATH="`pwd`"/.cargo/bin:$PATH
cd -
MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none" \
./mach build %{?with_verbose:--verbose}
MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none" ./mach package
2023-08-19 07:47:56 +00:00
%install
MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none" \
DESTDIR=%{buildroot} \
./mach install
%{__rm} -rvf %{buildroot}%{_bindir}/%{name}
cat > %{buildroot}%{_bindir}/%{name} << FOE
#! /bin/sh
exec %{wolfdir}/%{name} "\$@"
FOE
%{__chmod} +x %{buildroot}%{_bindir}/%{name}
%{__mkdir_p} %{buildroot}%{_datadir}/applications
%{__install} -Dm 0644 %{SOURCE3} \
%{buildroot}%{_datadir}/applications
%{__sed} -i -e "s|@LIBDIR@|%{wolfdir}|g" \
%{buildroot}%{_datadir}/applications/%{name}.desktop
for size in 16 32 48 64 128 ;do
%{__mkdir_p} %{buildroot}%{_iconsdir}/hicolor/${size}x${size}/apps
ln -sfv %{wolfdir}/browser/chrome/icons/default/default${size}.png \
%{buildroot}%{_iconsdir}/hicolor/${size}x${size}/apps/%{name}.png
done
2023-08-19 07:47:56 +00:00