Application Development Kit (ADK)


Table of Contents

About this Document
1. Installer Wizard
1.1. Starting the Installer Wizard
1.2. Installer Wizard Start Screen
1.3. General Settings
1.4. License Text
1.5. Adding Files
1.6. Application Options
1.7. SBOM Options
1.8. Additional Application Options
1.9. Installer Files
1.10. Example .Wiz File (Standalone)
2. Application License Manager
2.1. Using the Application License Manager
2.2. Example License File
2.3. License File Search Paths
3. Installer Script Language Specification
3.1. General Remarks
3.2. Preprocessor Statements
3.2.1. Preprocessor Variables
3.2.2. INCLUDE Statement
3.2.3. Conditional Directives
3.2.4. PRECOMPRESS_COMPRESSION_LEVEL Statement (Windows only)
3.2.5. PRECOMPRESS_COMPRESSION_NUM_THREADS Statement (Windows only)
3.2.6. PREPROCESS_EXECUTE Statement
3.2.7. PREPROCESS_CHECK_EXECUTE Statement
3.2.8. PREPROCESS_MKDIR Statement
3.2.9. PRINT and PRINT_ERROR Statement
3.2.10. [REGEX_]REPLACE_STRING_IN_VARIABLE Statement
3.2.11. REGEX_CAPTURE_IN_VARIABLE Statement
3.2.12. HTML_ESCAPE_IN_VARIABLE Statement
3.2.13. TOUPPER_IN_VARIABLE/TOLOWER_IN_VARIABLE Statement
3.2.14. READ_FILE_AND_WRITE_CONTENTS_TO_​VARIABLE Statement
3.3. Execution Statements
3.3.1. MKDIR Statement
3.3.2. CD Statement
3.3.3. COPY Statement
3.3.4. MOVE Statement
3.3.5. LINK Statement
3.3.6. TEMPLATE Statement
3.3.7. ZIP Statement
3.3.8. ZIP_COLLECT Statement
3.3.9. EXECUTE Statement
3.3.10. Collect and Exclude Statements
3.3.11. SWITCH_PACKAGE Statement
3.3.12. PUT_DIRECTLY_TO_FILELIST Statement
3.3.13. WRITE_NSIS_FILELIST Statement
3.3.14. DELETE Statement
3.3.15. FIND_AND_DELETE Statement
3.4. Standalone Application Installer Variables
4. Advanced Commands
4.1. runApplicationCommand

List of Figures

1.1. Project Wizard
1.2. Installer Wizard
1.3. General Settings
1.4. License Text
1.5. Adding Files Manually
1.6. Application Options
1.7. SBOM Options
1.8. Additional Options
1.9. Generated Installer Files
2.1. Application License Manager
2.2. Application Missing License Dialog

About this Document

The following document includes special features that come with the application development kit (ADK) of MeVisLab.

The difference between the SDK and the ADK is that with the latter, stand-alone applications (installers) can be created. For being able to use that, your own license file needs to be an ADK license file.

Chapter 1. Installer Wizard

To ease the installer generation for an application, an Installer Wizard is available. This Wizard leads through the creation of the .mlinstall file, which can then be used in a build process, e.g., in ToolRunner.

[Note]Note

For further information on the MeVisLab Project Wizard, please refer to the MeVisLab Reference Manual.

1.1. Starting the Installer Wizard

In the menu bar of MeVisLab, open FileRun Project Wizard and select Standalone Application.

Figure 1.1. Project Wizard

Project Wizard

This opens the Installer Wizard, which leads through the creation of a stand-alone application (or in a first step, the .mlinstall file necessary for it) from a macro module.

For using the Installer Wizard, the following programs must be installed:

Move between the dialogs with Back and Next. At any point, the settings can be saved as .wiz file (see Section 1.10, “Example .Wiz File (Standalone)”) via (Save Current Wizard Settings...).

1.2. Installer Wizard Start Screen

Figure 1.2. Installer Wizard

Installer Wizard

Macro Module

Set the macro module to be used for the application. Select one from the list.

Package

Set the target package. Select a target from the list (or stop here and create a user package with the Package Wizard first).

[Note]Note

The info text is only available on Windows.

Check if required tools are installed (Windows only)

Run the tool check tool (which is also part of ToolRunner).

1.3. General Settings

Figure 1.3. General Settings

General Settings

Product Name

Enter the product name. Can be chosen freely.

Version

Enter the program version.

Release, Debug

Select whether the installer includes the release and/or debug version.

Create Command-Line Interface (CLI) Application Installer

Select whether the resulting application should have a command-line interface (e.g., shows no splash screen at startup).

[Note]Note

For each option, the C++ code is compiled accordingly.

Precompile Python files

All Python files will be precompiled if selected.

Exclude original Python files (*.py)

If Python files are precompiled, it is possible to exclude the original Python files from the installer.

[Note]Note

It is not possible to use the Packages.zip when referencing PNG images in Qt stylesheets, because Qt cannot load the images from the zip file.

License

Set the license used for signing the application files.

1.4. License Text

Figure 1.4. License Text

License Text

Selects the license text shown in the installer.

The resulting license text is shown in the preview at the bottom of this window.

Default

The default license text shipped with MeVisLab is used.

Custom

A custom license text stored in the text file at the Path is used. By default, this points to the default license text shipped with MeVisLab.

None

No license text is shown in the application.

1.5. Adding Files

The required files of the macro module are detected by the dependency analysis of MeVisLab and are automatically added to the installer.

The ModuleDependencyAnalyzer module can be used to test the result of the automatic analysis. If required files are missing, they should be added to the Deployment section of the module that depends on it. If there is a reason for not adding files to the Deployment section, they can be manually specified here.

Figure 1.5. Adding Files Manually

Adding Files Manually

If not all necessary files have been found automatically, more commands and files can be added manually.

