Package original PHP alongside the Swift server

This commit is contained in:
SantaSpeen committed 2026-11-22 04:01:25 +03:00
1 parent 5852266ed9
commit 66a35a9f7c
5 files changed
+66 -5

No files matched your search

+25
View File
@@ -10,6 +10,19 @@ build_for_arch() {
swift build -c release --arch "$arch" --scratch-path "$scratch" --show-bin-path
}
runtime="${EZSERVER_RUNTIME:-$PWD/.build/ezserver-macos/runtime}"
installer="$PWD/_source/EzServer V4.1.6 Setup.exe"
if [[ ! -e "$runtime" && -f "$installer" ]]; then
EZSERVER_RUNTIME="$runtime" ./server/prepare.sh "$installer"
fi
if [[ -e "$runtime" || "${EZSERVER_REQUIRE_PHP:-0}" == 1 ]]; then
if [[ ! -f "$runtime/www/ezwebserver/src/public/api/index.php" ||
! -f "$runtime/www/ezwebserver/src/vendor/autoload.php" ]]; then
printf 'Original PHP runtime missing or incomplete: %s\n' "$runtime" >&2
exit 1
fi
fi
arm64_bin="$(build_for_arch arm64)"
x86_64_bin="$(build_for_arch x86_64)"
mkdir -p dist
@@ -23,6 +36,18 @@ xcrun lipo "$binary" -verify_arch arm64 x86_64
cp Packaging/Info.plist "$app/Contents/Info.plist"
cp README.md "$app/Contents/Resources/README.md"
ditto Packaging/webconsole "$app/Contents/Resources/webconsole"
if [[ -d "$runtime" ]]; then
php_resources="$app/Contents/Resources/php"
mkdir -p "$php_resources"
cp server/{run.sh,router.php,nginx.conf.in,php-fpm.conf.in,init-sqlite.php,patients.sqlite.sql,sqlite-database.php,sqlite-rest.php} \
"$php_resources/"
mkdir "$php_resources/runtime"
ditto "$runtime/www" "$php_resources/runtime/www"
cp "$runtime/index.html" "$php_resources/runtime/index.html"
application="$php_resources/runtime/www/ezwebserver/src/application"
rm -rf "$application/logs" "$application/cache/sessions"
mkdir -p "$application/logs" "$application/cache/sessions"
fi
codesign --force --sign - "$app"
codesign --verify --deep --strict "$app"
ditto -c -k --keepParent "$app" "$stage/EzServerMac-universal.zip"