# Package Generation

This project supports generating both Debian (.deb) and RPM (.rpm) packages
using CPack.

## Manual Package Generation

### Prerequisites

- CMake 3.16 or later
- Make or Ninja build system
- For RPM packages: `rpmbuild` utility

### Build Process

1. **Create build directory:**
   ```bash
   mkdir -p build-package
   cd build-package
   ```

2. **Configure with CMake:**
   ```bash
   cmake .. -DCMAKE_BUILD_TYPE=Release
   ```

3. **Build the project:**
   ```bash
   make -j$(nproc)
   ```

4. **Generate packages:**
   ```bash
   cpack -G DEB    # Generate Debian package
   cpack -G RPM    # Generate RPM package (requires rpmbuild)
   ```

### Requirements for RPM Generation

To generate RPM packages, you need `rpmbuild` installed:

- **Ubuntu/Debian**: `sudo apt-get install rpm`
- **CentOS/RHEL**: `sudo yum install rpm-build`
- **Fedora**: `sudo dnf install rpm-build`

### Package Contents

The generated packages include:

- **Main executable**: `/usr/bin/salmanoff`
- **Shared libraries**: `/usr/lib/lib*.so`
- **Device configurations**: `/usr/share/salmanoff/devices/` (preprocessed
  .daps files)
- **Documentation**: `/usr/share/doc/salmanoff/`

### Installing Packages

**Debian/Ubuntu:**
```bash
sudo dpkg -i salmanoff-0.00.004-x86_64.deb
```

**CentOS/RHEL/Fedora:**
```bash
sudo rpm -i salmanoff-0.00.004-x86_64.rpm
```

### Package Configuration

Package metadata and configuration is defined in
`cmake/CPackConfig.cmake`. This includes:

- Package name, version, and description
- Dependencies and recommendations
- License information
- File naming conventions

### Troubleshooting

- **RPM generation fails**: Ensure `rpmbuild` is installed
- **Missing dependencies**: Check that all build dependencies are
  installed
- **Permission errors**: Ensure you have write permissions in the build
  directory
