Defined Type: bazinga::php::compile_ext

Defined in:
manifests/php/compile_ext.pp

Overview

Define: bazinga::php::compile_ext

Parameters:

repository

The Git repository

configure_flags

Flags to append after the ‘configure’ command

Parameters:

  • repository (Any)
  • configure_flags (Any) (defaults to: 'UNDEF')


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'manifests/php/compile_ext.pp', line 11

define bazinga::php::compile_ext (
  $repository,
  $configure_flags = 'UNDEF'
) {

  ensure_packages([ 'git' ])

  $tmp_dir = "/tmp/${name}"
  $flags   = $configure_flags ? {
    'UNDEF' => '',
    default => " ${configure_flags}"
  }

  exec { "bazinga-php-compile-ext-${name}-download":
    command => "git clone ${repository} ${tmp_dir}",
    path    => '/usr/bin:/bin:/usr/sbin:/sbin',
    unless  => "php -m | grep ${name}",
  }

  exec { "bazinga-php-compile-ext-${name}-phpize":
    command => 'phpize',
    path    => '/usr/bin:/bin:/usr/sbin:/sbin',
    cwd     => $tmp_dir,
    require => [
      Class['bazinga::roles::php'],
      Exec["bazinga-php-compile-ext-${name}-download"]
    ],
    onlyif  => "test -d ${tmp_dir}",
  }

  exec { "bazinga-php-compile-ext-${name}-configure":
    command => "sh configure${flags}",
    path    => '/usr/bin:/bin:/usr/sbin:/sbin',
    cwd     => $tmp_dir,
    require => Exec["bazinga-php-compile-ext-${name}-phpize"],
    onlyif  => "test -d ${tmp_dir}",
  }

  exec { "bazinga-php-compile-ext-${name}-install":
    command => 'make && make install',
    path    => '/usr/bin:/bin:/usr/sbin:/sbin',
    cwd     => $tmp_dir,
    require => Exec["bazinga-php-compile-ext-${name}-configure"],
    onlyif  => "test -d ${tmp_dir}",
    unless  => "php -m | grep ${name}",
  }

  file { "bazinga-php-compile-ext-${name}-config-file":
    ensure  => present,
    name    => "${php::params::conf_dir}${name}.ini",
    content => template('bazinga/php/extension.ini.erb'),
    require => Exec["bazinga-php-compile-ext-${name}-install"],
    notify  => defined(Class['php::fpm::service']) ? {
      true  => Class['php::fpm::service'],
      false => undef
    },
  }
}