1.6. Application Options

Figure 1.6. Application Options

Application Options

Window Mode

Set the window mode of the application upon startup. Available options are Maximized, Normal, Full Screen.

Splash Screen Image

Set the screen shown upon startup of the application. Preferably in .png format.

Icon File Windows

Set the icon displayed for the application on Windows. Preferably in .ico format.

Create application with diagnosis console (for debugging only)

Add the diagnosis console to the application.

1.7. SBOM Options

Figure 1.7. SBOM Options

SBOM Options

By default, the installer generator creates a software bill of materials (SBOM) file in JSON format that lists all used third-party components. Here, you can specify additional attributes for your application, which is treated as the main component in the SBOM file. The link in the description directs you to a website describing the allowed attributes.

1.8. Additional Application Options

Figure 1.8. Additional Options

Additional Options

Enable finished page

Select to show a finished page to the installer.

Header Image

Set the image displayed upon startup of the installer.

This is the last dialog before the final page, where the installer is created.

1.9. Installer Files

Figure 1.9. Generated Installer Files

Generated Installer Files

The installer is first created as a collection of files:

  • <ProductName>.mlinstall: File containing the installer information. For details on the installer script language, see chapter Chapter 3, Installer Script Language Specification.

  • <ProductName>.autodetect.mli: List of files and paths collected by analyzing the involved Python and .script files.

  • <ProductName>.bat: Windows batch file that generates the installer by calling the Python build script with the application's .mlinstall file.

  • <ProductName>.sh: Shell script for Linux (equivalent to the batch file for Windows).

If ToolRunner is not used, the installer compilation needs to be started explicitly via the batch file or shell script.

Create Installer

Starts ToolRunner to build the executable.

[Note]Note

The application files are signed and encrypted automatically. To keep the files unencrypted, you must state this explicitly in the <ProductName>.mlinstall file by adding the line

$STANDALONE_NO_FILE_CRYPTING 1 # don't encrypt files (after the $Product name).

For details on the installer script language, see chapter Chapter 3, Installer Script Language Specification.

Browse Output Directory

Open the output directory in the default file browser.

Create Application License

Create an application license (.dat file) to be distributed with the application. Starts the Application License Manager, see Chapter 2, Application License Manager

Close

Close the installer generation at this point. The output files will remain in the output directory.

1.10. Example .Wiz File (Standalone)

// MDL v1 utf8
wizard = StandaloneAppWizard
fields  {
  instanceName  = wizard
  moduleName    = CurveInspector
  productName   = CurveMaker
  debugFlag     = 0
  releaseFlag   = 1
  diagnosisFlag = 0
  version       = 1
  licensePath   = "C:/Documents and Settings/jdoe/mevislablicense.dat"

  autoAssembleInstallerScript = "# Switching to package MeVisLab/Standard
                                 SWITCH_PACKAGE MeVisLab/Standard
                                 + Package.def
                                 + Modules/ML/MLBase
                                 + Modules/ML/MLMiscModulesInv
                                 + Modules/Macros/Inspectors"

  assembleInstallerScript = ""
  splashScreenImage       = ""
  headerImageWin32        = ""
  iconFileWin32           = ""
  headerImageMac          = ""
  iconFileMac             = ""
  windowMode              = MAXIMIZED
  createEnable            = TRUE
  packageIdentifier       = MyPackageGroup/Research
}

Chapter 2. Application License Manager

[Note]Note

ADK licenses that allow creating custom run-time licenses with the Application License Manager are no longer available to customers. If you require run-time licenses, please contact the sales department of MeVis Medical Solutions AG.

MeVis Medical Solutions AG Caroline-Herschel-Str. 1 28359 Bremen Germany Tel.: +49 421 22495 0 Fax: +49 421 22495 999 sales@mevislab.de

2.1. Using the Application License Manager

In the menu bar of MeVisLab, open FileRun Application License Manager.

Figure 2.1. Application License Manager

Application License Manager

Change license

Click here to select the license on which the new license will be based. A file dialog opens. By default, your developer license is used.

Customer information:

Site ID

Enter the Site ID, for example, a company name: “The Medical Company”.

Owner full name

Enter the full name of the application license owner, for example, “John Doe”.

Mail

Enter the owner's mail address, for example, “jdoe@mymail.com”.

Info

Enter any free text information regarding the application and/or license.

License settings:

Applications

Select the application(s) that the generated license should allow to run. Applications are listed by package groups. Additional applications can be added in the field Manual applications.

Selected applications overview

All selected applications are displayed in this area.

Available license features

This box lists special features that can be enabled for the end-user license. Only features permitted by the developer's license are shown.

Hardware addresses

The end-user license can be restricted to computers with a specific MAC address (the hardware address of the network adapter). If no addresses are specified, there is no restriction; otherwise, the license is valid only on computers with one of the specified MAC addresses.

The MAC address of a user's computer can easily be found out if the user starts the created application. A “missing license” dialog will be shown that also has a System Information button. On pressing that button, the MAC addresses and types of all installed network adapters are displayed.

Figure 2.2. Application Missing License Dialog

Application Missing License Dialog

License expires

Check this option to set an expiration date in the field to the right.

Save

Click to save the license. The Save dialog opens. The license name is constructed as “CurrentDate_SiteID_OwnerName.dat”. In the example, this results in a license named “20250224_The Medical Company_John_Doe.dat”. The created license is signed with the MeVis license.

2.2. Example License File

The generated license may look as follows:

