Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11723122
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/roles/webserver-legacy/php-builder/source.sls b/roles/webserver-legacy/php-builder/source.sls
index c9d4c92..ef2b0cc 100644
--- a/roles/webserver-legacy/php-builder/source.sls
+++ b/roles/webserver-legacy/php-builder/source.sls
@@ -1,132 +1,138 @@
#!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"
def get_build_directories():
return [get_build_directory(build) for build in __pillar__["php_custom_builds"]]
def get_build_directory(build):
return "/opt/php/_builds/" + build
+def get_install_directory(build):
+ return "/opt/php/" + 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'
build_directories = get_build_directories()
directories_to_create = ['/opt/php', '/opt/php/_archives', '/opt/php/_builds']
# Task: create 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 = get_build_directory(build_name)
command = get_extract_archive_command(archive, directory)
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'},
]}
# Task: build PHP
# Task: install PHP
for build_name, build in __pillar__["php_custom_builds"].items():
- directory = get_build_directory(build_name)
+ build_directory = get_build_directory(build_name)
+ install_directory = get_install_directory(build_name)
+
config["php_build_" + build_name + "_phase2_compile"] = {'cmd.run': [
{'names': [
- "cd " + directory,
get_configure(build["version"], build_name),
- "make"
+ "make",
+ "touch .built",
]},
+ {'cwd': build_directory},
{'user': builder_user},
- {'creates': directory + "/configure"},
+ {'creates': build_directory + "/.built"},
]}
config["php_build_" + build_name + "_phase2_install"] = {'cmd.run': [
{'name': "make install"},
- {'creates': directory + "/configure"},
+ {'cwd': build_directory},
+ {'creates': install_directory + "/bin/php"},
]}
return config
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Sep 18, 08:17 (14 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2990230
Default Alt Text
(5 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment