# RPM spec file for Theia IDE # Theia IDE is an Electron-based modern IDE built on the Theia Platform # # This package bundles its Node.js dependencies as it's an Electron application # that cannot use system-installed Node.js modules. # # To generate sources: # ./theia-ide-generate-tarball.sh %{version} # # This RPM build uses the same dependency bundling mechanism as the flatpak build: # - flatpak-node-generator reads yarn.lock and generates a list of all dependencies # - The tarball generation script downloads all deps and bundles them into a tarball # - The build extracts this tarball and proceeds offline # # This approach is simpler and more maintainable than manually creating yarn caches. # # Reference: https://docs.fedoraproject.org/en-US/packaging-guidelines/Node.js/ %global debug_package %{nil} %global __strip /bin/true %global _missing_build_ids_terminate_build 0 # Filter out provides from bundled Electron libraries to avoid polluting # the system package database with internal Electron symbols. %global __provides_exclude_from %{_libdir}/%{name}/.* # Filter out auto-detected requires for libraries bundled within Electron. # These are shipped inside the Electron distribution and should not create # dependencies on system packages. %global __requires_exclude ^lib(ffmpeg|EGL|GLESv2|vk_swiftshader|vulkan) # Filter out interpreter requirements for Node.js since it's bundled in Electron %global __requires_exclude_from ^%{_libdir}/%{name}/.* # Main runtime dependency versions (from package.json) %global theia_version 1.67.0 %global electron_version 38.4.0 Name: theia-ide Version: 1.67.100 Release: 2%{?dist} Summary: A modern and open IDE built on the Theia Platform License: MIT AND EPL-2.0 URL: https://theia-ide.org # Source0: Main application source # To download: spectool -g theia-ide.spec Source0: https://github.com/eclipse-theia/theia-ide/archive/v%{version}/%{name}-%{version}.tar.gz # Source1: Bundled plugins (VSIX extensions) # Source2: Bundled node dependencies and electron binaries # Source3: Dependency metadata (generated sources JSON) # Generated by: ./theia-ide-generate-tarball.sh Source1: %{name}-plugins-%{version}.tar.xz Source2: %{name}-deps-%{version}.tar.xz Source3: %{name}-deps-%{version}.json # Patch to configure electron-builder to build unpacked directory # Same patch used by flatpak build Patch0: electron-builder.patch ExclusiveArch: x86_64 aarch64 # Build dependencies BuildRequires: nodejs >= 20 BuildRequires: nodejs-devel >= 20 BuildRequires: nodejs-npm BuildRequires: yarnpkg BuildRequires: python3 BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make BuildRequires: git-core BuildRequires: libsecret-devel BuildRequires: libX11-devel BuildRequires: libxkbfile-devel BuildRequires: desktop-file-utils BuildRequires: libappstream-glib BuildRequires: unzip # Runtime dependencies # Note: Many dependencies are auto-detected by RPM from the Electron binary. # We only list additional dependencies not auto-detected, plus dependencies # needed for Theia-specific functionality. # # Core Electron dependencies (auto-detected via .so linkage): # gtk3, nss, nspr, alsa-lib, libdrm, mesa-libgbm, at-spi2-core, # cups-libs, libX*, libxkbcommon, pango, cairo, etc. # # Additional dependencies: Requires: libsecret%{?_isa} Requires: libxkbfile%{?_isa} Requires: hicolor-icon-theme # For Wayland support Requires: libxkbcommon%{?_isa} # Bundled dependencies - Electron and Theia framework # This is an Electron application which bundles Node.js and Chromium Provides: bundled(electron) = %{electron_version} Provides: bundled(nodejs) = 22 Provides: bundled(chromium) # Theia framework components Provides: bundled(npm(@theia/core)) = %{theia_version} Provides: bundled(npm(@theia/editor)) = %{theia_version} Provides: bundled(npm(@theia/filesystem)) = %{theia_version} Provides: bundled(npm(@theia/navigator)) = %{theia_version} Provides: bundled(npm(@theia/terminal)) = %{theia_version} Provides: bundled(npm(@theia/monaco)) = %{theia_version} Provides: bundled(npm(@theia/debug)) = %{theia_version} Provides: bundled(npm(@theia/git)) = %{theia_version} Provides: bundled(npm(@theia/scm)) = %{theia_version} Provides: bundled(npm(@theia/plugin-ext)) = %{theia_version} Provides: bundled(npm(@theia/plugin-ext-vscode)) = %{theia_version} %description The Theia IDE is a modern IDE built on the Theia Platform. The Theia IDE is built upon the highly modular Theia platform, enabling the integration of custom extensions and the creation of fully tailored tools. It supports the VS Code extension API, making it compatible with many VS Code extensions from the Open VSX Registry. Features: - Full VS Code Extension compatibility via Open VSX - Language Server Protocol (LSP) support - Debug Adapter Protocol (DAP) support - Built-in Git support - Integrated terminal - AI-assisted coding features - Remote development support Note: This package bundles Electron and its dependencies as required for Electron applications per Fedora packaging guidelines. %prep %autosetup -n theia-ide-%{version} -p1 # Extract plugins tar -xf %{SOURCE1} mv %{name}-plugins-%{version} plugins # Extract bundled dependencies # This tarball was created by flatpak-node-generator (same as flatpak build) tar -xf %{SOURCE2} # Copy dependency metadata for shell command execution cp %{SOURCE3} . # Configure yarn to use the extracted dependencies # The deps tarball contains: # - flatpak-node/yarn-mirror: yarn packages # - flatpak-node/cache/electron: electron binaries cat > .yarnrc << 'EOF' --install.frozen-lockfile true --install.offline true --run.offline true yarn-offline-mirror ./theia-ide-deps-%{version}/flatpak-node/yarn-mirror disable-self-update-check true EOF # Execute shell commands from generated sources to set up electron cache structure # These create symlinks and directories needed for offline electron downloads if [ -f "%{name}-deps-%{version}.json" ]; then python3 << 'PYEOF' import json import os import subprocess from pathlib import Path # Get build directory build_root = Path.cwd() # Read generated sources json_file = list(build_root.glob("*-deps-*.json"))[0] with open(json_file) as f: sources = json.load(f) # Get deps directory name deps_dir = json_file.stem # e.g., "theia-ide-deps-1.67.100" # Get current architecture for filtering import platform current_arch = platform.machine() arch_map = { 'x86_64': 'x86_64', 'aarch64': 'aarch64', } rpm_arch = arch_map.get(current_arch, current_arch) # Execute shell commands to set up cache structure for source in sources: if source.get("type") == "shell": # Check architecture filter only_arches = source.get("only-arches", []) if only_arches and rpm_arch not in only_arches: continue # Skip this command for other architectures dest = source.get("dest", "") commands = source.get("commands", []) if dest and commands: dest_path = build_root / deps_dir / dest dest_path.mkdir(parents=True, exist_ok=True) for cmd in commands: subprocess.run(cmd, shell=True, check=True, cwd=dest_path) PYEOF fi # Make git dependencies available to yarn by fixing repository state # Yarn cache expects git repos to be on a branch, not detached HEAD for gitrepo in theia-ide-deps-%{version}/flatpak-node/tmp/node-gyp-*; do if [ -d "$gitrepo/.git" ]; then pushd "$gitrepo" > /dev/null # Check if we're in detached HEAD state if ! git symbolic-ref -q HEAD > /dev/null; then # Get the current commit hash commit=$(git rev-parse HEAD) # Try to find an existing branch pointing to this commit branch=$(git branch -a --contains "$commit" | grep -v 'HEAD detached' | head -n1 | sed 's/^[* ]*//' | sed 's/remotes\/origin\///') if [ -z "$branch" ]; then # No branch found, create one branch="offline-build" git checkout -b "$branch" else # Found a branch, check it out git checkout "$branch" 2>/dev/null || git checkout -b "$branch" fi fi popd > /dev/null fi done # Also fix any git repos in the yarn cache for gitrepo in theia-ide-deps-%{version}/flatpak-node/cache/yarn/v6/.tmp/*; do if [ -d "$gitrepo/.git" ]; then pushd "$gitrepo" > /dev/null if ! git symbolic-ref -q HEAD > /dev/null; then commit=$(git rev-parse HEAD) branch=$(git branch -a --contains "$commit" | grep -v 'HEAD detached' | head -n1 | sed 's/^[* ]*//' | sed 's/remotes\/origin\///') if [ -z "$branch" ]; then branch="offline-build" git checkout -b "$branch" else git checkout "$branch" 2>/dev/null || git checkout -b "$branch" fi fi popd > /dev/null fi done %build # Build environment setup - same as flatpak build export NODE_OPTIONS="--max-old-space-size=8192" export PUPPETEER_SKIP_DOWNLOAD=true export npm_config_offline=true export npm_config_nodedir=/usr # Prevent any network access export ELECTRON_SKIP_NOTARIZATION=1 export npm_config_prefer_offline=true # Point to extracted electron cache # Electron will find the zip files here and extract them without downloading export XDG_CACHE_HOME=$PWD/theia-ide-deps-%{version}/flatpak-node/cache export electron_config_cache=$PWD/theia-ide-deps-%{version}/flatpak-node/cache/electron export TMPDIR=$PWD/theia-ide-deps-%{version}/flatpak-node/tmp mkdir -p "$TMPDIR" # Set compiler flags per Fedora guidelines for native modules export CXXFLAGS="%{optflags}" export CFLAGS="%{optflags}" export LDFLAGS="%{?__global_ldflags}" # Remove browser application (only building electron app) rm -rf applications/browser # Configure git to use local clones instead of fetching from network # This redirects git URLs to the local repositories extracted from the deps tarball for gitrepo in theia-ide-deps-%{version}/flatpak-node/tmp/node-gyp-*; do if [ -d "$gitrepo/.git" ]; then commit=$(basename "$gitrepo" | sed 's/node-gyp-//') # Configure git URL rewriting to use local clone git config --global url."file://$(pwd)/$gitrepo/.git".insteadOf "https://github.com/electron/node-gyp" fi done # Install dependencies from offline mirror yarn install # Build the application yarn run build # Package the electron application yarn run package:applications:prod %install install -d %{buildroot}%{_libdir}/%{name} install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_datadir}/applications install -d %{buildroot}%{_datadir}/icons/hicolor/512x512/apps install -d %{buildroot}%{_datadir}/metainfo install -d %{buildroot}%{_datadir}/pixmaps # Install application files from electron-builder output # electron-builder outputs to different directories based on architecture: # x86_64: dist/linux-unpacked # aarch64: dist/linux-arm64-unpacked %ifarch x86_64 cp -a applications/electron/dist/linux-unpacked/* %{buildroot}%{_libdir}/%{name}/ %endif %ifarch aarch64 cp -a applications/electron/dist/linux-arm64-unpacked/* %{buildroot}%{_libdir}/%{name}/ %endif # Install bundled plugins - extract VSIXs since Theia expects directories install -d %{buildroot}%{_libdir}/%{name}/resources/app/plugins for vsix in plugins/*.vsix; do [ -f "$vsix" ] || continue pluginname=$(basename "$vsix" .vsix) mkdir -p "%{buildroot}%{_libdir}/%{name}/resources/app/plugins/${pluginname}" unzip -q "$vsix" -d "%{buildroot}%{_libdir}/%{name}/resources/app/plugins/${pluginname}" done # Create launcher script cat > %{buildroot}%{_bindir}/%{name} << 'EOF' #!/usr/bin/bash # Theia IDE launcher THEIA_PATH="%{_libdir}/%{name}" export LD_LIBRARY_PATH="${THEIA_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" exec "${THEIA_PATH}/theia-ide-electron-app" \ --ozone-platform-hint=auto \ "$@" EOF chmod 0755 %{buildroot}%{_bindir}/%{name} # Create desktop file cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << 'EOF' [Desktop Entry] Categories=Development;IDE; Keywords=Code;Eclipse;Editor;Programming;Text;VSCode; Comment=A modern and open IDE Exec=theia-ide %F Icon=org.eclipse.theia Name=Theia IDE Terminal=false Type=Application Version=1.0 EOF # Create metainfo file cat > %{buildroot}%{_datadir}/metainfo/%{name}.metainfo.xml << 'EOF' org.eclipse.theia Theia IDE A modern and open IDE MIT MIT Eclipse Foundation #8ff0a4 #865e3c

