[Bug 261642] www/firefox: update to 97 (phase: Beta, ETA: 2022-02-08)

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 01 Feb 2022 01:01:03 UTC

Evgeniy Khramtsov <evgeniy@khramtsov.org> changed:

           What    |Removed                     |Added
                 CC|                            |evgeniy@khramtsov.org

--- Comment #1 from Evgeniy Khramtsov <evgeniy@khramtsov.org> ---
Created attachment 231479
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231479&action=edit

# v1.0.patch and depot.patch are in /usr/ports
# ppc64 related parts are commented out because chroot doesn't work

cd /usr/ports && git am v1.0.patch
rm /usr/ports/www/firefox/files/patch-libwebrtc-generated
cd www/firefox
export WRKDIR=/tmp/fox/src
make patch
(cd "$WRKDIR/firefox-97.0" ; git init && git add . && git commit -m init)
cp ../../depot.patch $WRKDIR/firefox-97.0

pkg install qemu-user-static
service qemu_user_static onestart
poudriere jail -c -j clean-aarch64 -v 13.0-RELEASE -a arm64.aarch64 -X
#poudriere jail -c -j clean-powerpc64 -v 13.0-STABLE -a powerpc.powerpc64 -X
poudriere jail -c -j clean -v 13.0-RELEASE

export ARMJAIL=/usr/local/poudriere/jails/clean-aarch64
#export PPCJAIL=/usr/local/poudriere/jails/clean-powerpc64
export CLNJAIL=/usr/local/poudriere/jails/clean

mkdir $ARMJAIL/tmp/fox
#mkdir $PPCJAIL/tmp/fox
mkdir $CLNJAIL/tmp/fox
mkdir $ARMJAIL/usr/ports
#mkdir $PPCJAIL/usr/ports
mkdir $CLNJAIL/usr/ports
mount_nullfs /tmp/fox $CLNJAIL/tmp/fox
mount_nullfs /usr/ports $CLNJAIL/usr/ports

cp /etc/resolv.conf $ARMJAIL/etc/resolv.conf
#cp /etc/resolv.conf $PPCJAIL/etc/resolv.conf
cp /etc/resolv.conf $CLNJAIL/etc/resolv.conf
mount -t devfs devfs $ARMJAIL/dev
#mount -t devfs devfs $PPCJAIL/dev
mount -t devfs devfs $CLNJAIL/dev

mkdir $CLNJAIL/arm
mkdir $CLNJAIL/ppc
mount_nullfs $ARMJAIL $CLNJAIL/arm
mount_nullfs $PPCJAIL $CLNJAIL/ppc

service qemu_user_static onestop
chroot $CLNJAIL
export TERM=xterm PS1="(clean) # "

# Check that chroot works (network, ports and gecko source)
file /bin/echo
/bin/echo test
host example.com
ls -alh /usr/ports
ls -alh /tmp/fox

pkg install -y qemu-user-static
service qemu_user_static onestart
mkdir -p /arm/usr/local/bin
#mkdir -p /ppc/usr/local/bin
cp /usr/local/bin/qemu-aarch64-static /arm/usr/local/bin
#cp /usr/local/bin/qemu-ppc64-static /ppc/usr/local/bin
mount_nullfs /tmp/fox /arm/tmp/fox
#mount_nullfs /tmp/fox /ppc/tmp/fox
mount_nullfs /usr/ports /arm/usr/ports
#mount_nullfs /usr/ports /ppc/usr/ports

# Check that qemu-user-static aarch64 chroot is OK
chroot /arm
file /bin/echo
/bin/echo test
host example.com
ls -alh /usr/ports
ls -alh /tmp/fox

# ppc64 related parts are commented out because of this, no further steps for
#Assertion failed: (!have_mmap_lock()), function cpu_exec, file
line 697.
#Abort trap
#chroot /ppc

# (this is a "goto" mark for steps from aarch64 chroot down below)

pkg install -y pkg
# pkg is interactive, asks first to fetch packages, then to install
# make install-missing-packages will install everything needed and unneeded,
# saves a ton of time installing everything "./mach configure" asks for
(cd /usr/ports/www/firefox ; make install-missing-packages)

