summaryrefslogtreecommitdiff
path: root/packages/net-www/exlibs/chromium.exlib
blob: 2527d0120ee427933603c0caa4304e62fded68ed (plain)
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# Copyright 2009, 2010 Elias Pipping <pipping@exherbo.org>
# Copyright 2009 Heiko Przybyl <zuxez@cs.tu-berlin.de>
# Copyright 2016-2017 Timo Gurr <tgurr@exherbo.org>
# Distributed under the terms of the GNU General Public License v2

# You'll find new releases here:
# - http://omahaproxy.appspot.com/viewer
# - http://googlechromereleases.blogspot.com

CHROMIUM_CHANNEL=${PN#chromium-}

MY_PN=chromium
MY_PNV=${MY_PN}-${PV}

require freedesktop-desktop gtk-icon-cache python [ has_lib=false ] toolchain-funcs flag-o-matic

export_exlib_phases pkg_setup src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm

SUMMARY="The open-source project behind Google Chrome"
DESCRIPTION="Browser based on Blink and Google's V8 JavaScript engine."
HOMEPAGE="https://www.chromium.org/Home"
DOWNLOADS="
    https://storage.googleapis.com/chromium-browser-official/${MY_PNV}.tar.xz
    https://gsdview.appspot.com/chromium-browser-official/${MY_PNV}.tar.xz
"

LICENCES="
    BSD-3         [[ note = [ chromium itself ] ]]
    Apache-2.0    [[ note = [ skia ] ]]
    BSD-2         [[ note = [ bsdiff, bspatch ] ]]
    BSD-3         [[ note = [ dtoa, jscre, modp_b64, v8, webkit ] ]]
    GPL-2         [[ note = [ hunspell, 'Mozilla interface to Java Plugin APIs', npapi, nspr, nss ] ]]
    LGPL-2        [[ note = [ webkit ] ]]
    LGPL-2.1      [[ note = [ ffmpeg, hunspell, 'Mozilla interface to Java Plugin APIs', npapi, nspr,
                              nss, webkit ] ]]
    MPL-1.1       [[ note = [ hunspell, 'Mozilla interface to Java Plugin APIs', npapi, nspr, nss ] ]]
    MIT           [[ note = [ harfbuzz ] ]]
    public-domain [[ note = [ lzma_sdk, sqlite ] ]]
"
SLOT="0"
MYOPTIONS="
    bindist
    cups
    keyring [[ description = [ Store passwords using GNOME Keyring ] ]]
    pulseaudio
    suid-sandbox [[ description = [ Enable Chromium's SUID sandbox, only necessary for
        kernels built without user namespaces ] ]]
    platform:
        amd64
        x86
    x86_cpu_features:
        sse2
    ( providers: jpeg-turbo )
    ( providers: eudev systemd ) [[ number-selected = exactly-one ]]
"

# http://crbug.com/62803 tracks the addition of a use_openssl option. Once that bug is closed,
# use_openssl=1 can be passed; dev-libs/{nss,nspr} will no longer be needed. Note that that flag
# currently does not use system openssl but a bundled version from third_party/openssl!
# There is use_system_ssl for that

# TODO: GN build with system speech dispatcher and libevent
#  app-speech/speechd[>=0.8]
#  dev-libs/icu:=
#  dev-libs/libevent[>=1.4.13]
#  dev-libs/libxml2:2.0[>=2.6.32]
#  media-libs/libvpx[>=1.6.0-r1]
#  media-libs/openh264[>=1.6.0] ( once it's written )
DEPENDENCIES="
    build:
        dev-lang/node
        dev-lang/python:*[>=2.5&<3]
        dev-lang/yasm
        dev-perl/Switch
        dev-python/beautifulsoup4[python_abis:2.7]
        dev-python/html5lib[python_abis:2.7]
        dev-python/simplejson[python_abis:2.7]
        dev-scm/git [[ note = [ https://bugs.gentoo.org/show_bug.cgi?id=593476 ] ]]
        dev-util/gperf[>=3.0.4]
        sys-devel/bison
        sys-devel/ninja[>=1.7.2]
    build+run:
        app-arch/gzip[>=1.8]
        app-arch/snappy
        dev-libs/atk
        dev-libs/dbus-glib:1[>=0.84]
        dev-libs/expat
        dev-libs/glib:2[>=2.26] [[ note = [ for gsettings ] ]]
        dev-libs/libxslt[>=1.1.26]
        dev-libs/nspr[>=4.0]
        dev-libs/nss[>=3.12.3] [[ note = [ see base/nss_util.cc for the version requirement ] ]]
        media-libs/flac
        media-libs/fontconfig
        media-libs/freetype:2
        media-libs/libpng:=[>=1.2.37]
        media-libs/libwebp:=[>=0.6.0-r1]
        media-libs/opus[>=1.1-r1]
        net-libs/libsrtp
        sys-apps/dbus
        sys-apps/pciutils
        sys-libs/zlib[>=1.2.7-r1]
        sys-sound/alsa-lib
        virtual/usb:1
        x11-dri/libdrm
        x11-libs/cairo[X]
        x11-libs/gdk-pixbuf:2.0
        x11-libs/harfbuzz[>=1.4.2]
        x11-libs/libX11
        x11-libs/libxcb
        x11-libs/libXScrnSaver
        x11-libs/libXcomposite
        x11-libs/libXcursor
        x11-libs/libXdamage
        x11-libs/libXext
        x11-libs/libXfixes
        x11-libs/libXi
        x11-libs/libXrandr
        x11-libs/libXrender
        x11-libs/libXtst
        x11-libs/pango
        cups? (
            dev-libs/libgcrypt
            net-print/cups
        )
        keyring? ( gnome-desktop/libgnome-keyring:1 )
        providers:eudev? ( sys-apps/eudev )
        providers:jpeg-turbo? ( media-libs/libjpeg-turbo )
        providers:systemd? ( sys-apps/systemd )
        pulseaudio? ( media-sound/pulseaudio )
    run:
        x11-libs/gtk+:3
        cups? ( x11-libs/gtk+:3[cups] )
    recommendation:
        fonts/corefonts [[ description = [ Needed to display some websites ] ]]
        x11-apps/xdg-utils [[ description = [ Set as default browser. Use application launchers for downloaded files (only for Gnome/KDE/Xfce) ] ]]
    suggestion:
        gnome-desktop/adwaita-icon-theme [[ description = [ For the downloads tab ] ]]
"

WORK=${WORKBASE}/${MY_PNV}

DEFAULT_SRC_COMPILE_PARAMS=( chrome chrome_sandbox )

cxx_is_gxx() {
    [[ ${CXX} == *g++* ]] && [[ ${CXX} != *clang* ]]
}

eninja() {
    edo ninja -j ${EXJOBS:-1} -v "$@"
}

chromium_pkg_setup() {
    export V=1

    # For ffmpeg's linking
    export LD="${CXX}"

    exdirectory --allow /opt
}

chromium_src_prepare() {
    default

    # setup nodejs
    edo mkdir -p third_party/node/linux/node-linux-x64/bin
    edo ln -s /usr/host/bin/node third_party/node/linux/node-linux-x64/bin/node

    local keeplibs=(
        base/third_party/dmg_fp
        base/third_party/dynamic_annotations
        base/third_party/icu
        base/third_party/nspr
        base/third_party/superfasthash
        base/third_party/symbolize
        base/third_party/valgrind
        base/third_party/xdg_mime
        base/third_party/xdg_user_dirs
        breakpad/src/third_party/curl
        chrome/third_party/mozilla_security_manager
        courgette/third_party
        net/third_party/mozilla_security_manager
        net/third_party/nss
        third_party/WebKit
        third_party/analytics
        third_party/angle
        third_party/angle/src/common/third_party/base
        third_party/angle/src/common/third_party/murmurhash
        third_party/angle/src/third_party/compiler
        third_party/angle/src/third_party/libXNVCtrl
        third_party/angle/src/third_party/trace_event
        third_party/boringssl
        third_party/brotli
        third_party/cacheinvalidation
        third_party/catapult
        third_party/catapult/third_party/polymer
        third_party/catapult/third_party/py_vulcanize
        third_party/catapult/third_party/py_vulcanize/third_party/rcssmin
        third_party/catapult/third_party/py_vulcanize/third_party/rjsmin
        third_party/catapult/tracing/third_party/d3
        third_party/catapult/tracing/third_party/gl-matrix
        third_party/catapult/tracing/third_party/jszip
        third_party/catapult/tracing/third_party/mannwhitneyu
        third_party/catapult/tracing/third_party/oboe
        third_party/ced
        third_party/cld_2
        third_party/cld_3
        third_party/cros_system_api
        third_party/devscripts
        third_party/dom_distiller_js
        third_party/fips181
        third_party/flatbuffers
        third_party/flot
        third_party/freetype
        third_party/glslang-angle
        third_party/google_input_tools
        third_party/google_input_tools/third_party/closure_library
        third_party/google_input_tools/third_party/closure_library/third_party/closure
        third_party/googletest
        third_party/hunspell
        third_party/iccjpeg
        third_party/inspector_protocol
        third_party/jinja2
        third_party/jstemplate
        third_party/khronos
        third_party/leveldatabase
        third_party/libXNVCtrl
        third_party/libaddressinput
        third_party/libjingle
        third_party/libphonenumber
        third_party/libsecret
        third_party/libsrtp
        third_party/libudev
        third_party/libusb
        third_party/libwebm
        third_party/libxml
        third_party/libyuv
        third_party/lss
        third_party/lzma_sdk
        third_party/markupsafe
        third_party/mesa
        third_party/modp_b64
        third_party/mt19937ar
        third_party/node
        third_party/node/node_modules/vulcanize/third_party/UglifyJS2
        third_party/openh264
        third_party/openmax_dl
        third_party/ots
        third_party/pdfium
        third_party/pdfium/third_party/agg23
        third_party/pdfium/third_party/base
        third_party/pdfium/third_party/build
        third_party/pdfium/third_party/bigint
        third_party/pdfium/third_party/freetype
        third_party/pdfium/third_party/lcms2-2.6
        third_party/pdfium/third_party/libopenjpeg20
        third_party/pdfium/third_party/libpng16
        third_party/pdfium/third_party/libtiff
        third_party/ply
        third_party/polymer
        third_party/protobuf
        third_party/protobuf/third_party/six
        third_party/qcms
        third_party/sfntly
        third_party/skia
        third_party/skia/third_party/vulkan
        third_party/smhasher
        third_party/spirv-headers
        third_party/spirv-tools-angle
        third_party/sqlite
        third_party/swiftshader
        third_party/swiftshader/third_party/llvm-subzero
        third_party/swiftshader/third_party/subzero
        third_party/tcmalloc
        third_party/usrsctp
        third_party/vulkan
        third_party/vulkan-validation-layers
        third_party/web-animations-js
        third_party/webdriver
        third_party/webrtc
        third_party/widevine
        third_party/woff2
        third_party/zlib/google
        url/third_party/mozilla
        v8/src/third_party/valgrind
        v8/third_party/inspector_protocol
    )

    # TODO: keep for GN builds
    keeplibs+=(
        base/third_party/libevent
        third_party/adobe
        third_party/speech-dispatcher
        third_party/usb_ids
        third_party/xdg-utils
        third_party/yasm/run_yasm.py
    )

    # TODO: keep FFmpeg
    keeplibs+=( third_party/ffmpeg )

    # TODO: package re2
    keeplibs+=( third_party/re2 )

    # TODO: keep libvpx (58.0.3029.81 fails to compile with the current libvpx-1.6.1)
    keeplibs+=( third_party/libvpx )
    keeplibs+=( third_party/libvpx/source/libvpx/third_party/x86inc )

    # TODO: keep icu (59.0.3071.86 fails to compile with the current icu-59.1
    keeplibs+=( third_party/icu/common )
    keeplibs+=( third_party/icu/source )

    # remove some of the bundled libraries
    edo build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove

    # TODO: Find out how to properly do this for GN and/or report upstream
    edo sed \
        -e "s:pkg_config = \"\":pkg_config = \"$(exhost --tool-prefix)pkg-config\":g" \
        -i build/config/linux/pkg_config.gni

    # TODO: Find out how to properly do this for GN and/or report upstream
    # Fix this for multiarch by adding appropriate symlinks here and adding this directory to
    # the PATH
    local dir=${WORKBASE}/symlinked-build-tools
    edo mkdir -p ${dir}
    # Build error: FAILED: x64/obj/third_party/brotli/libbrotli.a
    edo ln -s /usr/host/bin/$(exhost --target)-ar ${dir}/ar
    # Build error: FAILED: x64/obj/third_party/brotli/brotli/decode.o
    edo ln -s /usr/host/bin/$(exhost --target)-cc ${dir}/gcc
    # Build error: FAILED: x64/obj/third_party/brotli/bro/encode_parallel.o
    edo ln -s /usr/host/bin/$(exhost --target)-c++ ${dir}/g++
    # Build error: strip is hardcoded somewhere
    edo ln -s /usr/host/bin/$(exhost --target)-strip ${dir}/strip
    # Build error: FAILED: libGLESv2.so libGLESv2.so.TOC
    edo ln -s /usr/host/bin/$(exhost --target)-readelf ${dir}/readelf

    # and, they assume python is python2!
    edo ln -s /usr/host/bin/python2 ${dir}/python
    export PATH="${dir}:${PATH}"
}

chromium_src_configure() {
    # icu: 59.0.3071.86 https://chromium-review.googlesource.com/c/505173/
    # re2: not yet packaged
    # libevent: https://bugs.gentoo.org/593458
    # libvpx: 58.0.3029.81 fails to compile
    # libxml: 59.0.3071.86 https://bugs.gentoo.org/616818
    # ffmpeg: unknown
    local gn_system_libraries="
        flac
        harfbuzz-ng
        libdrm
        libjpeg
        libpng
        libwebp
        libxslt
        opus
        snappy
        yasm
        zlib
    "

    edo build/linux/unbundle/replace_gn_files.py --system-libraries ${gn_system_libraries}

    local myconf_gn=""

    export AR="${AR}"
    export CC="${CC}"
    export CXX="${CXX}"
    export NM="${NM}"

    # Define a custom toolchain for GN
    myconf_gn+=" custom_toolchain=\"${FILES}/toolchain:default\""

    # GN needs explicit config for Debug/Release as opposed to inferring it from build directory
    myconf_gn+=" is_debug=false"

    # Use tcmalloc
    myconf_gn+=" use_allocator=\"tcmalloc\""

    # Disable nacl, we can't build without pnacl (http://crbug.com/269560)
    myconf_gn+=" enable_nacl=false"

    # Trying to use gold results in linker crash
    myconf_gn+=" use_gold=false use_sysroot=false linux_use_bundled_binutils=false use_custom_libcxx=false"

    # Don't try to build with Clang for now
    myconf_gn+=" is_clang=false"

    # Make sure that -Werror doesn't get added to CFLAGS by the build system.
    # Depending on GCC version the warnings are different and we don't want
    # the build to fail because of that.
    myconf_gn+=" treat_warnings_as_errors=false"

    # Disable fatal linker warnings, Gentoo bug 506268
    myconf_gn+=" fatal_linker_warnings=false"

    # Follow upstream advice on the chromium-packagers group
    myconf_gn+=" fieldtrial_testing_like_official_build=true"

    # FFmpeg handling
    ffmpeg_branding="$(option bindist Chromium Chrome)"
    myconf_gn+=" proprietary_codecs=$(option bindist false true)"
    myconf_gn+=" ffmpeg_branding=\"${ffmpeg_branding}\""

    # Options
    myconf_gn+=" enable_hangout_services_extension=true"
    myconf_gn+=" enable_widevine=true"
    myconf_gn+=" link_pulseaudio=$(option pulseaudio true false)"
    myconf_gn+=" use_cups=$(option cups true false)"
    myconf_gn+=" use_gnome_keyring=$(option keyring true false)"
    myconf_gn+=" use_pulseaudio=$(option pulseaudio true false)"

    # hard disable kerberos support (requires heimdal)
    myconf_gn+=" use_kerberos=false"

    # GTK3 build
    myconf_gn+=" use_gtk3=true"

    # Disable deprecated
    myconf_gn+=" use_gconf=false"

    # Set up Google API keys, see https://www.chromium.org/developers/how-tos/api-keys
    # Note: These are for Exherbo use ONLY. For your own distribution, please get
    # your own set of keys.
    local google_api_key="AIzaSyBEuNWzExJ_qIX-NT8OY_RGN6d6ZLWnExA"
    local google_default_client_id="750749113475.apps.googleusercontent.com"
    local google_default_client_secret="hw21UnHlcmzSMxzS6VACbPTq"
    myconf_gn+=" google_api_key=\"${google_api_key}\""
    myconf_gn+=" google_default_client_id=\"${google_default_client_id}\""
    myconf_gn+=" google_default_client_secret=\"${google_default_client_secret}\""

    # Update strings
    edo third_party/libaddressinput/chromium/tools/update-strings.py

    # 46.0.2490.86 fails with Exception: Failed to open test/data/webui/i18n_process_css_test.html while
    # trying to flatten test/data/webui/i18n_process_css_test.html
    edo touch chrome/test/data/webui/i18n_process_css_test.html

    # GN configure
    edo tools/gn/bootstrap/bootstrap.py -v --no-clean --gn-gen-args "${myconf_gn}"
    edo out/Release/gn gen --args="${myconf_gn}" out/Release
}

chromium_src_compile() {
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68853
    if cc-is-gcc && [[ "$(gcc-major-version)" > 5 ]]; then
        append-flags -fno-delete-null-pointer-checks
    fi

    if optionq suid-sandbox; then
        eninja -C out/Release chrome chrome_sandbox
    else
        eninja -C out/Release chrome
    fi
}

chromium_src_test() {
    local disabled_base_tests=(
        FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe            # Needs a utf8 locale
        LoggingTest.CheckStreamsAreLazy                         # does not like to be sandboxed
        OutOfMemoryDeathTest.ViaSharedLibraries
        ProcessMetricsTest.GetNumberOfThreads
        RTLTest.WrapPathWithLTRFormatting
        StatsTableTest.MultipleThreads                          # Flaky
        # Need access to a running X11 server (and potentially more)
        'MessageLoopTestTypeUI.*'
        MessageLoopTest.IsType
        'WaitableEventWatcherTest.*'
        'MessagePumpGLibTest.*'
        'MessagePumpLibeventTest.*'
        'TimerTest.*'
        # fails with "out of memory" even with plenty free mem
        SecurityTest.MemoryAllocationRestrictionsNew
        SecurityTest.MemoryAllocationRestrictionsNewArray
        SecurityTest.NewOverflow
        # Fails randomly on different systems
        SysInfoTest.MaxSharedMemorySize
        TraceEventTestFixture.TraceSampling
        # 42.0.2311.135
        ProcessUtilTest.CurrentDirectory
    )
    local disabled_crypto_tests=(
        # 39.0.2171.95
        SignatureVerifierTest.VerifyRSAPSS
    )
    local disabled_gn_tests=(
        BuilderTest.BasicDeps
        # 41.0.2272.76
        Label.Resolve
    )
    local disabled_ui_base_tests=(
        # Needs fonts/corefonts
        FontTest.LoadArial

        FontTest.GetActualFontNameForTesting

        # Need access to a running X11 server (and potentially more)
        'CanvasTest.*'
        'ClipboardTest.*'
        'ClipboardTest/0.*'
        'FontTest.AvgCharWidth'
        'FontTest.AvgWidths'
        'FontTest.Widths'
        'GtkExpandedContainerTest.*'
        'RenderTextTest.*'
        'ResourceBundleTest.DelegateGetFontList'
        'ScreenTest.*'
        'TextEliderTest.*'
        'TextUtilsTest.GetStringWidth'
        'AnimationContainerTest.*'
        'AnimationTest.*'
        'SlideAnimationTest.*'
        'OSExchangeDataProviderAuraX11Test.*'
        'InputMethodBaseTest.*'
        'OSExchangeDataTest.*'

        # These have been failing for a long time but are not critical. http://crbug.com/110711
        FontListTest.FontDescString_FromFontVector
        FontListTest.Fonts_DescStringWithStyleInFlexibleFormat_RoundTrip
        FontListTest.Fonts_FontVector_RoundTrip
        FontListTest.Fonts_FromDescString
        FontListTest.Fonts_FromDescStringInFlexibleFormat
        FontListTest.Fonts_FromDescStringWithStyleInFlexibleFormat
        FontListTest.Fonts_FromFontVector
        FontListTest.Fonts_GetHeight_GetBaseline
        FontListTest.Fonts_Derive
        FontListTest.Fonts_DeriveWithSizeDelta

        # 38.0.2125.101
        SelectionRequestorTest.NestedRequests
    )

    local disabled_media_tests=(
        # http://crbug.com/160384
        'YUVConvertTest.*'
    )

    local t suites=( base cacheinvalidation crypto gn gpu printing ui_base url ) HOME="${TEMP}"

    for t in ${suites[@]}; do
        tv=disabled_${t}_tests[*]
        eninja -C out/Release ${t}_unittests
        edo out/Release/${t}_unittests --gtest_filter=$(IFS=:; echo "-${!tv}")
    done
}

chromium_src_install() {
    # Install into /opt
    local dest=/opt/chromium
    edo cd out/Release

    exeinto ${dest}
    doexe chrome

    if optionq suid-sandbox; then
        newexe chrome_sandbox chrome-sandbox # the name is hardcoded
        edo chmod 4755 "${IMAGE}"${dest}/chrome-sandbox
    fi
    doexe "${FILES}"/chromium-launcher.sh

    insinto ${dest}
    doins -r *.pak locales resources
    doins -r *.bin

    # TODO: Required by bundled icu
    doins icudtl.dat

    doins libwidevinecdmadapter.so

    doman chrome.1

    dodir /usr/$(exhost --target)/bin
    dosym ${dest}/chromium-launcher.sh /usr/$(exhost --target)/bin/chromium-browser

    insinto ${dest}/swiftshader
    doins swiftshader/*.so

    for size in 22 24 48 64 128 256 ; do
        insinto /usr/share/icons/hicolor/${size}x${size}/apps
        newins "${WORK}"/chrome/app/theme/chromium/product_logo_${size}.png chromium-browser.png
    done

    insinto /usr/share/applications/
    hereins chromium-browser.desktop <<EOF
[Desktop Entry]
Version=1.0
Name=Chromium
GenericName=Web Browser
Exec=chromium-browser %U
Terminal=false
Icon=chromium-browser
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/mailto;x-scheme-handler/webcal;
StartupWMClass=Chromium-browser
EOF

    insinto /etc/revdep-rebuild
    hereins ${PN} <<EOF
SEARCH_DIRS=${dest}
EOF
}

chromium_pkg_postinst() {
    freedesktop-desktop_pkg_postinst
    gtk-icon-cache_pkg_postinst
}

chromium_pkg_postrm() {
    freedesktop-desktop_pkg_postrm
    gtk-icon-cache_pkg_postrm
}