mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00:00
Ports: Notify user of missing ImageMagick binaries
This commit is contained in:
parent
6f2640d031
commit
546af2d9ef
1 changed files with 22 additions and 19 deletions
|
@ -99,7 +99,8 @@ ensure_build() {
|
||||||
|
|
||||||
install_main_icon() {
|
install_main_icon() {
|
||||||
if [ -n "$icon_file" ] && [ -n "$launcher_command" ]; then
|
if [ -n "$icon_file" ] && [ -n "$launcher_command" ]; then
|
||||||
install_icon "$icon_file" "$launcher_command"
|
local launcher_binary="${launcher_command%% *}"
|
||||||
|
install_icon "$icon_file" "${launcher_binary}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,27 +109,29 @@ install_icon() {
|
||||||
echo "Syntax: install_icon <icon> <launcher>"
|
echo "Syntax: install_icon <icon> <launcher>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
icon="$1"
|
local icon="$1"
|
||||||
launcher="$2"
|
local launcher="$2"
|
||||||
|
|
||||||
command -v convert >/dev/null 2>&1
|
command -v convert >/dev/null || true
|
||||||
convert_exists=$?
|
local convert_exists=$?
|
||||||
|
command -v identify >/dev/null || true
|
||||||
|
local identify_exists=$?
|
||||||
|
|
||||||
command -v identify >/dev/null 2>&1
|
if [ "${convert_exists}" != "0" ] || [ "${identify_exists}" != 0 ]; then
|
||||||
identify_exists=$?
|
echo 'Unable to install icon: missing convert or identify, did you install ImageMagick?'
|
||||||
|
return
|
||||||
if [ "$convert_exists" == "0" ] && [ "$identify_exists" == "0" ]; then
|
|
||||||
for icon_size in "16x16" "32x32"; do
|
|
||||||
index=$(run identify "$icon" | grep "$icon_size" | grep -oE "\[[0-9]+\]" | tr -d "[]" | head -n1)
|
|
||||||
if [ -n "$index" ]; then
|
|
||||||
run convert "${icon}[${index}]" "app-${icon_size}.png"
|
|
||||||
else
|
|
||||||
run convert "$icon" -resize $icon_size "app-${icon_size}.png"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
run objcopy --add-section serenity_icon_s="app-16x16.png" "${DESTDIR}${launcher}"
|
|
||||||
run objcopy --add-section serenity_icon_m="app-32x32.png" "${DESTDIR}${launcher}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for icon_size in "16x16" "32x32"; do
|
||||||
|
index=$(run identify "$icon" | grep "$icon_size" | grep -oE "\[[0-9]+\]" | tr -d "[]" | head -n1)
|
||||||
|
if [ -n "$index" ]; then
|
||||||
|
run convert "${icon}[${index}]" "app-${icon_size}.png"
|
||||||
|
else
|
||||||
|
run convert "$icon" -resize $icon_size "app-${icon_size}.png"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
run objcopy --add-section serenity_icon_s="app-16x16.png" "${DESTDIR}${launcher}"
|
||||||
|
run objcopy --add-section serenity_icon_m="app-32x32.png" "${DESTDIR}${launcher}"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_main_launcher() {
|
install_main_launcher() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue