anchor.diff:            --replace '$kf5_incdir/KWindow' ${inc kwindowsystem "KWindow"} \
             --replace '$kf5_incdir/KIO'     ${inc kio "KIO"} \
             --replace '-L$kf5_libdir '      '${libs [ kconfig kcoreaddons ki18n kio kwindowsystem ]} '
  -    '';
  -  
  +      '';
  +
       dontUseCmakeConfigure = true;
       dontUseCmakeBuildDir = true;
  -  
  +
       preConfigure = ''
         configureFlagsArray=(
           "--with-parallelism=$NIX_BUILD_CORES"
           "--with-lang=${langsSpaces}"
         );
  -  
  +
         chmod a+x ./bin/unpack-sources
         patchShebangs .
  -  
  +
         # This is required as some cppunittests require fontconfig configured
         cp "${fontsConf}" fonts.conf
         sed -e '/include/i<include>${carlito}/etc/fonts/conf.d</include>' -i fonts.conf
         export FONTCONFIG_FILE="$PWD/fonts.conf"
  -  
  +
         NOCONFIGURE=1 ./autogen.sh
       '';
  -  
  +
       postConfigure =
         # fetch_Download_item tries to interpret the name as a variable name, let it do so...
         ''
  
positive.code:       ''
        # This to avoid using /lib:/usr/lib at linking
        + ''
        sed -i '/gb_LinkTarget_LDFLAGS/{ n; /rpath-link/d;}' solenv/gbuild/platform/unxgcc.mk
    
        find -name "*.cmd" -exec sed -i s,/lib:/usr/lib,, {} \;
        '';
    
      makeFlags = [ "SHELL=${bash}/bin/bash" ];
    
      enableParallelBuilding = true;
    
      buildPhase = ''
        make build-nocheck
      '';
    
      doCheck = true;
    
      # It installs only things to $out/lib/libreoffice
      postInstall = ''
        mkdir -p $out/bin $out/share/desktop
    
        mkdir -p "$out/share/gsettings-schemas/collected-for-libreoffice/glib-2.0/schemas/"
    
        for a in sbase scalc sdraw smath swriter simpress soffice unopkg; do
          ln -s $out/lib/libreoffice/program/$a $out/bin/$a
        done
    
        ln -s $out/bin/soffice $out/bin/libreoffice
        ln -s $out/lib/libreoffice/share/xdg $out/share/applications
    
        for f in $out/share/applications/*.desktop; do
          substituteInPlace "$f" \
            --replace "Exec=libreofficedev${major}.${minor}" "Exec=libreoffice" \
            --replace "Exec=libreoffice${major}.${minor}"    "Exec=libreoffice"
        done
    
        cp -r sysui/desktop/icons  "$out/share"
        sed -re 's@Icon=libreoffice(dev)?[0-9.]*-?@Icon=@' -i "$out/share/applications/"*.desktop
    
        mkdir -p $dev
        cp -r include $dev
      '' + lib.optionalString kdeIntegration ''
          for prog in $out/bin/*
          do
            wrapQtApp $prog
          done
      '';
    
      dontWrapQtApps = true;
    
      configureFlags = [
        (if withHelp then "" else "--without-help")
        "--with-boost=${boost.dev}"
  
negative.code:       runHook postInstallPhase
      '';
    };
  in
  if stdenv.isDarwin
  then darwin
  else linux
  