Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change waterfox locale to PT-BR #3641

Open
1 task
PiuShige opened this issue Dec 2, 2024 · 0 comments
Open
1 task

Can't change waterfox locale to PT-BR #3641

PiuShige opened this issue Dec 2, 2024 · 0 comments
Labels

Comments

@PiuShige
Copy link

PiuShige commented Dec 2, 2024

What happened?

I compiled directly from the source code, in its latest version, however, I can't change the interface locale to PT-BR.
When I download the pre-compiled version, I can change it normally.
There must be something I'm missing during compilation.
Any clues?
I use Arch Linux, and the PKGBUILD I used is this:

Reproducible?

  • I have checked that this issue cannot be reproduced on Mozilla Firefox.

Version

Other

What platform are you seeing the problem on?

Linux

Relevant log output

# Three-stage profile-guided optimization
: ${_build_pgo:=false}

# Profile with xvfb-run, if possible
: ${_build_pgo_xvfb:=false}

_pkgver=6.5.1
_pkgrel=1

pkgname=waterfox-2024
_pkgname=Waterfox
pkgver=${_pkgver%-*}
pkgrel=1
epoch=1
pkgdesc='Fork of Mozilla Firefox featuring some privacy, usability, and speed enhancements.'
arch=(x86_64)
license=('MPL-2.0')
url='https://www.waterfox.net/'
depends=(
	gtk3
	libxt
	mime-types
	dbus-glib
	nss
	ttf-font
)
makedepends=(
	cbindgen
	clang17
	diffutils
	dump_syms
	imake
	jack
	lld
	llvm17
	mercurial
	mesa
	nasm
	nodejs
	python
	unzip
	wasi-compiler-rt
	wasi-libc
	wasi-libc++
	wasi-libc++abi
	xorg-server-xvfb
	yasm
	zip
)

optdepends=(
	'libnotify: Notification integration'
	'networkmanager: Location detection via available WiFi networks'
	'pulseaudio: Audio support'
	'speech-dispatcher: Text-to-Speech'
	'xdg-desktop-portal: Screensharing with Wayland'
)

options=(!debug
  !emptydirs
  !lto
  !makeflags
  !strip)
backup=("usr/lib/waterfox-2024/waterfox.cfg"
  "usr/lib/waterfox-2024/distribution/policies.json")
source=(
#	"waterfox-$pkgver.tar.gz::https://github.com/WaterfoxCo/Waterfox/archive/refs/tags/$pkgver.tar.gz"
"Waterfox-current.zip::https://github.com/BrowserWorks/Waterfox/archive/refs/heads/current.zip"
	"waterfox.desktop"
	"rustup.sh"
	"patch.patch"
)
sha256sums=('SKIP'
            'SKIP'
			'SKIP'
			'SKIP')

# Select the method of profiling
if [[ "${_build_pgo::1}" == "t" ]]; then
  if [[ "${_build_pgo_xvfb::1}" == "t" ]]; then
    makedepends+=(xorg-server-xvfb)
  else
    makedepends+=(weston xwayland-run)
  fi
fi

