Files
zed-packager/README.md
Rawleenc 0dba8ae99a
All checks were successful
Build and Release Zed Editor / check-version (push) Successful in 3s
Build and Release Zed Editor / build-and-release (push) Successful in 1m21s
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
2025-10-14 11:46:28 +02:00

119 lines
3.3 KiB
Markdown

# Zed Packager
A Makefile-based tool to package Zed editor as a Debian/Ubuntu package with dynamic dependency detection.
## Features
- **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
## Prerequisites
```bash
sudo apt install wget jq dpkg-dev apt-file
sudo apt-file update
```
## Usage
### Build the package
```bash
make
```
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
### 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
```
## 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
# 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
```
### Makefile Integration
The Makefile automatically calls `find-deps.sh` during package creation to generate the `Depends:` field in the control file. This means:
- ✅ Dependencies are always detected from actual bundled libraries
- ✅ Works with any Zed version
- ✅ No manual maintenance required
## Project Structure
```
.
├── 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
```
## Available Make Targets
| 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 |
## Package Details
- **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 packaging tool is provided as-is. Zed editor is subject to its own license terms.