// MDL v1 utf8
license  {
  version = 1
  owner  {
    id       = "The Medical Company"
    mail     = "jdoe@mymail.com"
    fullName = "John Doe"
    info     = "This application is for demo purposes only. "
  }
  publicKey  = ""
  privateKey = ""
  features   = "application CurveInspector"
  expire     = 2026-05-24
  platform   = "win32 linux"
  tickets  {
    ticket application {
      value =
      "K2ttRTRxa2lnSjREUHFNRjFxZ1plSCt5RXNTYUh4VFVjSjA1S0YxZ29NNlZrSW5
      yYVU3UFJyeHJ6bWFtbXBMbkdoM3kwYklYCm02YlFIamt0WEd5cVNRU1JIZCtVSWd
      MdgoKLy8jIE1lVmlzIHNpZ25hdHVyZSB2MQovLyMga2V5OiBNRm93RFFZSktvWkl
      odmNOQVFFQkJRQURTUUF3UmdKQkFNZUxFVHprUEhQbkwxS3NSNXFjT1F0NEJ2T1c
      0NUpKTnlscDlpMUhodVJlTGgvRVRqT0M2K3BoSnFWR0ZHS3I3OXB6OE45MXdhYjh
      mb0dHNUpEWEpmVUNBUkU9OmVoR1hncStvQzZscVVSZENxWWZrb0NVeml3RzFVMUF
      HaFV2UFpBbVpSUU9kYkFtRkdybndKeGd0LzJ0RjlNZU9sTzQzSDVkYk40T2gwTmU
      zMDVkYUFBPT0KLy8jIG93bmVyOiBNZVZpcyBMaWNlbnNlTWFuYWdlcgovLyMgZGF
      0ZTogMjAwOC0wNi0yNFQxNzowMzoxOAovLyMgZmxhZ3M6IGNyeXB0ZWQKLy8jIGh
      hc2g6IEh1ZC9FQXFPWXpGTmZWNm91M1RQRDhvTUplTk41dXpNaXMwYmNxVXlKUEI
      3ZnYyL0dLbEozSmZBV2ViSnA5b0FRajRyY3MxVjRCMjNNZHFkdVRYNzJ3PT0KLy8
      jIE1lVmlzIGVuZAo="
    }
  }
}

//# MeVis signature v1
//# key:
MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBAJ39AF/+qRFGV0lZzIzNP4omakEwTD6kCi8JyX
EVrGPusCE1lC7nmusDutrgfEC17wdGJljOayO/txkXTBxpkFcCARE=:DLuRbU1lg8t990I
RMCieK8NkY7E5AjAp3jIGWrcs1gSGWy+HVlgt1skD4tXED+0TjB0NSfKZHJn+NiqQFXhTu
Q==
//# owner: StandaloneMeVisApp
//# date: 2025-02-24T14:31:42
//# hash:
KSjfg+gKjNTNNsag4ifyLFN/aUkuPmoT4Q2upxXa4g2XiQTSXqXUJ2CCejrp72CZeRn3iU
4XGUNW4XqxWcQKmQ==
//# MeVis end

2.3. License File Search Paths

The following pseudocode shows where MeVisLab searches for license files and in which order. The first valid license found is used.

getLicenseFile() {
  if (overrideLicenseFilePath) {
    // overridden license file path from the command line
    // option "-license <license file path>"
    licenseFile = overrideLicenseFilePath
    return licenseFile
  } else {
    if (windows) {
      // e.g., C:/Documents and Settings/Username/<appname>license.dat
      licenseFiles  = QDir::homePath()/<appname>license.dat

      // e.g., C:/Documents and Settings/Username/My Documents/
      //          <appname>license.dat
      licenseFiles += winGetSpecialFolder(CSIDL_PERSONAL)/<appname>license.dat>

      // e.g., C:/Documents and Settings/Username/My Documents/MeVis/
      //          <appname>license.dat
      licenseFiles += winGetSpecialFolder(CSIDL_PERSONAL)/MeVis/ \
                      <appname>license.dat

      licenseFiles += <Install Path>/<appname>license.dat
    }

    if (linux) {
      licenseFiles  = $(HOME)/.local/share/MeVis/<appname>/<appname>license.dat
      licenseFiles += $(HOME)/Documents/MeVis/<appname>license.dat
      licenseFiles += <Install Path>/<appname>license.dat
    }

    if (hasEnvVar("<APP_NAME>_LICENSE_FILE")) {
      licenseFiles += getEnvVar("<APP_NAME>_LICENSE_FILE")
    }

    // use first valid license file
    for (licenseFile in licenseFiles) {
      if (existsAndIsValid(licenseFile)) {
        break
      }
    }
    return licenseFile
  }
}
      

Chapter 3. Installer Script Language Specification

3.1. General Remarks

Installer scripts are used to collect all files necessary for a certain installer version in a temporary output directory and call an installer generator to create the installer executable. Most of the installer script statements occupy a single line, except for TEMPLATE blocks, which consist of several lines enclosed by TEMPLATE_BEGIN and TEMPLATE_END statements, and #if(n)def .. #else(if) .. #endif directives.

Installer script statements are either preprocessor or execution statements. During the preprocessing step, the script is read, and the execution statements are collected and put into the specified order. During the execution step, the execution statements are executed to collect the files and to generate the installer.

Both / and \ are valid path separators. On Windows, however, the first separator in a drive specification must be \ (for example, C:\ instead of C:/).

Everything from a # character up to the end of the line is treated as comment. Leading and trailing spaces and tabs are ignored.

3.2. Preprocessor Statements

3.2.1. Preprocessor Variables

Macro expressions of the form $(VAR) are replaced by the value of the variable VAR during the preprocessing step. Preprocessor variables are defined by a preprocessor statement or passed as commandline arguments to the installer script interpreter. To define a preprocessor variable in an installer script, use the statement

$VAR value

Undefined variables are not replaced and generate a warning. Environment variables can be read by adding an ENV_ prefix to the variable name.

[Note]Note

Exception: The environment variables BUILDDATE, BUILDVERSION, some other variables that are used internally, and all variables that start with MLAB_ or INSTALLER_ are accessible without the ENV_ prefix.

