Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F14040569
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/roles/webserver-legacy/php-builder/files/fix-bug-76113.patch b/roles/webserver-legacy/php-builder/files/fix-bug-76113.patch
new file mode 100644
index 0000000..b062088
--- /dev/null
+++ b/roles/webserver-legacy/php-builder/files/fix-bug-76113.patch
@@ -0,0 +1,11 @@
+--- php_mbregex.c.orig 2018-03-19 09:10:18 UTC
++++ php_mbregex.c
+@@ -454,7 +454,7 @@ static php_mb_regex_t *php_mbregex_compi
+ OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
+
+ found = zend_hash_find(&MBREX(ht_rc), (char *)pattern, patlen+1, (void **) &rc);
+- if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) {
++ if (found == FAILURE || onig_get_options(*rc) != options || onig_get_encoding(*rc) != enc || onig_get_syntax(*rc) != syntax) {
+ if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
+ onig_error_code_to_str(err_str, err_code, &err_info);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str);
diff --git a/roles/webserver-legacy/php-builder/init.sls b/roles/webserver-legacy/php-builder/init.sls
index a59429f..3ab43b9 100644
--- a/roles/webserver-legacy/php-builder/init.sls
+++ b/roles/webserver-legacy/php-builder/init.sls
@@ -1,10 +1,11 @@
# -------------------------------------------------------------
# Salt — Compile custom PHP builds
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2018-10-16
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
+ - .software
- .source
diff --git a/roles/webserver-legacy/php-builder/init.sls b/roles/webserver-legacy/php-builder/software.sls
similarity index 55%
copy from roles/webserver-legacy/php-builder/init.sls
copy to roles/webserver-legacy/php-builder/software.sls
index a59429f..baf179d 100644
--- a/roles/webserver-legacy/php-builder/init.sls
+++ b/roles/webserver-legacy/php-builder/software.sls
@@ -1,10 +1,16 @@
# -------------------------------------------------------------
# Salt — Compile custom PHP builds
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
-# Created: 2018-10-16
+# Created: 2018-10-17
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-include:
- - .source
+# -------------------------------------------------------------
+# PHP dependencies
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+php_builder_dependencies:
+ pkg.installed:
+ - pkgs:
+ - libmcrypt
diff --git a/roles/webserver-legacy/php-builder/source.sls b/roles/webserver-legacy/php-builder/source.sls
index 23cdd5a..2536373 100644
--- a/roles/webserver-legacy/php-builder/source.sls
+++ b/roles/webserver-legacy/php-builder/source.sls
@@ -1,80 +1,133 @@
#!py
# -------------------------------------------------------------
# Salt — Compile custom PHP builds
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2018-10-16
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Builds and versions helper methods
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def get_release_builds():
return {name: build
for (name, build) in __pillar__["php_custom_builds"].items()
if build["mode"] == "release"}
def get_release_versions():
versions = [(build['version'], build['hash'])
for build in get_release_builds().values()]
return set(versions)
def get_archive_path(version):
- return "/opt/php/archives/php-" + version + ".tar.bz2"
+ return "/opt/php/_archives/php-" + version + ".tar.bz2"
def get_build_directories():
- return ["/opt/php/" + build for build in __pillar__["php_custom_builds"]]
+ return [get_build_directory(build) for build in __pillar__["php_custom_builds"]]
+
+
+def get_build_directory(build):
+ return "/opt/php/_builds/" + build
def get_extract_archive_command(archive, directory):
return "tar xjf " + archive + " --strip-components=1 -C " + directory
+# -------------------------------------------------------------
+# ./configure
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def get_configure(version, build):
+ if version.startswith("5.6"):
+ cmd = "./configure --prefix=/opt/php/{target} --disable-cgi " \
+ "--enable-fpm --with-fpm-user=app --with-fpm-group=app " \
+ "--enable-mysqlnd --enable-bcmath --with-bz2 --enable-calendar " \
+ "--with-curl --with-gd --with-jpeg-dir --enable-gd-native-ttf " \
+ "--enable-mbstring --with-mcrypt --with-mysqli --with-pdo-mysql " \
+ "--enable-pcntl --with-openssl --with-xsl --with-readline " \
+ "--with-zlib --enable-zip"
+
+ return cmd.format(target=build)
+
+ raise Exception("Unknown ./configure for PHP v" + version)
+
+
# -------------------------------------------------------------
# Configuration provider
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def run():
config = {}
builder_user = 'builder'
- directories_to_create = ['/opt/php', '/opt/php/archives']
+ build_directories = get_build_directories()
+ directories_to_create = ['/opt/php', '/opt/php/_archives', '/opt/php/_builds']
# Task: create directories
- directories_to_create.extend(get_build_directories())
+ directories_to_create.extend(build_directories)
for directory in directories_to_create:
config[directory] = {'file.directory': [{'user': builder_user}]}
# Task: fetch archives
for version, archive_hash in get_release_versions():
archive = get_archive_path(version)
url = "http://fr2.php.net/get/php-" + version + ".tar.bz2/from/this/mirror"
config[archive] = {'file.managed': [
{'source': url},
{'source_hash': archive_hash},
{'user': builder_user},
]}
# Task: extract archives to build directories
for build_name, build in get_release_builds().items():
archive = get_archive_path(build['version'])
- directory = "/opt/php/" + build_name
+ directory = get_build_directory(build_name)
command = get_extract_archive_command(archive, directory)
- config["php_build_" + build_name] = {'cmd.run' : [
+ config["php_build_" + build_name + "_phase1_extract"] = {'cmd.run': [
{'name': command},
{'user': builder_user},
{'creates': directory + "/configure.in"},
]}
+ if build['version'] < "7":
+ # New versions of Onigurama requires a patch not merged in 5.6.38
+ # See https://bugs.php.net/bug.php?id=76113
+ config["php_build_" + build_name + "_phase1_patch"] = {'file.patch': [
+ {'name': directory + '/ext/mbstring/php_mbregex.c'},
+ {'source': 'salt://roles/webserver-legacy/php-builder/files/fix-bug-76113.patch'},
+ {'hash': '609629c38fa9d8e520e3dadc3fae942d'},
+ ]}
+
+ # Task: build PHP
+ # Task: install PHP
+ for build_name, build in __pillar__["php_custom_builds"].items():
+ directory = get_build_directory(build_name)
+ config["php_build_" + build_name + "_phase2_compile"] = {'cmd.run': [
+ {'names': [
+ "cd " + directory,
+ get_configure(build["version"], build_name),
+ "make"
+ ]},
+ {'user': builder_user},
+ {'creates': directory + "/configure"},
+ ]}
+
+ config["php_build_" + build_name + "_phase2_install"] = {'cmd.run': [
+ {'name': "make install"},
+ {'creates': directory + "/configure"},
+ ]}
+
return config
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Nov 28, 17:42 (23 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3205142
Default Alt Text
(8 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment