Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3912972
D1941.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D1941.diff
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
--- /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
--- a/roles/webserver-legacy/php-builder/init.sls
+++ b/roles/webserver-legacy/php-builder/init.sls
@@ -7,4 +7,5 @@
# -------------------------------------------------------------
include:
+ - .software
- .source
diff --git a/roles/webserver-legacy/php-builder/init.sls b/roles/webserver-legacy/php-builder/software.sls
copy from roles/webserver-legacy/php-builder/init.sls
copy to roles/webserver-legacy/php-builder/software.sls
--- a/roles/webserver-legacy/php-builder/init.sls
+++ b/roles/webserver-legacy/php-builder/software.sls
@@ -2,9 +2,15 @@
# 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
--- a/roles/webserver-legacy/php-builder/source.sls
+++ b/roles/webserver-legacy/php-builder/source.sls
@@ -27,11 +27,15 @@
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):
@@ -39,6 +43,26 @@
# -------------------------------------------------------------
+# ./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
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -47,10 +71,11 @@
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}]}
@@ -68,13 +93,41 @@
# 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/plain
Expires
Fri, Dec 20, 07:49 (20 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2307799
Default Alt Text
D1941.diff (6 KB)
Attached To
Mode
D1941: Build PHP source code
Attached
Detach File
Event Timeline
Log In to Comment