diff --git a/roles/devserver/userland-software/files/ast.ini b/roles/devserver/userland-software/files/ast.ini new file mode 100644 index 0000000..18d10b7 --- /dev/null +++ b/roles/devserver/userland-software/files/ast.ini @@ -0,0 +1,16 @@ +; ------------------------------------------------------------- +; PHP configuration +; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +; Project: Nasqueron +; License: Trivial work, not eligible to copyright +; Source file: roles/devserver/userland-software/files/ast.ini +; ------------------------------------------------------------- +; +; +; This file is managed by our rOPS SaltStack repository. +; +; Changes to this file may cause incorrect behavior +; and will be lost if the state is redeployed. +; + +extension=ast.so diff --git a/roles/devserver/userland-software/files/install-php-extension.sh b/roles/devserver/userland-software/files/install-php-extension.sh new file mode 100644 index 0000000..426e97b --- /dev/null +++ b/roles/devserver/userland-software/files/install-php-extension.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# ------------------------------------------------------------- +# Intall PHP extension +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Nasqueron +# Author: Sébastien Santoro aka Dereckson +# Created: 2018-03-29 +# License: BSD-2-Clause +# Source file: roles/devserver/userland-software/files/install-php-extension.sh +# ------------------------------------------------------------- + +phpize +./configure +make diff --git a/roles/devserver/userland-software/init.sls b/roles/devserver/userland-software/init.sls index a9b4267..72b833b 100644 --- a/roles/devserver/userland-software/init.sls +++ b/roles/devserver/userland-software/init.sls @@ -1,22 +1,23 @@ # ------------------------------------------------------------- # Salt — Provision software # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # Created: 2017-10-20 # License: Trivial work, not eligible to copyright # ------------------------------------------------------------- include: # Shell server content - roles/shellserver/userland-software/base - roles/shellserver/userland-software/irc - roles/shellserver/userland-software/web # Builder role content - roles/builder # Software specific for development servers - .dev - .misc - .notifications - .phabricator + . .php-ast - .psysh - .wordpress diff --git a/roles/devserver/userland-software/map.jinja b/roles/devserver/userland-software/map.jinja new file mode 100644 index 0000000..7dbf0be --- /dev/null +++ b/roles/devserver/userland-software/map.jinja @@ -0,0 +1,20 @@ +# ------------------------------------------------------------- +# Salt — Provision dev software +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Nasqueron +# Created: 2018-03-29 +# License: Trivial work, not eligible to copyright +# ------------------------------------------------------------- + +{% set php = salt['grains.filter_by']({ + 'Debian': { + 'current_api': '20170718', + 'extension_dir': '/usr/lib/php/20170718', + 'cli_conf_dir': '/etc/php/7.2/cli/conf.d/', + }, + 'FreeBSD' : { + 'current_api': '20170718', + 'extension_dir': '/usr/local/lib/php/20170718', + 'cli_conf_dir': '/usr/local/etc/php/', + }, +}, default='Debian') %} diff --git a/roles/devserver/userland-software/php-ast.sls b/roles/devserver/userland-software/php-ast.sls new file mode 100644 index 0000000..ee322e1 --- /dev/null +++ b/roles/devserver/userland-software/php-ast.sls @@ -0,0 +1,48 @@ +# ------------------------------------------------------------- +# Salt — Provision dev software +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Nasqueron +# Created: 2018-03-29 +# License: Trivial work, not eligible to copyright +# ------------------------------------------------------------- + +{% from "roles/devserver/userland-software/map.jinja" import php with context %} + +# ------------------------------------------------------------- +# Fetch software +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +/opt/php-ast: + file.directory: + - user: builder + +php_ast_repository: + git.latest: + - name: https://github.com/nikic/php-ast.git + - target: /opt/php-ast + - user: builder + +# ------------------------------------------------------------- +# Build software +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +php_ast_build: + cmd.script: + - source: salt://roles/devserver/userland-software/files/install-php-extension.sh + - cwd: /opt/php-ast + - runas: builder + - creates: /opt/php-ast/modules/ast.so + +php_ast_install: + cmd.run: + - name: make install + - cwd: /opt/php-ast + - creates: {{ php.extension_dir }}/ast.so + +# ------------------------------------------------------------- +# PHP configuration +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +{{ php.cli_conf_dir }}/ext-40-ast.ini: + file.managed: + - source: salt://roles/devserver/userland-software/files/ast.ini