The following special variables are also supported:

$(INPUT)

Defines the current root for collect statements.

$(OUTPUT)

Defines the current output directory as target for collect statements.

$(OUTPUT_ROOT)

Defines the output root directory (taken from OUTPUT on startup).

$(OUTPUT_PACKAGES_ROOT)

Defines the output root directory for packages (initial value is $(OUTPUT_ROOT)/Packages).

$(WIN32)

Set to 1 on Windows systems.

$(CURRENT_YEAR)

Set to the current year. Useful for copyright information.

$(UNIX)

Set to 1 on Linux systems.

$(LINUX)

Set to 1 on Linux systems.

$(INPUT) and $(OUTPUT) can be switched anywhere in the script. Collect statements always use the currently defined $(INPUT)/$(OUTPUT) pair for input scanning and the output target directory.

3.2.2. INCLUDE Statement

The statement

INCLUDE file

is equivalent to replacing this statement by the contents of the specified file. INCLUDE statements are processed recursively. If the file is not specified using an absolute path, it is searched

  1. in the directory containing the current file

  2. in the current working directory

(in this order).

INCLUDE_IF_EXISTING file
is a variant of this command that silently skips the file if it is not found.

3.2.3. Conditional Directives

IF(N)DEF VAR
ELIF(N)DEF VAR
ELSE
ENDIF

IF(N)SET VAR
ELIF(N)SET VAR
ELSE
ENDIF

IF [VAR|"String"] [==|!=|=~|!~] [VAR|"String"]
ELIF [VAR|"String"] [==|!=|=~|!~] [VAR|"String"]
ELSE
ENDIF

IF [EXISTS|ISFILE|ISDIR] [VAR|"String"]
ELIF [EXISTS|ISFILE|ISDIR] [VAR|"String"]
ELSE
ENDIF
[Note]Note

VAR stands for a variable name.

$(VAR) evaluates to the value of the variable.

The (EL)IFDEF directives evaluate to true if the specified variable is defined and its value is neither 0 nor an empty string.

(EL)IFNDEF evaluates as above, but negated.

(EL)IF(N)SET directives test whether the specified variable is defined (or undefined in the case of IFNSET); the variable's value is not considered.

The operators == and != perform a string comparison, while =~ and !~ perform a regular expression search of the second argument within the first.

The versions that contain ! are always the negation of their counterparts with =.

The syntax for regular expressions is that of the Python re package.

The EXISTS, ISFILE, and ISDIR operators check for the existence of files or directories in the file system. To concatenate path fragments, enclose the argument in quotes, e.g., IF EXISTS "$(LOCAL)/someFile.txt".

3.2.4. PRECOMPRESS_COMPRESSION_LEVEL Statement (Windows only)

The statement

PRECOMPRESS_COMPRESSION_LEVEL level

defines the compression level used in pre-compression. Pre-compression is used on Windows if either precompressCurrentDirectory.mli or precompressPackages.mli is included and DISABLE_INSTALLER_PRECOMPRESSION is not defined.

In this case, the files to be added to the installer are first packaged into one or more zip files (using 7zip), which are then added to the installer. This ensures support for long file paths and better compression than the default method.

Valid values for level range from 1 (lowest compression rate) to 9 (highest compression rate); the default is 9.

This setting allows trading compression ratio for compression speed.

3.2.5. PRECOMPRESS_COMPRESSION_NUM_THREADS Statement (Windows only)

The statement

PRECOMPRESS_COMPRESSION_NUM_THREADS numThreads

defines the number of threads (numThreads) used in pre-compression (see PRECOMPRESS_COMPRESSION_LEVEL for details).

Valid values for numThreads are positive integers; the default is 8.

[Note]Note

The memory consumption increases with the number of threads, so avoid setting the value too high on systems with limited RAM.

3.2.6. PREPROCESS_EXECUTE Statement

The statement

PREPROCESS_EXECUTE command

executes the specified command early while parsing the .mli and .mlinstall files. This allows to create .mli files or other files that are later included with INCLUDE or read with READ_FILE_AND_WRITE_CONTENTS_TO_VARIABLE in the same run of assembleInstaller.

3.2.7. PREPROCESS_CHECK_EXECUTE Statement

The statement

PREPROCESS_CHECK_EXECUTE command

is a variant of PREPROCESS_EXECUTE that does not report an error if the command exits with a nonzero code. Instead, the exit code is written as a string to the variable LAST_EXIT_CODE, which should always be checked in an IF statement afterward, as there is no reason to use this directive otherwise.

3.2.8. PREPROCESS_MKDIR Statement

The statement

PREPROCESS_MKDIR path

is a variant of MKDIR executed while parsing the .mli and .mlinstall files. It is useful when a directory must be created before running another command with PREPROCESS_EXECUTE.

3.2.9. PRINT and PRINT_ERROR Statement

The statement

PRINT       string1 string2 ...
PRINT_ERROR string1 string2 ...

can be used to print information or non-fatal error messages to the console output.

3.2.10. [REGEX_]REPLACE_STRING_IN_VARIABLE Statement

The statement

[REGEX_]REPLACE_STRING_IN_VARIABLE varname string1 string2

replaces all occurrences of string1 in the variable varname with string2. The variable name can contain * characters, allowing the replacement to occur in multiple variables.

Example:

REPLACE_STRING_IN_VARIABLE INSTALLER_* "/" "\"

replaces all slashes with backslashes in all variables that start with INSTALLER_.The statement is executed immediately, so variables assigned afterward already use the replaced values.

The REGEX_REPLACE_STRING_IN_VARIABLE statement enables the use of regular expressions.

3.2.11. REGEX_CAPTURE_IN_VARIABLE Statement

The statement

REGEX_CAPTURE_IN_VARIABLE sourceVarName targetVarName regExp captureGroup