The Theia IDE is a modern IDE built on the Theia Platform.

The Theia IDE is built upon the highly modular Theia platform, enabling the integration of custom extensions and the creation of fully tailored tools. It supports the VSCode API, thus it is compatible with most of the VSCode addons.

mild keyboard pointing 768 https://github.com/eclipse-theia/theia-ide/issues https://theia-ide.org https://github.com/eclipse-theia/theia-ide theia-ide.desktop https://theia-ide.org/static/theia-screenshot-1523502d52358dd40d381c7f2969c9d0.png
EOF # Create theia symlink as alias for theia-ide ln -s %{_bindir}/%{name} %{buildroot}%{_bindir}/theia # Install icon (preserve upstream naming) install -Dm0644 applications/electron/resources/icons/LinuxLauncherIcons/512x512.png \ %{buildroot}%{_datadir}/icons/hicolor/512x512/apps/org.eclipse.theia.png # Symlink for pixmaps ln -s %{_datadir}/icons/hicolor/512x512/apps/org.eclipse.theia.png \ %{buildroot}%{_datadir}/pixmaps/org.eclipse.theia.png %check desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/%{name}.metainfo.xml %post /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : /usr/bin/update-desktop-database &>/dev/null || : %postun if [ $1 -eq 0 ]; then /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : fi /usr/bin/update-desktop-database &>/dev/null || : %posttrans /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %files %license LICENSE %doc README.md CONTRIBUTING.md %{_bindir}/%{name} %{_bindir}/theia %{_libdir}/%{name}/ %{_datadir}/applications/%{name}.desktop %{_datadir}/metainfo/%{name}.metainfo.xml %{_datadir}/icons/hicolor/*/apps/org.eclipse.theia.png %{_datadir}/pixmaps/org.eclipse.theia.png %changelog %autochangelog