Skip to content

Commit 5f19038

Browse files
committed
chore: Find cairosvg using shell expansion
Also allow for a fixed path to be given to configure. Should now build icons on a more modern pkgsrc using python10.
1 parent 31578f4 commit 5f19038

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

configure

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ for x; do
5656
QTDIR) QTDIR=$var;;
5757
--with-icons) WITH_ICONS=${var:-yes};;
5858
--without-icons) WITH_ICONS=no;;
59+
CAIROSVG) CAIROSVG=$var;;
5960
--enable-notification) NOTIFY=yes;;
6061
--disable-notification) NOTIFY=no;;
6162
--help) echo "See the README file for available options"; exit 0;;
@@ -90,14 +91,16 @@ _which()
9091
echo "$x"
9192
return 0
9293
fi
93-
for x in /sbin/"$1" /usr/sbin/"$1" \
94-
/usr/pkg/sbin/"$1" /usr/local/sbin/"$1"
95-
do
96-
if [ -e "$x" ]; then
97-
echo "$x"
98-
return 0
99-
fi
94+
95+
# poor mans which with shell expansion
96+
for path in $(echo "$PATH" | tr ':' ' '); do
97+
for file in "$path"/*; do
98+
case "$file" in
99+
*$1) echo "$file"; return 0;;
100+
esac
101+
done
100102
done
103+
101104
return 1
102105
}
103106

@@ -371,12 +374,14 @@ echo "LDADD+= -Wl,--as-needed" >>$CONFIG_MK
371374
# convert the SVG icons to PNG.
372375
# We use cairosvg for this, but the binary name is based on python version
373376
printf "Finding cairosvg ... "
374-
for _CAIROSVG in cairosvg cairosvg-py3 cairosvg3.9 cairosvg3.8; do
375-
CAIROSVG=$(_which "$_CAIROSVG")
376-
if [ -x "$CAIROSVG" ]; then
377-
break
378-
fi
379-
done
377+
if [ -z "$CAIROSVG" ]; then
378+
for _CAIROSVG in cairosvg cairosvg-py3 cairosvg-[3-9]*.[0-9]*; do
379+
CAIROSVG=$(_which "$_CAIROSVG")
380+
if [ -x "$CAIROSVG" ]; then
381+
break
382+
fi
383+
done
384+
fi
380385
if [ -x "$CAIROSVG" ]; then
381386
echo "$CAIROSVG"
382387
echo "CAIROSVG= $CAIROSVG" >>$CONFIG_MK

0 commit comments

Comments
 (0)