An AbstractProduct is an expected result after building of a package.

Examples of Products include LibraryProduct, FrameworkProduct, ExecutableProduct and FileProduct. All AbstractProduct types must define the following minimum set of functionality:

ExecutableProduct(names::Vector{String}, varname::Symbol; dir_path = nothing)

On all platforms, an ExecutableProduct checks for existence of the file. On Windows platforms, it will check that the file ends with ".exe", (adding it on automatically to the search paths, if it is not already present).

LibraryProduct(paths::Vector{String}, varname::Symbol;

Declares a LibraryProduct that points to a library located within the prefix. paths contain valid paths for this library, varname is the name of the variable in the JLL package that can be used to call into the library. The flags to pass to dlopen can be specified as a vector of Symbols with the dlopen_flags keyword argument.

Each element of path takes the form [dirname/]basename[.versioned-ext] where dirname and versioned-ext are optional and can be omitted. Accordingly, the following three paths will all find the same library:

  • lib/
  • lib/libnettle
  • libnettle

On non-Windows targets, omitting dirname will automatically prepend lib, while on Windows targets bin will be prepended. Omitting the versioned extension will allow any version of the library to be used (usually not a problem as there's typically only one version of a library at a time).

locate(ep::ExecutableProduct, prefix::String;
       verbose::Bool = false)

If the given executable file exists and is executable, return its path.

On all platforms, an ExecutableProduct checks for existence of the file. On non-Windows platforms, it will check for the executable bit being set. On Windows platforms, it will check that the file ends with ".exe", (adding it on automatically, if it is not already present).

locate(fp::FileProduct, prefix::String; env, verbose = false)

If the file product exists at any of its search paths, return that path.

locate(lp::LibraryProduct, prefix::Prefix;
       verbose::Bool = false)

If the given library exists (under any reasonable name) and is dlopen()able, (assuming it was built for the current platform) return its location. Note that the dlopen() test is only run if the current platform matches the given platform keyword argument, as cross-compiled libraries cannot be dlopen()ed on foreign platforms.

path_prefix_transformation(::Type{<:AbstractProduct}, path, prefix, env)

Performs ths transformation to alter a path to be relative to prefix. Takes into account templating via env, as well as applying add_default_product_dir() to products that can have their leading directory dropped (e.g. ExecutableProduct and LibraryProduct).

valid_dl_path(path, platform)

Returns true if path represents a valid dynamic library path (e.g. on Linux/FreeBSD, libfoo-X.dll on Windows, libfoo.X.dylib on macOS) as specified by Base.BinaryPlatforms.parse_dl_name_version(). Returns false otherwise