# Save the password from pw, one will need it when installing i686 Rust libs
# if in qemu chroot, one may not need doas, but it's a good idea to save it
pkg install -y bash doas
pw user add fox -d /tmp/fox/home -w random -s /usr/local/bin/bash
mkdir /tmp/fox/home

echo 'permit fox as root' > /usr/local/etc/doas.conf
chown -R fox /tmp/fox
chown -R fox /usr/ports/www/firefox

ln -s /usr/local/bin/python3.8 /usr/local/bin/python3
ln -s /usr/local/bin/python3.8 /usr/local/bin/python
ln -s /usr/local/bin/pip-3.8 /usr/local/bin/pip3
ln -s /usr/local/bin/bash /bin/bash

su -l fox
cd ../src/firefox-97.0/

# if in qemu chroot, don't
git clone https://gn.googlesource.com/gn
(cd gn && git checkout 8fe02009)

# Use ninja from ports because the ports one is fine and building in qemu is
export NINJA=/usr/local/bin/ninja
(cd gn ; python build/gen.py && $NINJA -C out)
export GN=`pwd`/gn/out/gn

# if in qemu chroot, don't
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
(cd depot_tools && git checkout e7d1862b155a)
(cd depot_tools && git apply ../depot.patch)

export DEPOT_TOOLS=`pwd`/depot_tools
export CC=/usr/local/bin/clang13 CPP=/usr/local/bin/clang-cpp13

# (will prompt you then download and build tons of stuff in /tmp/fox/home
(Press Enter)
# glean-sdk will fail in qemu but it apparently does not affect generate.sh:
# "Could not install glean-sdk, so telemetry will not be collected.
./mach configure --prefix="/usr/local"

# if in qemu chroot, don't
fetch 'https://pkg.FreeBSD.org/FreeBSD:13:i386/quarterly/All/rust-1.57.0.pkg'
-o rust-i386.pkg
mkdir ../rustlib
tar -C ../rustlib -xf rust-i386.pkg --include='*-unknown-freebsd*'
--strip-components 5
doas cp -a ../rustlib /usr/local/lib
rm -rf ../rustlib

# if in qemu chroot, uncomment the arm64 CONFIG line, and comment out PC CONFIG
# in dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
# "generate-gn-build-files.sh" in qemu is slow, be patient
# If you get the following output, consider success:
# "Done generating gn build files. You should now be able to build with ./mach

git add "./*moz.build*" "dom/media/webrtc/third_party_build/gn-configs/*.json"

# Do below if in (clean) non-qemu environment
# If you don't delete the remaining PC binaries in home,
# then qemu would hang
git commit -m 'PC'
rm -rf /tmp/fox/home/.cache /tmp/fox/home/.cargo /tmp/fox/home/.local \
/tmp/fox/home/.mozbuild gn/out

# Do below if in qemu
# Work is done after outputting to "patch-webrtc-generated"
git commit -m 'ARM'
git diff --no-prefix HEAD~2 HEAD -- ":(exclude)*/$1/*.json" >

# If in (clean) non-qemu environment
# Exit to (clean), mount /dev for qemu chroot
# (Nested nullfs in chroot doesn't work the way it seems to, so
# instead of starting from scratch and redoing the whole how-to,
# just mount devfs to /arm/dev)
mount -t devfs devfs /arm/dev
chroot /arm
export PS1="(aarch64) # "

# Search for "PREPARE" in this how-to and repeat the same from there
# Good luck and be patient


Here is a rustc wrapper script for cross-compiling as noted in bug 261410.
Rust part will pass but then the clang cross-compile test would fail:
/tmp/hello-25a9fd.o is incompatible with /usr/lib/crt1.o
ENOTIME to work on cross-compile.

mv /usr/local/bin/rustc /usr/local/bin/rustc-real
cat >/usr/local/bin/rustc <<'EOF'


for i in "$@"; do
  case $i in
      if [ "$TARGET" = "aarch64-unknown-freebsd" ]; then
        VAR+=("-C link-arg=--sysroot -C link-arg=/tmp/130-aarch64")

env RUSTFLAGS="$VAR" /usr/local/bin/rustc-real "${cmd[@]}"
chmod +x /usr/local/bin/rustc

You are receiving this mail because:
You are the assignee for the bug.