git: c2cb67bb78c0 - main - www/linux-chrome: Add new port

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Sun, 12 May 2024 10:02:52 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c2cb67bb78c00ef5f66bc9edd06dc74c29dd9973

commit c2cb67bb78c00ef5f66bc9edd06dc74c29dd9973
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2024-05-02 08:04:10 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-05-12 10:01:20 +0000

    www/linux-chrome: Add new port
    
    Sponsored by:   Serenity Cybersecurity, LLC
---
 www/Makefile                            |   1 +
 www/linux-chrome/Makefile               |  58 ++++++++++++++++++
 www/linux-chrome/distinfo               |   3 +
 www/linux-chrome/files/google-chrome.in |  20 ++++++
 www/linux-chrome/pkg-descr              |   6 ++
 www/linux-chrome/pkg-plist              | 104 ++++++++++++++++++++++++++++++++
 6 files changed, 192 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index 3048d975cdd1..92162b606800 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -324,6 +324,7 @@
     SUBDIR += links
     SUBDIR += links1
     SUBDIR += linux-c7-qtwebkit
+    SUBDIR += linux-chrome
     SUBDIR += linux-rl9-libnghttp2
     SUBDIR += linux-widevine-cdm
     SUBDIR += litmus
diff --git a/www/linux-chrome/Makefile b/www/linux-chrome/Makefile
new file mode 100644
index 000000000000..e71a62e6b504
--- /dev/null
+++ b/www/linux-chrome/Makefile
@@ -0,0 +1,58 @@
+PORTNAME=	chrome
+PORTVERSION=	${CHROME_VER}
+PORTREVISION=	1
+CATEGORIES=	www linux
+MASTER_SITES=	https://dl.google.com/linux/chrome/rpm/stable/x86_64/
+DISTNAME=	google-${PORTNAME}-stable-${CHROME_VER}-${CHROME_BUILD}.x86_64
+PKGNAMEPREFIX=	linux-
+
+MAINTAINER=	chromium@FreeBSD.org
+COMMENT=	Google web browser based on WebKit
+WWW=		https://www.chromium.org/Home
+
+RUN_DEPENDS=	linux-rl9-wget>0:ftp/linux-wget \
+		linux-rl9-gnupg2>0:security/linux-gnupg \
+		update-mime-database:misc/shared-mime-info
+
+USES=		cpe desktop-file-utils gnome linux:rl9 shared-mime-info shebangfix
+USE_LINUX=	alsalib alsa-plugins-oss alsa-plugins-pulseaudio ca-certificates \
+		cups-libs curl dbuslibs dri ffmpeg-libs gstreamer1-libav \
+		gtk3 libunistring nss p11-kit sqlite3 xorglibs
+ONLY_FOR_ARCHS=	amd64
+
+SHEBANG_FILES=	opt/google/chrome/google-chrome
+
+NO_BUILD=	yes
+NO_WRKSUBDIR=	yes
+
+EXTRACT_SUFX?=		.rpm
+EXTRACT_SUFX_aarch64?=	.aarch64${EXTRACT_SUFX}
+EXTRACT_SUFX_amd64?=	.x86_64${EXTRACT_SUFX}
+SRC_SUFX?=		.src${EXTRACT_SUFX}
+
+REINPLACE_ARGS=	-i ""
+
+CHROME_VER?=	121.0.6167.160
+CHROME_BUILD?=	1
+
+DATADIR=	${PREFIX}/share/${PORTNAME}
+DOCSDIR=	${PREFIX}/share/doc/${PORTNAME}
+
+OPTIONS_DEFINE=	DOCS
+
+SUB_FILES=	google-chrome
+
+post-extract:
+	@${REINPLACE_CMD} -e 's|/usr/bin/google-chrome-stable|${LOCALBASE}/bin/google-chrome|' \
+		${WRKSRC}/usr/share/applications/google-chrome.desktop
+
+do-install:
+	${INSTALL_SCRIPT} ${WRKDIR}/google-chrome ${STAGEDIR}${PREFIX}/bin
+	cd ${WRKSRC}/opt/google && ${CP} -r chrome ${STAGEDIR}${PREFIX}/share
+	cd ${WRKSRC}/usr/share && ${COPYTREE_SHARE} \* ${STAGEDIR}${PREFIX}/share
+.for sz in 16 24 32 48 64 128 256
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/${sz}x${sz}/apps
+	${CP} ${STAGEDIR}${DATADIR}/product_logo_${sz}.png ${STAGEDIR}${PREFIX}/share/icons/hicolor/${sz}x${sz}/apps/google-chrome.png
+.endfor
+
+.include <bsd.port.mk>
diff --git a/www/linux-chrome/distinfo b/www/linux-chrome/distinfo
new file mode 100644
index 000000000000..ab7664678cc5
--- /dev/null
+++ b/www/linux-chrome/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1707749505
+SHA256 (google-chrome-stable-121.0.6167.160-1.x86_64.rpm) = b9917ae1c7d5599e0db295c1abc3c311161577210d84c110d78ff729ecb9560f
+SIZE (google-chrome-stable-121.0.6167.160-1.x86_64.rpm) = 108535521
diff --git a/www/linux-chrome/files/google-chrome.in b/www/linux-chrome/files/google-chrome.in
new file mode 100644
index 000000000000..557e7ca74a3d
--- /dev/null
+++ b/www/linux-chrome/files/google-chrome.in
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+get_pa_sock_path()
+{
+	PA_SOCK_PATH=$(sockstat | awk -v me=$(whoami) -F'[ \t]+' '
+		$1 == me && $2 == "pulseaudio" && $6 ~ /native/ {
+			print $6;
+			exit 0
+		}'
+	)
+}
+
+get_pa_sock_path
+[ -S "$PA_SOCK_PATH" ] && export PULSE_SERVER=unix:$PA_SOCK_PATH && export PULSE_COOKIE="~/.config/pulse/cookie"
+
+export CHROME_PATH="%%DATADIR%%/chrome"
+export CHROME_WRAPPER="$(readlink -f "$0")"
+export LIBGL_DRI3_DISABLE=1
+
+exec "$CHROME_PATH" --no-sandbox --no-zygote --test-type --v=0 --password-store=basic "$@"
diff --git a/www/linux-chrome/pkg-descr b/www/linux-chrome/pkg-descr
new file mode 100644
index 000000000000..68ef078870ec
--- /dev/null
+++ b/www/linux-chrome/pkg-descr
@@ -0,0 +1,6 @@
+Chrome is an open-source browser project that aims to build a safer,
+faster, and more stable way for all users to experience the web.
+
+The Chrome website contains design documents, architecture overviews,
+testing information, and more to help you learn to build and work with
+the Chrome source code.
diff --git a/www/linux-chrome/pkg-plist b/www/linux-chrome/pkg-plist
new file mode 100644
index 000000000000..15aa4887f88b
--- /dev/null
+++ b/www/linux-chrome/pkg-plist
@@ -0,0 +1,104 @@
+bin/google-chrome
+share/appdata/google-chrome.appdata.xml
+share/applications/google-chrome.desktop
+%%DATADIR%%/CHROME_VERSION_EXTRA
+%%DATADIR%%/MEIPreload/manifest.json
+%%DATADIR%%/MEIPreload/preloaded_data.pb
+%%DATADIR%%/WidevineCdm/LICENSE
+%%DATADIR%%/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so
+%%DATADIR%%/WidevineCdm/manifest.json
+%%DATADIR%%/chrome
+%%DATADIR%%/chrome-management-service
+%%DATADIR%%/chrome-sandbox
+%%DATADIR%%/chrome_100_percent.pak
+%%DATADIR%%/chrome_200_percent.pak
+%%DATADIR%%/chrome_crashpad_handler
+%%DATADIR%%/default-app-block
+%%DATADIR%%/default_apps/external_extensions.json
+%%DATADIR%%/google-chrome
+%%DATADIR%%/icudtl.dat
+%%DATADIR%%/libEGL.so
+%%DATADIR%%/libGLESv2.so
+%%DATADIR%%/liboptimization_guide_internal.so
+%%DATADIR%%/libqt5_shim.so
+%%DATADIR%%/libqt6_shim.so
+%%DATADIR%%/libvk_swiftshader.so
+%%DATADIR%%/libvulkan.so.1
+%%DATADIR%%/locales/af.pak
+%%DATADIR%%/locales/am.pak
+%%DATADIR%%/locales/ar.pak
+%%DATADIR%%/locales/bg.pak
+%%DATADIR%%/locales/bn.pak
+%%DATADIR%%/locales/ca.pak
+%%DATADIR%%/locales/cs.pak
+%%DATADIR%%/locales/da.pak
+%%DATADIR%%/locales/de.pak
+%%DATADIR%%/locales/el.pak
+%%DATADIR%%/locales/en-GB.pak
+%%DATADIR%%/locales/en-US.pak
+%%DATADIR%%/locales/es-419.pak
+%%DATADIR%%/locales/es.pak
+%%DATADIR%%/locales/et.pak
+%%DATADIR%%/locales/fa.pak
+%%DATADIR%%/locales/fi.pak
+%%DATADIR%%/locales/fil.pak
+%%DATADIR%%/locales/fr.pak
+%%DATADIR%%/locales/gu.pak
+%%DATADIR%%/locales/he.pak
+%%DATADIR%%/locales/hi.pak
+%%DATADIR%%/locales/hr.pak
+%%DATADIR%%/locales/hu.pak
+%%DATADIR%%/locales/id.pak
+%%DATADIR%%/locales/it.pak
+%%DATADIR%%/locales/ja.pak
+%%DATADIR%%/locales/kn.pak
+%%DATADIR%%/locales/ko.pak
+%%DATADIR%%/locales/lt.pak
+%%DATADIR%%/locales/lv.pak
+%%DATADIR%%/locales/ml.pak
+%%DATADIR%%/locales/mr.pak
+%%DATADIR%%/locales/ms.pak
+%%DATADIR%%/locales/nb.pak
+%%DATADIR%%/locales/nl.pak
+%%DATADIR%%/locales/pl.pak
+%%DATADIR%%/locales/pt-BR.pak
+%%DATADIR%%/locales/pt-PT.pak
+%%DATADIR%%/locales/ro.pak
+%%DATADIR%%/locales/ru.pak
+%%DATADIR%%/locales/sk.pak
+%%DATADIR%%/locales/sl.pak
+%%DATADIR%%/locales/sr.pak
+%%DATADIR%%/locales/sv.pak
+%%DATADIR%%/locales/sw.pak
+%%DATADIR%%/locales/ta.pak
+%%DATADIR%%/locales/te.pak
+%%DATADIR%%/locales/th.pak
+%%DATADIR%%/locales/tr.pak
+%%DATADIR%%/locales/uk.pak
+%%DATADIR%%/locales/ur.pak
+%%DATADIR%%/locales/vi.pak
+%%DATADIR%%/locales/zh-CN.pak
+%%DATADIR%%/locales/zh-TW.pak
+%%DATADIR%%/product_logo_128.png
+%%DATADIR%%/product_logo_16.png
+%%DATADIR%%/product_logo_24.png
+%%DATADIR%%/product_logo_256.png
+%%DATADIR%%/product_logo_32.png
+%%DATADIR%%/product_logo_32.xpm
+%%DATADIR%%/product_logo_48.png
+%%DATADIR%%/product_logo_64.png
+%%DATADIR%%/resources.pak
+%%DATADIR%%/v8_context_snapshot.bin
+%%DATADIR%%/vk_swiftshader_icd.json
+%%DATADIR%%/xdg-mime
+%%DATADIR%%/xdg-settings
+share/gnome-control-center/default-apps/google-chrome.xml
+share/icons/hicolor/128x128/apps/google-chrome.png
+share/icons/hicolor/16x16/apps/google-chrome.png
+share/icons/hicolor/24x24/apps/google-chrome.png
+share/icons/hicolor/256x256/apps/google-chrome.png
+share/icons/hicolor/32x32/apps/google-chrome.png
+share/icons/hicolor/48x48/apps/google-chrome.png
+share/icons/hicolor/64x64/apps/google-chrome.png
+share/man/man1/google-chrome-stable.1.gz
+share/man/man1/google-chrome.1.gz