Skip to content
Snippets Groups Projects
Select Git revision
  • a80b64b66ed739c87b224997177c9ddef77afc9e
  • master default protected
  • update-appmonitor
3 results

inc_functions.php

Blame
  • build.php 4.65 KiB
    #!/bin/env php
    <?php
    
    require("inc_vars.php");
    require("inc_functions.php");
    
    $INFILE="$selfdir/src/amcli.php";
    $INCFILE="$selfdir/src/include_checks.php";
    $TMPFILE="$selfdir/$dirBuild/amcli.php.tmp";
    
    $OUTFILE="$selfdir/$dirPackages/".str_replace('.php', '', basename($INFILE)).$myosextension;
    $OUTFILE2="$selfdir/$dirPackages/".str_replace('.php', '', basename($INFILE)).'_'.$myos.'_'.$myarchitecture.$myosextension;
    
    $FLAG_FORCEBUILD=false;
    $FLAG_FULLTEST=false;
    
    echo "
      \e[1mCLI client\e[0m
      DEVELOPMENT ENVIRONMENT
    
      B U I L D E R
    
    ...............................................................................
    ";
    
    if ($argc > 1) {
        parse_str(implode('&', array_slice($argv, 1)), $ARGS);
    }
    
    if(isset($ARGS['-h']) || isset($ARGS['--help'])){
        echo "
        - Merge PHP sources to a single file
        - Compile binary
        - Test binary
        - Coy to architecture specific binary
        - Create readme with buildinfos
    
    ...............................................................................
    
     ✨ \e[1mSYNTAX:\e[0m
    
        ./build.php [OPTIONS]
    
     🔷 \e[1mOPTIONS:\e[0m
    
        -h, --help     Show this help
        -f, --force    Force rebuild on unchanged sources
        -t, --test     Run full test suite: ./tests/00_start.php
                       without '-t': run a  single check only.
    
    ";
        exit(0);
    }
    
    if(isset($ARGS['-f']) || isset($ARGS['--force'])){
        $FLAG_FORCEBUILD=true;
    }
    if(isset($ARGS['-t']) || isset($ARGS['--test'])){
        $FLAG_FULLTEST=true;
    }
    
    _h1("Startup");
    _chdir($selfdir);
    _mkdir($dirPackages);
    
    // ----------------------------------------------------------------------
    
    _h1("Check target file");
    if(file_exists($OUTFILE)){
        $ts_in=filemtime($INFILE);