118 lines
3.2 KiB
Markdown
118 lines
3.2 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 apt install ./build/zed-editor_*.deb
|
|
```
|
|
|
|
### 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.
|