Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/debian-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Debian Package

on:
push:
tags:
- 'v*'

jobs:
debian-buildpackage:
runs-on: ubuntu-24.04

steps:
- name: Derive LLVM version from tag
id: llvm
run: |
TAG="${GITHUB_REF_NAME}"
# Extract major version: v22.1.0-rc1 -> 22
MAJOR="${TAG#v}"
MAJOR="${MAJOR%%.*}"
echo "major=${MAJOR}" >> "$GITHUB_OUTPUT"
echo "Using LLVM ${MAJOR} for tag ${TAG}"

- name: Add LLVM apt repository
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
| sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
CODENAME=$(lsb_release -cs)
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] \
https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${{ steps.llvm.outputs.major }} main" \
| sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update

- name: Install build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
MAJOR=${{ steps.llvm.outputs.major }}
sudo apt-get install -y --no-install-recommends \
build-essential debhelper devscripts lintian fakeroot \
cmake ninja-build python3 zlib1g-dev \
llvm-${MAJOR}-dev libclang-${MAJOR}-dev llvm-${MAJOR}-tools

- name: Checkout eld
uses: actions/checkout@v4

- name: Update changelog version from tag
run: |
TAG="${GITHUB_REF_NAME}"
# v22.1.0-rc1 -> 22.1.0~rc1
VERSION="${TAG#v}"
VERSION="${VERSION//-/\~}"
sed -i "1s/([^)]*)/($VERSION-1)/" debian/changelog

- name: Build source and binary packages
env:
MAJOR: ${{ steps.llvm.outputs.major }}
run: |
dpkg-buildpackage -us -uc -b \
-d \
-j$(nproc)