prepare() {
  rm -rf "${srcdir}/mozbuild"
  mkdir "${srcdir}/mozbuild"

  # Install rust 1.82 in $srcdir and preprend to path
  export RUSTUP_HOME="${srcdir}/rustup"
  export CARGO_HOME="${srcdir}/cargo"
  export RUSTUP_INIT_SKIP_PATH_CHECK=yes
  sh "${srcdir}/rustup.sh" -q -y --no-modify-path --default-toolchain 1.82
  export PATH="${srcdir}/cargo/bin:$PATH"

  	cd Waterfox-current || exit


	
#tar xvf "$srcdir/locales.tar.gz" && cp -Rav "$srcdir/locales" "$srcdir/Waterfox-current/waterfox/browser/locales"
#rm -Rfv "$srcdir/Waterfox-current/waterfox/browser/moz.build" && cp -v "$srcdir/moz.build" "$srcdir/Waterfox-current/waterfox/browser/moz.build"

  export PATH="/usr/lib/llvm17/bin:$PATH"
  export LD_LIBRARY_PATH=/usr/lib/llvm17/lib
export LDFLAGS="-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic -fno-exceptions"

#	patch -Np1 	-i ../patch.patch
  cat > ../mozconfig << END
#export LDFLAGS="-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic -fno-exceptions"

# Build options
ac_add_options --disable-bootstrap
ac_add_options --disable-elf-hack
ac_add_options --enable-default-toolkit=cairo-gtk3
ac_add_options --enable-hardening
#ac_add_options --enable-linker=mold
#ac_add_options --enable-linker=ldd
ac_add_options --enable-release
ac_add_options --disable-rust-simd
ac_add_options --disable-wasm-simd
ac_add_options --prefix=/usr
#ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
# FIXME: Build/use wasi sysroot instead of disabling wasm libs sandbox
ac_add_options --without-wasm-sandboxed-libraries
#ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot

export MOZ_INCLUDE_SOURCE_INFO=1
#export LDFLAGS="-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic -fno-exceptions"

# Branding
ac_add_options --allow-addon-sideload
ac_add_options --enable-unverified-updates
ac_add_options --with-app-name=waterfox
ac_add_options --with-app-basename=Waterfox
ac_add_options --with-branding=waterfox/browser/branding

ac_add_options --enable-optimize="-O3 -msse2 -mfpmath=sse -march=native -mtune=native -fcolor-diagnostics -w -fno-exceptions"

ac_add_options --with-distribution-id=org.archlinux
ac_add_options --with-unsigned-addon-scopes=app,system
ac_add_options --allow-addon-sideload
ac_add_options --enable-application=browser
mk_add_options MOZ_OBJDIR=${PWD@Q}/obj

export MOZILLA_OFFICIAL=1
export MOZ_APP_REMOTINGNAME=waterfox
export MOZ_CRASHREPORTER=
export MOZ_DATA_REPORTING=
export MOZ_REQUIRE_SIGNING=
export MOZ_SERVICES_HEALTHREPORT=
export MOZ_TELEMETRY_REPORTING=

# System libraries
ac_add_options --with-system-jpeg
ac_add_options --with-system-libevent
ac_add_options --with-system-libvpx
ac_add_options --without-system-nspr
ac_add_options --without-system-nss
ac_add_options --with-system-webp
ac_add_options --with-system-zlib
ac_add_options --without-system-icu

# Features
ac_add_options --disable-crashreporter # (Minimize telemetry)
ac_add_options --disable-debug
ac_add_options --disable-debug-js-modules
ac_add_options --disable-debug-symbols
ac_add_options --disable-default-browser-agent
ac_add_options --disable-gpsd
ac_add_options --disable-necko-wifi
ac_add_options --disable-parental-controls # (Disable local/OS MTIM)
ac_add_options --disable-rust-tests
ac_add_options --disable-synth-speechd
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --disable-warnings-as-errors
ac_add_options --disable-webspeech
ac_add_options --disable-webspeechtestbackend
ac_add_options --enable-alsa
ac_add_options --enable-av1
ac_add_options --enable-eme=widevine
ac_add_options --enable-jack
ac_add_options --enable-jxl
ac_add_options --enable-proxy-bypass-protection
ac_add_options --enable-pulseaudio
ac_add_options --enable-raw
ac_add_options --disable-sandbox
ac_add_options --enable-strip
ac_add_options --disable-accessibility
ac_add_options --disable-profiling
ac_add_options --disable-geckodriver


# Optimization
ac_add_options --enable-optimize=-O3
ac_add_options --disable-lto
#ac_add_options --enable-rust-debug

# Other
#export AR=llvm-ar-17
#export CC=clang-17
#export CXX=clang++-17
#export NM=llvm-nm-17
#export RANLIB=llvm-ranlib-17
END
}

