To create a package the program mkpkg can be used. The set of files to put into the package should be in the desired location in the $(PackagesDir) directory. The mkpkg command should be run with $(PackagesDir) as the working directory and all files to go into the package must be referred to using relative paths. A package must have a package description file that is placed in the $(PackagesDir)/packages directory. The package description file name must end with _package.xml. If a package is to create entries in the new project wizard then it must have a file name project_templates.xml.
For example, a package for the mythical FX150 processor would supply the following files:
The package file FX150.hzq would be created using the following command line:
mkpkg -c packages/FX150.hzq targets/FX150/project_templates.xml … packages/FX150_package.xml
You can list the contents of the package using the -t option:
mkpkg -t packages/FX150.hzq
You can remove an entry from a package using the -d option:
mkpkg -d packages/FX150.hzq -d fileName
You can add or replace a file into an existing package using the -r option:
mkpkg -r packages/FX150.hzq -r fileName
You can extract files from an existing package using the -x option:
mkpkg -x packages/FX150.hzq outputDirectory
You can automate the package creation process using a Combining project type.
When a package is installed, the files in the package are copied into the desired $(PackagesDir)-relative locations. When a file is copied into the $(PackagesDir)/packages directory and its filename ends with _package.xml the file $(PackagesDir)/packages/installed_packages.xml is updated with an entry:
<include filename="FX150_package.xml" />
During development of a package you can manually edit this file. The same applies to the file $(PackagesDir)/targets/project_templates.xml which will contain a reference to your project_templates.xml file.
mkpkg [options] packageFileName file1 file2 …
Option | Description |
-c | Create a new package. |
-compress level | Change compression level (0 for none, 9 for maximum). |
-d | Remove files from a package. |
-f | Output files to stdout. |
-r | Replace files in a package. |
-readonly | Force all files to have read only attribute. |
-t | List the contents of a package. |
-v | Be chatty. |
-V | Show version information. |
-x | Extract files from a package. |