diff --git a/.gitignore b/.gitignore index ce6d63465d3f168c7736308965fff983f0b4365a..c68933aee0e9b8ff5a4d2f34216fb2b68a7a8bc8 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 a7ed9a33d5f923c98b2c6f16971ed0d3519a0345..527184edf90d95d77f981708fd590e5e805387d2 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 938f0d4e521b203939357dd4e08039f8ae380b5a..2b0ad233f13e9e700d26e3dda426136fde2d1639 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 895649b8d4a74d5830e53781977d0cb45b71c2a7..82b9265b188cc1c2629bf4e5fa84504491fe5829 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 d8b8a0f527a938ecd2e1d9246c2ce8160a732f64..92da17e47e84cd15b39b81a1635d171f6c963ec5 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\"");