- name: Verify packages were built
run: |
echo "--- Built packages ---"
ls -lh ../*.deb
echo ""
echo "--- Package contents (eld) ---"
dpkg-deb -c ../eld_*.deb
echo ""
echo "--- Package contents (eld-plugin-dev) ---"
dpkg-deb -c ../eld-plugin-dev_*.deb

- name: Lint packages
run: |
lintian --no-tag-display-limit ../*.deb || true

- name: Clean up
if: always()
run: rm -f ../*.deb ../*.buildinfo ../*.changes
1 change: 1 addition & 0 deletions debian
82 changes: 82 additions & 0 deletions packaging/debian/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Debian Package for ELD

This directory contains the Debian packaging metadata for ELD.

## Files

- `source/format` - Source package format (`3.0 (quilt)`)
- `control` - Source and binary package definitions
- `rules` - Build rules (CMake + Ninja via debhelper)
- `changelog` - Package version history
- `copyright` - DEP-5 formatted license information
- `watch` - Upstream release monitoring for `uscan`
- `eld.install` - File list for the `eld` binary package
- `eld-plugin-dev.install` - File list for the `eld-plugin-dev` headers package
- `eld.docs` - Documentation files shipped with `eld`

## Prerequisites

1. A Debian or Ubuntu system with packaging tools installed:
```bash
sudo apt install build-essential debhelper devscripts lintian
```
2. Build dependencies (installed automatically by `sbuild`, or manually):
```bash
sudo apt install cmake ninja-build llvm-19-dev libclang-19-dev \
llvm-19-tools python3 zlib1g-dev
```

## Building

Since `dpkg-buildpackage` requires `debian/` at the source root, create a
symlink before building:

```bash
cd /path/to/eld
ln -s packaging/debian debian
dpkg-buildpackage -us -uc
```

For a clean chroot build (recommended):

```bash
cd /path/to/eld
ln -s packaging/debian debian
sbuild --no-clean-source
```

## Linting

```bash
# Lint the source package
lintian --info *.dsc

# Lint the binary packages
lintian --info *.deb
```

## Binary Packages

The packaging produces two binary packages:

- **`eld`** — The linker binary, libLW shared library, linker script
templates, and YAMLMapParser utility
- **`eld-plugin-dev`** — Plugin API C++ development headers

## Package Layout

```
/usr/bin/ld.eld # Main linker binary
/usr/bin/YAMLMapParser.py # YAML map file parser
/usr/lib/*/libLW.so* # Plugin API shared library
/usr/share/eld/templates/ # Linker script templates
/usr/include/ELD/PluginAPI/*.h # Plugin development headers (eld-plugin-dev)
/usr/share/doc/eld/About.md # Project documentation
```

## LLVM Version Compatibility

ELD derives its version from LLVM's `PACKAGE_VERSION`. The `debian/rules`
file passes `-DPACKAGE_VERSION=19.0.0` and points to the LLVM 19 CMake
config at `/usr/lib/llvm-19/lib/cmake/llvm`. When updating to a new LLVM
version, update these values along with the Build-Depends in `control`.
5 changes: 5 additions & 0 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
eld (19.0.0-1) unstable; urgency=medium

* Initial release. (Closes: #NNNNNN)

-- Qualcomm ELD Team <eld-maintainers@qualcomm.com> Wed, 12 Feb 2026 00:00:00 +0000
42 changes: 42 additions & 0 deletions packaging/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Source: eld
Section: devel
Priority: optional
Maintainer: Qualcomm ELD Team <eld-maintainers@qualcomm.com>
Build-Depends:
debhelper-compat (= 13),
cmake (>= 3.16),
ninja-build,
llvm-19-dev,
libclang-19-dev,
llvm-19-tools,
python3,
zlib1g-dev,
Standards-Version: 4.6.2
Homepage: https://github.com/qualcomm/eld
Rules-Requires-Root: no

Package: eld
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Embedded Linker for LLVM
ELD is an embedded linker developed by Qualcomm, derived from mclinker.
It operates on ELF files and is tailored to meet the requirements of
the embedded community.
.
The linker supports ARM, AArch64, Hexagon, RISC-V, and X86 targets and
provides mature linker script support with custom extensions, a plugin
infrastructure, and machine-readable map files.
.
This package contains the ld.eld linker binary, the libLW shared library,
linker script templates, and the YAMLMapParser utility.

Package: eld-plugin-dev
Architecture: any
Depends: eld (= ${binary:Version}), ${misc:Depends}
Description: ELD linker plugin development headers
ELD is an embedded linker developed by Qualcomm, derived from mclinker.
It provides a plugin infrastructure that allows users to create custom
passes that run during link time.
.
This package contains the C++ header files needed to develop plugins
for the ELD linker using the PluginAPI.
40 changes: 40 additions & 0 deletions packaging/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: eld
Upstream-Contact: Qualcomm ELD Team <eld-maintainers@qualcomm.com>
Source: https://github.com/qualcomm/eld

Files: *
Copyright: Qualcomm Technologies, Inc. and/or its subsidiaries.
License: BSD-3-Clause

Files: debian/*
Copyright: Qualcomm Technologies, Inc. and/or its subsidiaries.
License: BSD-3-Clause

License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions packaging/debian/eld-plugin-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/include/ELD/PluginAPI/
1 change: 1 addition & 0 deletions packaging/debian/eld.docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
About.md
4 changes: 4 additions & 0 deletions packaging/debian/eld.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
usr/bin/ld.eld
usr/lib/*/libLW.so*
usr/share/eld/templates/
usr/bin/YAMLMapParser.py
33 changes: 33 additions & 0 deletions packaging/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/make -f

export DH_VERBOSE = 1

%:
dh $@ --buildsystem=cmake+ninja

override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_TARGETS_TO_BUILD="Hexagon;AArch64;ARM;RISCV;X86" \
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu \
-DCMAKE_SKIP_RPATH=ON \
-DELD_CREATE_SYMLINKS=OFF \
-DPACKAGE_VERSION=19.0.0 \
-DLLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm \
-DELD_INSTALL_LINKER_SCRIPT_TEMPLATES=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DELD_YAML_MAP_PARSER_DEST_DIR=bin

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
dh_auto_test
endif

override_dh_auto_install:
dh_auto_install
# Move templates to the standard share directory
if [ -d debian/tmp/usr/templates ]; then \
mkdir -p debian/tmp/usr/share/eld/templates; \
cp -a debian/tmp/usr/templates/* debian/tmp/usr/share/eld/templates/; \
rm -rf debian/tmp/usr/templates; \
fi
1 change: 1 addition & 0 deletions packaging/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
4 changes: 4 additions & 0 deletions packaging/debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version=4
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%eld-$1.tar.gz%" \
https://github.com/qualcomm/eld/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz
Loading