From c1f6ed7c67d3e1d1f9ed742e448209d7fac9811d Mon Sep 17 00:00:00 2001 From: windowsboy111 Date: Fri, 10 Feb 2023 22:41:07 +0800 Subject: [PATCH] add: electron Signed-off-by: windowsboy111 --- anda/tools/electron/.gitignore | 3 - .../tools/electron/{anda.hcl.bak => anda.hcl} | 0 anda/tools/electron/electron.spec | 51 +++++ anda/tools/electron/electron.spec.bak | 214 ------------------ anda/tools/electron/update.rhai | 1 + 5 files changed, 52 insertions(+), 217 deletions(-) delete mode 100644 anda/tools/electron/.gitignore rename anda/tools/electron/{anda.hcl.bak => anda.hcl} (100%) create mode 100644 anda/tools/electron/electron.spec delete mode 100644 anda/tools/electron/electron.spec.bak create mode 100644 anda/tools/electron/update.rhai diff --git a/anda/tools/electron/.gitignore b/anda/tools/electron/.gitignore deleted file mode 100644 index e67aec3ff4..0000000000 --- a/anda/tools/electron/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*/ - -*.tar.* \ No newline at end of file diff --git a/anda/tools/electron/anda.hcl.bak b/anda/tools/electron/anda.hcl similarity index 100% rename from anda/tools/electron/anda.hcl.bak rename to anda/tools/electron/anda.hcl diff --git a/anda/tools/electron/electron.spec b/anda/tools/electron/electron.spec new file mode 100644 index 0000000000..614c3b6e10 --- /dev/null +++ b/anda/tools/electron/electron.spec @@ -0,0 +1,51 @@ +%define debug_package %{nil} +%ifarch x86_64 +%global garch x64 +%elifarch aarch64 +%global garch arm64 +%endif + +Name: electron +Version: 20.3.12 +Release: 1 +Summary: Build cross platform desktop apps with web technologies +License: MIT +URL: https://electronjs.org/ +Source0: https://github.com/electron/electron/releases/download/v%{version}/chromedriver-v%{version}-linux-%{garch}.zip +Source1: https://github.com/electron/electron/releases/download/v%{version}/electron-v%{version}-linux-%{garch}.zip +Requires: c-ares ffmpeg gtk3 libevent libxslt minizip nss re2 +BuildRequires: unzip + +%description +The Electron framework lets you write cross-platform desktop applications using JavaScript, HTML and CSS. It is based on Node.js and Chromium and is used by the Atom editor and many other apps. + +%prep +unzip %{SOURCE0} +unzip -o %{SOURCE1} + +%build + +%install +install -dm755 %{buildroot}/usr/lib/%{name}/ +find . -mindepth 1 -maxdepth 1 -type f ! -name "*.zip" ! -name "LICENSE*" -exec cp -r --no-preserve=ownership --preserve=mode -t %{buildroot}/usr/lib/%{name}/. {} + + +for _folder in 'locales' 'resources'; do + cp -r --no-preserve=ownership --preserve=mode "${_folder}/" %{buildroot}/usr/lib/%{name}/${_folder}/ +done + +chmod u+s %{buildroot}/usr/lib/%{name}/chrome-sandbox + +install -dm755 %{buildroot}/usr/bin +ln -nfs /usr/lib/%{name}/%{name} %{buildroot}/usr/bin/%{name} + + +%files +%license LICENSE +%license LICENSES.chromium.html +/usr/lib/electron +/usr/bin/electron + + +%changelog +* Fri Feb 10 2023 windowsboy111 +- Initial package diff --git a/anda/tools/electron/electron.spec.bak b/anda/tools/electron/electron.spec.bak deleted file mode 100644 index 2f6e613382..0000000000 --- a/anda/tools/electron/electron.spec.bak +++ /dev/null @@ -1,214 +0,0 @@ -%global DEPOT_COMMIT 1f511020737b695f4cbb3260fdaef78a29acdd35 -%global commit d010bcca8659825705dd34061d7e1bfc7ea81934 - -%global builddir out/Release -%global headlessbuilddir out/Headless -%global remotingbuilddir out/Remoting - -%global _chromiumver 109.0.5375.1 -Name: electron -Version: 20.3.3 -Release: %autorelease -Summary: Build cross-platform desktop apps with JavaScript, HTML, and CSS -URL: https://electronjs.org -# Source0: https://chromium.googlesource.com/chromium/src.git/+archive/refs/tags/%{_chromiumver}.tar.gz -# Source0: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%{_chromiumver}.tar.xz -Source0: https://github.com/electron/electron/archive/refs/tags/v%{version}.tar.gz -Source1: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+archive/%{DEPOT_COMMIT}.tar.gz - -# nodejs source -Source3: https://github.com/nodejs/node/archive/refs/tags/v19.0.0.tar.gz - -Requires: ffmpeg gtk3 libevent libxslt minizip nss re2 snappy c-ares -License: MIT -BuildRequires: clang -BuildRequires: dbus-devel -BuildRequires: gperf -BuildRequires: gtk3-devel -BuildRequires: libnotify-devel -BuildRequires: libgnome-keyring-devel -BuildRequires: libcap-devel -BuildRequires: cups-devel -BuildRequires: libXtst-devel -BuildRequires: alsa-lib-devel -BuildRequires: libXrandr-devel -BuildRequires: nss-devel -BuildRequires: python-dbusmock -BuildRequires: git-core -BuildRequires: python3.7 -BuildRequires: python3-httplib2 -BuildRequires: nodejs -BuildRequires: libcxx-devel -BuildRequires: libcxxabi-devel -BuildRequires: gcc-c++ - -BuildRequires: alsa-lib-devel -BuildRequires: atk-devel -BuildRequires: bison -BuildRequires: cups-devel -BuildRequires: dbus-devel -BuildRequires: desktop-file-utils -BuildRequires: expat-devel -BuildRequires: flex -BuildRequires: fontconfig-devel -BuildRequires: glib2-devel -BuildRequires: glibc-devel -BuildRequires: gperf -BuildRequires: libusb-compat-0.1-devel -BuildRequires: libutempter-devel -BuildRequires: libXdamage-devel -BuildRequires: libXtst-devel -BuildRequires: xcb-proto -BuildRequires: mesa-libgbm-devel - -BuildRequires: libstdc++-static -BuildRequires: libstdc++-devel, openssl-devel -BuildRequires: bzip2-devel -BuildRequires: dbus-glib-devel -BuildRequires: elfutils -BuildRequires: elfutils-libelf-devel -BuildRequires: flac-devel -BuildRequires: libva-devel -%description -The Electron framework lets you write cross-platform desktop applications using JavaScript, HTML and CSS. It is based on Node.js and Chromium and is used by the Atom editor and many other apps. - -%prep -%setup -q -T -c -n depot_tools -a 1 -#git clone --depth 1 https://chromium.googlesource.com/chromium/src.git --branch %_chromiumver %{_builddir}/chromium-%{_chromiumver} -# %%autosetup -c chromium-%{_chromiumver} -p1 -v - -# pushd %{_builddir}/chromium-%{_chromiumver} - -# # git checkout %{_chromiumver} - -# # export PATH=%{_builddir}/depot_tools:$PATH -# # mkdir -p %{_builddir}/electron -# # pushd %{_builddir}/electron - -# mkdir -p electron -# tar -xvf %{SOURCE1} --strip-components=1 -C electron - - - -# popd - -cd %{_builddir} -echo $PWD -#%{_builddir}/depot_tools/gclient config -v --name "src" --unmanaged https://chromium.googlesource.com/chromium/src -#%{_builddir}/depot_tools/gclient sync --force -v --nohooks --shallow --deps=linux -%{_builddir}/depot_tools/gclient config -vvv --name "src/electron" --unmanaged https://github.com/electron/electron@%{version} -%{_builddir}/depot_tools/gclient sync --force -vvv --nohooks --with_branch_heads --with_tags --deps=linux - -#mkdir -p third_party/electron_node -#tar -xvf %{SOURCE3} --strip-components=1 -C third_party/electron_node - - -%build -cd %{_builddir}/src - - -# build/landmines.py -# build/util/lastchange.py -o build/util/LASTCHANGE -# electron/script/apply_all_patches.py \ -# electron/patches/config.json - -export CC="gcc" -export CXX="g++" -export AR="ar" -export RANLIB="ranlib" -# gclient sync -f -v - -export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools - -build/landmines.py -build/util/lastchange.py -o build/util/LASTCHANGE - -%{_builddir}/depot_tools/download_from_google_storage.py \ - --no_resume --extract --no_auth --bucket chromium-nodejs \ - -s third_party/node/node_modules.tar.gz.sha1 - -CHROMIUM_CORE_GN_DEFINES="" -CHROMIUM_CORE_GN_DEFINES+=' is_debug=false dcheck_always_on=false dcheck_is_configurable=false' -%ifarch x86_64 aarch64 -CHROMIUM_CORE_GN_DEFINES+=' system_libdir="lib64"' -%endif -#CHROMIUM_CORE_GN_DEFINES+=' ffmpeg_branding="ChromeOS" proprietary_codecs=true' -CHROMIUM_CORE_GN_DEFINES+=' use_custom_libcxx=false' -CHROMIUM_CORE_GN_DEFINES+=' enable_ppapi=true' -CHROMIUM_CORE_GN_DEFINES+=' is_clang=false use_sysroot=false disable_fieldtrial_testing_config=true use_lld=false rtc_enable_symbol_export=true' -#CHROMIUM_CORE_GN_DEFINES+=' exec_script_whitelist=exec_script_whitelist+["//electron/BUILD.gn"]' -# allow //electron to use exec_script -echo ' + ["//electron/BUILD.gn"]' >> .gn - -# remove first line of .gn -# sed -i '1d' .gn -# sed -i 's|import("//third_party/angle/dotfile_settings.gni")||g' .gn -# sed -i 's|angle_dotfile_settings.exec_script_whitelist +||g' .gn - -# CHROMIUM_CORE_GN_DEFINES+=' is_official_build=true use_thin_lto=false is_cfi=false chrome_pgo_phase=0 use_debug_fission=true' -#sed -i 's|OFFICIAL_BUILD|GOOGLE_CHROME_BUILD|g' tools/generate_shim_headers/generate_shim_headers.py - -export CHROMIUM_CORE_GN_DEFINES - - -CHROMIUM_BROWSER_GN_DEFINES="" -CHROMIUM_BROWSER_GN_DEFINES+=' use_gio=true use_pulseaudio=true icu_use_data_file=true' -CHROMIUM_BROWSER_GN_DEFINES+=' enable_nacl=false' -CHROMIUM_BROWSER_GN_DEFINES+=' enable_widevine=true' -CHROMIUM_BROWSER_GN_DEFINES+=' use_vaapi=true' - -export CHROMIUM_BROWSER_GN_DEFINES - -mkdir -p third_party/node/linux/node-linux-x64/bin -ln -sf %{_bindir}/node third_party/node/linux/node-linux-x64/bin/node - -sed -i 's|arm-linux-gnueabihf-|arm-linux-gnu-|g' build/toolchain/linux/BUILD.gn - -%ifarch aarch64 -# We don't need to cross compile while building on an aarch64 system. -sed -i 's|aarch64-linux-gnu-||g' build/toolchain/linux/BUILD.gn - -# Correct the ninja file to check for aarch64, not just x86. -sed -i '/${LONG_BIT}/ a \ aarch64)\' ../depot_tools/ninja -sed -i '/aarch64)/ a \ exec "/usr/bin/ninja-build" "$@";;\' ../depot_tools/ninja -%endif - -# Get rid of the pre-built eu-strip binary, it is x86_64 and of mysterious origin -rm -rf buildtools/third_party/eu-strip/bin/eu-strip -# Replace it with a symlink to the Fedora copy -ln -sf %{_bindir}/eu-strip buildtools/third_party/eu-strip/bin/eu-strip - -# is_mas_build fails to build and we're not on a mac -sed -i 's|is_mas_build|is_mac|g' electron/BUILD.gn -sed -i 's|enable_ppapi|true|g' electron/BUILD.gn -# tools/gn/bootstrap/bootstrap.py -v --no-clean --gn-gen-args="$CHROMIUM_CORE_GN_DEFINES $CHROMIUM_BROWSER_GN_DEFINES $GN_EXTRA_ARGS" -mkdir -p %{builddir} -ln -sf /usr/bin/gn buildtools/linux64/gn -gn --script-executable=/usr/bin/python3 gen --args="import(\"//electron/build/args/release.gn\") $CHROMIUM_CORE_GN_DEFINES $CHROMIUM_BROWSER_GN_DEFINES $GN_EXTRA_ARGS" %{builddir} - - - -export PATH=%{_builddir}/depot_tools:$PATH -# ln -s /usr/bin/python3.7 /usr/bin/python -# cd src/electron -export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools -export CC="gcc" -export CXX="g++" -export AR="ar" -export RANLIB="ranlib" - -# gn gen %{builddir} --args="import(\"//electron/build/args/release.gn\")" -ninja -C %{builddir} electron - -%install -electron/script/strip-binaries.py -d out/Release -install electron ./out/Release/electron - -%files -%{_bindir}/electron -%doc electron/src/README.md -%license electron/src/LICENSE - -%changelog -* Sun Oct 23 2022 windowsboy111 -- Initial package diff --git a/anda/tools/electron/update.rhai b/anda/tools/electron/update.rhai new file mode 100644 index 0000000000..97c1feda97 --- /dev/null +++ b/anda/tools/electron/update.rhai @@ -0,0 +1 @@ +print(gh("electron/electron"));