From 8e4b9036309c456601e3053d87f857ca155a42f3 Mon Sep 17 00:00:00 2001 From: tuxillo Date: Wed, 12 Sep 2018 19:25:17 +0000 Subject: [PATCH] --- docs/howtos/HowToUpdateChromium/index.mdwn | 132 ++++++++++++++++++++- 1 file changed, 131 insertions(+), 1 deletion(-) diff --git a/docs/howtos/HowToUpdateChromium/index.mdwn b/docs/howtos/HowToUpdateChromium/index.mdwn index 2c4e7f40..e1f731ec 100644 --- a/docs/howtos/HowToUpdateChromium/index.mdwn +++ b/docs/howtos/HowToUpdateChromium/index.mdwn @@ -159,8 +159,138 @@ Once the _'-freebsd'_ branch is created with all the FreeBSD patches for the spe # git checkout -b 68-dfly 68-freebsd -## Appendix +### Cherry-picking changes from the previous version + +At this point you'll have a _'-dfly'_ branch which is exactly the same as the _'-freebsd'_ one. Next step is to cherry pick the changes from the latest working Chromium, in our case _'67-dfly'_, commit: + + commit 317fe2dbcdc3946787ed8de610e66f2829fc4ffb (67-dfly) + Author: Antonio Huete Jimenez + Date: Mon Aug 20 05:04:23 2018 -0700 + + Changes to be applied on top of 67-freebsd + +Just cherry-pick it: + + # git cherry-pick 317fe2dbcdc3946787ed8de610e66f2829fc4ffb + +Most likely there'll be conflicts to resolve. All of them need to be resolved before issuing a 'git cherry-pick --continue'. For now we are keeping all the changes to be applied on top of the '-freebsd' branch in one commit so there shouldn't be more commits to apply. + +### Building + +Here it is described how I have personally done the test build, you don't need to do it the same way but there are some things definitely needed. + +The port definition for the latest Dports' Chromium version is [[here|https://github.com/DragonFlyBSD/DPorts/tree/master/www/chromium]]. The port definition for the latest FreeBDS ports' Chromium version is [[here|https://github.com/freebsd/freebsd-ports/tree/master/www/chromium]]. The preference is to always go with the FreeBSD latest changes since most of the work is done based on FreeBSD's patches but there must be things kept from the Dports port definition because they'll be DragonFly specific. + +For example, there is a conditional around the compiler selection which allows the FreeBSD port to be build with either base clang or the port clang. + +For the FreeBSD port it looks like: + + .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1101513 + BUILD_DEPENDS+= clang60:devel/llvm60 + CC= clang60 + CXX= clang++60 + EXTRA_PATCHES+= ${FILESDIR}/extra-patch-llvm-port + .else + BUILD_DEPENDS+= ${LOCALBASE}/bin/ar:devel/binutils + EXTRA_PATCHES+= ${FILESDIR}/extra-patch-llvm-base + .endif + +Since the DragonFly port is always built with DPort's clang it should look something like: + + BUILD_DEPENDS+= ${LOCALBASE}/lib/c++/libstdc++.so:devel/libc++ + BUILD_DEPENDS+= clang60:devel/llvm60 + CC= clang60 + CXX= clang++60 + EXTRA_PATCHES+= ${FILESDIR}/extra-patch-llvm-port + +Note that there is an extra dependency from DPorts: _devel/libc++_ , which will be used as the standard C++ library instead of the system base which is libstdc++. + +As of now there are two important differences from the FreeBSD port: + +Allow 'tools/gn' to be compiled and linked against libc++: + + do-configure: + # GN generator bootstrapping and generating ninja files + cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} CC=${CC} CXX=${CXX} LD=${CXX} \ + READELF=${READELF} AR=${AR} NM=${NM} CXXFLAGS="-I${LOCALBASE}/include/c++/v1" \ + LDFLAGS="-L${LOCALBASE}/lib/c++" ${PYTHON_CMD} \ + ./tools/gn/bootstrap/bootstrap.py ${GN_BOOTSTRAP_FLAGS} + +Pass extra_cxxflags and extra_ldflags for Chromium to be compiled/linked against devel/libc++: + + ## Appendix# TODO bz@ : install libwidevinecdm.so (see third_party/widevine/cdm/BUILD.gn) + # + # Run "./out/${BUILDTYPE}/gn args out/${BUILDTYPE} --list" for all variables. + # Some parts don't have use_system_* flag, and can be turned on/off by using + # replace_gn_files.py script, some parts just turned on/off for target host + # OS "target_os == is_bsd", like libusb, libpci. + GN_ARGS+= clang_use_chrome_plugins=false \ + enable_nacl=false \ + enable_one_click_signin=true \ + enable_remoting=false \ + fieldtrial_testing_like_official_build=true \ + is_clang=true \ + toolkit_views=true \ + treat_warnings_as_errors=false \ + use_allocator="none" \ + use_allocator_shim=false \ + use_aura=true \ + use_bundled_fontconfig=false \ + use_custom_libcxx=false \ + use_gnome_keyring=false \ + use_gtk3=true \ + use_lld=true \ + use_sysroot=false \ + use_system_freetype=true \ + use_system_harfbuzz=true \ + use_system_libjpeg=true \ + extra_cxxflags="-stdlib=libc++ -cxx-isystem ${LOCALBASE}/include/c++/v1 -I${LOCALBASE}/include" \ + extra_ldflags="-L${LOCALBASE}/lib/c++ -L${LOCALBASE}/lib -L /usr/lib -L /lib" + + +Once the DPorts port definition, what I usually do is to copy it to: /usr/dports/www/chromiumXX (in this case XX = 68) and build from there. + +There are two little scripts you can use to make generating the patches easier but make sure you adjust the paths. For running those scripts the current working directory must be the git repository where you are working on. + +The patch below removes all the patch-* from the port specified and generates a patch-all file which is enough for the build: + + #!/bin/csh + # + + set nonomatch + rm -f /usr/dports/www/chromium68/files/patch-* + git diff --no-prefix crater/chromium-68.0.3440.106 . > /usr/dports/www/chromium68/files/patch-all + +Once you've extracted chromium and kicked off the build, you'll likely find errors very early. To avoid having to extract over and over to test your patches the script below simplifies the task by detecting what files need to be changed in the chromium's OBJDIR and copies them over, so you can restart the build directly: + + #! /bin/sh + + OBJDIR=/usr/obj/dports/www/chromium68/chromium-68.0.3440.106/ + + for f in $(git ls-files -m) + do + if diff -q $f $OBJDIR/$f >/dev/null; then + echo $f does not need repatch + else + cp -fv $f $OBJDIR/$f + fi + done + +To kick-off the build, it can be done as for any other port: + + # cd /usr/dports/www/chromium68 + # make | tee /tmp/build.out + +I recommend sending the output to a log file where you can inspect it more easily. + +Once the build finishes successfully you can check the _chrome_ binary in 'out/Release/' in the OBJDIR and see if it runs properly. If it does, please check point above *"Repository location and contributions"* on how to submit your work. Thanks! ### Tools The Chromium project offers a cross-reference tool which is extremely useful when working on Chromium source code: [[Chromium Search Code|https://cs.chromium.org/]] + + +### Support + +You can contact me (tuxillo) and others in our mailing list (users@) or by IRC in EFnet #dragonflybsd for questions. + -- 2.41.0