From 5a66c40c63ea3ee8f734c0336cc9d68d894e9bb0 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Fri, 14 Mar 2025 14:28:29 +0100 Subject: [PATCH] update build env: use php 8.4.4; add build info --- .gitignore | 2 +- TODO.md | 2 ++ build.php | 41 +++++++++++++++++++++++++++++++++++++++-- inc_vars.php | 5 ++++- installer.php | 4 ++-- 5 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index ce6d634..c68933a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ built_packages/ external/ build src/include_checks.php -src/amcli.php.tmp +src/amcli__build.php diff --git a/TODO.md b/TODO.md index a7ed9a3..527184e 100644 --- a/TODO.md +++ b/TODO.md @@ -12,6 +12,8 @@ was ich so sehe ... ⬜ Docker dev environment +⬜ IP Restriction + ## Tests schreiben ✅ Test auf gesetzte Metadaten diff --git a/build.php b/build.php index 938f0d4..2b0ad23 100755 --- a/build.php +++ b/build.php @@ -40,8 +40,16 @@ if(file_exists($OUTFILE)){ // ---------------------------------------------------------------------- _h1("Prepare source"); +$sBuildDate=date("Y-m-d H:i:s"); +$sBuildPhpcode="\$AMCLI_BUILD_DATE=\"$sBuildDate\";"; +$datefile=str_replace('.php', '__build.php', $INFILE); +file_put_contents( + $datefile, "<?php + // This file was generated by ".__FILE__." + $sBuildPhpcode" +); $in=file_get_contents($INFILE); -$inccode=file_get_contents($INCFILE); +$inccode=$sBuildPhpcode . "\n". file_get_contents($INCFILE); $inccode=str_replace("<?php", "", $inccode); $tempcode=preg_replace("#\/\/ ---MARK---INCLUDE-CHECKS---START---.*---MARK---INCLUDE-CHECKS---END#s", "$inccode", $in); @@ -68,11 +76,40 @@ _exec("$SPC \ _h1("Test generated binary"); _exec("file \"$OUTFILE\""); -_exec("\"$OUTFILE\" --ini=../src/simple.ini"); +_exec("\"$OUTFILE\" --ini=../tests/configs/metadata.ini"); _h1("Write architecture specific binary"); _exec("cp \"$OUTFILE\" '$OUTFILE2'"); +_h1("Create readme"); +$readme="{$OUTFILE2}__README.md"; +$versionSPC=system("$SPC --version"); +file_put_contents($readme, + "# Build infos + +Date : $sBuildDate + +OS : $myos +architecture: $myarchitecture + +File : ".basename($OUTFILE2)." + +## Versions + +Used SPC : $versionSPC +PHP version : $php_version +PHP modules : $php_libs + +## Conmands + +Download : `$cmdSpcDownload` + +Build : `$cmdSpcBuild` + +see https://os-docs.iml.unibe.ch/appmonitor-cli-client/ +"); + +echo "see $readme\n"; // ---------------------------------------------------------------------- diff --git a/inc_vars.php b/inc_vars.php index 895649b..82b9265 100644 --- a/inc_vars.php +++ b/inc_vars.php @@ -8,7 +8,7 @@ $dirPackages="built_packages"; // ---------- build with spc // php version for spc -$php_version="8.3"; +$php_version="8.4.4"; // extensions - see https://static-php.dev/en/guide/extensions.html $php_libs="mysqli,openssl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,sockets"; @@ -38,3 +38,6 @@ switch ($myos) { $myosextension=$myos=="windows" ? ".exe" : ""; $SPC=str_replace('/', DIRECTORY_SEPARATOR , "$selfdir/$dirExternal/bin/spc$myosextension"); + +$cmdSpcDownload="$SPC download --no-interaction --with-php=$php_version --for-extensions \"$php_libs\""; +$cmdSpcBuild="$SPC build --no-interaction --build-micro \"$php_libs\""; diff --git a/installer.php b/installer.php index d8b8a0f..92da17e 100755 --- a/installer.php +++ b/installer.php @@ -171,10 +171,10 @@ if ($bDoBild){ _exec("$SPC --no-interaction doctor"); echo "💡 Hint: this can take a minute on a fresh install ...\n"; - _exec("$SPC download --no-interaction --with-php=$php_version --for-extensions \"$php_libs\""); + _exec($cmdSpcDownload); echo "💡 Hint: this can take 4 minutes on a fresh install or less on module changes ...\n"; - _exec("$SPC build --no-interaction --build-micro \"$php_libs\""); + _exec($cmdSpcBuild); file_put_contents("$doneBuild", date("Y-m-d H:i:s") . "\n$sDoneData\n"); } else { _skip("Micro already built - php $php_version - extensions \"$php_libs\""); -- GitLab