searches for the given regular expression in the value of the sourceVarName variable. The specified captureGroup is extracted from the result and assigned to targetVarName.

Example:

# First read into a variable
READ_FILE_AND_WRITE_CONTENTS_TO_VARIABLE TMP_VERSION_FILE
  $(MLAB_MeVis_Foundation)/Configuration/MeVisLabVersion.pri

# Now capture the version number using a regular expression
REGEX_CAPTURE_IN_VARIABLE TMP_VERSION_FILE MEVISLAB_VERSION
  "^\s*MEVISLAB_VERSION_STRING\s*=\s*([^\s]+)\s*$" 1

This code loads the content of the specified file into a temporary variable and searches it for a line containing MEVISLAB_VERSION_STRING = xxx. The version is then captured by the regular expression and stored in MEVISLAB_VERSION.

3.2.12. HTML_ESCAPE_IN_VARIABLE Statement

The statement

HTML_ESCAPE_IN_VARIABLE varName

replaces all special characters in varName with HTML entities and stores the result back to varName.

3.2.13. TOUPPER_IN_VARIABLE/TOLOWER_IN_VARIABLE Statement

The statement

(TOUPPER|TOLOWER)_IN_VARIABLE varName

converts the string in varName to either all uppercase or all lowercase characters.

3.2.14. READ_FILE_AND_WRITE_CONTENTS_TO_​VARIABLE Statement

The statement

READ_FILE_AND_WRITE_CONTENTS_TO_VARIABLE varName pathToFile

loads the content of the specified file at pathToFile into the variable varName.

3.3. Execution Statements

Execution statements are used to create directories, copy files, and execute external commands. As a special form of copy statements, collect + and exclude - statements can be used to copy and filter files or entire subdirectories.

In general, execution statements are executed in the order in which they appear in the installer script. However, by preceding an execution statement with <, >, or >>, it can be moved toward the beginning or toward the end of the execution queue.

The statements in the execution queue are processed in the following order:

  1. All < statements except collect and exclude statements

  2. All < collect and exclude statements

  3. All collect and exclude statements without < or >

  4. All > collect and exclude statements

  5. All >> collect and exclude statements

  6. Now all collected files are copied

  7. All non-collect and non-exclude statements without < or >

  8. All > non-collect and non-exclude statements

  9. All >> non-collect and non-exclude statements

[Note]Note

It is possible to move a statement further to the front or back of the execution queue with <<, >>>, and >>>>, but this is not recommended because it may interfere with the order of internal statements.

3.3.1. MKDIR Statement

The statement

MKDIR path

creates the directory and all required parent directories. If path is not absolute, it is interpreted as relative to the $(OUTPUT) directory.

3.3.2. CD Statement

The statement

CD path

changes the current directory to path. The path can be relative to the script or absolute.

3.3.3. COPY Statement

The statement

COPY source target [exclude-pattern]

copies files from source to target. The source can be a single file, a directory, or a path with wildcards.

If source is not an absolute path, it is interpreted relative to the directory containing the installer script.

If target is not an absolute path, it is interpreted relative to the $(OUTPUT) directory.

If target ends in an / or \, it is interpreted as a directory.

The following cases are handled:

  • If source is a file and target does not exist, source is copied to the file target.

  • If source is a file and target is an existing file, the file target is overwritten by source.

  • If source is a file or directory and target is a directory, source is copied into target.

  • If source is not a single file and target does not exist or is a directory, the source files are copied into the directory target, which is created if it does not exist.

  • If source is not a single file and target is an existing file, an error message is generated.

An optional third argument can be provided to specify an exclude pattern. The pattern syntax follows the Python re package.

Any file path that matches this pattern, even partially, will not be copied.

3.3.4. MOVE Statement

The statement

MOVE source destination

moves files or directories from source to a new destination.

Example:

>MOVE $(OUTPUT_ROOT)/SomeFile.txt $(OUTPUT_ROOT)/SomeOtherFile.txt

3.3.5. LINK Statement

The statement

LINK source target

creates a link of target to the specified source.

Example:

>LINK $(OUTPUT_ROOT)/SomeFile.txt $(OUTPUT_ROOT)/SomeOtherFile.txt
[Note]Note

On Windows, unprivileged users may not have permission to create symlinks.

3.3.6. TEMPLATE Statement

The statement block

TEMPLATE_BEGIN source target
  TEMPLATE_USE_VARIABLES SOMEVARIABLE_PREFIX
  @TVAR value
  ...
TEMPLATE_END

is a special copy statement that copies the file source to target and replaces template macro expressions of the form @(TVAR) with the value of the template variable TVAR. Both source and target must specify single files, evaluated relative to the directory containing the installer script and the $(OUTPUT) directory, respectively.

Template variables are defined locally within the template block and are independent of environment variables or template variables defined in another template block. Preprocessor variables can be used in the values assigned to a template variable. A $ in a template variable assignment can be escaped with $$.

In the source template file, the conditional directives

@IF (TVAR)
@ELSEIF (TVAR)
@ELSE
@ENDIF

may be used. The expression in an @IF/@ELSEIF directive evaluates to true if the template variable TVAR is defined and evaluates to the boolean value true (i.e., neither 0 nor an empty string).

A ! preceding the template variable name negates the expression.

TEMPLATE_USE_VARIABLES can be used multiple times within a block and treats all variables starting with the given prefix as template variables.

Example:

TEMPLATE_USE_VARIABLES PREFSFILE_

takes all variables declared with $PREFSFILE_... as @PREFSFILE_... variables to be used in the template.

This allows setting template variables without specifying them within the template block statement.

3.3.7. ZIP Statement

The statement block

ZIP_BEGIN sourcePath targetZipFile
  OPTIONS arg1 arg2 ...
  COMPRESSION [0-9]
  REMOVE_ORIGINAL_FILES
  + ...
  - ...
  ...
