Skip to content

Compile and build rules

Vincent Fortier edited this page Dec 20, 2020 · 14 revisions

Cross package rules

Rule name Explanation Example
arch-% Cross-compiles a package for an individual architecture.
A default toolchain version, located in local.mk, will be appended automatically.

To list all available architectures use ls toolchains from within the spksrc directory. Remove the prefix syno- for the actual architecture.
make arch-88f6281

You can specify a toolchain version by appending the version:
make arch-88f6281-4.3
all-archs Cross-compiles a package for all available arches.
make digests Generates a digests file for $(PKG_DIST_NAME) or, if specified, for $(PKG_DIST_FILE).
make dependency-tree Generates a list of all dependencies of the package.

SPK rules (general)

Rule name Explanation Example
make clean Remove all build directories arch-*
make spkclean Remove only spk generated files at the end of the build process.
make dependency-tree Generates a list of all dependencies of the package.

SPK rules (specific)

Rule name Explanation Example
arch-%
publish-arch-%
Builds a package for an individual architecture.
A default toolchain version, located in local.mk, will be appended automatically.

To list all available architectures use ls toolchains from within the spksrc directory. Remove the prefix syno- for the actual architecture.
make arch-88f6281

You can specify a toolchain version by appending the version: make arch-88f6281-4.3.
all-supported
publish-all-supported
Builds packages for all supported architectures, with the latest available toolchain. Currently, packages will be built for all architectures that can run DSM5.2.

For DSM5.1 and higher, if the package does not depend on kernel sources (i.e. if REQ_KERNEL is not set in the Makefile), an x64 package is built instead of individual x86-64 packages (avoton, braswell, bromolow, cedarview and x86).
all-legacy
publish-all-legacy
Builds packages for all legacy architectures, and packages for supported architectures with the previous major toolchain (currently 4.3).

The legacy rule will build individual x86-64 packages instead of an x64 package, regardless of the setting of REQ_KERNEL.
all-archs-latest
publish-archs-latest
Builds packages for all architectures with the latest minor version of each major toolchain version.
This rule combines the all-supported and all-legacy rules
Example: For the Bromolow architecture, two packages will be built: one built with the Bromolow-4.3 toolchain, and one built with the Bromolow-5.1 toolchain.
all-archs
publish-all-archs
Builds packages for all available architectures
all-toolchain-%
publish-all-toolchain-%
Builds packages for all architectures with the specified toolchain version. Skips architectures if the specified toolchain version does not exist. Example: make all-toolchain-4.3 will build packages for any toolchain where version 4.3 is available.
latest-arch-%
publish-latest-arch-%
Builds packages for the latest available version of the specified architecture. This rule has no other purpose than to support other rules. make latest-arch-bromolow

Notes

  • Publishing rules (where publish- is prepended to the rule) are used to easily publish packages on a repository after building. To use these rules, PUBLISH_URL and PUBLISH_API_KEY should be specified in local.mk, and publish permissions are needed on the repository.
  • If an architecture is added to UNSUPPORTED_ARCHS in the Makefile, that architecture is skipped during compilation and building. Example: By specifying UNSUPPORTED_ARCHS = powerpc, spksrc will show an error when running make arch-powerpc.
  • If REQUIRED_DSM is set in the Makefile, older toolchains are skipped during compilation. Example: REQUIRED_DSM = 5.0 means that packages will not be built with toolchain version 4.3 and older. spksrc will show an error when running make arch-bromolow-4.3.
  • To get <platform>_ARCHES group aliases available, it is required to include ../../mk/spksrc.common.mk before usage in Makefile. Refer to #2530

Recommended setup

To publish package, local.mk should contain:

PUBLISH_URL=https://api.synocommunity.com
PUBLISH_API_KEY=<yourkeyfromspkrepo>
MAINTAINER?=
MAINTAINER_URL=
DISTRIBUTOR=SynoCommunity
DISTRIBUTOR_URL=https://synocommunity.com/
REPORT_URL=https://github.com/SynoCommunity/spksrc/issues
SUPPORT_URL=https://github.com/SynoCommunity/spksrc/issues
DEFAULT_TC=5.2
#PARALLEL_MAKE=max

Parallel build

When working on a large package, build time may slow your work typically for large projects like ffmpeg or mono.

It is possible to set number of parallel executions or "max" to use your number of cpus as value of variable PARALLEL_MAKE. If variable is unset or 0 or 1, there is no parallel execution.

That variable may have no significant effect for small or non-compatible package like python for instance.

Clone this wiki locally