+ # we don't use git sources
+ patch -p1 -i $SRC/last-commit-position.patch
+
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853347
+ patch -p1 -i $SRC/chromium-blink-gcc7.patch
+
+ # Fix build with glibc 2.26
+ patch -p1 -i $SRC/breakpad-use-ucontext_t.patch
+
+ # Fixes from Gentoo
+ patch -p1 -i $SRC/chromium-gcc-r1.patch
+ patch -p1 -i $SRC/chromium-gn-bootstrap-r14.patch
+ patch -p1 -i $SRC/chromium-atk-r1.patch
+
+ mkdir -p third_party/node/linux/node-linux-x64/bin
+ ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+
+ # Let's fix the toolchain
+ patch -p0 -i $SRC/$name-build-toolchain.patch
+
+ _gn_args=(
+ 'blink_gc_plugin=false'
+ 'clang_use_chrome_plugins=false'
+ 'enable_hangout_services_extension=true'
+ 'enable_nacl=false'
+ 'enable_swiftshader=false'
+ 'fatal_linker_warnings=false'
+ 'ffmpeg_branding="Chrome"'
+ 'is_clang=false'
+ 'is_debug=false'
+ 'linux_use_bundled_binutils=false'
+ 'use_custom_libcxx=false'
+ 'proprietary_codecs=true'
+ 'remove_webcore_debug_symbols=true'
+ 'symbol_level=0'
+ 'treat_warnings_as_errors=false'
+ 'use_allocator="none"'
+ 'use_cups=false'
+ 'use_gconf=false'
+ 'use_gnome_keyring=false'
+ 'use_gold=false'
+ 'use_kerberos=false'
+ 'use_pulseaudio=false'
+ 'use_sysroot=false'
+ 'use_system_libjpeg=true'
+ )
+
+ export TMPDIR="${PKGMK_WORK_DIR}/temp"
+ mkdir -p -m 755 "${TMPDIR}" || die
+
+ python2 tools/gn/bootstrap/bootstrap.py --gn-gen-args="${_gn_args[*]}"
+ out/Release/gn gen out/Release --args="${_gn_args[*]}" --script-executable=/usr/bin/python2
+
+ # Ninja, by default, sets the number of jobs to the number of availalble threads
+# local JOBS=$(awk 'BEGIN{RS="-j|--jobs="} NR==2 {print $1}' <<< $MAKEFLAGS)
+# test -n "$JOBS" && export JOBS="-j $JOBS"
+ JOBS="-j 2"
+ ninja $JOBS -C out/Release chrome chrome_sandbox
+