build() {
	cd Waterfox-current

  export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
  export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip
  export MOZ_ENABLE_FULL_SYMBOLS=0
  export MOZ_NOSPAM=1
  export MOZ_PROFILER_STARTUP=1 # Starts the profiler is started as early as possible during startup.
#  export LDFLAGS="-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic -fno-exceptions"

  # Fix DRI/zink issues during compilation
  export LIBGL_ALWAYS_SOFTWARE=true

  # Malloc_usable_size is used in various parts of the codebase
  CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
  CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"

	# prevents references to $srcdir being included in error messages
	# some references still remain in libxul.so and omni.ja
	CFLAGS+=" -ffile-prefix-map=$srcdir=."
	CXXFLAGS+=" -ffile-prefix-map=$srcdir=."

	# suppress warnings
	CFLAGS+=" -w -fno-exceptions"
	CXXFLAGS+=" -w -fno-exceptions"

  # LTO needs more open files
 # ulimit -n 4096

  # Do 3-tier PGO
  if [[ "${_build_pgo::1}" == "t" ]]; then
    local _old_profdata="${SRCDEST:-$startdir}/merged.profdata"
    local _old_jarlog="${SRCDEST:-$startdir}/jarlog"

    # Restore old profile
    if [[ "${_build_pgo_reuse::1}" == "t" ]]; then
      if [[ -s "$_old_profdata" ]]; then
        echo "Restoring old profile data."
        cp --reflink=auto -f "$_old_profdata" merged.profdata
      fi

      if [[ -s "$_old_jarlog" ]]; then
        echo "Restoring old jar log."
        cp --reflink=auto -f "$_old_jarlog" jarlog
      fi
    fi

    # Make new profile
    if [[ "${_build_pgo_reuse::1}" != "t" ]] || [[ ! -s merged.profdata ]]; then
      echo "Building instrumented browser..."
      cat > .mozconfig ../mozconfig
	  echo >> .mozconfig "ac_add_options --disable-profile-generate"
      ./mach build

      echo "Profiling instrumented browser..."
      ./mach package

      if [[ "${_build_pgo_xvfb::1}" == "t" ]]; then
        local _headless_run=(
          xvfb-run
          -s "-screen 0 1920x1080x24 -nolisten local"
        )
      else
        local _headless_run=(
          wlheadless-run
          -c weston --width=1920 --height=1080
        )
      fi

      LLVM_PROFDATA=llvm-profdata JARLOG_FILE=${PWD@Q}/jarlog \
        "${_headless_run[@]}" -- ./mach python build/pgo/profileserver.py

      echo "Removing instrumented browser..."
      ./mach clobber
    fi

    echo "Building optimized browser..."
    cat > .mozconfig ../mozconfig

    if [[ -s merged.profdata ]]; then
      stat -c "Profile data found (%s bytes)" merged.profdata
      echo >> .mozconfig "ac_add_options --disable-profile-use"
      echo >> .mozconfig "ac_add_options --with-pgo-profile-path='${PWD@Q}/merged.profdata'"

      # save profdata for reuse
      cp --reflink=auto -f merged.profdata "$_old_profdata"
    else
      echo "Profile data not found."
    fi

    if [[ -s jarlog ]]; then
      stat -c "Jar log found (%s bytes)" jarlog
      echo >> .mozconfig "ac_add_options --with-pgo-jarlog='${PWD@Q}/jarlog'"

      # save jarlog for reuse
      cp --reflink=auto -f jarlog "$_old_jarlog"
    else
      echo "Jar log not found."
    fi

    ./mach build
  else
    echo "Building browser..."
    cat > .mozconfig ../mozconfig
    ./mach build
  fi

  echo "Building symbol archive..."
  ./mach buildsymbols

}

package() {
  cd Waterfox-current|| exit


DESTDIR="$pkgdir" ./mach install

  local vendorjs="${pkgdir}/usr/lib/waterfox/browser/defaults/preferences/vendor.js"
  install -Dvm644 /dev/stdin "${vendorjs}" << END
// Use LANG environment variable to choose locale
pref("intl.locale.requested", "");

// Use system-provided dictionaries
pref("spellchecker.dictionary_path", "/usr/share/hunspell");

// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);

// Don't disable extensions in the application directory
pref("extensions.autoDisableScopes", 11);

// Enable GNOME Shell search provider
pref("browser.gnome-search-provider.enabled", true);
EOT

	local distini="$pkgdir/usr/lib/waterfox/distribution/distribution.ini"
	install -Dvm644 /dev/stdin "$distini" <<EOT
[Global]
id=archlinux
version=1.0
about=Waterfox for Arch Linux

[Preferences]
app.distributor=archlinux
app.distributor.channel=waterfox
EOT

	local i theme=waterfox
	for i in 16 22 24 32 48 64 128 256; do
		install -Dvm644 browser/branding/$theme/default$i.png \
			"$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/waterfox.png"
	done
	install -Dvm644 browser/branding/$theme/content/about-logo.png \
		"$pkgdir/usr/share/icons/hicolor/192x192/apps/waterfox.png"
	install -Dvm644 browser/branding/$theme/content/[email protected] \
		"$pkgdir/usr/share/icons/hicolor/384x384/apps/waterfox.png"
	install -Dvm644 browser/branding/$theme/content/identity-icons-brand.svg \
		"$pkgdir/usr/share/icons/hicolor/symbolic/apps/waterfox-symbolic.svg"

	install -Dvm644 ../waterfox.desktop \
		"$pkgdir/usr/share/applications/waterfox.desktop"

	# Install a wrapper to avoid confusion about binary path
	install -Dvm755 /dev/stdin "$pkgdir/usr/bin/waterfox" <<EOT
#!/usr/bin/env sh
exec /usr/lib/waterfox/waterfox "\$@"
END

	# Replace duplicate binary with wrapper
	# https://bugzilla.mozilla.org/show_bug.cgi?id=658850
	ln -srfv "$pkgdir/usr/bin/waterfox" "$pkgdir/usr/lib/waterfox/waterfox-bin"

	# Use system certificates
	local nssckbi="$pkgdir/usr/lib/waterfox/libnssckbi.so"
	if [[ -e $nssckbi ]]; then
		ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
	fi
}
@PiuShige PiuShige added the bug label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant