Update docs

This commit is contained in:
crazywhalecc
2024-07-14 01:19:34 +08:00
committed by Jerry Ma
parent 4dbbf05d5c
commit 758b697cee
9 changed files with 159 additions and 76 deletions

View File

@@ -24,7 +24,8 @@ The following is the source download configuration corresponding to the `libeven
"type": "ghrel",
"repo": "libevent/libevent",
"match": "libevent.+\\.tar\\.gz",
"license": {
"provide-pre-built": true,
"license": {
"type": "file",
"path": "LICENSE"
}
@@ -55,6 +56,8 @@ Each source file in source.json has the following params:
- `license`: the open source license of the source code, see **Open Source License** section below
- `type`: must be one of the types mentioned above
- `path` (optional): release the source code to the specified directory instead of `source/{name}`
- `provide-pre-built` (optional): whether to provide precompiled binary files.
If `true`, it will automatically try to download precompiled binary files when running `bin/spc download`
::: tip
The `path` parameter in `source.json` can specify a relative or absolute path. When specified as a relative path, the path is based on `source/`.

View File

@@ -19,7 +19,7 @@ The project is mainly divided into several folders:
- `bin/`: used to store program entry files, including `bin/spc`, `bin/spc-alpine-docker`, `bin/setup-runtime`.
- `config/`: Contains all the extensions and dependent libraries supported by the project,
as well as the download link and download methods of these sources. It is divided into files: `lib.json`, `ext.json`, `source.json`, `pkg.json` .
as well as the download link and download methods of these sources. It is divided into files: `lib.json`, `ext.json`, `source.json`, `pkg.json`, `pre-built.json` .
- `src/`: The core code of the project, including the entire framework and commands for compiling various extensions and libraries.
- `vendor/`: The directory that Composer depends on, you do not need to make any modifications to it.

View File

@@ -157,6 +157,9 @@ bin/spc download php-src,micro,zstd,ext-zstd
# Download only extensions and libraries to be compiled (use extensions, including suggested libraries)
bin/spc download --for-extensions=openssl,swoole,zip,pcntl,zstd
# Download resources, prefer to download dependencies with pre-built packages (reduce the time to compile dependencies)
bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built
# Download only the extensions and dependent libraries to be compiled (use extensions, excluding suggested libraries)
bin/spc download --for-extensions=openssl,swoole,zip,pcntl --without-suggestions
@@ -388,6 +391,8 @@ when you use static-php-cli to build PHP or modify and enhance the static-php-cl
- `dev:sort-config`: Sort the list of configuration files in the `config/` directory in alphabetical order
- `dev:lib-ver <lib-name>`: Read the version from the source code of the dependency library (only available for specific dependency libraries)
- `dev:ext-ver <ext-name>`: Read the corresponding version from the source code of the extension (only available for specific extensions)
- `dev:pack-lib <lib-name>`: Package the specified library into a tar.gz file (maintainer only)
- `dev:gen-ext-docs`: Generate extension documentation (maintainer only)
```bash
# output all extensions information
@@ -523,3 +528,12 @@ Commonly used objects and functions using the `-P` function are:
static-php-cli has many open methods, which cannot be listed in the docs,
but as long as it is a `public function` and is not marked as `@internal`, it theoretically can be called.
:::
## Multiple builds
If you need to build multiple times locally, the following method can save you time downloading resources and compiling.
- If you only switch the PHP version without changing the dependent libraries, you can use `bin/spc switch-php-version` to quickly switch the PHP version, and then re-run the same `build` command.
- If you want to rebuild once, but do not re-download the source code, you can first `rm -rf buildroot source` to delete the compilation directory and source code directory, and then rebuild.
- If you want to update a version of a dependency, you can use `bin/spc del-download <source-name>` to delete the specified source code, and then use `download <source-name>` to download it again.
- If you want to update all dependent versions, you can use `bin/spc download --clean` to delete all downloaded sources, and then download them again.