ZIP_END

collects files via + and - statements that act on the given sourcePath and places them into the targetZipFile.

The OPTIONS command can be used to add zip command-line options.

COMPRESSION defines the compression level: 0 stores the files without compression, while 9 applies maximum compression.

REMOVE_ORIGINAL_FILES indicates that the original files added to the .zip archive should be deleted afterward.

The contents of the zip file are relative to the sourcePath.

If you require a different zip file layout, copy the files to a temporary directory first and run the ZIP block with that directory as sourcePath.

[Note]Note

Global exclude rules (deferred via >-) do not apply to the collect statements within the ZIP block.

ZIP blocks must be run after all corresponding ZIP_COLLECT statements!

3.3.8. ZIP_COLLECT Statement

In the statement block

ZIP_COLLECT_BEGIN targetZipFile
  + ...
  - ...
ZIP_COLLECT_END

the enclosed collect and exclude statements (+/-) are appended to those of the ZIP block. The paths in these must be relative to the sourcePath of the ZIP block.

[Note]Note

It is important that ZIP_COLLECT statements are processed before the corresponding ZIP block is executed!

3.3.9. EXECUTE Statement

The statement

EXECUTE command

runs the specified command in the directory containing the installer script.

The variant

EXECUTE_NO_FAIL command
ignores any nonzero exit code returned by the command.

3.3.10. Collect and Exclude Statements

The statements

+ path
+L path
+? path

- filter
-G filter
-GR filter

are used to define a list of source files copied to the $(OUTPUT) directory. The +(L) statement adds all files matching the specified path, which is evaluated relative to the $(INPUT) directory (absolute paths are not allowed).

If the path specifies a directory, all files in that directory are added. The + statement adds files recursively, while the +L statement ("local") only adds files in the specified directory.

+? optionally adds files and does not report an error if the file does not exist.

The - statement removes all files from the list that match the specified filter and share the same input directory as the current one.

The -G statement acts globally, removing all matching files regardless of their input directory. It does not affect files that are added by a subsequent + statement.

The -GR statement also acts globally, removing all matching files, but the filter is considered to be a valid regular expression.

Files collected by those statements are copied after the last collect/exclude statement, i.e., before the non-collect or non-exclude statements without < or > (see Section 3.3, “Execution Statements”).

For both path and filter, the wildcards * and ? can be used, as well as [...] and (...|...|...) alternatives.

< and > mark directory name boundaries, allowing a directory to match even if it is at the beginning or end of the path.

Collect + patterns are matched against the start of the relative file path, while exclude - patterns are matched against the full relative file path.

A special pair pattern of the form (...) can be used in exclude statements to exclude a file matching the pattern when a paired file without the (...) expression is included. If the pair pattern expression starts with !, the file without the (...) expression is excluded.

Examples:

