feat: switch to /usr layout and add dynamic dependency detection
- Move binaries to /usr/bin and /usr/libexec for system integration - Add find-deps.sh script to detect required system packages from .so files - Update Makefile to generate Depends field dynamically using apt-file - Add list-deps target to Makefile for dependency analysis - Update README with new usage, features, and instructions - Update CI workflow to install apt-file and update its database
This commit is contained in:
172
README.md
172
README.md
@@ -1,122 +1,118 @@
|
||||
# Zed Editor Packager
|
||||
# Zed Packager
|
||||
|
||||
Automated packaging system for [Zed Editor](https://zed.dev/) for Debian/Ubuntu.
|
||||
|
||||
## Description
|
||||
|
||||
This project automatically creates `.deb` packages of Zed Editor from official GitHub releases and publishes them to a Gitea repository.
|
||||
A Makefile-based tool to package Zed editor as a Debian/Ubuntu package with dynamic dependency detection.
|
||||
|
||||
## Features
|
||||
|
||||
- **Automatic version detection**: Fetches the latest stable version from GitHub
|
||||
- **DEB package building**: Creates a ready-to-install Debian package
|
||||
- **CI/CD with Gitea Actions**: Automated workflow that:
|
||||
- Checks daily for new versions
|
||||
- Builds the package only if a new version is available
|
||||
- Creates a Gitea release with the package
|
||||
- Publishes the package to the Gitea Debian repository
|
||||
- **Automatic downloads** latest Zed release from GitHub
|
||||
- **Dynamic dependency detection** using `apt-file` to find required system packages
|
||||
- **System libraries** instead of bundled libraries for better integration
|
||||
- **Proper installation** with maintainer scripts for icon cache updates
|
||||
|
||||
## Local Usage
|
||||
|
||||
### Prerequisites
|
||||
## Prerequisites
|
||||
|
||||
```bash
|
||||
sudo apt-get install wget curl jq dpkg-dev
|
||||
sudo apt install wget jq dpkg-dev apt-file
|
||||
sudo apt-file update
|
||||
```
|
||||
|
||||
### Manual Building
|
||||
## Usage
|
||||
|
||||
### Build the package
|
||||
|
||||
```bash
|
||||
# Build the package
|
||||
make
|
||||
```
|
||||
|
||||
# Or step by step
|
||||
make download # Download the archive
|
||||
make extract # Extract the archive
|
||||
make deb # Create the .deb package
|
||||
This will:
|
||||
1. Download the latest Zed release
|
||||
2. Extract the archive
|
||||
3. Analyze bundled libraries to detect system dependencies
|
||||
4. Create a `.deb` package with dynamic dependencies
|
||||
|
||||
# Clean up
|
||||
### List dependencies
|
||||
|
||||
To see what system packages are needed:
|
||||
|
||||
```bash
|
||||
make list-deps
|
||||
```
|
||||
|
||||
This will show a detailed analysis of each `.so` library and its corresponding Debian/Ubuntu package.
|
||||
|
||||
### Install the package
|
||||
|
||||
```bash
|
||||
sudo dpkg -i build/zed-editor_*.deb
|
||||
sudo apt-get install -f # Install missing dependencies if any
|
||||
```
|
||||
|
||||
### Clean up
|
||||
|
||||
```bash
|
||||
make clean
|
||||
```
|
||||
|
||||
### Installation
|
||||
## How it works
|
||||
|
||||
### Dynamic Dependency Detection
|
||||
|
||||
The `find-deps.sh` script analyzes the `.so` files bundled with Zed and uses `apt-file` to find the corresponding Debian/Ubuntu packages. This ensures dependencies are always up-to-date.
|
||||
|
||||
**Script usage:**
|
||||
|
||||
```bash
|
||||
# Install the locally created package
|
||||
sudo dpkg -i build/zed-editor_*.deb
|
||||
# Human-readable output
|
||||
./find-deps.sh /path/to/zed.app/lib
|
||||
|
||||
# Machine-readable formats
|
||||
./find-deps.sh --format makefile /path/to/zed.app/lib # Comma-separated
|
||||
./find-deps.sh --format list /path/to/zed.app/lib # One per line
|
||||
|
||||
# Quiet mode (no progress messages)
|
||||
./find-deps.sh --quiet --format makefile /path/to/zed.app/lib
|
||||
```
|
||||
|
||||
## Gitea Workflow
|
||||
### Makefile Integration
|
||||
|
||||
The [`.gitea/workflows/build-and-release.yml`](.gitea/workflows/build-and-release.yml) workflow runs:
|
||||
The Makefile automatically calls `find-deps.sh` during package creation to generate the `Depends:` field in the control file. This means:
|
||||
|
||||
- **Automatically**: Every day at 2 AM (cron)
|
||||
- **Manually**: Via the Gitea interface (workflow_dispatch)
|
||||
- **On push**: On every push to the `main` branch
|
||||
- ✅ Dependencies are always detected from actual bundled libraries
|
||||
- ✅ Works with any Zed version
|
||||
- ✅ No manual maintenance required
|
||||
|
||||
### Required Configuration
|
||||
|
||||
To publish to the Gitea Debian repository, create a `PACKAGE_PUB_TOKEN` secret:
|
||||
|
||||
1. Generate a personal access token on Gitea with package permissions
|
||||
2. Add it as a secret in the repository settings: `PACKAGE_PUB_TOKEN`
|
||||
|
||||
### Workflow Behavior
|
||||
|
||||
1. **Version check**: Compares the latest GitHub version with the latest Gitea release
|
||||
2. **Early exit**: If versions match, the workflow stops immediately
|
||||
3. **Build**: If a new version is detected, builds the .deb package
|
||||
4. **Publishing**:
|
||||
- Creates a Gitea release with the version tag
|
||||
- Uploads the .deb file to the release assets
|
||||
- Publishes the package to the Gitea Debian repository
|
||||
|
||||
## Package Structure
|
||||
|
||||
The package installs Zed in the following locations:
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
/opt/zed/ # Main application
|
||||
/opt/zed/bin/zed # Main binary
|
||||
/opt/zed/libexec/zed-editor # Editor binary
|
||||
/opt/zed/lib/ # Shared libraries
|
||||
/usr/bin/zed # Symbolic link
|
||||
/usr/share/applications/zed.desktop # Desktop file
|
||||
/usr/share/icons/hicolor/*/apps/zed.png # Icons
|
||||
.
|
||||
├── Makefile # Main build system
|
||||
├── find-deps.sh # Dynamic dependency detection script
|
||||
└── build/
|
||||
├── extracted/ # Extracted Zed archive
|
||||
├── deb/ # Package staging directory
|
||||
└── zed-editor_*.deb # Final package
|
||||
```
|
||||
|
||||
## Installation from Gitea Repository
|
||||
## Available Make Targets
|
||||
|
||||
Once the repository is configured:
|
||||
| Target | Description |
|
||||
|--------------|------------------------------------------|
|
||||
| `all` | Build the .deb package (default) |
|
||||
| `download` | Download the archive from GitHub |
|
||||
| `extract` | Extract the archive |
|
||||
| `deb` | Create the .deb package |
|
||||
| `list-deps` | List dynamic library dependencies |
|
||||
| `clean` | Clean up temporary files |
|
||||
| `help` | Display help |
|
||||
|
||||
```bash
|
||||
# Add the repository (adapt according to your Gitea instance)
|
||||
echo "deb https://git.rawleenc.dev/api/packages/YOUR_USERNAME/debian stable main" | sudo tee /etc/apt/sources.list.d/zed-editor.list
|
||||
## Package Details
|
||||
|
||||
# Install
|
||||
sudo apt update
|
||||
sudo apt install zed-editor
|
||||
```
|
||||
|
||||
## Makefile
|
||||
|
||||
The Makefile supports the following targets:
|
||||
|
||||
| Target | Description |
|
||||
|------------|---------------------------------------------|
|
||||
| `all` | Build the complete package (default target) |
|
||||
| `download` | Download the archive from GitHub |
|
||||
| `extract` | Extract the archive |
|
||||
| `deb` | Create the .deb package |
|
||||
| `clean` | Clean up temporary files |
|
||||
| `help` | Display help |
|
||||
- **Package name:** `zed-editor`
|
||||
- **Installation location:** `/usr/bin/zed`, `/usr/libexec/zed-editor`
|
||||
- **Desktop integration:** Yes (with proper window class binding)
|
||||
- **Icon cache:** Automatically updated via maintainer scripts
|
||||
- **Dependencies:** Dynamically detected from bundled libraries
|
||||
|
||||
## License
|
||||
|
||||
This project is a packaging tool. Zed Editor itself is subject to its own license.
|
||||
|
||||
## Notes
|
||||
|
||||
- The created packages are **unofficial**
|
||||
- Binaries come directly from official Zed releases
|
||||
- The packaging only adds system integration (desktop files, etc.)
|
||||
This packaging tool is provided as-is. Zed editor is subject to its own license terms.
|
||||
|
||||
Reference in New Issue
Block a user