From 0be4c0f88e6271c99854905d5cd46a915c282af1 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Tue, 22 Oct 2024 19:08:42 +0200 Subject: [PATCH] untested floorp package with PGO --- srcpkgs/floorp/files/floorp-wayland | 2 + srcpkgs/floorp/files/floorp.desktop | 273 +++++++++++++++ srcpkgs/floorp/files/stab.h | 71 ++++ srcpkgs/floorp/files/vendor.js | 14 + .../patches/big-endian-image-decoders.patch | 88 +++++ .../floorp/patches/firefox-i686-build.patch | 14 + .../floorp/patches/fix-arm-opus-include.patch | 11 + .../patches/fix-i686-build-moz-1792159.patch | 18 + .../floorp/patches/fix-i686-ppc-musl.patch | 11 + .../patches/fix-image-format-warning.patch | 39 +++ .../floorp/patches/fix-webrtc-glibcisms.patch | 20 ++ srcpkgs/floorp/patches/mallinfo.patch | 34 ++ srcpkgs/floorp/patches/ply-python3.11.patch | 85 +++++ srcpkgs/floorp/patches/ppc32-fix-build.patch | 36 ++ srcpkgs/floorp/patches/rust-configure.patch | 71 ++++ srcpkgs/floorp/patches/rust-lto-thin.patch | 12 + srcpkgs/floorp/patches/sandbox-fork.patch | 15 + srcpkgs/floorp/template | 319 ++++++++++++++++++ 18 files changed, 1133 insertions(+) create mode 100644 srcpkgs/floorp/files/floorp-wayland create mode 100644 srcpkgs/floorp/files/floorp.desktop create mode 100644 srcpkgs/floorp/files/stab.h create mode 100644 srcpkgs/floorp/files/vendor.js create mode 100644 srcpkgs/floorp/patches/big-endian-image-decoders.patch create mode 100644 srcpkgs/floorp/patches/firefox-i686-build.patch create mode 100644 srcpkgs/floorp/patches/fix-arm-opus-include.patch create mode 100644 srcpkgs/floorp/patches/fix-i686-build-moz-1792159.patch create mode 100644 srcpkgs/floorp/patches/fix-i686-ppc-musl.patch create mode 100644 srcpkgs/floorp/patches/fix-image-format-warning.patch create mode 100644 srcpkgs/floorp/patches/fix-webrtc-glibcisms.patch create mode 100644 srcpkgs/floorp/patches/mallinfo.patch create mode 100644 srcpkgs/floorp/patches/ply-python3.11.patch create mode 100644 srcpkgs/floorp/patches/ppc32-fix-build.patch create mode 100644 srcpkgs/floorp/patches/rust-configure.patch create mode 100644 srcpkgs/floorp/patches/rust-lto-thin.patch create mode 100644 srcpkgs/floorp/patches/sandbox-fork.patch create mode 100644 srcpkgs/floorp/template diff --git a/srcpkgs/floorp/files/floorp-wayland b/srcpkgs/floorp/files/floorp-wayland new file mode 100644 index 00000000000..169bf58a6f4 --- /dev/null +++ b/srcpkgs/floorp/files/floorp-wayland @@ -0,0 +1,2 @@ +#!/bin/sh +exec env MOZ_ENABLE_WAYLAND=1 /usr/lib/floorp/floorp "$@" diff --git a/srcpkgs/floorp/files/floorp.desktop b/srcpkgs/floorp/files/floorp.desktop new file mode 100644 index 00000000000..bab1fb08b6b --- /dev/null +++ b/srcpkgs/floorp/files/floorp.desktop @@ -0,0 +1,273 @@ +[Desktop Entry] +Version=1.0 +Name=Floorp +GenericName=Web Browser +GenericName[ca]=Navegador web +GenericName[cs]=Webový prohlížeč +GenericName[es]=Navegador web +GenericName[fa]=مرورگر اینترنتی +GenericName[fi]=WWW-selain +GenericName[fr]=Navigateur Web +GenericName[hu]=Webböngésző +GenericName[it]=Browser Web +GenericName[ja]=ウェブ・ブラウザ +GenericName[ko]=웹 브라우저 +GenericName[nb]=Nettleser +GenericName[nl]=Webbrowser +GenericName[nn]=Nettlesar +GenericName[no]=Nettleser +GenericName[pl]=Przeglądarka WWW +GenericName[pt]=Navegador Web +GenericName[pt_BR]=Navegador Web +GenericName[sk]=Internetový prehliadač +GenericName[sv]=Webbläsare +Comment=Browse the Web +Comment[ca]=Navegueu per el web +Comment[cs]=Prohlížení stránek World Wide Webu +Comment[de]=Im Internet surfen +Comment[es]=Navegue por la web +Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید +Comment[fi]=Selaa Internetin WWW-sivuja +Comment[fr]=Navigue sur Internet +Comment[hu]=A világháló böngészése +Comment[it]=Esplora il web +Comment[ja]=ウェブを閲覧します +Comment[ko]=웹을 돌아 다닙니다 +Comment[nb]=Surf på nettet +Comment[nl]=Verken het internet +Comment[nn]=Surf på nettet +Comment[no]=Surf på nettet +Comment[pl]=Przeglądanie stron WWW +Comment[pt]=Navegue na Internet +Comment[pt_BR]=Navegue na Internet +Comment[sk]=Prehliadanie internetu +Comment[sv]=Surfa på webben +Exec=floorp --class="floorp" %u +Icon=floorp +Terminal=false +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; +Categories=Network;WebBrowser; +Keywords=web;browser;internet; +Actions=new-window;new-private-window;profile-manager-window; + +[Desktop Action new-window] +Name=Open a New Window +Name[ach]=Dirica manyen +Name[af]=Nuwe venster +Name[an]=Nueva finestra +Name[ar]=نافذة جديدة +Name[as]=নতুন উইন্ডো +Name[ast]=Ventana nueva +Name[az]=Yeni Pəncərə +Name[be]=Новае акно +Name[bg]=Нов прозорец +Name[bn-BD]=নতুন উইন্ডো (N) +Name[bn-IN]=নতুন উইন্ডো +Name[br]=Prenestr nevez +Name[brx]=गोदान उइन्ड'(N) +Name[bs]=Novi prozor +Name[ca]=Finestra nova +Name[cak]=K'ak'a' tzuwäch +Name[cs]=Nové okno +Name[cy]=Ffenestr Newydd +Name[da]=Nyt vindue +Name[de]=Neues Fenster +Name[dsb]=Nowe wokno +Name[el]=Νέο παράθυρο +Name[en-GB]=New Window +Name[en-US]=New Window +Name[en-ZA]=New Window +Name[eo]=Nova fenestro +Name[es-AR]=Nueva ventana +Name[es-CL]=Nueva ventana +Name[es-ES]=Nueva ventana +Name[es-MX]=Nueva ventana +Name[et]=Uus aken +Name[eu]=Leiho berria +Name[fa]=پنجره جدید‌ +Name[ff]=Henorde Hesere +Name[fi]=Uusi ikkuna +Name[fr]=Nouvelle fenêtre +Name[fy-NL]=Nij finster +Name[ga-IE]=Fuinneog Nua +Name[gd]=Uinneag ùr +Name[gl]=Nova xanela +Name[gn]=Ovetã pyahu +Name[gu-IN]=નવી વિન્ડો +Name[he]=חלון חדש +Name[hi-IN]=नया विंडो +Name[hr]=Novi prozor +Name[hsb]=Nowe wokno +Name[hu]=Új ablak +Name[hy-AM]=Նոր Պատուհան +Name[id]=Jendela Baru +Name[is]=Nýr gluggi +Name[it]=Nuova finestra +Name[ja]=新しいウィンドウ +Name[ja-JP-mac]=新規ウインドウ +Name[ka]=ახალი ფანჯარა +Name[kk]=Жаңа терезе +Name[km]=បង្អួច​​​ថ្មី +Name[kn]=ಹೊಸ ಕಿಟಕಿ +Name[ko]=새 창 +Name[kok]=नवें जनेल +Name[ks]=نئئ وِنڈو +Name[lij]=Neuvo barcon +Name[lo]=ຫນ້າຕ່າງໃຫມ່ +Name[lt]=Naujas langas +Name[ltg]=Jauns lūgs +Name[lv]=Jauns logs +Name[mai]=नव विंडो +Name[mk]=Нов прозорец +Name[ml]=പുതിയ ജാലകം +Name[mr]=नवीन पटल +Name[ms]=Tetingkap Baru +Name[my]=ဝင်းဒိုးအသစ် +Name[nb-NO]=Nytt vindu +Name[ne-NP]=नयाँ सञ्झ्याल +Name[nl]=Nieuw venster +Name[nn-NO]=Nytt vindauge +Name[or]=ନୂତନ ୱିଣ୍ଡୋ +Name[pa-IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pl]=Nowe okno +Name[pt-BR]=Nova janela +Name[pt-PT]=Nova janela +Name[rm]=Nova fanestra +Name[ro]=Fereastră nouă +Name[ru]=Новое окно +Name[sat]=नावा विंडो (N) +Name[si]=නව කවුළුවක් +Name[sk]=Nové okno +Name[sl]=Novo okno +Name[son]=Zanfun taaga +Name[sq]=Dritare e Re +Name[sr]=Нови прозор +Name[sv-SE]=Nytt fönster +Name[ta]=புதிய சாளரம் +Name[te]=కొత్త విండో +Name[th]=หน้าต่างใหม่ +Name[tr]=Yeni pencere +Name[tsz]=Eraatarakua jimpani +Name[uk]=Нове вікно +Name[ur]=نیا دریچہ +Name[uz]=Yangi oyna +Name[vi]=Cửa sổ mới +Name[wo]=Palanteer bu bees +Name[xh]=Ifestile entsha +Name[zh-CN]=新建窗口 +Name[zh-TW]=開新視窗 +Exec=floorp --class="floorp" --new-window %u + +[Desktop Action new-private-window] +Name=Open a New Private Window +Name[ach]=Dirica manyen me mung +Name[af]=Nuwe privaatvenster +Name[an]=Nueva finestra privada +Name[ar]=نافذة خاصة جديدة +Name[as]=নতুন ব্যক্তিগত উইন্ডো +Name[ast]=Ventana privada nueva +Name[az]=Yeni Məxfi Pəncərə +Name[be]=Новае акно адасаблення +Name[bg]=Нов прозорец за поверително сърфиране +Name[bn-BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn-IN]=নতুন ব্যক্তিগত উইন্ডো +Name[br]=Prenestr merdeiñ prevez nevez +Name[brx]=गोदान प्राइभेट उइन्ड' +Name[bs]=Novi privatni prozor +Name[ca]=Finestra privada nova +Name[cak]=K'ak'a' ichinan tzuwäch +Name[cs]=Nové anonymní okno +Name[cy]=Ffenestr Breifat Newydd +Name[da]=Nyt privat vindue +Name[de]=Neues privates Fenster +Name[dsb]=Nowe priwatne wokno +Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης +Name[en-GB]=New Private Window +Name[en-US]=New Private Window +Name[en-ZA]=New Private Window +Name[eo]=Nova privata fenestro +Name[es-AR]=Nueva ventana privada +Name[es-CL]=Nueva ventana privada +Name[es-ES]=Nueva ventana privada +Name[es-MX]=Nueva ventana privada +Name[et]=Uus privaatne aken +Name[eu]=Leiho pribatu berria +Name[fa]=پنجره ناشناس جدید +Name[ff]=Henorde Suturo Hesere +Name[fi]=Uusi yksityinen ikkuna +Name[fr]=Nouvelle fenêtre de navigation privée +Name[fy-NL]=Nij priveefinster +Name[ga-IE]=Fuinneog Nua Phríobháideach +Name[gd]=Uinneag phrìobhaideach ùr +Name[gl]=Nova xanela privada +Name[gn]=Ovetã ñemi pyahu +Name[gu-IN]=નવી ખાનગી વિન્ડો +Name[he]=חלון פרטי חדש +Name[hi-IN]=नयी निजी विंडो +Name[hr]=Novi privatni prozor +Name[hsb]=Nowe priwatne wokno +Name[hu]=Új privát ablak +Name[hy-AM]=Սկսել Գաղտնի դիտարկում +Name[id]=Jendela Mode Pribadi Baru +Name[is]=Nýr huliðsgluggi +Name[it]=Nuova finestra anonima +Name[ja]=新しいプライベートウィンドウ +Name[ja-JP-mac]=新規プライベートウインドウ +Name[ka]=ახალი პირადი ფანჯარა +Name[kk]=Жаңа жекелік терезе +Name[km]=បង្អួច​ឯកជន​ថ្មី +Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ +Name[ko]=새 사생활 보호 모드 +Name[kok]=नवो खाजगी विंडो +Name[ks]=نْو پرایوٹ وینڈو& +Name[lij]=Neuvo barcon privou +Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່ +Name[lt]=Naujas privataus naršymo langas +Name[ltg]=Jauns privatais lūgs +Name[lv]=Jauns privātais logs +Name[mai]=नया निज विंडो (W) +Name[mk]=Нов приватен прозорец +Name[ml]=പുതിയ സ്വകാര്യ ജാലകം +Name[mr]=नवीन वैयक्तिक पटल +Name[ms]=Tetingkap Persendirian Baharu +Name[my]=New Private Window +Name[nb-NO]=Nytt privat vindu +Name[ne-NP]=नयाँ निजी सञ्झ्याल +Name[nl]=Nieuw privévenster +Name[nn-NO]=Nytt privat vindauge +Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ +Name[pa-IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pl]=Nowe okno prywatne +Name[pt-BR]=Nova janela privativa +Name[pt-PT]=Nova janela privada +Name[rm]=Nova fanestra privata +Name[ro]=Fereastră privată nouă +Name[ru]=Новое приватное окно +Name[sat]=नावा निजेराक् विंडो (W ) +Name[si]=නව පුද්ගලික කවුළුව (W) +Name[sk]=Nové okno v režime Súkromné prehliadanie +Name[sl]=Novo zasebno okno +Name[son]=Sutura zanfun taaga +Name[sq]=Dritare e Re Private +Name[sr]=Нови приватан прозор +Name[sv-SE]=Nytt privat fönster +Name[ta]=புதிய தனிப்பட்ட சாளரம் +Name[te]=కొత్త ఆంతరంగిక విండో +Name[th]=หน้าต่างส่วนตัวใหม่ +Name[tr]=Yeni gizli pencere +Name[tsz]=Juchiiti eraatarakua jimpani +Name[uk]=Приватне вікно +Name[ur]=نیا نجی دریچہ +Name[uz]=Yangi maxfiy oyna +Name[vi]=Cửa sổ riêng tư mới +Name[wo]=Panlanteeru biir bu bees +Name[xh]=Ifestile yangasese entsha +Name[zh-CN]=新建隐私浏览窗口 +Name[zh-TW]=新增隱私視窗 +Exec=floorp --class="floorp" --private-window %u + +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=floorp --class="floorp" --ProfileManager %u diff --git a/srcpkgs/floorp/files/stab.h b/srcpkgs/floorp/files/stab.h new file mode 100644 index 00000000000..6f70af39897 --- /dev/null +++ b/srcpkgs/floorp/files/stab.h @@ -0,0 +1,71 @@ +/* $OpenBSD: stab.h,v 1.3 2003/06/02 19:34:12 millert Exp $ */ +/* $NetBSD: stab.h,v 1.4 1994/10/26 00:56:25 cgd Exp $ */ + +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stab.h 5.2 (Berkeley) 4/4/91 + */ + +#ifndef _STAB_H_ +#define _STAB_H_ + +/* + * The following are symbols used by various debuggers and by the Pascal + * compiler. Each of them must have one (or more) of the bits defined by + * the N_STAB mask set. + */ + +#define N_GSYM 0x20 /* global symbol */ +#define N_FNAME 0x22 /* F77 function name */ +#define N_FUN 0x24 /* procedure name */ +#define N_STSYM 0x26 /* data segment variable */ +#define N_LCSYM 0x28 /* bss segment variable */ +#define N_MAIN 0x2a /* main function name */ +#define N_PC 0x30 /* global Pascal symbol */ +#define N_RSYM 0x40 /* register variable */ +#define N_SLINE 0x44 /* text segment line number */ +#define N_DSLINE 0x46 /* data segment line number */ +#define N_BSLINE 0x48 /* bss segment line number */ +#define N_SSYM 0x60 /* structure/union element */ +#define N_SO 0x64 /* main source file name */ +#define N_LSYM 0x80 /* stack variable */ +#define N_BINCL 0x82 /* include file beginning */ +#define N_SOL 0x84 /* included source file name */ +#define N_PSYM 0xa0 /* parameter variable */ +#define N_EINCL 0xa2 /* include file end */ +#define N_ENTRY 0xa4 /* alternate entry point */ +#define N_LBRAC 0xc0 /* left bracket */ +#define N_EXCL 0xc2 /* deleted include file */ +#define N_RBRAC 0xe0 /* right bracket */ +#define N_BCOMM 0xe2 /* begin common */ +#define N_ECOMM 0xe4 /* end common */ +#define N_ECOML 0xe8 /* end common (local name) */ +#define N_LENG 0xfe /* length of preceding entry */ + +#endif /* !_STAB_H_ */ diff --git a/srcpkgs/floorp/files/vendor.js b/srcpkgs/floorp/files/vendor.js new file mode 100644 index 00000000000..bdc8b2ad37e --- /dev/null +++ b/srcpkgs/floorp/files/vendor.js @@ -0,0 +1,14 @@ +// Use LANG environment variable to choose locale +pref("intl.locale.requested", ""); + +// Disable default browser checking. +pref("browser.shell.checkDefaultBrowser", false); + +// Don't disable our bundled extensions in the application directory +pref("extensions.autoDisableScopes", 11); + +// Enable JPEG XL images +pref("image.jxl.enabled", true); + +// Prevent about:config warning +pref("browser.aboutConfig.showWarning", false); diff --git a/srcpkgs/floorp/patches/big-endian-image-decoders.patch b/srcpkgs/floorp/patches/big-endian-image-decoders.patch new file mode 100644 index 00000000000..bd2f925c917 --- /dev/null +++ b/srcpkgs/floorp/patches/big-endian-image-decoders.patch @@ -0,0 +1,88 @@ +https://bugzilla.mozilla.org/show_bug.cgi?id=1626236 +https://bug1626236.bmoattachments.org/attachment.cgi?id=9137096 + +# HG changeset patch +# User msirringhaus@suse.de +# Date 1582805876 -3600 +# Thu Feb 27 13:17:56 2020 +0100 +# Node ID cc3d09abea31068e57f1ab918782f9f86fc6a158 +# Parent 9cd90914846f667f18babc491a74c164ae5d6e9f +imported patch decoder_workaround.patch + +diff -r 9cd90914846f image/decoders/nsGIFDecoder2.cpp +--- a/image/decoders/nsGIFDecoder2.cpp Thu Feb 27 12:57:14 2020 +0100 ++++ b/image/decoders/nsGIFDecoder2.cpp Fri Mar 27 13:06:18 2020 +0100 +@@ -422,6 +422,9 @@ + MOZ_ASSERT(mSwizzleFn); + uint8_t* data = reinterpret_cast(aColormap); + mSwizzleFn(data, data, aColors); ++#if MOZ_BIG_ENDIAN() ++ SwizzleRow(SurfaceFormat::A8R8G8B8, SurfaceFormat::B8G8R8A8)(data, data, aColors); ++#endif + } + + LexerResult nsGIFDecoder2::DoDecode(SourceBufferIterator& aIterator, +diff -r 9cd90914846f image/decoders/nsJPEGDecoder.cpp +--- a/image/decoders/nsJPEGDecoder.cpp Thu Feb 27 12:57:14 2020 +0100 ++++ b/image/decoders/nsJPEGDecoder.cpp Fri Mar 27 13:06:18 2020 +0100 +@@ -263,6 +263,9 @@ + case JCS_YCbCr: + // By default, we will output directly to BGRA. If we need to apply + // special color transforms, this may change. ++#if MOZ_BIG_ENDIAN() ++ mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB; ++#else + switch (SurfaceFormat::OS_RGBX) { + case SurfaceFormat::B8G8R8X8: + mInfo.out_color_space = JCS_EXT_BGRX; +@@ -277,6 +280,7 @@ + mState = JPEG_ERROR; + return Transition::TerminateFailure(); + } ++#endif + break; + case JCS_CMYK: + case JCS_YCCK: +diff -r 9cd90914846f image/decoders/nsPNGDecoder.cpp +--- a/image/decoders/nsPNGDecoder.cpp Thu Feb 27 12:57:14 2020 +0100 ++++ b/image/decoders/nsPNGDecoder.cpp Fri Mar 27 13:06:18 2020 +0100 +@@ -361,7 +361,7 @@ + IResumable* aOnResume) { + MOZ_ASSERT(!HasError(), "Shouldn't call DoDecode after error!"); + +- return mLexer.Lex(aIterator, aOnResume, ++ LexerResult res = mLexer.Lex(aIterator, aOnResume, + [=](State aState, const char* aData, size_t aLength) { + switch (aState) { + case State::PNG_DATA: +@@ -371,6 +371,14 @@ + } + MOZ_CRASH("Unknown State"); + }); ++ ++#if MOZ_BIG_ENDIAN() ++ if(res.is() && res.as() == TerminalState::SUCCESS) { ++ NativeEndian::swapToLittleEndianInPlace((uint32_t*)(mImageData), mImageDataLength / 4); ++ } ++#endif ++ ++ return res; + } + + LexerTransition nsPNGDecoder::ReadPNGData( +diff -r 9cd90914846f image/decoders/nsWebPDecoder.cpp +--- a/image/decoders/nsWebPDecoder.cpp Thu Feb 27 12:57:14 2020 +0100 ++++ b/image/decoders/nsWebPDecoder.cpp Fri Mar 27 13:06:18 2020 +0100 +@@ -237,7 +237,12 @@ + // WebP doesn't guarantee that the alpha generated matches the hint in the + // header, so we always need to claim the input is BGRA. If the output is + // BGRX, swizzling will mask off the alpha channel. ++#if MOZ_BIG_ENDIAN() ++ mBuffer.colorspace = MODE_ARGB; ++ SurfaceFormat inFormat = mFormat; ++#else + SurfaceFormat inFormat = SurfaceFormat::OS_RGBA; ++#endif + + SurfacePipeFlags pipeFlags = SurfacePipeFlags(); + if (mFormat == SurfaceFormat::OS_RGBA && diff --git a/srcpkgs/floorp/patches/firefox-i686-build.patch b/srcpkgs/floorp/patches/firefox-i686-build.patch new file mode 100644 index 00000000000..01561761df9 --- /dev/null +++ b/srcpkgs/floorp/patches/firefox-i686-build.patch @@ -0,0 +1,14 @@ +https://src.fedoraproject.org/rpms/firefox/blob/rawhide/f/firefox-i686-build.patch + +diff -up firefox-105.0/mozglue/misc/SIMD_avx2.cpp.old firefox-105.0/mozglue/misc/SIMD_avx2.cpp +--- firefox-105.0/mozglue/misc/SIMD_avx2.cpp.old 2022-09-22 21:35:07.006221995 +0200 ++++ firefox-105.0/mozglue/misc/SIMD_avx2.cpp 2022-09-22 21:36:12.972480517 +0200 +@@ -55,7 +55,7 @@ __m256i CmpEq256(__m256i a, __m256i b) { + return _mm256_cmpeq_epi64(a, b); + } + +-# if defined(__GNUC__) && !defined(__clang__) ++# if 0 + + // See the comment in SIMD.cpp over Load32BitsIntoXMM. This is just adapted + // from that workaround. Testing this, it also yields the correct instructions diff --git a/srcpkgs/floorp/patches/fix-arm-opus-include.patch b/srcpkgs/floorp/patches/fix-arm-opus-include.patch new file mode 100644 index 00000000000..b0c052f4009 --- /dev/null +++ b/srcpkgs/floorp/patches/fix-arm-opus-include.patch @@ -0,0 +1,11 @@ +--- a/media/libopus/silk/arm/arm_silk_map.c 2019-03-19 20:55:01.249609964 +0100 ++++ b/media/libopus/silk/arm/arm_silk_map.c 2019-03-19 20:55:25.769400255 +0100 +@@ -28,7 +28,7 @@ + # include "config.h" + #endif + +-#include "main_FIX.h" ++#include "../fixed/main_FIX.h" + #include "NSQ.h" + #include "SigProc_FIX.h" + diff --git a/srcpkgs/floorp/patches/fix-i686-build-moz-1792159.patch b/srcpkgs/floorp/patches/fix-i686-build-moz-1792159.patch new file mode 100644 index 00000000000..592dcad93eb --- /dev/null +++ b/srcpkgs/floorp/patches/fix-i686-build-moz-1792159.patch @@ -0,0 +1,18 @@ +--- a/js/src/jit/shared/AtomicOperations-shared-jit.cpp ++++ b/js/src/jit/shared/AtomicOperations-shared-jit.cpp +@@ -5,4 +5,9 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + ++// bug 1792159 ++#if defined(__i386__) && defined(__GNUC__) && !defined(__clang__) ++# include "../../../mfbt/Attributes.h" ++#endif ++ + #include "jit/AtomicOperations.h" + +--- a/config/check_spidermonkey_style.py ++++ b/config/check_spidermonkey_style.py +@@ -68,2 +68,3 @@ + "jit/AtomicOperationsGenerated.h", # generated in $OBJDIR ++ "../../../mfbt/Attributes.h", # unrecognized path + "jit/CacheIROpsGenerated.h", # generated in $OBJDIR diff --git a/srcpkgs/floorp/patches/fix-i686-ppc-musl.patch b/srcpkgs/floorp/patches/fix-i686-ppc-musl.patch new file mode 100644 index 00000000000..38a85b5922c --- /dev/null +++ b/srcpkgs/floorp/patches/fix-i686-ppc-musl.patch @@ -0,0 +1,11 @@ +--- a/mozglue/misc/StackWalk.cpp 2021-11-05 15:55:03.614609706 +0000 ++++ b/mozglue/misc/StackWalk.cpp 2021-10-28 19:03:47.000000000 +0100 +@@ -45,7 +45,7 @@ + # define MOZ_STACKWALK_SUPPORTS_MACOSX 0 + #endif + +-#if (defined(linux) && \ ++#if defined(__GLIBC__) && (defined(linux) && \ + ((defined(__GNUC__) && (defined(__i386) || defined(PPC))) || \ + defined(HAVE__UNWIND_BACKTRACE))) + # define MOZ_STACKWALK_SUPPORTS_LINUX 1 diff --git a/srcpkgs/floorp/patches/fix-image-format-warning.patch b/srcpkgs/floorp/patches/fix-image-format-warning.patch new file mode 100644 index 00000000000..7cdff60ce2f --- /dev/null +++ b/srcpkgs/floorp/patches/fix-image-format-warning.patch @@ -0,0 +1,39 @@ +# HG changeset patch +# User Lee Salzman +# Date 1462463631 14400 +# Thu May 05 11:53:51 2016 -0400 +# Node ID 8da374804a09977c8f89af5e6e0cb37cb074595d +# Parent 29662e28a9c93ac67ee0b8ddfb65a9f29bbf73f5 +handle big-endian formats in Cairo format conversions + +--- a/gfx/2d/HelpersCairo.h ++++ b/gfx/2d/HelpersCairo.h +@@ -147,7 +147,14 @@ static inline cairo_format_t GfxFormatToCairoFormat(Su + case SurfaceFormat::R5G6B5_UINT16: + return CAIRO_FORMAT_RGB16_565; + default: +- gfxCriticalError() << "Unknown image format " << (int)format; ++ // _UINT32 formats don't match B8G8R8[AX]8 on big-endian platforms, ++ // and Moz2d uses B8G8R8[AX]8 as if it was _UINT32. ++ // See bug 1269654 ++ if (format == SurfaceFormat::B8G8R8X8) { ++ return CAIRO_FORMAT_RGB24; ++ } else if (format != SurfaceFormat::B8G8R8A8) { ++ gfxCriticalError() << "Unknown image format " << (int)format; ++ } + return CAIRO_FORMAT_ARGB32; + } + } +@@ -177,7 +184,11 @@ static inline cairo_content_t GfxFormatToCairoContent( + case SurfaceFormat::A8: + return CAIRO_CONTENT_ALPHA; + default: +- gfxCriticalError() << "Unknown image content format " << (int)format; ++ if (format == SurfaceFormat::B8G8R8X8) { ++ return CAIRO_CONTENT_COLOR; ++ } else if (format != SurfaceFormat::B8G8R8A8) { ++ gfxCriticalError() << "Unknown image content format " << (int)format; ++ } + return CAIRO_CONTENT_COLOR_ALPHA; + } + } diff --git a/srcpkgs/floorp/patches/fix-webrtc-glibcisms.patch b/srcpkgs/floorp/patches/fix-webrtc-glibcisms.patch new file mode 100644 index 00000000000..4f9043b58e1 --- /dev/null +++ b/srcpkgs/floorp/patches/fix-webrtc-glibcisms.patch @@ -0,0 +1,20 @@ +--- a/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc ++++ b/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc +@@ -18,7 +18,7 @@ + #define WEBRTC_GLIBC_PREREQ(a, b) 0 + #endif + +-#if WEBRTC_GLIBC_PREREQ(2, 16) ++#if !__GLIBC__ || WEBRTC_GLIBC_PREREQ(2, 16) + #include + #else + #include +@@ -40,7 +40,7 @@ + int architecture = 0; + uint64_t hwcap = 0; + const char* platform = NULL; +-#if WEBRTC_GLIBC_PREREQ(2, 16) ++#if !__GLIBC__ || WEBRTC_GLIBC_PREREQ(2, 16) + hwcap = getauxval(AT_HWCAP); + platform = (const char*)getauxval(AT_PLATFORM); + #else diff --git a/srcpkgs/floorp/patches/mallinfo.patch b/srcpkgs/floorp/patches/mallinfo.patch new file mode 100644 index 00000000000..0d704301f39 --- /dev/null +++ b/srcpkgs/floorp/patches/mallinfo.patch @@ -0,0 +1,34 @@ +--- a/xpcom/base/nsMemoryReporterManager.cpp 2019-03-19 17:12:20.844810044 +0100 ++++ b/xpcom/base/nsMemoryReporterManager.cpp 2019-03-19 17:13:32.505133615 +0100 +@@ -123,6 +123,7 @@ + return GetProcSelfSmapsPrivate(aN); + } + ++#ifdef __GLIBC__ + # ifdef HAVE_MALLINFO + # define HAVE_SYSTEM_HEAP_REPORTER 1 + static MOZ_MUST_USE nsresult SystemHeapSize(int64_t* aSizeOut) { +@@ -142,6 +143,7 @@ + return NS_OK; + } + # endif ++#endif // __GLIBC__ + + #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ + defined(__OpenBSD__) || defined(__FreeBSD_kernel__) +@@ -642,6 +644,7 @@ + return NS_OK; + } + ++#ifdef __GLIBC__ + # define HAVE_SYSTEM_HEAP_REPORTER 1 + // Windows can have multiple separate heaps. During testing there were multiple + // heaps present but the non-default ones had sizes no more than a few 10s of +@@ -698,6 +701,7 @@ + *aSizeOut = heapsSize; + return NS_OK; + } ++#endif // __GLIBC__ + + struct SegmentKind { + DWORD mState; diff --git a/srcpkgs/floorp/patches/ply-python3.11.patch b/srcpkgs/floorp/patches/ply-python3.11.patch new file mode 100644 index 00000000000..8d1415a4b36 --- /dev/null +++ b/srcpkgs/floorp/patches/ply-python3.11.patch @@ -0,0 +1,85 @@ +The Ply lexer, which doesn't seem too active a project, wraps regular +expressions from grammar definitions in its own regular expressions that name +groups. This breaks re.compile in Python >= 3.11 when the original expressions +contain global flags, because the compiler requires that global flags appear at +the start of the expression instead of inside the named group. + +This patch wraps re.compile to scan the expression for any global flags and, +when found, moves them to the start of the expression. + +--- a/third_party/python/ply/ply/lex.py ++++ b/third_party/python/ply/ply/lex.py +@@ -49,6 +49,37 @@ + # Python 3.0 + StringTypes = (str, bytes) + ++ ++def _re_compile(expression, *args, **kwargs): ++ ''' ++ Rearrange global flags in the regular expression to appear at the ++ beginning, avoiding deprecation warnings on Python < 3.11 and hard ++ errors on Python >= 3.11. ++ ''' ++ flags = set() ++ remainder = '' ++ ++ pattern = re.compile(r'\(\?([aiLmsux]+)\)') ++ while m := pattern.search(expression): ++ # Location of the global flag spec ++ l, h = m.span(0) ++ # Accumulate global flags from this spec ++ flags.update(m.group(1)) ++ # Capture all text leading up to the match ++ remainder += expression[:l] ++ # Trim to the end fo the flag spec ++ expression = expression[h:] ++ ++ # Any remaining expression contains no flags ++ remainder += expression ++ ++ # If there are flags, they belong at the beginning ++ if flags: ++ remainder = f'(?{"".join(sorted(flags))})' + remainder ++ ++ return re.compile(remainder, *args, **kwargs) ++ ++ + # This regular expression is used to match valid token names + _is_identifier = re.compile(r'^[a-zA-Z0-9_]+$') + +@@ -230,7 +261,7 @@ + titem = [] + txtitem = [] + for pat, func_name in lre: +- titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict))) ++ titem.append((_re_compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict))) + + self.lexstatere[statename] = titem + self.lexstateretext[statename] = txtitem +@@ -495,7 +526,7 @@ + return [] + regex = '|'.join(relist) + try: +- lexre = re.compile(regex, reflags) ++ lexre = _re_compile(regex, reflags) + + # Build the index to function map for the matching engine + lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1) +@@ -758,7 +789,7 @@ + continue + + try: +- c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags) ++ c = _re_compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags) + if c.match(''): + self.log.error("%s:%d: Regular expression for rule '%s' matches empty string", file, line, f.__name__) + self.error = True +@@ -782,7 +813,7 @@ + continue + + try: +- c = re.compile('(?P<%s>%s)' % (name, r), self.reflags) ++ c = _re_compile('(?P<%s>%s)' % (name, r), self.reflags) + if (c.match('')): + self.log.error("Regular expression for rule '%s' matches empty string", name) + self.error = True diff --git a/srcpkgs/floorp/patches/ppc32-fix-build.patch b/srcpkgs/floorp/patches/ppc32-fix-build.patch new file mode 100644 index 00000000000..b26a46cfe83 --- /dev/null +++ b/srcpkgs/floorp/patches/ppc32-fix-build.patch @@ -0,0 +1,36 @@ +This is not a complete/correct patch, but it makes firefox build. For now +mostly for tracking, so a real fix can be made, but right now it still +segfaults on start. + +Ref: https://hg.mozilla.org/mozilla-central/rev/08339a56f3ae +Ref: https://hg.mozilla.org/mozilla-central/rev/d16fcad6aa60 +Ref: https://hg.mozilla.org/mozilla-central/rev/ab87611d012e +Ref: https://hg.mozilla.org/mozilla-central/file/tip/xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_linux.cpp + +--- a/xpcom/reflect/xptcall/xptcall.h ++++ b/xpcom/reflect/xptcall/xptcall.h +@@ -71,6 +71,11 @@ struct nsXPTCVariant { + ExtendedVal ext; + }; + ++#if defined(__powerpc__) && !defined(__powerpc64__) ++ // this field is still necessary on ppc32, as an address ++ // to it is taken certain places in xptcall ++ void *ptr; ++#endif + nsXPTType type; + uint8_t flags; + +@@ -91,7 +96,12 @@ struct nsXPTCVariant { + }; + + void ClearFlags() { flags = 0; } ++#if defined(__powerpc__) && !defined(__powerpc64__) ++ void SetIndirect() { ptr = &val; flags |= IS_INDIRECT; } ++ bool IsPtrData() const { return IsIndirect(); } ++#else + void SetIndirect() { flags |= IS_INDIRECT; } ++#endif + + bool IsIndirect() const { return 0 != (flags & IS_INDIRECT); } + diff --git a/srcpkgs/floorp/patches/rust-configure.patch b/srcpkgs/floorp/patches/rust-configure.patch new file mode 100644 index 00000000000..358ba7528e9 --- /dev/null +++ b/srcpkgs/floorp/patches/rust-configure.patch @@ -0,0 +1,71 @@ +Mozilla rustc check does not support crossbuild: let's remove it +Remove calls to unwrap_rustup, they fail if rustup isn't present + +Do not try to figure out the rust target as it is broken on musl +instead use what is set in RUST_TARGET + +Skip extra checks on cross builds (broken for arm*) + +--- a/build/moz.configure/rust.configure 2020-12-12 01:35:33.000000000 +0100 ++++ b/build/moz.configure/rust.configure 2020-12-15 19:45:16.467750787 +0100 +@@ -91,9 +91,6 @@ + return unwrap + + +-rustc = unwrap_rustup(rustc, "rustc") +-cargo = unwrap_rustup(cargo, "cargo") +- + + set_config("CARGO", cargo) + set_config("RUSTC", rustc) +@@ -260,7 +257,9 @@ + data.setdefault(key, []).append(namespace(rust_target=t, target=info)) + return data + +- ++@imports('os') ++@imports(_from='mozbuild.util', _import='ensure_unicode') ++@imports(_from='mozbuild.util', _import='system_encoding') + def detect_rustc_target( + host_or_target, compiler_info, arm_target, rust_supported_targets + ): +@@ -382,12 +381,12 @@ + + return None + +- rustc_target = find_candidate(candidates) ++ rustc_target = os.environ['RUST_TARGET'] + + if rustc_target is None: + die("Don't know how to translate {} for rustc".format(host_or_target.alias)) + +- return rustc_target ++ return ensure_unicode(rustc_target, system_encoding) + + + @imports("os") +@@ -486,6 +485,7 @@ + host, compiler_info, arm_target, rust_supported_targets + ) + if rustc_target != rustc_host: ++ return rustc_host + if host.alias == rustc_target: + configure_host = host.alias + else: +@@ -507,7 +507,6 @@ + ) + ) + ) +- assert_rust_compile(host, rustc_target, rustc) + return rustc_target + + +@@ -521,7 +520,6 @@ + rustc_target = detect_rustc_target( + target, compiler_info, arm_target, rust_supported_targets + ) +- assert_rust_compile(target, rustc_target, rustc) + return rustc_target + + + diff --git a/srcpkgs/floorp/patches/rust-lto-thin.patch b/srcpkgs/floorp/patches/rust-lto-thin.patch new file mode 100644 index 00000000000..788fceab39f --- /dev/null +++ b/srcpkgs/floorp/patches/rust-lto-thin.patch @@ -0,0 +1,12 @@ +set rust crate lto to thin to not use fatlto for gkrust which fails sometimes +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -92,7 +92,7 @@ + # Never enable when coverage is enabled to work around https://github.com/rust-lang/rust/issues/90045. + ifndef MOZ_CODE_COVERAGE + ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) +-cargo_rustc_flags += -Clto$(if $(filter full,$(MOZ_LTO_RUST_CROSS)),=fat) ++cargo_rustc_flags += -Clto=thin + endif + # We need -Cembed-bitcode=yes for all crates when using -Clto. + RUSTFLAGS += -Cembed-bitcode=yes diff --git a/srcpkgs/floorp/patches/sandbox-fork.patch b/srcpkgs/floorp/patches/sandbox-fork.patch new file mode 100644 index 00000000000..d4584e74b91 --- /dev/null +++ b/srcpkgs/floorp/patches/sandbox-fork.patch @@ -0,0 +1,15 @@ +make SYS_fork non-fatal, musl uses it for fork(2) + +--- a/security/sandbox/linux/SandboxFilter.cpp ++++ b/security/sandbox/linux/SandboxFilter.cpp +@@ -1420,6 +1420,10 @@ + // usually do something reasonable on error. + case __NR_clone: + return ClonePolicy(Error(EPERM)); ++# ifdef __NR_fork ++ case __NR_fork: ++ return Error(ENOSYS); ++# endif + + # ifdef __NR_fadvise64 + case __NR_fadvise64: diff --git a/srcpkgs/floorp/template b/srcpkgs/floorp/template new file mode 100644 index 00000000000..77cabd8bc4c --- /dev/null +++ b/srcpkgs/floorp/template @@ -0,0 +1,319 @@ +# Template file for 'floorp' +pkgname=floorp +version=11.19.1 +_core_commit=52cda8a1aa5256c8d8f27ec5a85df0a3ad0ca8b4 +_l10n_commit=4b2ee48a02b4c08603970323e6d5e9e361e7d421 +revision=1 +archs="x86_64*" +build_helper="rust" +hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust + cargo llvm18 clang18 lld18 nodejs cbindgen nasm which tar + $(vopt_if pgo_xvfb xorg-server-xvfb)" +makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel icu-devel + pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel + libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std + libXdamage-devel freetype-devel + $(vopt_if alsa alsa-lib-devel) $(vopt_if dbus dbus-glib-devel) + $(vopt_if pulseaudio pulseaudio-devel) $(vopt_if xscreensaver libXScrnSaver-devel) + $(vopt_if sndio sndio-devel) $(vopt_if jack jack-devel)" +depends="nss>=3.72 nspr>=4.32 desktop-file-utils hicolor-icon-theme" +short_desc="Firefox based browser with excellent privacy & flexibility." +maintainer="Luca Bilke " +license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later, MIT" +homepage="https://floorp.app/" +distfiles="https://github.com/floorp-Projects/${pkgname}/archive/v${version}.tar.gz +https://github.com/Floorp-Projects/Floorp-core/archive/${_core_commit}.tar.gz +https://github.com/Floorp-Projects/Unified-l10n-central/archive/${_l10n_commit}.tar.gz +" +checksum="de6ab7535f359d084bdedd1f6ee9a6689b35166e0f0100ad1d0a2fcaf0522b84 + 6837ea84b0cafd89b664e49a5eb9e377013139b5edfc68f3a101c7e9dea5ef39 + 5fa247cf526045f26c8af80a362f55dcc4731da0ff03dd937a5b47064894b064" + +lib32disabled=yes + +build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland lto clang pgo_xvfb" +build_options_default="alsa jack dbus pulseaudio xscreensaver sndio lto clang pgo_xvfb" + +case $XBPS_TARGET_MACHINE in + armv[56]*) broken="required NEON extensions are not supported on armv6" ;; + ppc64*) ;; + ppc*) broken="xptcall bitrot" ;; +esac + +# we need this because cargo verifies checksums of all files in vendor +# crates when it builds and gives us no way to override or update the +# file sanely... so just clear out the file list +_clear_vendor_checksums() { + sed -i 's/\("files":{\)[^}]*/\1/' third_party/rust/$1/.cargo-checksum.json +} + +post_extract() { + case "$XBPS_TARGET_MACHINE" in + *-musl) + cp "${FILESDIR}/stab.h" toolkit/crashreporter/google-breakpad/src/ + ;; + esac + mv Floorp-${version}/{,.}* . && rmdir Floorp-${version} + mv Floorp-core-${_core_commit}/{,.}* floorp && rmdir Floorp-core-${_core_commit} + mv Unified-l10n-central-${_l10n_commit}/{,.}* floorp/browser/locales/l10n-central && rmdir Unified-l10n-central-${_l10n_commit} +} + +post_patch() { + : # _clear_vendor_checksums num-traits +} + +do_build() { + if [ "$build_option_clang" ]; then + export CC=clang + export CXX=clang++ + + # if [ "$CROSS_BUILD" ]; then + # mkdir -p wrapper + # + # local gcc_version=$(gcc -dumpversion) + # local clang_version=$(clang -dumpversion) + # + # cat <<-! >"wrapper/${XBPS_TARGET_MACHINE}-clang" + # #!/bin/sh + # exec clang \ + # --target="${XBPS_CROSS_TRIPLET}" \ + # --sysroot="${XBPS_CROSS_BASE}" \ + # "\$@" + # ! + # + # cat <<-! >"wrapper/${XBPS_TARGET_MACHINE}-clang++" + # #!/bin/sh + # exec clang++ \ + # --target="${XBPS_CROSS_TRIPLET}" \ + # --sysroot="${XBPS_CROSS_BASE}" \ + # "\$@" + # ! + # + # chmod +x wrapper/* + # + # export PATH="${wrksrc}/wrapper:$PATH" + # export CC=${XBPS_TARGET_MACHINE}-clang + # export CXX=${XBPS_TARGET_MACHINE}-clang++ + # fi + + export AR=llvm-ar + export NM=llvm-nm + export RANLIB=llvm-ranlib + export HOST_CC=clang + export HOST_CXX=clang++ + fi + + export AS="${CC}" + export CFLAGS="-O3" + export CXXFLAGS="-O3" + export OPT_LEVEL="3" + export RUSTC_OPT_LEVEL="3" + export HOST_CFLAGS="" + export HOST_CXXFLAGS="" + export LDFLAGS="-Wl,-rpath=/usr/lib/firefox" + # export LDFLAGS+="-Wl,--threads=${XBPS_MAKEJOBS}" + + disable_jemalloc() { + if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + echo "ac_add_options --disable-jemalloc" + fi + } + + disable_elfhack() { + case "$XBPS_TARGET_MACHINE" in + x86_64* | i686* | arm* | aarch64*) echo "ac_add_options --disable-elf-hack" ;; + esac + } + + disable_webrtc() { + # it seems mozilla has started catching up with google's webrtc + # and this newly involves introducing several megabytes of generated + # json junk that we just cannot maintain in-tree, additionally they + # have indicated that they will be re-generating these frequently + # + # it is unacceptable to keep a 7MB patch downstream, so disable it + # + # https://phabricator.services.mozilla.com/D134738 + # + case "$XBPS_TARGET_MACHINE" in + armv7l*) echo "ac_add_options --disable-webrtc" ;; + esac + + # third_party/libwebrtc/common_audio/wav_file.cc:93:2: error: + # #error "Need to convert samples to big-endian when reading from WAV file" + if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then + echo "ac_add_options --disable-webrtc" + fi + } + + cat <<-EOF >../mozconfig + ac_add_options --enable-application=browser + ac_add_options --disable-artifact-builds + + ac_add_options --prefix=/usr + ac_add_options --libdir=/usr/lib + ac_add_options --host=${XBPS_TRIPLET} + ac_add_options --target=${XBPS_CROSS_TRIPLET:-${XBPS_TRIPLET}} + ac_add_options --enable-linker=$(vopt_if clang lld bfd) + $(vopt_if lto 'ac_add_options --enable-lto=cross,full') + $(vopt_if clang 'ac_add_options --with-libclang-path=/usr/lib') + + ac_add_options --enable-release + ac_add_options --enable-hardening + ac_add_options --enable-rust-simd + ac_add_options --enable-wasm-simd + ac_add_options --enable-optimize="\${CFLAGS}" + ac_add_options --enable-path-remapping=c,rust + + # Debugging + ac_add_options --disable-debug + ac_add_options --disable-debug-symbols + ac_add_options --disable-debug-js-modules + ac_add_options --enable-strip + ac_add_options --enable-install-strip + export STRIP_FLAGS="--strip-debug --strip-unneeded" + + # Features + ac_add_options --disable-tests + ac_add_options --disable-crashreporter + ac_add_options --disable-updater + ac_add_options --disable-default-browser-agent + ac_add_options --disable-parental-controls + $(disable_jemalloc) + $(disable_elfhack) + $(disable_webrtc) + ac_add_options $(vopt_enable dbus) + ac_add_options $(vopt_enable dbus necko-wifi) + ac_add_options --disable-audio-backends + ac_add_options $(vopt_enable alsa) + ac_add_options $(vopt_enable jack) + ac_add_options $(vopt_enable pulseaudio) + ac_add_options $(vopt_enable sndio) + ac_add_options --enable-av1 + ac_add_options --enable-eme=widevine + ac_add_options --enable-jxl + ac_add_options --enable-raw + ac_add_options --enable-sandbox + + # Branding + ac_add_options --with-app-basename=$pkgname + ac_add_options --with-app-name=$pkgname + ac_add_options --with-branding=browser/branding/official + ac_add_options --enable-update-channel=release + ac_add_options --with-unsigned-addon-scopes=app,system + ac_add_options --allow-addon-sideload + + # Floorp Upstream + ac_add_options --enable-proxy-bypass-protection + ac_add_options --enable-unverified-updates + ac_add_options --with-l10n-base="${wrksrc}/floorp/browser/locales/l10n-central" + + # API Keys + ac_add_options --with-mozilla-api-keyfile="${wrksrc}/floorp/apis/api-mozilla-key" + ac_add_options --with-google-location-service-api-keyfile="${wrksrc}/floorp/apis/api-google-location-service-key" + ac_add_options --with-google-safebrowsing-api-keyfile="${wrksrc}/floorp/apis/api-google-safe-browsing-key" + + # System libraries + # XXX: wasi currently not ready + # ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot + ac_add_options --without-wasm-sandboxed-libraries + ac_add_options --enable-system-pixman + ac_add_options --with-system-ffi + ac_add_options --with-system-icu + ac_add_options --with-system-jpeg + ac_add_options --with-system-libevent + ac_add_options --with-system-libvpx + ac_add_options --with-system-nspr + ac_add_options --with-system-nss + ac_add_options --with-system-webp + ac_add_options --with-system-zlib + # XXX: the system's libpng doesn't have APNG support + ac_add_options --without-system-png + + ac_add_options --enable-default-toolkit=$(vopt_if wayland 'cairo-gtk3-wayland' 'cairo-gtk3') + + # work around large debug symbols on 32-bit hosts + if [ "$XBPS_WORDSIZE" = "32" ]; then + echo "ac_add_options --disable-debug-symbols" >>.mozconfig + echo "ac_add_options --disable-debug" >>.mozconfig + export LDFLAGS+=" -Wl,--no-keep-memory" + fi + + if [ "$SOURCE_DATE_EPOCH" ]; then + export MOZ_BUILD_DATE=$(date --date "@$SOURCE_DATE_EPOCH" "+%Y%m%d%H%M%S") + fi + + export MOZILLA_OFFICIAL=1 + export MOZ_APP_REMOTINGNAME=${pkgname} + MOZ_REQUIRE_SIGNING= + + mk_add_options MOZ_DATA_REPORTING=0 + mk_add_options MOZ_SERVICES_HEALTHREPORT=0 + mk_add_options MOZ_TELEMETRY_REPORTING=0 + EOF + + if [ "$build_option_pgo_xvfb" ]; then + # LTO/PGO needs more open files + ulimit -n 4096 + cat ../mozconfig - <<-EOF >.mozconfig + ac_add_options --enable-profile-generate=cross + export MOZ_ENABLE_FULL_SYMBOLS=1 + EOF + ./mach build + + ./mach package + + LLVM_PROFDATA=llvm-profdata JARLOG_FILE=${wrksrc}/jarlog \ + xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ + -- ./mach python build/pgo/profileserver.py + + ./mach clobber + + cat ../mozconfig >.mozconfig + + if [ -s merged.profdata ]; then + cat <<-EOF >>.mozconfig + ac_add_options --enable-profile-use=cross + ac_add_options --with-pgo-profile-path=${wrksrc}/merged.profdata + EOF + fi + + if [ -s jarlog ]; then + cat <<-EOF >>.mozconfig + ac_add_options --with-pgo-jarlog=${wrksrc}/jarlog + EOF + fi + + ./mach build + fi + + export MOZ_MAKE_FLAGS="${makejobs}" + export MOZ_NOSPAM=1 + export MOZBUILD_STATE_PATH="${wrksrc}/mozbuild" + export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system + + rm -f old-configure + ./mach build +} + +do_install() { + export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system + export MOZBUILD_STATE_PATH="${wrksrc}/mozbuild" + DESTDIR="$DESTDIR" ./mach install + + vinstall "${FILESDIR}/vendor.js" 644 usr/lib/${pkgname}/browser/defaults/preferences + vinstall "${FILESDIR}/${pkgname}.desktop" 644 usr/share/applications + + for i in 16x16 22x22 24x24 32x32 48x48 128x128 256x256; do + vinstall ${wrksrc}/browser/branding/official/default${i%x*}.png 644 \ + usr/share/icons/hicolor/${i}/apps ${pkgname}.png + done + + # We don't want the development stuff + rm -rf ${DESTDIR}/usr/{include,lib/floorp-devel,share/idl} + + # https://bugzilla.mozilla.org/show_bug.cgi?id=658850 + ln -sf ${pkgname} ${DESTDIR}/usr/lib/${pkgname}/${pkgname}-bin + + vbin ${FILESDIR}/${pkgname}-wayland +}