1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
# $OpenBSD: Makefile,v 1.605 2021/12/20 19:00:04 robert Exp $
BROKEN-powerpc64 = Check failed: false. OS architecture not handled. (powerpc64)
USE_WXNEEDED= Yes
DPB_PROPERTIES= parallel parallel2
COMMENT= Chromium browser
V= 102.0.5005.61
REVISION= 1
DISTNAME= chromium-${V}
DISTFILES+= chromium-${V}${EXTRACT_SUFX}
CATEGORIES= www
HOMEPAGE= https://www.chromium.org/Home
MAINTAINER= Robert Nagy <robert@openbsd.org>
EXTRACT_SUFX= .tar.xz
FLAVORS= component ungoogled
PSEUDO_FLAVORS= debug
FLAVOR?=
# BSD-like
PERMIT_PACKAGE = Yes
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/
MASTER_SITES0= http://nerd.hu/distfiles/
MODULES= lang/python
COMPILER = base-clang ports-clang ports-gcc
MODPY_RUNDEP= No
MODPY_SETUPTOOLS= Yes
PATCHORIG= .orig.port
# uses pledge()
WANTLIB += X11 Xext Xfixes Xrender c cups dbus-1 event
WANTLIB += execinfo Xft
WANTLIB += gdk_pixbuf-2.0 glib-2.0 gobject-2.0
WANTLIB += m
WANTLIB += kvm pthread
WANTLIB += xslt
WANTLIB += sndio
WANTLIB += ${COMPILER_LIBCXX}
WANTLIB += Xi Xtst
WANTLIB += Xcursor Xrandr gio-2.0
WANTLIB += nspr4 nss3 nssutil3 smime3
WANTLIB += atk-bridge-2.0
WANTLIB += X11-xcb xcb
WANTLIB += GL expat
WANTLIB += atk-1.0 cairo gdk-3 gtk-3 pango-1.0
WANTLIB += pangocairo-1.0
WANTLIB += Xcomposite Xdamage
WANTLIB += EGL Xau Xdmcp Xinerama Xxf86vm atspi cairo-gobject
WANTLIB += drm epoxy fontconfig freetype fribidi gmodule-2.0 graphite2
WANTLIB += gthread-2.0 intl pangoft2-1.0 pcre pixman-1
WANTLIB += plc4 plds4 util xcb-dri2 xcb-glx xcb-render xcb-shm
WANTLIB += xml2 z
WANTLIB += harfbuzz harfbuzz-subset harfbuzz-gobject
WANTLIB += ffi png
WANTLIB += iconv lzma
WANTLIB += fido2 cbor usbhid crypto
WANTLIB += gbm xkbcommon
WANTLIB += tiff xshmfence
WANTLIB += lzo2
RUN_DEPENDS= devel/xdg-utils \
devel/desktop-file-utils \
fonts/noto/fonts \
graphics/libexif \
x11/gtk+3,-guic \
x11/gtk+3,-cups
BUILD_DEPENDS= archivers/bzip2 \
devel/gperf \
devel/bison \
lang/node \
shells/bash \
sysutils/flock \
sysutils/pciutils \
devel/ninja \
x11/gtk+3 \
x11/py-xcbgen${MODPY_FLAVOR} \
${MODGCC4_CPPDEP}
LIB_DEPENDS= devel/harfbuzz \
graphics/tiff \
security/nss \
textproc/libxslt \
x11/gtk+3 \
x11/xkbcommon \
print/cups,-libs \
${MODGCC4_CPPLIBDEP}
.include <bsd.own.mk>
# Set BUILDTYPE to Release
BUILDTYPE= Release
SUBST_VARS+= WRKSRC WRKDIR DEBUGFLAG
ALL_TARGET= chrome chromedriver
TEST_TARGET= base_unittests
DIST_TARGET_DIR= chrome
CONFIGURE_STYLE=none # prevent python MODULE from overriding do-build
BUILDDIR= ${WRKSRC}/out/${BUILDTYPE}
# These libraries are used from the system and the build infrastructure
# removes them from the bundled third_party directory and replaces them
# with hooks to use them from the system.
GN_SYSTEM_LIBS= libevent \
libxslt
GN_ARGS= enable_nacl=false \
is_official_build=true \
is_debug=false \
is_cfi=false \
optimize_webui=false \
enable_js_type_check=false \
enable_remoting=false \
use_kerberos=false \
use_sndio=true \
use_cups=true \
use_system_libdrm=true \
use_bundled_fontconfig=false \
use_system_harfbuzz=true \
use_system_freetype=false \
use_gnome_keyring=false \
is_clang=true \
use_sysroot=false \
treat_warnings_as_errors=false \
clang_use_chrome_plugins=false \
use_allocator=\"none\" \
use_allocator_shim=false \
disable_fieldtrial_testing_config=true \
extra_cppflags=\"-idirafter ${LOCALBASE}/include -idirafter ${X11BASE}/include\" \
fatal_linker_warnings=false
.if ${FLAVOR:Mungoogled}
GN_ARGS+= build_with_tflite_lib=false \
chrome_pgo_phase=0 \
enable_hangout_services_extension=false \
enable_mdns=false \
enable_mse_mpeg2ts_stream_parser=true \
enable_nacl_nonsfi=false \
enable_one_click_signin=false \
enable_reading_list=false \
enable_reporting=false \
enable_service_discovery=false \
exclude_unwind_tables=true \
safe_browsing_mode=0 \
use_official_google_api_keys=false \
use_unofficial_version_number=false
.else
GN_ARGS+= enable_one_click_signin=true
.endif
# notyet
GN_ARGS+= use_vaapi=false
.if ${MACHINE_ARCH} == "i386"
GN_ARGS+= extra_ldflags=\"-L${LOCALBASE}/lib -L${X11BASE}/lib -Wl,--no-keep-memory\"
.else
GN_ARGS+= extra_ldflags=\"-L${LOCALBASE}/lib -L${X11BASE}/lib\"
.endif
.if ${MACHINE_ARCH} == "aarch64"
PKG_ARGS+= -Dswiftshader=0
.else
PKG_ARGS+= -Dswiftshader=1
.endif
# Note: these keys are for OpenBSD use ONLY. For your own distribution,
# please get your own set of keys. It's free!
.if ${FLAVOR:Mungoogled}
GN_ARGS+= google_api_key=\"\"
.else
GN_ARGS+= google_api_key=\"AIzaSyA015yecfJyWi8UQpneQVrNzIKlxjv4MhI\"
.endif
GN_ARGS+= ffmpeg_branding=\"Chrome\" \
proprietary_codecs=true
# These are now restricted to use by Google, so bye-bye sync.
#GN_ARGS+= google_default_client_id=\"451220141585.apps.googleusercontent.com\"
#GN_ARGS+= google_default_client_secret=\"nQcDyaBvDyCeDrsRqKIWSHJn\" \
# XXX dwz doesn't work with chromium yet
DWZ = :
.if ${FLAVOR:Mdebug}
GN_ARGS+= symbol_level=1
DEBUG_PACKAGES= ${BUILD_PACKAGES}
.else
GN_ARGS+= symbol_level=0
.endif
.if ${FLAVOR:Mcomponent}
GN_ARGS+= is_component_build=true
.else
GN_ARGS+= is_component_build=false
.endif
.if ${FLAVOR:Mungoogled}
CHROMEDRIVER=chromedriver
.else
CHROMEDRIVER=chromedriver.unstripped
.endif
.if ${FLAVOR:Mungoogled}
post-patch:
@cd ${WRKSRC} && while read file; do \
rm "$$file"; \
done <${FILESDIR}/pruning.list
@cd ${WRKSRC} && rm chrome/build/pgo_profiles/chrome-linux-*
@cd ${WRKSRC} && while read file; do \
perl -pi ${FILESDIR}/domain_regex.list "$$file"; \
done <${FILESDIR}/domain_substitution.list
.endif
pre-configure:
@ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python
.for _arch in x64 ia32 arm64
. for _dir in avcodec avformat avutil
@cp -pR ${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/linux/${_arch}/lib${_dir} \
${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/openbsd/${_arch}/lib${_dir}
. endfor
.endfor
@mkdir -p ${WRKSRC}/media/audio/sndio ${WRKSRC}/media/audio/openbsd
@cp ${FILESDIR}/hid_{service,connection}_fido.{cc,h} ${WRKSRC}/services/device/hid
@cp ${FILESDIR}/sndio_{out,in}put.{cc,h} ${WRKSRC}/media/audio/sndio
@cp ${FILESDIR}/audio_manager_openbsd.{cc,h} ${WRKSRC}/media/audio/openbsd
@mkdir -p ${WRKSRC}/third_party/node/openbsd/node-openbsd/bin
@ln -sf ${TRUEPREFIX}/bin/node ${WRKSRC}/third_party/node/openbsd/node-openbsd/bin/node
${SUBST_CMD} ${WRKSRC}/build/gn_run_binary.py ${WRKSRC}/v8/tools/run.py \
${WRKSRC}/tools/protoc_wrapper/protoc_wrapper.py \
${WRKSRC}/third_party/blink/renderer/build/scripts/run_with_pythonpath.py
# Configuration consists of three steps:
# 1. replace the specified bundled libraries with hooks to use the system libs
# 2. bootstrap gn, the tool to generate ninja files
# 3. run gn with the appropriate configuration arguments
do-configure:
@cd ${WRKSRC} && env -i ${MAKE_ENV} build/linux/unbundle/replace_gn_files.py \
--system-libraries ${GN_SYSTEM_LIBS}
@cd ${WRKSRC}/tools/gn && env -i ${MAKE_ENV} LDFLAGS=-L${LOCALBASE}/lib ${MODPY_BIN} bootstrap/bootstrap.py \
--no-clean -s --gn-gen-args "${GN_ARGS}"
@cd ${WRKSRC} && env -i ${CONFIGURE_ENV} ${WRKSRC}/out/Release/gn \
gen --args="${GN_ARGS}" out/${BUILDTYPE}
do-build:
@cd ${WRKSRC} && env -i ${MAKE_ENV} ninja \
-j ${MAKE_JOBS} -C out/${BUILDTYPE} ${ALL_TARGET}
do-install:
${INSTALL_DATA_DIR} ${PREFIX}/${DIST_TARGET_DIR}
${INSTALL_PROGRAM} ${BUILDDIR}/${DIST_TARGET_DIR} ${PREFIX}/${DIST_TARGET_DIR}
${SUBST_PROGRAM} ${FILESDIR}/${DIST_TARGET_DIR} ${PREFIX}/bin/${DIST_TARGET_DIR}
${INSTALL_PROGRAM} ${BUILDDIR}/${CHROMEDRIVER} ${PREFIX}/bin/chromedriver
${INSTALL_MAN} ${WRKSRC}/chrome/app/resources/manpage.1.in ${PREFIX}/man/man1/chrome.1
@perl -pi -e "s,\@\@PACKAGE\@\@,chromium,g;s,\@\@MENUNAME\@\@,Chromium Web Browser,g" \
${PREFIX}/man/man1/chrome.1
${INSTALL_DATA} ${BUILDDIR}/*.pak ${PREFIX}/${DIST_TARGET_DIR}
${INSTALL_DATA_DIR} ${PREFIX}/${DIST_TARGET_DIR}/locales
${INSTALL_DATA} ${BUILDDIR}/locales/* ${PREFIX}/${DIST_TARGET_DIR}/locales
${INSTALL_DATA} ${BUILDDIR}/*.png ${PREFIX}/${DIST_TARGET_DIR}
${INSTALL_DATA_DIR} ${PREFIX}/${DIST_TARGET_DIR}/resources
@cp -Rp ${BUILDDIR}/resources/* ${PREFIX}/${DIST_TARGET_DIR}/resources
@chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/${DIST_TARGET_DIR}/resources
.for f in icudtl.dat snapshot_blob.bin v8_context_snapshot.bin
${INSTALL_DATA} ${BUILDDIR}/${f} ${PREFIX}/${DIST_TARGET_DIR}
.endfor
# ANGLE, EGL, Vk
.for f in libEGL libGLESv2
${INSTALL_DATA} ${BUILDDIR}/${f}.so ${PREFIX}/${DIST_TARGET_DIR}
.endfor
.for f in libVkICD_mock_icd
${INSTALL_DATA} ${BUILDDIR}/${f}.so ${PREFIX}/${DIST_TARGET_DIR}
.endfor
${INSTALL_DATA} ${BUILDDIR}/libvulkan.so.1 \
${PREFIX}/${DIST_TARGET_DIR}/libvulkan.so
.if ${MACHINE_ARCH} != "aarch64"
# SwiftShader
${INSTALL_DATA_DIR} ${PREFIX}/${DIST_TARGET_DIR}/swiftshader
.for f in libEGL.so libGLESv2.so
${INSTALL_DATA} ${BUILDDIR}/swiftshader/${f} ${PREFIX}/${DIST_TARGET_DIR}/swiftshader
.endfor
.endif
.if ${FLAVOR:Mcomponent}
cp -Rp ${BUILDDIR}/*.so ${BUILDDIR}/*.so.[0-9] ${PREFIX}/${DIST_TARGET_DIR}/
.endif
.for s in 22_mono 24 48 64 128 256
${INSTALL_DATA_DIR} ${PREFIX}/share/icons/hicolor/${s}x${s}/apps
${INSTALL_DATA} ${WRKSRC}/${DIST_TARGET_DIR}/app/theme/chromium/product_logo_${s}.png \
${PREFIX}/share/icons/hicolor/${s}x${s}/apps/chrome.png
.endfor
${INSTALL_DATA_DIR} ${PREFIX}/share/applications
${INSTALL_DATA} ${FILESDIR}/chromium-browser.desktop \
${PREFIX}/share/applications/chromium-browser.desktop
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/chromium
.for f in pledge.main pledge.utility_audio pledge.utility_network pledge.utility_video \
unveil.gpu unveil.main unveil.plugin unveil.renderer unveil.utility unveil.utility_audio \
unveil.utility_network unveil.utility_video
${INSTALL_DATA} ${FILESDIR}/${f} ${PREFIX}/share/examples/chromium
.endfor
.include <bsd.port.mk>
.if ${FLAVOR:Mungoogled}
PATCH_LIST?= patch-*
PATCH_LIST!+= cat ${FILESDIR}/series
.endif
|