opt/chromium/Pkgfile

168 lines
5.4 KiB
Plaintext

# Description: Open source version of Google Chrome web browser.
# URL: http://chromium.org/
# Maintainer: CRUX System Team, core-ports at crux dot nu
# Depends on: clang dbus-glib gperf gtk gtk3 libexif libgcrypt libvpx libwebp nodejs nss pciutils speech-dispatcher xorg-libxscrnsaver xorg-libxt
name=chromium
version=65.0.3325.181
release=1
source=(https://commondatastorage.googleapis.com/$name-browser-official/$name-$version.tar.xz
last-commit-position.patch $name.sh
chromium-skia-harmony.patch
chromium-clang-r2.patch
chromium-math.h-r0.patch
chromium-stdint.patch)
build() {
cd $name-$version
if [ -n "$(pkginfo -i | grep '^ccache ')" ]; then
# Avoid falling back to preprocessor mode when sources contain time macros
export CCACHE_SLOPPINESS=time_macros
fi
export CFLAGS="$CFLAGS $(pkg-config --cflags nspr)"
export LDFLAGS="$LDFLAGS $(pkg-config --libs nspr)"
export CC=clang
export CXX=clang++
export AR=ar
export NM=nm
# we don't use git sources
patch -p1 -i $SRC/last-commit-position.patch
wget https://chromium.googlesource.com/chromium/src.git/+/$version?format=TEXT -O ../chromium-$version.txt
# https://crbug.com/710701
local _chrome_build_hash=$(base64 -d ../chromium-$version.txt |
grep -Po '^parent \K[0-9a-f]{40}$')
if [[ -z $_chrome_build_hash ]]; then
error "Unable to find Chrome build hash."
return 1
fi
echo "LASTCHANGE=$_chrome_build_hash-" >build/util/LASTCHANGE
CFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-parentheses-equality -Wno-unused-command-line-argument'
CXXFLAGS+=' -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-parentheses-equality -Wno-unused-command-line-argument'
CPPFLAGS+=' -DNO_UNWIND_TABLES'
# https://crbug.com/skia/6663#c10
patch -p4 -i $SRC/chromium-skia-harmony.patch
# Fixes from Gentoo
patch -p1 -i $SRC/chromium-clang-r2.patch
patch -p1 -i $SRC/chromium-math.h-r0.patch
patch -p1 -i $SRC/chromium-stdint.patch
# Remove compiler flags not supported by our system clang
sed -i \
-e '/"-Wno-enum-compare-switch"/d' \
-e '/"-Wno-null-pointer-arithmetic"/d' \
-e '/"-Wno-tautological-unsigned-zero-compare"/d' \
-e '/"-Wno-tautological-constant-compare"/d' \
-e '/"-fno-delete-null-pointer-checks"/d' \
-e '/"-Wno-maybe-uninitialized"/d' \
build/config/compiler/BUILD.gn
mkdir -p third_party/node/linux/node-linux-x64/bin
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
local gn_system_libraries=(
#libdrm
#libjpeg
#libpng
libvpx
libwebp
# libxml
yasm
# zlib
# bzip2
)
local ULIB
for ULIB in ${gn_system_libraries[@]}; do
find -type f -path "*third_party/$ULIB/*" \
\! -path "*third_party/$ULIB/chromium/*" \
\! -path "*third_party/$ULIB/google/*" \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
/usr/bin/python2 build/linux/unbundle/replace_gn_files.py \
--system-libraries ${gn_system_libraries[@]}
# Chromium issue #386097
/usr/bin/python2 third_party/libaddressinput/chromium/tools/update-strings.py
local _gn_args=(
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
'host_toolchain="//build/toolchain/linux/unbundle:default"'
'is_clang=false'
'clang_use_chrome_plugins=false'
'is_debug=false'
'fatal_linker_warnings=false'
'treat_warnings_as_errors=false'
'fieldtrial_testing_like_official_build=true'
'remove_webcore_debug_symbols=true'
'ffmpeg_branding="Chrome"'
'proprietary_codecs=true'
'link_pulseaudio=false'
'use_gnome_keyring=false'
'use_gold=false'
'use_lld=false'
'use_sysroot=false'
'use_bundled_fontconfig=false'
'linux_use_bundled_binutils=false'
'use_custom_libcxx=true'
'enable_hangout_services_extension=true'
'enable_widevine=false'
'enable_nacl=false'
'enable_swiftshader=false'
'use_cups=false'
'use_gconf=false'
'use_gnome_keyring=false'
'use_kerberos=false'
'use_pulseaudio=false'
)
/usr/bin/python2 tools/gn/bootstrap/bootstrap.py -s -v --no-clean
out/Release/gn gen out/Release --args="${_gn_args[*]}" --script-executable=/usr/bin/python2
ninja -j ${JOBS-1} -C out/Release chrome chrome_sandbox
install -m 0755 -D out/Release/chrome $PKG/usr/lib/$name/$name
install -m 4755 -o root -g root -D out/Release/chrome_sandbox $PKG/usr/lib/$name/chrome-sandbox
install -m 0644 -D out/Release/*.pak $PKG/usr/lib/$name
install -d $PKG/usr/lib/$name/locales
install -m 0644 out/Release/locales/en-US.pak $PKG/usr/lib/$name/locales
cp -a out/Release/resources $PKG/usr/lib/$name
install -m 0644 -D chrome/installer/linux/common/desktop.template $PKG/usr/share/applications/$name.desktop
install -m 0644 -D chrome/app/resources/manpage.1.in $PKG/usr/share/man/man1/$name.1
sed -i \
-e "s/@@MENUNAME@@/Chromium/g" \
-e "s/@@PACKAGE@@/chromium/g" \
-e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
$PKG/usr/share/applications/$name.desktop \
$PKG/usr/share/man/man1/$name.1
# fix v8 natives
cp -a out/Release/{natives,snapshot}_blob.bin $PKG/usr/lib/$name
for size in 16 32; do
install -m 0644 -D chrome/app/theme/default_100_percent/$name/product_logo_${size}.png \
$PKG/usr/share/icons/hicolor/${size}x${size}/apps/$name.png
done
for size in 22 24 48 64 128 256; do
install -m 0644 -D chrome/app/theme/$name/product_logo_${size}.png \
$PKG/usr/share/icons/hicolor/${size}x${size}/apps/$name.png
done
# fix icu installation
install -m 0644 -D out/Release/icudtl.dat $PKG/usr/lib/$name/icudtl.dat
install -m 0755 -D $SRC/$name.sh $PKG/usr/bin/$name
}