mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-21 20:35:58 +01:00
meson: Run patches on setup (#7)
* Add patching script with error checking+reporting new file: patches/apply.sh * Run patching script with run_command() at setup and print the output with message() at the end modified: meson.build * Report on patch application failure and exit script with code 1 modified: patches/apply.sh --------- Co-authored-by: Agent_00Ming <agent00ming9366@gmail.com>
This commit is contained in:
parent
611a4f24cd
commit
dcea6ce763
2 changed files with 36 additions and 0 deletions
|
@ -80,6 +80,8 @@ else
|
|||
)
|
||||
endif
|
||||
|
||||
patching = run_command('./patches/apply.sh', capture: true, check: true)
|
||||
|
||||
features = {
|
||||
'drm-backend': false,
|
||||
'x11-backend': false,
|
||||
|
@ -204,3 +206,5 @@ pkgconfig.generate(
|
|||
url: 'https://gitlab.freedesktop.org/wlroots/wlroots',
|
||||
variables: wlr_vars,
|
||||
)
|
||||
|
||||
message(patching.stdout().strip())
|
||||
|
|
32
patches/apply.sh
Executable file
32
patches/apply.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# find all patches in patches/
|
||||
PATCHES=$(find patches/ -type f -name '*.patch')
|
||||
|
||||
check () {
|
||||
git apply --check -q -p1 $PATCH
|
||||
}
|
||||
|
||||
apply () {
|
||||
git apply -p1 $PATCH
|
||||
}
|
||||
|
||||
check_applied () {
|
||||
git apply --check --reverse -q -p1 $PATCH
|
||||
}
|
||||
|
||||
fail () {
|
||||
echo =======\> \'$PATCH\' was not applied && exit 1
|
||||
}
|
||||
|
||||
if [[ -n "$PATCHES" ]];
|
||||
then
|
||||
# check patch validity and apply, else check if already applied and report and exit on failure
|
||||
echo 'Patches found. Applying...';
|
||||
for PATCH in $PATCHES;
|
||||
do
|
||||
check && apply || check_applied || fail;
|
||||
done
|
||||
else
|
||||
echo 'No patches found.'
|
||||
fi
|
Loading…
Reference in a new issue