diff options
| author | crueter <crueter@eden-emu.dev> | 2026-07-06 23:11:39 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-07-06 23:11:39 +0200 |
| commit | 66b073ab8d427d8fc06ffd715151f372cdde818c (patch) | |
| tree | 667e34c22f542d809a069738bd762a23786814c7 /tools/cpm/package.sh | |
| parent | 4c65780f11511b20c2e0288a287faace16516d38 (diff) | |
[cmake] CPMUtil rewrite of the day number 852 (#4130)
Composite PR for several changes to CPMUtil, most notably:
- https://git.crueter.xyz/CMake/CPMUtil/pulls/19
- https://git.crueter.xyz/CMake/CPMUtil/pulls/22
- https://git.crueter.xyz/CMake/CPMUtil/pulls/24
- https://git.crueter.xyz/CMake/CPMUtil/pulls/25
These contain a lot of changes that generally simplify control flow and improve ease-of-use. Read those descriptions and patchsets for more info.
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4130
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'tools/cpm/package.sh')
| -rwxr-xr-x | tools/cpm/package.sh | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/tools/cpm/package.sh b/tools/cpm/package.sh index bf2f3feaa7..8246222d50 100755 --- a/tools/cpm/package.sh +++ b/tools/cpm/package.sh @@ -12,17 +12,17 @@ Usage: cpmutil.sh package [command] Operate on a package or packages. Commands: - hash Verify the hash of a package, and update it if needed - update Check for updates for a package - fetch Fetch a package and place it in the cache - add Add a new package - rm Remove a package - version Change the version of a package - which Check if a package is defined - download Get the download URL for a package - dir Get the local directory for a package - reset Reset a fetched package to its original state - patch Create an in-tree patch based on local modifications + hash Verify the hash of a package, and update it if needed + update Check for updates for a package + fetch Fetch a package and place it in the cache + add Add a new package + rm Remove a package + version Change the version of a package + which Check if a package is defined + url Get the download URL for a package + dir Get the local directory for a package + reset Reset a fetched package to its original state + patch Add a patch to a package in the cpmfile EOF @@ -30,11 +30,48 @@ EOF } SCRIPTS=$(CDPATH='' cd -- "$(dirname -- "$0")/package" && pwd) -export SCRIPTS +CMAKE="$CMAKE/package" + +export SCRIPTS CMAKE + +filter_args() { + print_usage=false + all_flag=false + commit_flag=false + filtered="" + + for arg in "$@"; do + case "$arg" in + -h | --help) print_usage=true ;; + -a | --all) all_flag=true ;; + -c | --commit) commit_flag=true ;; + -ac | -ca) + commit_flag=true + all_flag=true + ;; + *) filtered="$filtered $arg" ;; + esac + done +} while :; do case "$1" in - hash | update | fetch | add | rm | version | which | download | reset | patch | dir) + dir | fetch | hash | reset | rm | url | version | which | update) + cmd="$1" + shift + + filter_args "$@" + cmake_defines="" + + if $print_usage; then cmake_defines="$cmake_defines -DPRINT_USAGE=TRUE"; fi + if $all_flag; then cmake_defines="$cmake_defines -DALL_PACKAGES=TRUE"; fi + if $commit_flag; then cmake_defines="$cmake_defines -DMAKE_COMMIT=TRUE"; fi + + # shellcheck disable=SC2086 + cmake $cmake_defines -P "$CMAKE/$cmd.cmake" -- $filtered + break + ;; + add | patch) cmd="$1" shift "$SCRIPTS/$cmd".sh "$@" |
