#!/bin/bash # $Id$ # Copyright 2013, 2014, 2015, 2016, 2017 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for # any purpose with or without fee is hereby granted, provided that # the above copyright notice and this permission notice appear in all # copies. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # ----------------------------------------------------------------------------- # # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: chromium # Descr: Open Source version of Chrome Web Browser # URL: http://www.chromium.org/ # Build needs: - multilib gcc & glibc for compiling the Native Client (64-bit); # - libelf with '-D_FILE_OFFSET_BITS=64' added to CFLAGS (32-bit); # - libtinfo (provides symlinks required by downloaded clang); # - ninja; # - nodejs; # - gcc >= 5.4.0 unless you compile using clang # - Internet access (for downloading the nacl/pnacl toolchain bins) # Needs: # Changelog: # 31.0.1650.57-1: # 18/nov/2013 by Eric Hameleers # * Initial build. # 31.0.1650.63-1: # 18/Nov/2013 by Eric Hameleers # 31.0.1650.67-1: # 19/dec/2013 by Eric Hameleers # * Update comes with several security fixes. # 32.0.1700.77-1: # 14/jan/2014 by Eric Hameleers # * Update comes with several security fixes. # 32.0.1700.102-1: # 29/jan/2014 by Eric Hameleers # * Update comes with several security fixes. # 32.0.1700.107-1: # 04/feb/2014 by Eric Hameleers # * Update. # 33.0.1750.117-1: # 21/feb/2014 by Eric Hameleers # * Update comes with several security fixes. # 33.0.1750.146-1: # 04/mar/2014 by Eric Hameleers # * Update comes with several security fixes. # 33.0.1750.149-1: # 11/mar/2014 by Eric Hameleers # * Update comes with several security fixes. # 33.0.1750.152-1: # 18/mar/2014 by Eric Hameleers # * Update comes with several security fixes. # 34.0.1847.116-1: # 09/apr/2014 by Eric Hameleers # * Update comes with several security fixes. # 34.0.1847.132-1: # 25/apr/2014 by Eric Hameleers # * Update. # 34.0.1847.137-1: # 14/may/2014 by Eric Hameleers # * Update. # 35.0.1916.114-1: # 20/may/2014 by Eric Hameleers # * Update comes with several security fixes. # 35.0.1916.153-1: # 10/jun/2014 by Eric Hameleers # * Update comes with several security fixes. # 36.0.1985.125-1: # 16/jun/2014 by Eric Hameleers # * Update comes with several security fixes. # We can no longer download the toolchain binaries in advance, # so the build will now require internet connectivity. # 36.0.1985.143-1: # 12/aug/2014 by Eric Hameleers # * Update comes with security fixes, Chrome also comes with an # updated Flash plugin: 14.0.0.177. # 37.0.2062.94-1: # 27/aug/2014 by Eric Hameleers # * Update comes with security fixes, New: an embedded PDF viewer. # 37.0.2062.120-1: # 09/sep/2014 by Eric Hameleers # * Update comes with security fixes, Chrome also comes with an # updated Flash plugin: 15.0.0.152. # 38.0.2125.101-1: # 08/oct/2014 by Eric Hameleers # * Update comes with security fixes. # 38.0.2125.104-1: # 18/oct/2014 by Eric Hameleers # * Update comes with security fixes. Chrome also updates its # Flash plugin to 15.0.0.189. # 38.0.2125.111-1: # 28/oct/2014 by Eric Hameleers # * Update. # 38.0.2125.122-1: # 11/nov/2014 by Eric Hameleers # * Update comes with security fixes. Chrome also updates its # Flash plugin to 15.0.0.223. # 39.0.2171.65-1: # 17/nov/2014 by Eric Hameleers # * Update comes with security fixes. See # http://googlechromereleases.blogspot.nl/2014/11/stable-channel-update_18.html # 39.0.2171.71-1: # 26/nov/2014 by Eric Hameleers # * Update comes with security fixes. Chrome also updates its # Flash plugin to 15.0.0.239. # 39.0.2171.95-1: # 09/dec/2014 by Eric Hameleers # * Update comes with security fixes. Chrome also updates its # Flash plugin to 16.0.0.235. # 39.0.2171.95-2: # 01/jan/2015 by Eric Hameleers # * Add support for the WIdevine CDM plugin (i.e. Netflix playback) # 39.0.2171.99-1: # 14/jan/2015 by Eric Hameleers # * New release accompanied by pepperflash 16.0.0.257. # 40.0.2214.91-1: # 21/jan/2015 by Eric Hameleers # * New release. # 40.0.2214.111-1: # 06/feb/2015 by Eric Hameleers # 41.0.2272.76-1: # 05/mar/2015 by Eric Hameleers # * First release of Chromium 41 stable. # 41.0.2272.118-1: # 02/apr/2015 by Eric Hameleers # * Security update. # 42.0.2311.90-1: # 15/apr/2015 by Eric Hameleers # * First release of Chromium 42 stable. # 42.0.2311.135-1: # 30/apr/2015 by Eric Hameleers # * Security update. # 43.0.2357.65-1: # 20/may/2015 by Eric Hameleers # * Security update, first 43 version. # 43.0.2357.81-1: # 29/may/2015 by Eric Hameleers # * Update. # 43.0.2357.124-1: # 09/jun/2015 by Eric Hameleers # * Update. # 43.0.2357.125-1: # 12/jun/2015 by Eric Hameleers # * Update. # 43.0.2357.125-2: # 19/jun/2015 by Eric Hameleers # * Disable "OK Google" hotwording completely. # 43.0.2357.130-1: # 22/jun/2015 by Eric Hameleers # * Update. # 43.0.2357.130-2: # 25/jun/2015 by Eric Hameleers # * Fix broken password manager in KDE. # 43.0.2357.132-1: # 08/jul/2015 by Eric Hameleers # * Update. # 43.0.2357.134-1: # 15/jul/2015 by Eric Hameleers # * Update. # 44.0.2403.89-1: # 22/jul/2015 by Eric Hameleers # * Update - first 44 release. # 44.0.2403.107-1: # 25/jul/2015 by Eric Hameleers # * Update - emergency bugfix release. # 44.0.2403.155-1: # 11/aug/2015 by Eric Hameleers # * Update. # 44.0.2403.157-1: # 21/aug/2015 by Eric Hameleers # * Update. # 45.0.2454.85-1: # 02/sep/2015 by Eric Hameleers # * Update - first 45 release. # 45.0.2454.93-1: # 16/sep/2015 by Eric Hameleers # * Update. # 45.0.2454.101-1: # 25/sep/2015 by Eric Hameleers # * Update. # 46.0.2490.71-1: # 14/oct/2015 by Eric Hameleers # * First 46 release. # 46.0.2490.86-1: # 22/nov/2015 by Eric Hameleers # * Security update. # 47.0.2526.73-1: # 03/dec/2015 by Eric Hameleers # * First 47 release. # 48.0.2564.82-1: # 24/jan/2016 by Eric Hameleers # * First 48 release. # 48.0.2564.97-1: # 31/jan/2016 by Eric Hameleers # * Update. # 48.0.2564.109-1: # 13/feb/2016 by Eric Hameleers # * Update. # 49.0.2623.75-1: # 05/mar/2016 by Eric Hameleers # * First 49 release. Binary plugins such as widevine and # pepperflash are no longer available for 32-bit since # Google stopped providing binaries for 32-bit Chrome. # 49.0.2623.108-1: # 25/feb/2016 by Eric Hameleers # * Update. # 49.0.2623.112-1: # 08/apr/2016 by Eric Hameleers # * Update. # 50.0.2661.75-1: # 14/apr/2016 by Eric Hameleers # * First 50 release. # 50.0.2661.94-1: # 29/apr/2016 by Eric Hameleers # * Security update. # 50.0.2661.102-1: # 12/may/2016 by Eric Hameleers # * Security update. # 51.0.2704.63-1: # 26/may/2016 by Eric Hameleers # * First 51 release. # 51.0.2704.84-1: # 07/jun/2016 by Eric Hameleers # * Update. # 51.0.2704.103-1: # 17/jun/2016 by Eric Hameleers # * Update. # 52.0.2743.82-1: # 24/jul/2016 by Eric Hameleers # * Update. # 52.0.2743.116-1: # 04/aug/2016 by Eric Hameleers # * Update. # 53.0.2785.92-1: # 06/sep/2016 by Eric Hameleers # * First 53 release. # 53.0.2785.92-2: # 12/sep/2016 by Eric Hameleers # * Apply patch required for Slackware 14.1. # 54.0.2840.90-1: # 03/nov/2016 by Eric Hameleers # * First 54 release. Build system changed from gyp to gn. # 54.0.2840.100-1: # 17/nov/2016 by Eric Hameleers # * Updated. Security fix. Removed the VAAPI patch because # several people have issues with it. # 55.0.2883.75-1: # 12/dec/2016 by Eric Hameleers # * First 55 release. # 56.0.2924.76-1: # 30/jan/2017 by Eric Hameleers # * First 56 release. # 56.0.2924.76-2: # 25/feb/2017 by Eric Hameleers # * Built for Slackware 14.1 with some additional patches. # 57.0.2987.98-1: # 14/mar/2017 by Eric Hameleers # * First 57 release. # 58.0.3029.96-1: # 04/may/2017 by Eric Hameleers # * Update to 58. # 59.0.3071.86-1: # 06/jun/2017 by Eric Hameleers # * Update to 59. # 60.0.3112.78-1: # 25/jun/2017 by Eric Hameleers # * Update to 60. # 61.0.3163.79-1: # 11/sep/2017 by Eric Hameleers # * Update to 61. # 61.0.3163.100-1: # 25/sep/2017 by Eric Hameleers # * Security update. # 62.0.3202.62-1: # 18/oct/2017 by Eric Hameleers # * Update to 62. # 62.0.3202.75-1: # 27/oct/2017 by Eric Hameleers # * Update, switch compiler to clang instead of gcc. # # ----------------------------------------------------------------------------- # # Run 'sh chromium.SlackBuild' to build a Slackware package. # The package (.txz) and .txt file as well as build logs are created in /tmp . # Install it using 'installpkg'. # # ----------------------------------------------------------------------------- SRCNAM=chromium SRCEXT=${SRCEXT:-""} # could be "-dev" for development build PRGNAM=${SRCNAM}${SRCEXT} # chromium or chromium-dev VERSION=${VERSION:-62.0.3202.75} BUILD=${BUILD:-1} TAG=${TAG:-alien} # Differentiate between stable and development releases: if [ "x$SRCEXT" = "x-dev" ]; then CRFLAGS="CHROMIUM_DEV_FLAGS" CRUSERFLAGS="CHROMIUM_DEV_USER_FLAGS" else CRFLAGS="CHROMIUM_FLAGS" CRUSERFLAGS="CHROMIUM_USER_FLAGS" fi # If pulseaudio is installed we support it unless you explicitly disable it: if /usr/bin/pkg-config --exists libpulse 2>/dev/null ; then USE_PA=${USE_PA:-1} else USE_PA=${USE_PA:-0} fi # By default the ffmpeg library is built statically into the chromium binary. # You can also build a shared library libffmpeg.so (formerly libffmpegsumo.so): USE_FFMPEG=${USE_FFMPEG:-shared} # other option is "static" # You can build without NaCl (native client) if you set USE_NACL to "0", # but you'll lose some Chrome functionality like using in-browser applications. # Note that NaCl is only supported on 64bit, and will be obsoleted in 2018 # in favor of WebAssembly: USE_NACL=${USE_NACL:-1} # Use the clang compiler. Results in faster build and smaller binaries. # This default to "1" (on) because gcc support is getting stale # and the gcc of Slackware 14.2 is already too old. # This script will compile google's modified clang from source, so that 32bit # can be supported (Google offers only 64bit pre-built clang for download0: USE_CLANG=${USE_CLANG:-1} # If you don't want to enable support for Widevine CDM # (content decryption module) say "0" here. USE_CDM=${USE_CDM:-1} # If you are OK with the "OK Google" hotwording feature which will # automatically download a binary blob with proprietary code, set this to "1". # Some people object to a download without consent so it is disabled by default: USE_HOTWORD=${USE_HOTWORD:-0} DOCS="AUTHORS BUILD.gn CODE_OF_CONDUCT.md DEPS LICENSE* OWNERS WATCHLISTS README*" # Where do we look for sources? SRCDIR=$(cd $(dirname $0); pwd) # Place to build (TMP) package (PKG) and output (OUTPUT) the program: TMP=${TMP:-/tmp/build} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} # Visible directory listing of anything Chrome related is: # http://gsdview.appspot.com/ # Official location (non-browsable) of the above is: # https://commondatastorage.googleapis.com/ # This package is built with Alien's Google API keys for Chromium. # The keys are contained in the file "chromium_apikeys". # If you want to rebuild this package, you can use my API keys, however: # you are not allowed to re-distribute these keys!! # You can also obtain your own, see: # http://www.chromium.org/developers/how-tos/api-keys # Or else you can simply compile without API keys. This will disable stuff like # browser sync and other functionality which accesses Google APIs. # The following variables must be set: # _google_api_key # _google_default_client_id # _google_default_client_secret if [ -f ${HOME}/.chromium_apikeys ]; then . ${HOME}/.chromium_apikeys elif [ -f ${SRCDIR}/chromium_apikeys ]; then . ${SRCDIR}/chromium_apikeys else _google_api_key=" " _google_default_client_id=" " _google_default_client_secret=" " cat <&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Fix compilation with gcc5: cat $SRCDIR/patches/chromium_gcc5.patch | patch -p1 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Fix compiling against glibc 2.26: cat $SRCDIR/patches/chromium_glibc226.patch | patch -p1 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Fix incorrect inclusion of in modes other than >= C++17 cat $SRCDIR/patches/crc32c-string-view-check.patch \ | patch -p1 --verbose -d third_party/crc32c/src \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # When compiling google's clang on 32bit Slackware use 'i586' in the triplet. # I am a python noob so this is clumsy, better implementation is welcome :-) cp $SRCDIR/patches/clang.toolchains.i586.triple.diff . cat $SRCDIR/patches/chromium_32bit_triplet.patch | patch -p0 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # When compiling google's clang, use the system cmake # (prebuilt binary from google is only available as 64bit): cat $SRCDIR/patches/chromium_use_system_cmake.patch | patch -p0 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Don't crap out when gzip does not support '--rsyncable' (Slackware < 14.2): if ! gzip --help |grep -q rsyncable ; then cat $SRCDIR/patches/chromium_no_rsyncable.patch | patch -p1 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log fi ## Enable VAAPI hardware decoding on Linux platform: #cat $SRCDIR/patches/chromium_vaapi.patch | patch -p1 --verbose \ # 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log # Also needed for Slackware <= 14.2: if [ $(LC_ALL=C gcc -dumpversion |cut -d. -f1) -eq 4 ]; then cat $SRCDIR/patches/chromium56_gcc4.patch | patch -p1 --verbose \ 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log fi # Explicitly use Python 2: find . -name '*.py' -exec sed -i -r 's|/usr/bin/python$|&2|g' {} + # The above does not solve every invocation of python: mkdir -p $TMP/tmp-$PRGNAM/privatebin ln -sf /usr/bin/python2 $TMP/tmp-$PRGNAM/privatebin/python # Prevent a build failure (yes, 'x64' even on 32bit Slackware): mkdir -p third_party/node/linux/node-linux-x64/bin ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ if [ "$ARCH" != "x86_64" ]; then # For now, disable NaCl except on x86_64 because the precompiled toolchain is # only available for that architecture at the moment. echo "** Not building NaCL - architecture '$ARCH' is currently unsupported." USE_NACL=0 fi if [ $USE_CDM -eq 1 ]; then # Add support for widevine cdm to this build. # Note that the resulting Slackware package will *not* include the # proprietary Widevine CDM, only the adapter library which is built from OSS. # To compile, we just add one #define - see https://crbug.com/473866 sed '14i#define WIDEVINE_CDM_VERSION_STRING "'$WIDEVINE_VERSION'"' \ -i third_party/widevine/cdm/stub/widevine_cdm_version.h fi if [ "x$SRCEXT" = "x-dev" ]; then # Save configuration in ~/.config/chromium-dev": sed -e "s|'filename': 'chromium-browser'|'filename': '${PRGNAM}'|" \ -e "s|'confdir': 'chromium'|'confdir': '${PRGNAM}'|" \ -i chrome/BUILD.gn sed -e 's|config_dir.Append("chromium")|config_dir.Append("'${PRGNAM}'")|' \ -e 's|config_dir.Append("chrome-frame")|config_dir.Append("'chrome-frame$SRCEXT}'")|' \ -i chrome/common/chrome_paths_linux.cc fi chown -R root:root . chmod -R u+w,go+r-w,a+X-s . echo Building ... [ ${USE_CLANG} -eq 1 ] && do_clang=true || do_clang=false [ ${USE_CDM} -eq 1 ] && do_cdm=true || do_cdm=false [ ${USE_HOTWORD} -eq 1 ] && do_hotword=true || do_hotword=false [ ${USE_NACL} -eq 1 ] && do_nacl=true || do_nacl=false [ ${USE_PA} -eq 1 ] && do_pa=true || do_pa=false export -n LDFLAGS="$SLKLDFLAGS" export -n CXXFLAGS="$SLKCFLAGS" export -n CFLAGS="$SLKCFLAGS -Wno-unused-local-typedefs" export PATH="$TMP/tmp-$PRGNAM/privatebin:$PATH" _chromium_conf=( "clang_use_chrome_plugins=false" 'enable_hangout_services_extension=true' 'enable_hidpi=true' "enable_hotwording=${do_hotword}" 'enable_glibc=false' "enable_nacl=${do_nacl}" "enable_nacl_nonsfi=${do_nacl}" 'enable_pepper_cdms=true' 'enable_swiftshader=false' 'enable_webrtc=true' "enable_widevine=${do_cdm}" 'exclude_unwind_tables=true' 'fatal_linker_warnings=false' 'ffmpeg_branding="Chrome"' "ffmpeg_component=\"${USE_FFMPEG}_library\"" 'fieldtrial_testing_like_official_build=true' "google_api_key=\"$_google_api_key\"" "google_default_client_id=\"$_google_default_client_id\"" "google_default_client_secret=\"$_google_default_client_secret\"" "is_clang=${do_clang}" 'is_debug=false' "linux_sandbox_path=\"/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/chrome_sandbox\"" 'linux_strip_binary=true' 'linux_use_bundled_binutils=false' 'linux_use_bundled_gold=false' 'linux_use_gold_binary=false' 'linux_use_gold_flags=false' 'logging_like_official_build=true' 'proprietary_codecs=true' 'remove_webcore_debug_symbols=true' 'treat_warnings_as_errors=false' "usb_ids_path=\"/usr/share/hwdata/usb.ids\"" 'use_allocator="none"' 'use_cups=true' 'use_custom_libcxx=false' 'use_gconf=false' 'use_gio=false' 'use_gold=false' 'use_kerberos=false' "use_pulseaudio=${do_pa}" 'use_sysroot=false' ) # Change this back when CRBUG 592268 is fixed (error during final link: # undefined reference to `base::i18n::GetRawIcuMemory()) # See https://bugs.chromium.org/p/chromium/issues/detail?id=592268 # icu_use_data_file_flag=false gn_system_libraries=( # 'bzip2' # 'ffmpeg' 'flac' # 'harfbuzz' # 'icu' # 'libevent' # 'libjpeg' # 'libpng' # 'libxml' # 'libxslt' # 'opus' # 'snappy' 'yasm' # 'zlib' ) # Unbundle the libraries which we use from the system. # (taken from Arch Linux:) # This *should* do what the remove_bundled_libraries.py script does, # with the added benefit of not having to list all the remaining libraries: echo "-- Unbundling system libraries from $PRGNAM sources." 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 # Change bundled libraries to system ones: echo "-- Change bundled to system libraries in $PRGNAM sources." python2 build/linux/unbundle/replace_gn_files.py --system-libraries ${gn_system_libraries[@]} # Do not make the build fail, see Chromium issue #386097: python2 third_party/libaddressinput/chromium/tools/update-strings.py \ 2>&1 | tee $OUTPUT/update_strings-${PRGNAM}.log # Use usb.ids at run time instead of compiling it in: sed -i device/usb/BUILD.gn \ -e 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' # Do not make the build fail, see https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion : touch chrome/test/data/webui/i18n_process_css_test.html # Do not make the build fail: if [ ! -f chrome/test/data/webui_test_resources.grd ]; then cat <chrome/test/data/webui_test_resources.grd EOF fi # Download the NaCL toolchains: if [ ${USE_NACL} -eq 1 ]; then # We do not need arm_trusted on x86: echo "-- Downloading NaCL toolchains." python2 build/download_nacl_toolchains.py --packages nacl_x86_newlib,pnacl_newlib,pnacl_translator sync --extract \ 2>&1 | tee $OUTPUT/nacl_dl-${PRGNAM}.log fi # Download and compile google's clang sources if needed # (clang is required for building NaCl): if [ ${USE_CLANG} -eq 1 -o ${USE_NACL} -eq 1 ]; then # Build clang from source instead of downloading: echo "-- Building google's clang toolchain." python2 tools/clang/scripts/update.py \ --force-local-build --gcc-toolchain=/usr --without-android \ 2>&1 | tee $OUTPUT/clang_build-${PRGNAM}.log fi # Generate the ninja build files: echo "-- Bootstrapping 'gn'." python2 tools/gn/bootstrap/bootstrap.py \ -v --gn-gen-args "${_chromium_conf[*]}" \ 2>&1 | tee $OUTPUT/gyp-${PRGNAM}.log echo "-- Generating ninja build files." out/Release/gn gen out/Release -v --args="${_chromium_conf[*]}" \ 2>&1 | tee -a $OUTPUT/gyp-${PRGNAM}.log # Compile everything: echo "-- Compiling the lot." if [ "$USE_CLANG" = "1" ]; then # clang_use_chrome_plugins=true fails with clang 3.5 - disable for now. export CC="clang" export CXX="clang++" else # Be careful not to override CC and CXX (may have been set by gcc5): export CC=${CC:-"gcc"} export CXX=${CXX:-"g++"} fi export AS=as export AR=ar LC_ALL=C \ ninja -C out/Release \ pdf chrome chrome_sandbox chromedriver widevinecdmadapter clearkeycdm \ 2>&1 | tee $OUTPUT/ninja-${PRGNAM}.log # Manually install everything: echo "-- Manually installing everything." # The main binary: install -D out/Release/chrome $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/${PRGNAM} # The sandbox: install -D -m4755 -o root -g root out/Release/chrome_sandbox \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/chrome-sandbox # The Chromium implementation of the WebDriver wire protocol # (automated testing of web apps): install -D out/Release/chromedriver $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/chromedriver # Copy over the remaining binaries: cp -a \ out/Release/*.pak \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ if [ -f out/Release/libffmpeg*.so ]; then cp -a \ out/Release/libffmpeg*.so \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ elif [ -f out/Release/lib/libffmpeg.so ]; then mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/lib/ cp -a \ out/Release/lib/libffmpeg.so \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/lib/ fi if [ -f out/Release/natives_blob.bin ]; then cp -a \ out/Release/{natives_blob.bin,snapshot_blob.bin} \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ fi if [ ${USE_NACL} -eq 1 ]; then # Native Client files: cp -a \ out/Release/nacl_helper{,_bootstrap,_nonsfi} \ out/Release/nacl_irt_*.nexe \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ fi if [ $USE_CDM -eq 1 ]; then # Widevine and ClearKey CDM adapter: cp -a \ out/Release/libwidevinecdmadapter.so \ out/Release/libclearkeycdm.so \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ fi # Manually strip binaries so that 'nacl_irt_*.nexe' is left intact strip --strip-unneeded \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/{${PRGNAM},chrome-sandbox} \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/chromedriver if [ -f $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/libffmpeg*.so ]; then strip --strip-unneeded \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/libffmpeg*.so elif [ -f $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/lib/libffmpeg*.so ]; then strip --strip-unneeded \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/lib/libffmpeg*.so fi if [ ${USE_NACL} -eq 1 ]; then strip --strip-unneeded \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/nacl_helper{,_bootstrap,_nonsfi} fi if [ ${USE_CDM} -eq 1 ]; then strip --strip-unneeded \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/libwidevinecdmadapter.so \ $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/libclearkeycdm.so fi # Add locales: cp -a out/Release/locales $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ ln -s locales $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/remoting_locales # Add resource files: cp -a out/Release/resources $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ # Install a man page: install -D -m0644 out/Release/chrome.1 $PKG/usr/man/man1/${PRGNAM}.1 # Without this file, chromium refuses to start: cp -a out/Release/icudtl.dat $PKG/usr/lib${LIBDIRSUFFIX}/${PRGNAM}/ # Install a wrapper script: install -D -m0755 $SRCDIR/${PRGNAM}.sh $PKG/usr/bin/${PRGNAM} sed \ -e "s/@PRGNAM@/${PRGNAM}/g" \ -e "s/@SRCEXT@/${SRCEXT}/g" \ -e "s/@LIBDIRSUFFIX@/${LIBDIRSUFFIX}/g" \ -e "s/@CRFLAGS@/${CRFLAGS}/g" \ -e "s/@CRUSERFLAGS@/${CRUSERFLAGS}/g" \ -i $PKG/usr/bin/${PRGNAM} # Make the chromedriver available in the $PATH : ln -s ../lib${LIBDIRSUFFIX}/${PRGNAM}/chromedriver $PKG/usr/bin/chromedriver${SRCEXT} # xdg-utils looks for "chromium-browser" so symlink it to the wrapper: ln -s ${PRGNAM} $PKG/usr/bin/chromium-browser${SRCEXT} # Install desktop icons: for size in 16 32; do install -D -m0644 \ chrome/app/theme/default_100_percent/chromium/product_logo_$size.png \ $PKG/usr/share/icons/hicolor/${size}x${size}/apps/${PRGNAM}.png ln -s ${PRGNAM}.png \ $PKG/usr/share/icons/hicolor/${size}x${size}/apps/chromium-browser${SRCEXT}.png done for size in 22 24 48 64 128 256; do install -D -m0644 \ chrome/app/theme/chromium/product_logo_$size.png \ $PKG/usr/share/icons/hicolor/${size}x${size}/apps/${PRGNAM}.png ln -s ${PRGNAM}.png \ $PKG/usr/share/icons/hicolor/${size}x${size}/apps/chromium-browser${SRCEXT}.png done # Add a desktop file: install -D -m0644 \ $SRCDIR/${PRGNAM}.desktop $PKG/usr/share/applications/${PRGNAM}.desktop # Move the 'default' file into place. # This allows users to override command-line options: mkdir -p $PKG/etc/${PRGNAM} cat $SRCDIR/${PRGNAM}.default | sed \ -e "s/@PRGNAM@/${PRGNAM}/g" \ -e "s/@SRCEXT@/${SRCEXT}/g" \ -e "s/@CRFLAGS@/${CRFLAGS}/g" \ -e "s/@CRUSERFLAGS@/${CRUSERFLAGS}/g" \ -e "s/@LIBDIRSUFFIX@/${LIBDIRSUFFIX}/g" \ > $PKG/etc/${PRGNAM}/00-default.conf.new # Add this to the doinst.sh: mkdir -p $PKG/install cat <> $PKG/install/doinst.sh # Handle the incoming configuration files: config() { for infile in \$1; do NEW="\$infile" OLD="\`dirname \$NEW\`/\`basename \$NEW .new\`" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\`cat \$OLD | md5sum\`" = "\`cat \$NEW | md5sum\`" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... done } config etc/${PRGNAM}/00-default.conf.new # Update the desktop database: if [ -x usr/bin/update-desktop-database ]; then chroot . /usr/bin/update-desktop-database usr/share/applications > /dev/null 2>&1 fi # Update hicolor theme cache: if [ -d usr/share/icons/hicolor ]; then if [ -x /usr/bin/gtk-update-icon-cache ]; then chroot . /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor 1> /dev/null 2> /dev/null fi fi # Update the mime database: if [ -x usr/bin/update-mime-database ]; then chroot . /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1 fi EOINS # Add documentation: mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true cat $SRCDIR/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION find $PKG/usr/doc -type f -exec chmod 644 {} \; # Compress the man page(s): if [ -d $PKG/usr/man ]; then find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \; for i in $(find $PKG/usr/man -type l -name "*.?") ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done fi # Add a package description: mkdir -p $PKG/install cat $SRCDIR/slack-desc${SRCEXT} > $PKG/install/slack-desc # Build the package: cd $PKG makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz} 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log cd $OUTPUT md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz} > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz}.md5 cd - cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txt # Restore the original umask: umask ${_UMASK_}