Makefile variables - SynoCommunity/spksrc GitHub Wiki

Available Variables in local.mk

Variable name Explanation Example
DEFAULT_TC Define default DSM version to be built by default.
Multiple version can be passed in argument.
This will be used to build all required packages when using make all-supported
DEFAULT_TC = 6.1 7.0
DISTRIBUTOR_URL
DISTRIBUTOR
PARALLEL_MAKE Ability to build multiple archs in parallel.
This also honor the -j flag within each arch parallel builds
PARALLEL_BUILD=4 make -j4 all-supported
PARALLEL_BUILD=max make all-supported
PSTAT Enable parallel compile stats using time when compiling
This generates a build.stats.log in the working directory
===> MAKELEVEL: 1, PARALLEL_MAKE: max, ARCH: native, NAME: python3
90.55user 7.09system 0:11.58elapsed 842%CPU (0avgtext+0avgdata 115260maxresident)k
649375inputs+219627outputs (30major+1471914minor)pagefaults 0swaps
PUBLISH_API_KEY
PUBLISH_URL
PUBLISH_URL
REPORT_URL

Available Variables in src/service-setup.sh

Most of the variables are provided by Synology DSM environment natively.

REMARKS:
Not all variables are available in all installation steps (i.e. SYNOPKG_PKGDEST is not available in service_preinst).

Variable name Explanation Value(s)
SYNOPKG_PKGNAME Package name.
All package names in SynoCommunity have lower case letters only and Packages of Synology start with uppercase letter.
<pkg_name>
(i.e. python311, synocli-file, ...)
SYNOPKG_PKGDEST_VOL The volume of the package installation. /volume1, /volume2, ...
SYNOPKG_PKGDEST Package installation path. /var/packages/<pkg_name>/target
The real name is ${SYNOPKG_PKGDEST_VOL}/@appstore/${SYNOPKG_PKGNAME}
SYNOPKG_PKGVAR Package var directory.
Synology provides this variable for DSM >= 7, but our generic installer adds this for other DSM versions for compatibility. You always can use /var/packages/<pkg_name>/var to access this folder (i.e. in config files).
/var/packages/<pkg_name>/var
real name on DSM7:
${SYNOPKG_PKGDEST_VOL}/@appdata/${SYNOPKG_PKGNAME}

Available Variables in cross/ Makefiles

