Summary

In previous sections, we learned how to use Package Tool to compile and pack your project. We will list some important notes here.

Source Code Layout:

toolkit/
├── pkgscripts/
├── build_env/
│   └── ds.${platform}-${version}
│       └── /usr/syno
│           ├── lib
│           ├── bin
│           └── include
├── result_spk/
│   └── ${package}-${version}/
│       └── *.spk
└── source/
    └── ${project}/
        ├── source code, Makefile ...
        ├── INFO.sh
        ├── PACKAGE_ICON.PNG
        ├── PACKAGE_ICON_256.PNG
        ├── scripts/
        │   ├── postinst
        │   ├── postuninst
        │   ├── postupgrade
        │   ├── preinst
        │   ├── preuninst
        │   ├── preupgrade
        │   └── start-stop-status
        └── SynoBuildConf/
            ├── build
            ├── depends
            └── install

The necessary files required by PkgCreate.py are listed below.

  • INFO
  • SynoBuildConf/build
  • SynoBuildConf/install
  • SynoBuildConf/depends
  • scripts/postinst
  • scripts/postuninst
  • scripts/postupgrade
  • scripts/preinst
  • scripts/preuninst
  • scripts/preupgrade
  • scripts/start-stop-status

Walk-Through of Create Package

  1. Install Package Toolkit
  2. List Available Environments
  3. Create Building Environment using EnvDeploy
  4. Create GPG key
  5. Create SynoBuildConf/build SynoBuildConf/install SynoBuildConf/depends
  6. Create scripts folder and scripts
  7. Build package with PkgCreate.py

Command Walk-Through


# Install Package Toolkit
mkdir -p /toolkit
cd /toolkit
git clone https://github.com/SynologyOpenSource/pkgscripts-ng pkgscripts

# Make Build Environment
./pkgscripts/EnvDeploy -v 6.0 --list
./pkgscripts/EnvDeploy -v 6.0 --info platform
./pkgscripts/EnvDeploy -v 6.0 -p x64 # for example

# Prepare GPG key
gpg --gen-key

> Please select what kind of key you want:
   (1) RSA and RSA (default)
> choose key size and enter your name, email
> enter a passphrase: just press Enter without typing any character
cp ~/.gnupg/* /toolkit/build_env/ds.x64-6.0/root/.gnupg/

# Prepare Project folder
mkdir -p ./source/${project}
# add source code, Makefile, SynoBuildConf and scripts
...

# Compile and Build Synology Package
./pkgscripts/PkgCreate.py -x0 -c ${project}