+ Dir1/Dir2      # Include Dir1/Dir2 and all subdirectories
+ Dir1/Dir[23]   # Include Dir1/Dir2 and Dir1/Dir3
+ Dir1/(one|two) # Include Dir1/one and Dir1/two
+ Dir1/*.def     # Include all .def files in Dir1 and subdirectories

- *.bak          # Exclude all .bak files
- *<CVS>*        # Exclude all CVS directories
- *(_d).dll      # Exclude all *_d.dll files, for which a *.dll exists
- *(!_d).dll     # Exclude all *.dll files, for which a *_d.dll exists

3.3.11. SWITCH_PACKAGE Statement

The statement

SWITCH_PACKAGE [SubDirectory/]PackageGroup/PackageName

switches $(INPUT) and $(OUTPUT) to the specified package. As a result, $(INPUT) points to $(MLAB_PackageGroup_PackageName) and $(OUTPUT) points to $(OUTPUT_PACKAGES_ROOT)/[SubDirectory/]PackageGroup/PackageName.

The output directory is created if it does not already exist. All subsequent collect statements or uses of $(INPUT) or $(OUTPUT) apply to the specified package.

Additional variables are set: $(CURRENT_PACKAGE_OUTPUT) points to the $(INPUT) of the package and $(CURRENT_PACKAGE_INPUT) points to the $(OUTPUT) of the package. These can be used if INPUT or OUTPUT are modified locally.

Examples:

SWITCH_PACKAGE MeVisLab/Foundation
+ lib
+ bin
SWITCH_PACKAGE MyPackageGroup/MyPackage
+ lib
+ bin

3.3.12. PUT_DIRECTLY_TO_FILELIST Statement

The statement

PUT_DIRECTLY_TO_FILELIST ext1 ext2 ext3 ...

adds the specified extensions to a list of file extensions.

All files with one of these extensions are added to a file list instead of being copied to $(OUTPUT).

This can be used, for example, with NSIS installers that can access the source data directly. In such cases, it is not necessary to copy files such as DLLs to the output directory, since they are not modified by the scripts (in contrast to MDL .script files, which are signed).

Typically, this statement should be placed early in the execution queue using <.

Example:

IFDEF WIN32
  <PUT_DIRECTLY_TO_FILELIST .dll .pyd .tiff .tif .dcm
                            .jpg .png .html .lib .exe .gif
ENDIF

3.3.13. WRITE_NSIS_FILELIST Statement

The statement

WRITE_NSIS_FILELIST NSIS_OUTPUTFILE NSIS_OUTPUTFILE_UNINSTALL relativePath1
                                               relativePath2 ...

can be used to generate complete source and destination file lists for NSIS installers. It considers both the file list generated by PUT_DIRECTLY_TO_FILELIST and the files copied to the $(OUTPUT_ROOT) directory. If relativePath1 is ., the entire $(OUTPUT_ROOT) directory is included.

Example:

>WRITE_NSIS_FILELIST $(INSTALLER_TMP)/binList.nsi
                     $(INSTALLER_TMP)/binListUninstall.nsi
                     bin

3.3.14. DELETE Statement

The statement

DELETE target1 target2 ...

removes the specified target file(s) or directories. Globbing patterns are supported for each target. Removal is not recursive.

Example:

>DELETE $(OUTPUT_ROOT)/SomeFile.txt

The DELETE_SILENT variant of this command does not report an error if no files are deleted.

3.3.15. FIND_AND_DELETE Statement

The statement

FIND_AND_DELETE directory pattern1 pattern2 ...

removes the files matching the specified patterns, searched recursively within the given directory.

Example:

>FIND_AND_DELETE $(OUTPUT_ROOT) .svn

3.4. Standalone Application Installer Variables

DEBUG

If DEBUG is set to 1, debug binaries (executables and libraries) are included in the installer. If it is set to 0, debug binaries are excluded.

EXCLUDE_...

You can forcibly exclude any third-party library from an installer by setting the variable EXCLUDE_<uppercase_library_name> to 1, for example, $EXCLUDE_LIBPQ 1.

Third-party library dependencies are detected automatically for standalone installers, but some dependencies are loaded dynamically and can be excluded if not required; for example, libpq, which is unnecessary unless access to a Postgres database is needed.

Careful testing of the installer is recommended when excluding libraries manually.

GENERATE_SBOM

By default, a software bill of materials (SBOM) JSON file following the CycloneDX specification is generated when creating a standalone installer. This step can be disabled by setting GENERATE_SBOM to 0.

The default value is 1.

INSTALLER_BRANDING

INSTALLER_BRANDING may be displayed in the installer. For example, on Windows the generated NSIS installer shows this string in the lower half above the button bar.

The default value is "MeVis Medical Solutions AG".

INSTALLER_COMPANY

The string in INSTALLER_COMPANY is used on Windows as the registry key that stores installation information.

The default value is "MeVis".

INSTALLER_COMPILE_ALL_PYTHON_FILES

Set INSTALLER_COMPILE_ALL_PYTHON_FILES to 1 to compile all Python source files (.py) into .pyc files, which are then included in the installer.

INSTALLER_EXCLUDE_UNCOMPILED_PYTHON_FILES

Set INSTALLER_EXCLUDE_UNCOMPILED_PYTHON_FILES to 1 to exclude all Python source files (.py) from the installer. This option is typically used together with INSTALLER_COMPILE_ALL_PYTHON_FILES.

INSTALLER_FINISHPAGE_LINK

Set INSTALLER_FINISHPAGE_LINK to the title of a link displayed on the finish page. The link URL must be specified using the INSTALLER_FINISHPAGE_LINK_LOCATION variable.

Example: $INSTALLER_FINISHPAGE_LINK Your Link Text

INSTALLER_FINISHPAGE_LINK_LOCATION

Set INSTALLER_FINISHPAGE_LINK_LOCATION to the URL of the link displayed on the finish page. The link title must be specified using the INSTALLER_FINISHPAGE_LINK variable.

Example: $INSTALLER_FINISHPAGE_LINK_LOCATION https://www.myCompany.com

INSTALLER_FINISHPAGE_RUN_NOTCHECKED

Set INSTALLER_FINISHPAGE_RUN_NOTCHECKED to 1 to leave the Run application checkbox unchecked by default.

INSTALLER_FINISHPAGE_RUN_TEXT

Set INSTALLER_FINISHPAGE_RUN_TEXT to a string to replace the text of Run application.

INSTALLER_FINISHPAGE_SHOWREADME

Set INSTALLER_FINISHPAGE_SHOWREADME to a relative path to display a checkbox for opening a readme or documentation file.

Example: $INSTALLER_FINISHPAGE_SHOWREADME Packages/MyPackageGroup/MyPackage/.../SomeFile.[html/PDF/txt]

INSTALLER_FINISHPAGE_SHOWREADME_NOTCHECKED

Set INSTALLER_FINISHPAGE_SHOWREADME_NOTCHECKED to 1 to leave the Show readme checkbox unchecked by default.

INSTALLER_FINISHPAGE_SHOWREADME_TEXT

Set INSTALLER_FINISHPAGE_SHOWREADME_TEXT to a string to replace the text of Show readme.

INSTALLER_FINISHPAGE_TEXT

Set INSTALLER_FINISHPAGE_TEXT to a string to replace the text of the finish page.

Example: $INSTALLER_FINISHPAGE_TEXT Alternative text...

INSTALLER_FINISHPAGE_TITLE

Set INSTALLER_FINISHPAGE_TITLE to a string to replace the title of the finish page.

Example: $INSTALLER_FINISHPAGE_TITLE Your Title

INSTALLER_GENERATE_ZIP

Set INSTALLER_GENERATE_ZIP to 1 to create a zip file instead of a self-installing executable.

The files in the .zip archive use the same layout as an executable installer, but actions such as installing desktop icons are not performed.

INSTALLER_HEADERBMP

(Windows only) Set INSTALLER_HEADERBMP to the path of a bitmap file displayed in the installer header.

Example: $INSTALLER_HEADERBMP $(LOCAL)/MyHeader.bmp

INSTALLER_HEADERIMG

(Linux only) Set INSTALLER_HEADERIMG to the path of a PNG file displayed in the installer header.

Example: $INSTALLER_HEADERIMG $(LOCAL)/MyHeader.png

INSTALLER_OUTFILE

Set INSTALLER_OUTFILE to the base name of the installer executable. This overrides the default $PRODUCT. The executable extension is appended automatically.

INSTALLER_TARGET_DIR

INSTALLER_OUTFILE refers to the root directory where the installer files are generated. You should not set this variable manually.

INSTALLER_TAR_COMPRESS_OPTION

(Linux only) Set the compression type used for the generated installer. Any single-letter option supported by the tar command can be used. Currently, these are:

z = gzip, j = bzip2, J = xz, Z = (un)compress

If not specified, z is used by default.

Note: xz provides better compression than gzip, but is slower because it runs single-threaded by default. To use all available processor cores, set the environment variable XZ_OPT=-T0.

INSTALLER_WINDOWS_ICON

Set this to the absolute path of a Windows .ico file to replace the default icon of the Windows installer executable.

MAKE_ALL_OUTPUT_FILES_WRITEABLE

Set MAKE_ALL_OUTPUT_FILES_WRITEABLE to 1 to make all output files writeable (this is useful when working with read-only source files).

OUTPUT_APPLICATION_ROOT

Set OUTPUT_APPLICATION_ROOT to specify a subdirectory of the default OUTPUT_ROOT where installer files are extracted.

OUTPUT_SBOM_FILE

If set, OUTPUT_SBOM_FILE specifies the location where the SBOM file is generated.

The default value is $(INSTALLER_TARGET_DIR)/$(PRODUCT)_sbom.json.

PREFSFILE_OPTION[1-10]

Set PREFSFILE_OPTION[1-10] to provide up to ten variables in the .prefs file.

Any text can be used in these options; it is copied verbatim and in order into the application's .prefs file.

Example: $PREFSFILE_OPTION1 MLCacheSizeInMB = 1024

Example: $PREFSFILE_OPTION2 OtherOption = OtherValue

PRODUCT

Set PRODUCT to the name of the product.

PRODUCT_VENDOR

Set PRODUCT_VENDOR to the vendor name of the product. On Windows, this is used, for example, in the registry.

The default is "MeVis Medical Solutions AG".

RELEASE

If RELEASE is set to 1, release binaries (executables and libraries) are included in the installer. If it is set to 0, release binaries are excluded.

SBOM_MAIN_COMPONENT_PATH

SBOM_MAIN_COMPONENT_PATH specifies the path to a JSON file containing the attributes of the main application component (i.e., your application) according to the CycloneDX specification.

The application name and version are always overridden with the $(PRODUCT) and $(VERSION) values from the .mlinstall file. If this value is not set, a minimal component is generated from $(PRODUCT) and $(VERSION).

SIGN_LICENSE_FILE

SIGN_LICENSE_FILE specifies the path to the license file used for signing.

STANDALONE_APPLICATION_ARGS

STANDALONE_APPLICATION_ARGS specifies the arguments passed to the MeVisLab macro.

Example: $STANDALONE_APPLICATION_ARGS arg1 arg2

STANDALONE_APPNAME

STANDALONE_APPNAME overrides the internal name of the application (default: STANDALONE_MACRONAME) and the filename of the license file (default: FINAL_LICENSEKEY_FILE). It is also used for the filenames of the application executable, icon file, splash image file, and .prefs file.

STANDALONE_AUTO_DETECT_MODULE_DEPENDENCIES

If STANDALONE_AUTO_DETECT_MODULE_DEPENDENCIES is set to 1, the dependencies of the application macro are detected automatically.

STANDALONE_CLI_APPLICATION

Set STANDALONE_CLI_APPLICATION to 1 if the application is intended to run from the command line only. This replaces -runapp with -runappbatch in the application arguments.

STANDALONE_EXECUTABLENAME

Set STANDALONE_EXECUTABLENAME to the desired name of the starter executable (as shown, for example, in process listings). It is recommended that the name not contain spaces. If not specified, the default is "MeVisLabApp".

STANDALONE_FINISHPAGE

Set STANDALONE_FINISHPAGE to 1 to enable the installer finish page on Windows. This page allows the user to start the application after installation and/or display additional information. See also the INSTALLER_FINISHPAGE_<OPTION> variables.

STANDALONE_ICON

Set STANDALONE_ICON to the path of the application’s icon file.

STANDALONE_LICENSEKEY

Set STANDALONE_LICENSEKEY to the path of a license file to embed it into the application installer.

STANDALONE_MACRONAME

Set STANDALONE_MACRONAME to the name of the MeVisLab application macro module.

STANDALONE_LOGFILE

Set STANDALONE_LOGFILE to a file path or file name that will be created relative to your $(HOME) directory.

The file name must end with .log; otherwise, the log file is created as $(STANDALONE_APPNAME).log in your $(HOME) directory.

STANDALONE_SPLASHIMAGE

Set STANDALONE_SPLASHIMAGE to the path of an image file that replaces the MeVisLab splash image.

STANDALONE_STARTER_ARGS

STANDALONE_STARTER_ARGS specifies additional arguments passed to the application.

Run MeVisLabApp -help in Packages/MeVisLab/IDE/bin to see a list of available arguments. Note that -runapp or -runappbatch are added automatically to the command-line arguments (see STANDALONE_CLI_APPLICATION).

VERSION

VERSION specifies the product version.

WEB_APPLICATION

Set WEB_APPLICATION to 1 to generate a web application installer.

WEB_APPLICATION_INDEX_TEMPLATE

Set WEB_APPLICATION_INDEX_TEMPLATE to the path of an HTML file to be used instead of the default template.

Chapter 4. Advanced Commands

4.1. runApplicationCommand

In the Commands section of a macro module, the runApplicationCommand tag defines a scripting command that is executed after a module is loaded but before its window is opened.

The runApplicationCommand receives the following arguments: (argumentList, absolutePath).

When MeVisLab is started with MeVisLab -runApp[Batch] SomeMacro arg1 arg2..., it creates the SomeMacro macro and executes runApplicationCommand with ([arg1, arg2, ...], currentDirectoryAsAbsolutePath) before showing the SomeMacro window.

When MeVisLab is started with -runAppBatch instead of -runApp, no window is shown, but runApplicationCommand is executed nevertheless.

[Tip]Tip

Please have a look at the module TestBatchCommand for an example.