Variable name Explanation Example
%_TARGET ability to overwrite the default target values: (CONFIGURE, BUILD, INSTALL, PATCH, PATCH, DOWNLOAD, STRIP) also every PRE_ and POST_ state CONFIGURE_TARGET=umurmur_configure POST_PATCH_TARGET=python_post_patch
ADDITIONAL_%FLAGS add some extra flags besides the one set by spksrc values (c, cpp, cxx, ld, rust) ADDITIONAL_CFLAGS
ADDITIONAL_CPPFLAGS
ADDITIONAL_CXXFLAGS
ADDITIONAL_LDFLAGS
ADDITIONAL_RUSTFLAGS
BUILD_DEPENDS package depends only needed for build (will not be included in spk) BUILD_DEPENDS = cross/ffmpeg
CARGO_BUILD_ARGS When building a Rust binary, you can add additional installation options. Specify each option in a separate statement. This must not include the --path option (see RUST_SRC_DIR) CARGO_BUILD_ARGS = --no-default-features
CARGO_BUILD_ARGS += --locked
CMAKE_DISABLE_EXE_LINKER_FLAGS Normally part of the CMAKE toolchain file are being set both CMAKE_EXE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS. Although in some rare cases CMAKE_EXE_LINKER_FLAGS ends-up mixing-up linking where libraries aren't being found. CMAKE_DISABLE_EXE_LINKER_FLAGS = 1
CMAKE_USE_NASM Disabled by default (e.g. 0). If set to 1 it enable building native/nasm and add it the the PATH environment variable CMAKE_USE_NASM = 1
CMAKE_USE_NINJA Disabled by default (e.g. 0). If set to 1 it enable using Ninja for building CMAKE_USE_NINJA = 1
CMAKE_USE_TOOLCHAIN_FILE By default always ON. Allow using CMake build in "legacy" mode where it mimics autoconf style and set the environment as "target" hiding "host" tools instead of using normal cross-compiling mode with toolchain files https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html. This is mainly used for sources that have issues / do not support building with normal cross-compiling toolchain files. CMAKE_USE_TOOLCHAIN_FILE = OFF
COMPILE_MAKE_OPTIONS Additional parameters to add to the make command for package compilation COMPILE_MAKE_OPTIONS = -f Makefile.linux
CONFIGURE_ARGS add some extra flags to the configure option CONFIGURE_ARGS = --disable-test
DEPENDS package depends on those tools or libraries. DEPENDS = cross/openssl
GNU_CONFIGURE Use GNU Configure (adds --host --target flags) GNU_CONFIGURE = 1
INSTALL_MAKE_OPTIONS Additional parameters to add to the make command for package installation. This can be used for a specific target or to define variables. (default: install DESTDIR=$(INSTALL_DIR) prefix=$(INSTALL_PREFIX)) INSTALL_MAKE_OPTIONS = install DESTDIR=$(INSTALL_DIR) INSTALL_PREFIX=
KERNEL_ROOT Root directory of the kernel source tree.
Enabled when REQUIRE_KERNEL = 1
spksrc/cross/<app>/work-<arch>-<v>/linux
OPTIONAL_DEPENDS package depends conditonally for instance only for some arch, used for dependency scanning OPTIONAL_DEPENDS = cross/rnm
PKG_DIST_ARCH PKG_DIST_ARCH_LIST For packages that have arch specific source files. Use PKG_DIST_ARCH in the definition of PKG_DIST_NAME and define a list of all dist archs with PKG_DIST_ARCH_LIST. As example see cross/libstd++ PKG_DIST_NAME = $(PKG_NAME).master.$(PKG_VERS).linux-core-$(PKG_DIST_ARCH).$(PKG_EXT)
PKG_DIST_ARCH_LIST = x64 arm arm64
PKG_DIST_FILE Provide a custom Name for the downloaded source file. Needed when filename does not contain package name (i.e. version only) to avoid conflicts in distrib folder. PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_NAME The name of the source file to download. When this name does not contain the package name add a definition for PKG_DIST_FILE PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
REQUIRE_KERNEL The build process will prepare corresponding DSM kernel for module building. REQUIRE_KERNEL = 1
REQUIRE_TOOLKIT The build process will download and extract the corresponding DSM development toolkit. REQUIRE_TOOLKIT = 1
REQUIRED_MAX_DSM The build process will exit when a higher than DSM toolchain version is used. Used for DSM archs only. REQUIRED_MAX_DSM = 6.999 to disable build for DSM >= 7
REQUIRED_MIN_DSM The build process will exit when a lower than required DSM toolchain is used. Used for DSM archs only. REQUIRED_MIN_DSM = 5.2
REQUIRED_MIN_SRM The build process will exit when a lower than required SRM toolchain is used. Used for SRM archs only. REQUIRED_MIN_SRM = 1.2
RUST_SRC_DIR Configures a custom --path parameter for building a Rust binary. Optional, default is RUST_SRC_DIR = $(WORK_DIR)/$(PKG_DIR) RUST_SRC_DIR = $(WORK_DIR)/$(PKG_DIR)/custom
UNSUPPORTED_ARCHS_TCVERSION exclude those arches/DSM-version from being built UNSUPPORTED_ARCHS_TCVERSION = armv7-1.2
UNSUPPORTED_ARCHS exclude those arches from being built UNSUPPORTED_ARCHS = cedarview
USE_NATIVE_CMAKE_LEGACY Disabled by default (e.g. 0). If set to 1 it enable using a legacy version of cmake matching Debian 10 "Buster" using native/cmake-legacy. In turns for this legacy CMake version to be accessible in the default PATH from within cross/* it requires ENV += PATH=$(CMAKE_PATH):$$PATH for it to be detected properly. USE_NATIVE_CMAKE_LEGACY = 1
include ../../mk/spksrc.cross-cmake.mk
ENV += PATH=$(CMAKE_PATH):$$PATH
USE_NATIVE_CMAKE Disabled by default (e.g. 0). If set to 1 it enable using latest "stable" version of cmake using native/cmake. In turns for this new CMake version to be accessible in the default PATH from within cross/* it requires ENV += PATH=$(CMAKE_PATH):$$PATH for it to be detected properly. USE_NATIVE_CMAKE = 1
include ../../mk/spksrc.cross-cmake.mk
ENV += PATH=$(CMAKE_PATH):$$PATH

Available Variables in native/ Makefiles

Variable name Explanation Example
%_TARGET ability to overwrite the default target values: (CONFIGURE, BUILD, INSTALL, PATCH, PATCH, DOWNLOAD, STRIP) also every PRE_ and POST_ state PRE_INSTALL_TARGET=mysql-connector-c_pre_install
CONFIGURE_ARGS add some extra flags to the configure option CONFIGURE_ARGS = --disable-test
DEPENDS package depends on those tools DEPENDS = native/go-1.4
GNU_CONFIGURE Use GNU Configure (adds --host --target flags) GNU_CONFIGURE = 1
NATIVE_%_FLAGS add some extra flags besides the one set by spksrc values (ld, cxx, c) NATIVE_LD_FLAGS=-L/some/path
PKG_DIST_FILE Provide a custom Name for the downloaded source file. Needed when filename does not contain package name (i.e. version only) to avoid conflicts in distrib folder. PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_NAME The name of the source file to download. When this name does not contain the package name add a definition for PKG_DIST_FILE PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)

Available Variables in spk/ Makefiles

Variable name Explanation Example
ADMIN_PORT Port for web based management interface of package. Used to create a link in DSM package center. Required only if SERVICE_PORT is not defined or different. Another use case is to define ADMIN_PORT = $(SERVICE_PORT) together with NO_SERVICE_SHORTCUT = true to get the web interface in the DSM package center but not in the DSM UI. ADMIN_PORT = 9091
ADMIN_PROTOCOL Protocol for web based management interface. Optional ADMIN_PROTOCOL = http
ADMIN_URL URL context for web based management interface. Optional ADMIN_URL = /
ARCH Sets the arch to the specified value. Omitting a value sets noarch ARCH =
BETA Marks a package as beta. Remove variable if not BETA=1
BUILD_DEPENDS Dependencies declared here are used during the build process, but are not included in the final package. BUILD_DEPENDS = cross/python3
CHANGELOG Description of changes related to the SPK_REV. CHANGELOG = "Enable sc-download group", CHANGELOG = "1. First entry<br/>2. Second entry"
CHECKPORT Check if there is any conflict between the ADMIN_PORT and the ports which are listening on DSM. Optional, default is yes CHECKPORT = yes
CONF_DIR Location of the conf/ directory to include in package CONF_DIR = src/conf
DEPENDS Requirements to compile and/or run the software after packaging DEPENDS = cross/libtorrent cross/$(SPK_NAME)
DESCRIPTION Package description shown in Package Center. Multiple languages are supported. Double quotes must be escaped by backslash. DESCRIPTION = "It's a \"great\" package", DESCRIPTION_FRE = "C'est un \"super\" package (in French)"
DISPLAY_NAME The name displayed in Package Center DISPLAY_NAME = Transmission
DSM_UI_CONFIG Package specific app/config file for DSM UI integration. Must be provided when url does not match / or port does not match SERVICE_PORT. DSM_UI_CONFIG = src/app/config
DSM_UI_DIR DSM UI directory location, relative to /var/packages/$PACKAGE/target/. Must be defined to provide a shortcut (icon) in DSM DSM_UI_DIR = app
FWPORTS Location of custom service configure file. Allows user to create firewall rules for this package. See SynoCommunity Ports FWPORTS = src/${SPK_NAME}.sc
GCC_DEBUG_INFO When set to 1 will change the optimization flags in order to include debug_info library symbols which in turns help for lower-level gdb debugging GCC_DEBUG_INFO := 1
HOMEPAGE Software homepage HOMEPAGE = http://www.transmissionbt.com
INSTALL_PREFIX Obsolete. Default is INSTALL_PREFIX = /var/packages/$(SPK_NAME)/target and must not be changed.
INSTALL_REPLACE_PACKAGES After your package is installed or upgraded, these to-be-replaced packages will be removed. The format consists of a package name and optional version. INSTALL_REPLACE_PACKAGES = "nzbdrone>=20210329-19"
INSTALLER_SCRIPT Location of package specific installer script. Replace generic installer. Use SERVICE_SETUP instead, when possible. INSTALLER_SCRIPT = src/installer.sh
LICENSE Software license LICENSE = GPLv2/GPLv3
MAINTAINER_URL URL of the creator or maintainer of the package. If the MAINTAINER is a valid github user the MAINTAINER_URL is evaluated to the github user account. If the MAINTAINER is not a github user, you sould define a valid URL. MAINTAINER_URL = https://gihub.com/synocommunity
MAINTAINER The creator of the package or current maintainer. Please use a github username. If you don't use a github username, you must define the MAINTAINER_URL MAINTAINER = Diaoul
NO_SERVICE_SHORTCUT Prevents DSM UI shortcut generation if set, when SERVICE_PORT does not provide http or should not be visible in DSM UI. NO_SERVICE_SHORTCUT = true
OS_MIN_VERS The minimum DSM version for DSM >= 6.1 OS_MIN_VERS = 6.2-23739
POST_STRIP_TARGET Process extra installation after the stripping to the target files. POST_STRIP_TARGET = deluge_extra_install
RELOAD_UI obsolete, not documented by synology
REPORT_URL Link to beta package feedback submission. In local.mk REPORT_URL = https://github.com/SynoCommunity/spksrc/issues
REQUIRED_MAX_DSM The build process will exit when a higher than DSM toolchain version is used. Used for DSM archs only. REQUIRED_MAX_DSM = 6.999 to disable build for DSM >= 7
REQUIRED_MIN_DSM The build process will exit when a lower than required DSM toolchain is used. Used for DSM archs only. REQUIRED_MIN_DSM = 5.2
REQUIRED_MIN_SRM The build process will exit when a lower than required SRM toolchain is used. Used for SRM archs only. REQUIRED_MIN_SRM = 1.2
SERVICE_CERT_RELOAD Package-relative path to a script for reloading the service after certificate changes SERVICE_CERT_RELOAD = tools/ca_reloader.sh
SERVICE_CERT Configure DSM certificate management for this service name from the firewall config file (*.sc). If several services are defined, only one can be picked here. SERVICE_CERT = syncthing_webui
SERVICE_COMMAND Service complete command line to fork with generic service support SERVICE_COMMAND = $${SYNOPKG_PKGDEST}/bin/myservice --port $${SERVICE_PORT}
SERVICE_EXE (not supported) Process executable absolute path for BusyBox start-stop-daemon with generic service support
Deprecated as not supported with DSM 7.
SERVICE_EXE = $${SYNOPKG_PKGDEST}/bin/myservice
SERVICE_OPTIONS Process options for BusyBox start-stop-daemon with generic service support SERVICE_OPTIONS = --configuration $${SYNOPKG_PKGDEST}/var/myservice.conf --port $${SERVICE_PORT}
SERVICE_PORT_ALL_USERS Grant access to DSM shortcut for all users. Default is true SERVICE_PORT_ALL_USERS = true
SERVICE_PORT_PROTOCOL Protocol for DSM shortcut. Default is http SERVICE_PORT_PROTOCOL=https
SERVICE_PORT_TITLE Protocol name for firewall interface. Default is package name SERVICE_PORT_TITLE=imaps
SERVICE_PORT_URL URL context path to access application from DSM shortcut. Default is / SERVICE_PORT_URL=/myapp
SERVICE_PORT TCP port of generic service support for firewall and DSM UI shortcut. For new packages please choose a free port and update the list SynoCommunity Used Ports SERVICE_PORT = 8080
SERVICE_SETUP Shell script functions and variables for package specific installation or service startup/stop process. Is not DSM start-stop-status script. When ever possible prefere SERVICE_SETUP over SSS_SCRIPT and INSTALLER_SCRIPT. SERVICE_SETUP = src/service-setup.sh
SERVICE_USER Runtime user account for generic service support. auto is recommended SERVICE_USER=auto
SERVICE_WIZARD_GROUP (not supported) Variable name from wizard which holds group name which controls service permissions to files on Shared Folder (not supported anymore) SERVICE_WIZARD_GROUP = wizard_group
SERVICE_WIZARD_SHARE (deprecated) Variable name from wizard which holds service storage on Shared Folder (deprecated, use SERVICE_WIZARD_SHARENAME) SERVICE_WIZARD_SHARE = wizard_share
SERVICE_WIZARD_SHARENAME Variable name from wizard which holds service storage on Shared Folder SERVICE_WIZARD_SHARENAME = wizard_sharename
SPK_COMMANDS List of folder/command to create soft links in /usr/local/{folder} for command line tools.
Requires use of generic installer.
SPK_COMMANDS = bin/lua bin/luac
SPK_DEPENDS Packages that must be installed before installation of this package is allowed SPK_DEPENDS = "python3>=3.7.7-15:gnupg>=2.1.6"
SPK_ICON Icon to be used in DSM. Must be of quadratic shape. Use at least 256x256 pixel. SPK_ICON = src/deluge.png
SPK_LINKS (deprecated) List of target:command to create soft links with different names for command line tools.
Deprecated, as not supported with DSM 7. Use SPK_USR_LOCAL_LINKS or SKP_COMMANDS.
SPK_NAME Package name SPK_NAME = deluge
SPK_REV Package Revision number. Starts at 1, goes up 1 for every subsequent release unrelated to SPK_VERS SPK_REV = 5
SPK_USR_LOCAL_LINKS List of folder:command to create soft links for command line tools that are not located in a standard folder one level below the installation target.
Requires use of generic installer.
SPK_USR_LOCAL_LINKS = bin:env/bin/borg bin:env/bin/borgmatic
SPK_VERS Software version SPK_VERS = 1.3.12
SSS_SCRIPT Location of package specific DSM start-stop-status. Use SERVICE_SETUP instead, when possible. SSS_SCRIPT = src/dsm-control.sh
STARTABLE Required. Declares if package starts a service STARTABLE = no
UNSUPPORTED_ARCHS_TCVERSION exclude those arches/DSM-version from being built UNSUPPORTED_ARCHS_TCVERSION = armv7-1.2
UNSUPPORTED_ARCHS Exclude these arches from being built UNSUPPORTED_ARCHS = cedarview
USE_DEPRECATED_REPLACE_MECHANISM If set to "yes", replacee will be uninstalled after replacer installed, and prereplace / postreplace scripts will not be executed. Otherwise, replacee will be uninstalled before replacer installed, and prereplace / postreplace will be executed. Default is no USE_DEPRECATED_REPLACE_MECHANISM = yes
WHEELS See Using Python wheels WHEELS = src/requirements.txt
WIZARDS_DIR Location of the wizard UI files WIZARDS_DIR = src/wizard
WIZARDS_TEMPLATES_DIR Location of the directory containing wizard UI files internationalized using mustache.
Template files should be named using the same convention as the corresponding non templated files and internationalized resources should be named using the convention [wizard_name][language_suffix].yml where [wizard_name] would be the name of the wizard (e.g. file name without the suffix), [language_suffix] would be '' (empty string) for english, _[language_code]. For example install_uifile.yml, install_uifile_fre.yml.
WIZARDS_TEMPLATES_DIR = src/wizard_templates
⚠️ **GitHub.com Fallback** ⚠️