2023-09-27 02:35:46 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, chromium
|
|
|
|
, nodejs
|
|
|
|
, python3
|
|
|
|
, fetchYarnDeps
|
|
|
|
, fetchNpmDeps
|
2024-01-14 14:14:58 +00:00
|
|
|
, prefetch-yarn-deps
|
2023-09-27 02:35:46 +00:00
|
|
|
, npmHooks
|
|
|
|
, yarn
|
|
|
|
, substituteAll
|
|
|
|
, libnotify
|
|
|
|
, unzip
|
|
|
|
, pkgs
|
|
|
|
, pkgsBuildHost
|
|
|
|
|
|
|
|
, info
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
fetchdep = dep: let
|
|
|
|
opts = removeAttrs dep ["fetcher"];
|
|
|
|
in pkgs.${dep.fetcher} opts;
|
|
|
|
|
|
|
|
in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
|
|
|
|
packageName = "electron";
|
|
|
|
inherit (info) version;
|
|
|
|
buildTargets = [ "electron:electron_dist_zip" ];
|
|
|
|
|
2024-01-14 14:14:58 +00:00
|
|
|
nativeBuildInputs = base.nativeBuildInputs ++ [ nodejs yarn prefetch-yarn-deps unzip npmHooks.npmConfigHook ];
|
2023-09-27 02:35:46 +00:00
|
|
|
buildInputs = base.buildInputs ++ [ libnotify ];
|
|
|
|
|
|
|
|
electronOfflineCache = fetchYarnDeps {
|
|
|
|
yarnLock = (fetchdep info.deps."src/electron") + "/yarn.lock";
|
|
|
|
sha256 = info.electron_yarn_hash;
|
|
|
|
};
|
|
|
|
npmDeps = fetchNpmDeps {
|
|
|
|
src = fetchdep info.deps."src";
|
|
|
|
sourceRoot = "source/third_party/node";
|
|
|
|
hash = info.chromium_npm_hash;
|
|
|
|
};
|
|
|
|
|
|
|
|
src = null;
|
|
|
|
|
2023-12-02 14:37:25 +00:00
|
|
|
patches = base.patches ++ lib.optional (lib.versionOlder info.version "27")
|
2023-09-27 02:35:46 +00:00
|
|
|
(substituteAll {
|
|
|
|
name = "version.patch";
|
2023-12-02 14:37:25 +00:00
|
|
|
src = ./version.patch;
|
2023-09-27 02:35:46 +00:00
|
|
|
inherit (info) version;
|
|
|
|
})
|
2023-10-10 08:35:26 +00:00
|
|
|
;
|
2023-09-27 02:35:46 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
runHook preUnpack
|
|
|
|
'' + (
|
|
|
|
lib.concatStrings (lib.mapAttrsToList (path: dep: ''
|
|
|
|
mkdir -p ${builtins.dirOf path}
|
|
|
|
cp -r ${fetchdep dep}/. ${path}
|
|
|
|
chmod u+w -R ${path}
|
|
|
|
'') info.deps)
|
|
|
|
) + ''
|
|
|
|
sourceRoot=src
|
|
|
|
runHook postUnpack
|
|
|
|
'';
|
|
|
|
|
|
|
|
npmRoot = "third_party/node";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
mkdir -p third_party/jdk/current/bin
|
|
|
|
|
|
|
|
echo 'build_with_chromium = true' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_google_benchmark = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_android = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_android_prebuilts_build_tools = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_android_native_support = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_ios_webkit = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_nacl = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_openxr = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_rts_model = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'checkout_src_internal = false' >> build/config/gclient_args.gni
|
|
|
|
echo 'cros_boards = ""' >> build/config/gclient_args.gni
|
|
|
|
echo 'cros_boards_with_qemu_images = ""' >> build/config/gclient_args.gni
|
|
|
|
echo 'generate_location_tags = true' >> build/config/gclient_args.gni
|
|
|
|
|
|
|
|
echo 'LASTCHANGE=${info.deps."src".rev}-refs/heads/master@{#0}' > build/util/LASTCHANGE
|
|
|
|
echo "$SOURCE_DATE_EPOCH" > build/util/LASTCHANGE.committime
|
|
|
|
|
|
|
|
cat << EOF > gpu/config/gpu_lists_version.h
|
|
|
|
/* Generated by lastchange.py, do not edit.*/
|
|
|
|
#ifndef GPU_CONFIG_GPU_LISTS_VERSION_H_
|
|
|
|
#define GPU_CONFIG_GPU_LISTS_VERSION_H_
|
|
|
|
#define GPU_LISTS_VERSION "${info.deps."src".rev}"
|
|
|
|
#endif // GPU_CONFIG_GPU_LISTS_VERSION_H_
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat << EOF > skia/ext/skia_commit_hash.h
|
|
|
|
/* Generated by lastchange.py, do not edit.*/
|
|
|
|
#ifndef SKIA_EXT_SKIA_COMMIT_HASH_H_
|
|
|
|
#define SKIA_EXT_SKIA_COMMIT_HASH_H_
|
|
|
|
#define SKIA_COMMIT_HASH "${info.deps."src/third_party/skia".rev}-"
|
|
|
|
#endif // SKIA_EXT_SKIA_COMMIT_HASH_H_
|
|
|
|
EOF
|
|
|
|
|
|
|
|
echo -n '${info.deps."src/third_party/dawn".rev}' > gpu/webgpu/DAWN_VERSION
|
|
|
|
|
|
|
|
(
|
|
|
|
cd electron
|
|
|
|
export HOME=$TMPDIR/fake_home
|
|
|
|
yarn config --offline set yarn-offline-mirror $electronOfflineCache
|
2024-01-14 14:14:58 +00:00
|
|
|
fixup-yarn-lock yarn.lock
|
2023-09-27 02:35:46 +00:00
|
|
|
yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
cd ..
|
|
|
|
PATH=$PATH:${lib.makeBinPath (with pkgsBuildHost; [ jq git ])}
|
|
|
|
config=src/electron/patches/config.json
|
|
|
|
for key in $(jq -r "keys[]" $config)
|
|
|
|
do
|
|
|
|
value=$(jq -r ".\"$key\"" $config)
|
|
|
|
for patch in $(cat $key/.patches)
|
|
|
|
do
|
2024-01-13 17:55:04 +00:00
|
|
|
echo applying in $value: $patch
|
|
|
|
git apply -p1 --directory=$value --exclude='src/third_party/blink/web_tests/*' $key/$patch
|
2023-09-27 02:35:46 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
)
|
|
|
|
'' + base.postPatch;
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
(
|
|
|
|
cd third_party/node
|
|
|
|
grep patch update_npm_deps | sh
|
|
|
|
)
|
|
|
|
'' + (base.preConfigure or "");
|
|
|
|
|
|
|
|
gnFlags = rec {
|
|
|
|
# build/args/release.gn
|
|
|
|
is_component_build = false;
|
|
|
|
is_official_build = true;
|
|
|
|
rtc_use_h264 = proprietary_codecs;
|
|
|
|
is_component_ffmpeg = true;
|
|
|
|
|
|
|
|
# build/args/all.gn
|
|
|
|
is_electron_build = true;
|
|
|
|
root_extra_deps = [ "//electron" ];
|
|
|
|
node_module_version = info.modules;
|
|
|
|
v8_promise_internal_field_count = 1;
|
|
|
|
v8_embedder_string = "-electron.0";
|
|
|
|
v8_enable_snapshot_native_code_counters = false;
|
|
|
|
v8_scriptormodule_legacy_lifetime = true;
|
|
|
|
v8_enable_javascript_promise_hooks = true;
|
|
|
|
enable_cdm_host_verification = false;
|
|
|
|
proprietary_codecs = true;
|
|
|
|
ffmpeg_branding = "Chrome";
|
|
|
|
enable_printing = true;
|
|
|
|
angle_enable_vulkan_validation_layers = false;
|
|
|
|
dawn_enable_vulkan_validation_layers = false;
|
|
|
|
enable_pseudolocales = false;
|
|
|
|
allow_runtime_configurable_key_storage = true;
|
|
|
|
enable_cet_shadow_stack = false;
|
|
|
|
is_cfi = false;
|
|
|
|
use_qt = false;
|
|
|
|
|
|
|
|
enable_widevine = false;
|
|
|
|
use_perfetto_client_library = false;
|
|
|
|
enable_check_raw_ptr_fields = false;
|
2023-12-02 14:37:25 +00:00
|
|
|
} // lib.optionalAttrs (lib.versionAtLeast info.version "27") {
|
2023-10-10 08:35:26 +00:00
|
|
|
override_electron_version = info.version;
|
2023-09-27 02:35:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-12-19 20:40:08 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2023-09-27 02:35:46 +00:00
|
|
|
mkdir -p $libExecPath
|
|
|
|
unzip -d $libExecPath out/Release/dist.zip
|
2023-12-19 20:40:08 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2023-09-27 02:35:46 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit info;
|
|
|
|
headers = stdenv.mkDerivation rec {
|
2023-12-20 12:27:33 +00:00
|
|
|
name = "node-v${info.node}-headers.tar.gz";
|
2023-09-27 02:35:46 +00:00
|
|
|
nativeBuildInputs = [ python3 ];
|
|
|
|
src = fetchdep info.deps."src/third_party/electron_node";
|
|
|
|
buildPhase = ''
|
2023-12-19 20:40:08 +00:00
|
|
|
runHook preBuild
|
2023-09-27 02:35:46 +00:00
|
|
|
make tar-headers
|
2023-12-19 20:40:08 +00:00
|
|
|
runHook postBuild
|
2023-09-27 02:35:46 +00:00
|
|
|
'';
|
|
|
|
installPhase = ''
|
2023-12-19 20:40:08 +00:00
|
|
|
runHook preInstall
|
2023-09-27 02:35:46 +00:00
|
|
|
mv ${name} $out
|
2023-12-19 20:40:08 +00:00
|
|
|
runHook postInstall
|
2023-09-27 02:35:46 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Cross platform desktop application shell";
|
|
|
|
homepage = "https://github.com/electron/electron";
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ yuka ];
|
|
|
|
mainProgram = "electron";
|
|
|
|
hydraPlatforms = lib.optionals (!(hasInfix "alpha" info.version) && !(hasInfix "beta" info.version)) ["aarch64-linux" "x86_64-linux"];
|
|
|
|
timeout = 172800; # 48 hours (increased from the Hydra default of 10h)
|
|
|
|
};
|
|
|
|
})
|