Your First Package¶
This guide walks you through building an existing package to verify your development environment and learn the basic workflow.
Prerequisites¶
Building a Simple Package¶
Let's build transmission, a lightweight BitTorrent client. It's a good first package because:
- It's relatively quick to build
- Has minimal dependencies
- Produces a working binary you can test
Step 1: Navigate to the Package¶
From the spksrc root directory:
Step 2: Build the Package¶
This starts the build process. The first build will:
- Download the appropriate toolchain (if not cached)
- Download transmission source code
- Cross-compile transmission and its dependencies
- Create the SPK package
Build Time
First builds take longer due to toolchain downloads. Subsequent builds use cached files.
Step 3: Find the Built Package¶
After a successful build, the SPK file is in:
You'll see something like:
The filename format is: <package>_<arch>-<dsm>_<version>-<rev>.spk
Specifying Architecture¶
You must specify both ARCH and TCVERSION when building:
# Build for Intel 64-bit, DSM 7.2
make ARCH=x64 TCVERSION=7.2
# Build for ARM 64-bit, DSM 7.2
make ARCH=aarch64 TCVERSION=7.2
To build for multiple architectures at once, use the arch- target:
# Build specific architectures
make arch-x64-7.2
make arch-aarch64-7.2
# Build all supported architectures (from local.mk DEFAULT_TC)
make all-supported
Understanding the Output¶
During the build, you'll see output like:
===> Downloading toolchain for x64-7.2
===> Extracting for openssl3-x64-7.2
===> Configuring for openssl3-x64-7.2
===> Compiling for openssl3-x64-7.2
===> Installing for openssl3-x64-7.2
===> Extracting for curl-x64-7.2
...
===> Creating package for transmission-x64-7.2
Each ===> line indicates a build stage:
| Stage | Description |
|---|---|
| Downloading | Fetching toolchain or source code |
| Extracting | Unpacking source archives |
| Configuring | Running ./configure or equivalent |
| Compiling | Building the software |
| Installing | Installing to staging directory |
| Creating package | Building the final SPK |
Cleaning Up¶
Clean Package Build¶
Remove build artifacts for this package:
This removes the work-* directories and build logs.
Clean Specific Architecture¶
To clean and rebuild a specific architecture:
Free Disk Space¶
make clean # Clean this package's work directories
rm -rf distrib/* # Remove downloads (will re-download when needed)
Troubleshooting¶
Build Fails with Missing Dependency¶
Solution: Dependencies should be built automatically. If not:
Then retry the SPK build.
Download Fails¶
Solutions:
- Check your internet connection
- Verify the URL in
cross/<package>/Makefileis valid - Try downloading manually to
distrib/
Build Takes Too Long¶
Enable parallel builds in local.mk:
Next Steps¶
- Package Anatomy - Understand how packages are structured
- Build Workflow - Learn more build commands
- Packaging Guide - Create your own package