From 99d22a21b9b6435411c6bfcdbe5a502ad063f8cf Mon Sep 17 00:00:00 2001 From: ohfp <1813007-ohfp@users.noreply.gitlab.com> Date: Sun, 14 Mar 2021 13:53:56 +0100 Subject: attempt to get things working for ubuntu --- scripts/prep-librewolf-dpkg.sh | 58 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/scripts/prep-librewolf-dpkg.sh b/scripts/prep-librewolf-dpkg.sh index d534203..91972a5 100755 --- a/scripts/prep-librewolf-dpkg.sh +++ b/scripts/prep-librewolf-dpkg.sh @@ -32,6 +32,15 @@ librewolf_common_url=https://gitlab.com/librewolf-community/browser/common.git librewolf_settings_url=https://gitlab.com/librewolf-community/settings.git librewolf_linux_url=https://gitlab.com/librewolf-community/browser/linux.git +case "${DISTRO}" in + ubuntu) + _mozconfig='/config/mozconfig.in' + ;; + *) + _mozconfig='/browser.mozconfig.in' + ;; +esac + # user configurable git_source_dir=${CI_PROJECT_DIR}/git # where LibreWolf git contents are cached debian_dir=${CI_PROJECT_DIR}/${firefox_version}/debian # where the firefox_debian.tar.xz file is extracted @@ -114,8 +123,8 @@ EOF # LibreWolf branding cp -pr "${git_source_dir}"/common/source_files/browser/branding "${source_dir}"/browser/ # update mozconfig with needed info -sed -i -e '/with-app-name=/d' "${debian_dir}"/browser.mozconfig.in -cat <> "${debian_dir}"/browser.mozconfig.in +sed -i -e '/with-app-name=/d' "${debian_dir}${_mozconfig}" +cat <> "${debian_dir}${_mozconfig}" # Start of LibreWolf effects ac_add_options --disable-tests @@ -165,10 +174,19 @@ sed -i 's/rustc (>= 1.47),/rustc (>= 1.41),/g' "${debian_dir}"/control.in # add patches to debian/patches mkdir -p "${debian_dir}"/patches/librewolf -cp -pr "${git_source_dir}"/linux/megabar.patch "${git_source_dir}"/linux/remove_addons.patch \ - "${git_source_dir}"/linux/deb_patches/*.patch \ + +if [[ DISTRO == 'ubuntu' ]]; then + cp -pr "${git_source_dir}"/linux/megabar.patch "${git_source_dir}"/linux/remove_addons.patch \ "${debian_dir}"/patches/librewolf/ -cat <> "${debian_dir}"/patches/series + cat <> "${debian_dir}"/patches/series +librewolf/remove_addons.patch -p1 +librewolf/megabar.patch -p1 +EOF +else + cp -pr "${git_source_dir}"/linux/megabar.patch "${git_source_dir}"/linux/remove_addons.patch \ + "${git_source_dir}"/linux/deb_patches/*.patch \ + "${debian_dir}"/patches/librewolf/ + cat <> "${debian_dir}"/patches/series librewolf/lower-python3-requirement.patch -p1 librewolf/armhf-reduce-linker-memory-use.patch -p1 #librewolf/build-with-libstdc++-7.patch -p1 @@ -183,6 +201,8 @@ librewolf/remove_addons.patch -p1 librewolf/megabar.patch -p1 librewolf/reduce-rust-debuginfo.patch -p1 EOF +fi + # observe that build-with-libstdc++-7 is disabled for this dpkg. Debian builds Firefox with gcc, not clang. # fix some fuzz in remove_addons.patch. The space is important! sed -i -r -e 's/libs /l10n /;' "${debian_dir}"/patches/librewolf/remove_addons.patch @@ -212,6 +232,8 @@ sed -z "$_cert_sed" -i "${source_dir}"/toolkit/mozapps/extensions/internal/XPIIn ##################################### # Script 4 tasks +if [[ DISTRO == 'debian' ]]; then + sed -i -r -e '2{ iexport DEB_BUILD_HARDENING=1 ;iexport DEB_BUILD_HARDENING_STACKPROTECTOR=1 @@ -232,24 +254,48 @@ sed -i -r -e '2{ } ' "${debian_dir}"/rules +fi + ##################################### # Additional steps for dpkg implementation # fix the binary name that gets installed in /usr/bin, and disable crash reporter by changing what variable name it looks for that will enable it + +if [[ DISTRO == 'debian' ]]; then + sed -i -e '/%if browser/,+2s/firefox/librewolf/' \ -e '/%if CRASH_REPORTER/s/CRASH_REPORTER/CRASH_REPORTER_ENABLED/' \ "${debian_dir}"/browser.install.in +elif [[ DISTRO == 'ubuntu' ]]; then + # let's hope this is enough + export MOZ_ENABLE_BREAKPAD=0 + export MOZ_APP_NAME=librewolf +fi + # instruct dpkg to include the librewolf settings rm -rf "${debian_dir}"/librewolf_settings cp -pr "${git_source_dir}"/settings "${debian_dir}"/librewolf_settings rm -rf "${debian_dir}"/librewolf_settings/.git* -cat <> "${debian_dir}"/browser.install.in + +if [[ DISTRO == 'debian' ]]; then + + cat <> "${debian_dir}"/browser.install.in debian/librewolf_settings/librewolf.cfg usr/lib/@browser@ debian/librewolf_settings/defaults usr/share/@browser@ debian/librewolf_settings/distribution usr/share/@browser@ EOF +else + + cat <> "${debian_dir}"/firefox.install.in +debian/librewolf_settings/librewolf.cfg @MOZ_LIBDIR@/ +debian/librewolf_settings/defaults @MOZ_LIBDIR@/ +debian/librewolf_settings/distribution @MOZ_LIBDIR@/ +EOF + +fi + # add changelog contents for LibreWolf new_changelog="$( mktemp )" { -- cgit