installer_t Derived Type

type, public :: installer_t

Declaration of the installer type


Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: bindir

Binary dir relative to the installation prefix

character(len=:), public, allocatable :: copy

Command to copy objects into the installation prefix

character(len=:), public, allocatable :: includedir

Include directory relative to the installation prefix

character(len=:), public, allocatable :: libdir

Library directory relative to the installation prefix

character(len=:), public, allocatable :: move

Command to move objects into the installation prefix

integer, public :: os

Cached operating system

character(len=:), public, allocatable :: prefix

Path to installation directory

character(len=:), public, allocatable :: testdir

Test program directory relative to the installation prefix

integer, public :: unit = output_unit

Output unit for informative printout

integer, public :: verbosity = 1

Verbosity of the installer


Type-Bound Procedures

procedure, public :: install

Install a generic file into a subdirectory in the installation prefix

  • private subroutine install(self, source, destination, error)

    Install a generic file into a subdirectory in the installation prefix

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: source

    Path to the original file

    character(len=*), intent(in) :: destination

    Path to the destination inside the prefix

    type(error_t), intent(out), allocatable :: error

    Error handling

procedure, public :: install_executable

Install an executable in its correct subdirectory

  • private subroutine install_executable(self, executable, error)

    Install an executable in its correct subdirectory

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: executable

    Path to the executable

    type(error_t), intent(out), allocatable :: error

    Error handling

procedure, public :: install_header

Install a header/module in its correct subdirectory

  • private subroutine install_header(self, header, error)

    Install a header/module in its correct subdirectory

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: header

    Path to the header

    type(error_t), intent(out), allocatable :: error

    Error handling

procedure, public :: install_library

Install a library in its correct subdirectory

  • private subroutine install_library(self, library, error)

    Install a library in its correct subdirectory

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: library

    Path to the library

    type(error_t), intent(out), allocatable :: error

    Error handling

procedure, public :: install_test

Install a test program in its correct subdirectory

  • private subroutine install_test(self, test, error)

    Install a test program in its correct subdirectory

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: test

    Path to the test executable

    type(error_t), intent(out), allocatable :: error

    Error handling

procedure, public :: make_dir

Create a new directory in the prefix, type-bound for unit testing purposes

  • private subroutine make_dir(self, dir, error)

    Create a new directory in the prefix

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: dir

    Directory to be created

    type(error_t), intent(out), allocatable :: error

    Error handling

procedure, public :: run

Run an installation command, type-bound for unit testing purposes

  • private subroutine run(self, command, error)

    Run an installation command

    Arguments

    Type IntentOptional Attributes Name
    class(installer_t), intent(inout) :: self

    Instance of the installer

    character(len=*), intent(in) :: command

    Command to be launched

    type(error_t), intent(out), allocatable :: error

    Error handling

Source Code

  type :: installer_t
    !> Path to installation directory
    character(len=:), allocatable :: prefix
    !> Binary dir relative to the installation prefix
    character(len=:), allocatable :: bindir
    !> Library directory relative to the installation prefix
    character(len=:), allocatable :: libdir
    !> Test program directory relative to the installation prefix
    character(len=:), allocatable :: testdir
    !> Include directory relative to the installation prefix
    character(len=:), allocatable :: includedir
    !> Output unit for informative printout
    integer :: unit = output_unit
    !> Verbosity of the installer
    integer :: verbosity = 1
    !> Command to copy objects into the installation prefix
    character(len=:), allocatable :: copy
    !> Command to move objects into the installation prefix
    character(len=:), allocatable :: move
    !> Cached operating system
    integer :: os
  contains
    !> Install an executable in its correct subdirectory
    procedure :: install_executable
    !> Install a library in its correct subdirectory
    procedure :: install_library
    !> Install a header/module in its correct subdirectory
    procedure :: install_header
    !> Install a test program in its correct subdirectory
    procedure :: install_test
    !> Install a generic file into a subdirectory in the installation prefix
    procedure :: install
    !> Run an installation command, type-bound for unit testing purposes
    procedure :: run
    !> Create a new directory in the prefix, type-bound for unit testing purposes
    procedure :: make_dir
  end type installer_t