Skip to content

Commit 7d90f12

Browse files
committed
Add Arch Linux AUR packaging for eld
Add PKGBUILD, .SRCINFO, and README for submitting eld to the Arch User Repository. Build-tested against LLVM release/21.x with eld v21.1.8. Key details: - Builds eld within the LLVM source tree (required by eld's build system) - Targets: ARM, AArch64, RISCV, Hexagon, x86_64 - Installs ld.eld binary, libLW.so plugin API, headers, and templates Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
1 parent d255a57 commit 7d90f12

3 files changed

Lines changed: 229 additions & 0 deletions

File tree

packaging/arch/.SRCINFO

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pkgbase = eld
2+
pkgdesc = ELF linker for embedded software with plugin support and GNU LD compatibility
3+
pkgver = 22.1.0rc3
4+
pkgrel = 1
5+
url = https://github.com/qualcomm/eld
6+
arch = x86_64
7+
license = BSD-3-Clause
8+
makedepends = cmake
9+
makedepends = ninja
10+
makedepends = clang
11+
makedepends = python
12+
makedepends = git
13+
depends = gcc-libs
14+
depends = zlib
15+
depends = libxml2
16+
optdepends = python: YAMLMapParser.py map file parsing utility
17+
options = !lto
18+
source = eld-22.1.0rc3.tar.gz::https://github.com/qualcomm/eld/archive/refs/tags/v22.1.0-rc3.tar.gz
19+
source = llvm-project::git+https://github.com/llvm/llvm-project.git#branch=release/22.x
20+
sha256sums = SKIP
21+
sha256sums = SKIP
22+
23+
pkgname = eld

packaging/arch/PKGBUILD

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Maintainer: Your Name <your.email@example.com>
2+
pkgname=eld
3+
pkgver=22.1.0rc3
4+
pkgrel=1
5+
pkgdesc='ELF linker for embedded software with plugin support and GNU LD compatibility'
6+
arch=('x86_64')
7+
url='https://github.com/qualcomm/eld'
8+
license=('BSD-3-Clause')
9+
depends=('gcc-libs' 'zlib' 'libxml2')
10+
makedepends=('cmake' 'ninja' 'clang' 'python' 'git')
11+
optdepends=('python: YAMLMapParser.py map file parsing utility')
12+
13+
# The eld git tag for this release (pkgver cannot contain hyphens).
14+
_eldtag=v22.1.0-rc3
15+
16+
# ELD's version is derived from LLVM's PACKAGE_VERSION, so the versions are
17+
# synchronized. The eld release/N.x branch builds against llvm release/N.x.
18+
# LLVM 22.x has no stable release yet; use the release/22.x branch.
19+
_llvmbranch=release/22.x
20+
21+
source=(
22+
"${pkgname}-${pkgver}.tar.gz::https://github.com/qualcomm/eld/archive/refs/tags/${_eldtag}.tar.gz"
23+
"llvm-project::git+https://github.com/llvm/llvm-project.git#branch=${_llvmbranch}"
24+
)
25+
sha256sums=('SKIP' 'SKIP')
26+
27+
# LTO is disabled because the build compiles LLVM components and applying
28+
# LTO across the full LLVM+eld build is impractical for packaging.
29+
options=('!lto')
30+
31+
prepare() {
32+
# Place eld source inside the LLVM tree as a tool so it is discovered
33+
# by LLVM's build system automatically.
34+
ln -sfn "${srcdir}/eld-${_eldtag#v}" \
35+
"${srcdir}/llvm-project/llvm/tools/eld"
36+
}
37+
38+
build() {
39+
local cmake_args=(
40+
-G Ninja
41+
-DCMAKE_BUILD_TYPE=None
42+
-DCMAKE_INSTALL_PREFIX=/usr
43+
-DCMAKE_C_COMPILER=clang
44+
-DCMAKE_CXX_COMPILER=clang++
45+
-DLLVM_ENABLE_PROJECTS='llvm;clang'
46+
-DLLVM_TARGETS_TO_BUILD='ARM;AArch64;RISCV;Hexagon;X86'
47+
-DLLVM_ENABLE_ASSERTIONS=OFF
48+
-DELD_ENABLE_SYMBOL_VERSIONING=ON
49+
-Wno-dev
50+
)
51+
52+
cmake -B build -S llvm-project/llvm "${cmake_args[@]}"
53+
54+
# Build only eld targets to avoid building the entire LLVM toolchain
55+
cmake --build build --target ld.eld
56+
cmake --build build --target LW
57+
cmake --build build --target LSParserVerifier
58+
}
59+
60+
check() {
61+
cmake --build build --target check-eld
62+
}
63+
64+
package() {
65+
local _eldsrc="eld-${_eldtag#v}"
66+
67+
# Install the eld binary
68+
install -Dm755 build/bin/ld.eld "${pkgdir}/usr/bin/ld.eld"
69+
70+
# Install LSParserVerifier
71+
install -Dm755 build/bin/LSParserVerifier "${pkgdir}/usr/bin/LSParserVerifier"
72+
73+
# Install the linker wrapper shared library
74+
install -Dm755 build/lib/libLW.so.4 "${pkgdir}/usr/lib/libLW.so.4"
75+
ln -s libLW.so.4 "${pkgdir}/usr/lib/libLW.so"
76+
77+
# Install target-specific symlinks (names match the build output)
78+
local _symlinks=('arm-link' 'aarch64-link' 'hexagon-link' 'riscv-link' 'x86_64-link')
79+
for _link in "${_symlinks[@]}"; do
80+
ln -s ld.eld "${pkgdir}/usr/bin/${_link}"
81+
done
82+
83+
# Install plugin API headers
84+
install -d "${pkgdir}/usr/include/ELD/PluginAPI"
85+
for _hdr in "${_eldsrc}"/include/eld/PluginAPI/*.h; do
86+
[[ "$(basename "$_hdr")" == "PluginConfig.h" ]] && continue
87+
install -Dm644 "$_hdr" "${pkgdir}/usr/include/ELD/PluginAPI/$(basename "$_hdr")"
88+
done
89+
# Install the generated PluginBase.h (from .h.inc template)
90+
install -Dm644 build/tools/eld/include/eld/PluginAPI/PluginBase.h \
91+
"${pkgdir}/usr/include/ELD/PluginAPI/PluginBase.h"
92+
93+
# Install linker script templates
94+
install -d "${pkgdir}/usr/share/eld/templates"
95+
cp -a "${_eldsrc}"/templates/. "${pkgdir}/usr/share/eld/templates/"
96+
97+
# Install YAMLMapParser utility
98+
install -Dm755 "${_eldsrc}/utils/YAMLMapParser/YAMLMapParser.py" \
99+
"${pkgdir}/usr/bin/YAMLMapParser.py"
100+
101+
# Install license
102+
install -Dm644 "${_eldsrc}/LICENSE" \
103+
"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
104+
}

packaging/arch/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Arch Linux Package for ELD
2+
3+
This directory contains the files needed to submit ELD to the
4+
[Arch User Repository (AUR)](https://aur.archlinux.org/).
5+
6+
## Files
7+
8+
- `PKGBUILD` - The package build script
9+
- `.SRCINFO` - Machine-readable metadata (regenerated before each push)
10+
11+
## Prerequisites
12+
13+
1. An Arch Linux system (or VM/container) with `base-devel` installed
14+
2. An [AUR account](https://aur.archlinux.org/register) with SSH key configured
15+
3. Tools: `makepkg`, `namcap` (from `namcap` package)
16+
17+
## Local Testing
18+
19+
```bash
20+
# Copy PKGBUILD to a clean directory
21+
mkdir /tmp/eld-pkg && cp PKGBUILD /tmp/eld-pkg/ && cd /tmp/eld-pkg
22+
23+
# Build the package locally (downloads sources, builds, creates .pkg.tar.zst)
24+
makepkg -s
25+
26+
# Lint the PKGBUILD
27+
namcap PKGBUILD
28+
29+
# Lint the built package
30+
namcap eld-*.pkg.tar.zst
31+
32+
# Install locally to test
33+
makepkg -si
34+
```
35+
36+
For maximum correctness, build in a clean chroot:
37+
38+
```bash
39+
# Requires 'devtools' package
40+
extra-x86_64-build
41+
```
42+
43+
## Submitting to the AUR
44+
45+
```bash
46+
# 1. Clone the AUR git repo (first time only)
47+
git clone ssh://aur@aur.archlinux.org/eld.git
48+
cd eld
49+
50+
# 2. Copy the PKGBUILD
51+
cp /path/to/PKGBUILD .
52+
53+
# 3. Generate .SRCINFO (REQUIRED on every push)
54+
makepkg --printsrcinfo > .SRCINFO
55+
56+
# 4. Commit and push
57+
git add PKGBUILD .SRCINFO
58+
git commit -m "Initial upload: eld 22.1.0rc3-1"
59+
git push origin master
60+
```
61+
62+
## Updating the Package
63+
64+
When a new eld version is released:
65+
66+
1. Update `pkgver` in `PKGBUILD`
67+
2. Update `_llvmver` if the LLVM compatibility version changed
68+
3. Reset `pkgrel` to `1`
69+
4. Update checksums: `updpkgsums` (from `pacman-contrib`)
70+
5. Regenerate `.SRCINFO`: `makepkg --printsrcinfo > .SRCINFO`
71+
6. Test locally, then commit and push to AUR
72+
73+
## LLVM Version Compatibility
74+
75+
ELD must be built within the LLVM source tree (placed in `llvm/tools/eld`).
76+
ELD's version number is derived from LLVM's `PACKAGE_VERSION`, so the
77+
versions are intentionally synchronized. The eld `release/N.x` branch
78+
tracks the `release/N.x` branch of `llvm/llvm-project`.
79+
80+
When LLVM has a stable release tarball available, the PKGBUILD can use a
81+
tarball source instead of the git clone. When only an RC is available (as
82+
with 22.x), the PKGBUILD uses a git source for the `release/N.x` branch.
83+
84+
## Package Layout
85+
86+
The built package installs:
87+
88+
```
89+
/usr/bin/ld.eld # Main linker binary
90+
/usr/bin/arm-link -> ld.eld # Target symlinks
91+
/usr/bin/aarch64-link -> ld.eld
92+
/usr/bin/hexagon-link -> ld.eld
93+
/usr/bin/riscv-link -> ld.eld
94+
/usr/bin/x86_64-link -> ld.eld
95+
/usr/bin/LSParserVerifier # Linker script parser verifier
96+
/usr/bin/YAMLMapParser.py # YAML map file parser
97+
/usr/lib/libLW.so.4 # Plugin API shared library
98+
/usr/lib/libLW.so -> libLW.so.4
99+
/usr/include/ELD/PluginAPI/*.h # Plugin development headers
100+
/usr/share/eld/templates/ # Linker script templates
101+
/usr/share/licenses/eld/LICENSE # BSD 3-Clause license
102+
```

0 commit comments

Comments
 (0)