From c86d376c82c33a8184bb74ea437732ee0b6e4492 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 22 Mar 2014 15:39:26 +0100 Subject: [PATCH] chromium: Selectively link bundled libraries. So far we just copied everything from source.* into the build directory during the prePatch. This somewhat defeated the purpose of the source splitup because it involved more I/O than just unpacking the entire source tree. Now, we're selectively *symlinking* the bundled sources into the build directory. Even that isn't perfect because in the end we'd just reference foreign derivations and we're done. But for now, this gets us at least prepared for a massive reduction of compile time. Unfortunately, gyp's behaviour when it comes to symlinks is quite painful to come by, so we need to fix a few references to use absolute paths. Signed-off-by: aszlig --- .../networking/browsers/chromium/browser.nix | 116 ++++++++++++++++-- 1 file changed, 107 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix index 94fa002ab20d..1954b392d17a 100644 --- a/pkgs/applications/networking/browsers/chromium/browser.nix +++ b/pkgs/applications/networking/browsers/chromium/browser.nix @@ -117,14 +117,113 @@ in stdenv.mkDerivation rec { ++ optional cupsSupport libgcrypt ++ optional pulseSupport pulseaudio; - prePatch = '' - # XXX: Figure out a way how to split these properly. - #cpflags="-dsr --no-preserve=mode" - cpflags="-dr" - cp $cpflags "${source.main}"/* . - cp $cpflags "${source.bundled}" third_party - cp $cpflags "${source.sandbox}" sandbox - chmod -R u+w . # XXX! + prePatch = let + lntree = [ "cp" "-dsr" "--no-preserve=mode" ]; + lntreeList = concatStringsSep ", " (map (arg: "'${arg}'") lntree); + lntreeSh = concatStringsSep " " lntree; + in '' + ${lntreeSh} "${source.main}"/* . + ${lntreeSh} "${source.sandbox}" sandbox + + ensureDir third_party + + # ONLY the dependencies we can't use from nixpkgs! + for bundled in ${concatStringsSep " " [ + # This is in preparation of splitting up the bundled sources into separate + # derivations so we some day can tremendously reduce build time. + "adobe" + "angle" + "cacheinvalidation" + "cld_2" + "codesighs" + "cros_dbus_cplusplus" + "cros_system_api" + "flot" + "freetype2" + "hunspell" + "iccjpeg" + "jinja2" + "JSON" + "jstemplate" + "khronos" + "leveldatabase" + "libaddressinput" + "libjingle" + "libmtp" + "libphonenumber" + "libsrtp" + "libXNVCtrl" + "libyuv" + "lss" + "lzma_sdk" + "markupsafe" + "mesa" + "modp_b64" + "mt19937ar" + "mtpd" + "npapi" + "ots" + "ply" + "protobuf" + "qcms" + "readability" + "safe_browsing" + "sfntly" + "skia" + "smhasher" + "speech-dispatcher" + "tcmalloc" + "trace-viewer" + "undoview" + "usb_ids" + "usrsctp" + "WebKit" + "webrtc" + "widevine" + "x86inc" + "yasm" + ]}; do + echo -n "Linking ${source.bundled}/$bundled to third_party/..." >&2 + ${lntreeSh} "${source.bundled}/$bundled" third_party/ + echo " done." >&2 + done + + # Everything else is decided based on gypFlags. + PYTHONPATH="build/linux/unbundle:$PYTHONPATH" python <