summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/prep-librewolf-rpm.conf12
-rwxr-xr-xscripts/prep-librewolf-rpm.sh105
2 files changed, 117 insertions, 0 deletions
diff --git a/scripts/prep-librewolf-rpm.conf b/scripts/prep-librewolf-rpm.conf
new file mode 100644
index 0000000..c4b42e4
--- /dev/null
+++ b/scripts/prep-librewolf-rpm.conf
@@ -0,0 +1,12 @@
+# Config file for prep-librewolf-rpm.sh
+# Configure these settings before running that script.
+
+# Available options for DISTRO: fedora
+DISTRO=${DISTRO:-'fedora'}
+# current version of Firefox package in target distro
+distro_firefox_release=${distro_firefox_release:-'6'}
+# current version of Firefox, as defined by name of the orig tarball.
+firefox_version=${firefox_version:-'88.0'}
+settings_commit=${settings_commit:-'master'}
+CI_PROJECT_DIR=${CI_PROJECT_DIR:-$(realpath $(dirname $0)/../)}
+output_dir=${CI_PROJECT_DIR}/out
diff --git a/scripts/prep-librewolf-rpm.sh b/scripts/prep-librewolf-rpm.sh
new file mode 100755
index 0000000..6708b1f
--- /dev/null
+++ b/scripts/prep-librewolf-rpm.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+# File: prep-librewolf-rpm.sh
+# Goal: modify the src.rpm git repo of firefox into src.rpm git repo for LibreWolf
+# Startdate: 2021-04-28
+# Dependencies:
+# req-fedora: rpmdevtools
+
+set -e;
+
+#####################################
+# Load settings
+# basically, dot-source the conf file.
+test -z "${librewolf_rpm_conf}" && export librewolf_rpm_conf="$( find "$( dirname "${0}" )" -maxdepth 2 -name "$( basename "${0%%.sh}.conf" )" -print 2>/dev/null | head -n1 )"
+test ! -r "${librewolf_rpm_conf}" && { echo "Unable to load config file, which should be named the same as this script but with a .conf ending. Aborted." 1>&2 ; exit 1 ; }
+. "${librewolf_rpm_conf}"
+
+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
+ fedora)
+ _mozconfig='firefox-mozconfig'
+ src_rpm_git_url="https://src.fedoraproject.org/rpms/firefox/"
+ src_rpm_git_commit="main"
+ ;;
+ *)
+ echo "Unconfigured DISTRO ${DISTRO}. Where in repo is mozconfig, and what is git url?" 1>&2
+ exit 1
+ ;;
+esac
+
+# user configurable
+git_source_dir=${CI_PROJECT_DIR}/git # where LibreWolf git contents are cached
+src_rpm_dir=${CI_PROJECT_DIR}/${firefox_version}/git # where the src git repo is downloaded
+work_dir=${CI_PROJECT_DIR}/prepared/
+
+#############################3
+# Download initial components
+mkdir -p "${work_dir}" ; cd "${work_dir}"
+if test -z "${SKIP_DOWNLOAD}" ; then
+ mkdir -p "${src_rpm_dir}" ; cd "${src_rpm_dir}"
+ git clone "${src_rpm_git_url}" . || :
+ test -n "${src_rpm_git_commit}" && {
+ git checkout "${src_rpm_git_commit}"
+ }
+ # Download original firefox source
+ spectool -g firefox.spec --source 0
+else : ; fi
+
+# Download git sources
+if test -z "${SKIP_GIT}" ; then (
+ # yes, use sub-shell for cd. pushd is a bashism.
+ mkdir -p "${git_source_dir}" ; cd "${git_source_dir}"
+ git clone "${librewolf_common_url}" ${git_source_dir}/common
+ git clone "${librewolf_settings_url}" ${git_source_dir}/settings
+ git clone "${librewolf_linux_url}" ${git_source_dir}/linux
+) ; else : ; fi
+
+
+#############################3
+# Script 1 tasks
+# Modify dependencies, and also lw-ize firefox fedora sources
+cd "${src_rpm_dir}"
+# FIXME: add -i, remove redirect
+sed -r firefox.spec \
+ -e '/^%global mozapp/{s:\/firefox:librewolf:;}' \
+ -e '/^Name:/{s:firefox:librewolf:;}' \
+ -e '/^%package (x11|wayland)/,/^\s*$/{s/firefox/librewolf/g;s/Firefox/LibreWolf/g;}' \
+ -e '/^BuildRequires.*zip$/aBuildRequires: jack-audio-connection-kit-devel' \
+ > firefox.spec2
+# FIXME: probably need a lot more librewolf-ization, like disabling crashreporter, etc.
+
+#####################################
+# Script 2 tasks
+
+# none. Download happened earlier
+
+#####################################
+# Script 3 tasks
+
+# Make new source tarball of branding elements
+cd "${git_source_dir}"/common/source_files/browser/branding ; tar -zcf "${src_rpm_dir}"/librewolf-branding.tgz librewolf
+
+# add new source tarball for the common.git/source_files/browser/branding/librewolf,a nd other script3 tasks
+# just change any logic for enable tests to disable them
+cd "${src_rpm_dir}"
+# FIXME: final changes should happen to firefox.spec
+sed -r firefox.spec2 \
+ -e '/__rm.*\.mozconfig/iSOURCE100: librewolf-branding.tgz\' -e '( cd browser/branding ; tar -zxf ${SOURCE100} . )' \
+ -e 's/--enable-tests\>/--disable-tests/g;' \
+ -e 's/--enable-debug\>/--disable-debug/g;' \
+ -e '/^MOZ_SMP_FLAGS/iecho "ac_add_options --enable-hardening" >> .mozconfig\'
+ -e 'echo "ac_add_options --enable-rust-simd" >> .mozconfig\'
+ -e 'echo "ac_add_options --with-app-name=librewolf" >> .mozconfig\'
+ -e 'echo "ac_add_options --with-app-basename=LibreWolf" >> .mozconfig\'
+ -e 'echo "ac_add_options --with-branding=browser/branding/librewolf" >> .mozconfig\'
+ -e 'echo "ac_add_options --with-branding=browser/branding/librewolf" >> .mozconfig\'
+ -e 'echo "ac_add_options --with-distribution-id=io.gitlab.librewolf-community" >> .mozconfig\'
+ -e 'echo "ac_add_options --with-unsigned-addon-scopes=app,system" >> .mozconfig\'
+ > firefox.spec3
+
+# script 3 notes: fedora firefox already includes some important options:
+# enable-release
+# allow-addon-sideload
bgstack15