mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-04 19:36:27 +00:00
[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>
This commit is contained in:
+50
-13
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user