@@ -23,6 +23,67 @@ MANPAGES=1
2323CURRENT_PACKAGE_VERSION=0
2424
2525
26+ # Version comparison function
27+ # Returns: 0 if v1 >= v2, 1 otherwise
28+ version_gte () {
29+ local ver1=" $1 "
30+ local ver2=" $2 "
31+
32+ # Handle empty/invalid inputs
33+ if [[ -z " $ver1 " || -z " $ver2 " ]]; then
34+ return 1
35+ fi
36+
37+ # Split versions into components
38+ local IFS=' .'
39+ read -ra V1 <<< " $ver1"
40+ read -ra V2 <<< " $ver2"
41+
42+ local max_len=${# V1[@]}
43+ [[ ${# V2[@]} -gt $max_len ]] && max_len=${# V2[@]}
44+
45+ for (( i= 0 ; i< max_len; i++ )) ; do
46+ local n1=" ${V1[i]:- 0} "
47+ local n2=" ${V2[i]:- 0} "
48+
49+ # Strip pre-release suffixes for comparison (e.g., "a1", "rc1")
50+ n1=" ${n1%% [a-z]* } "
51+ n2=" ${n2%% [a-z]* } "
52+
53+ # Compare numeric portions
54+ if (( n1 > n2 )) ; then
55+ return 0
56+ elif (( n1 < n2 )) ; then
57+ return 1
58+ fi
59+
60+ # Handle suffixes (release candidates, pre-releases)
61+ if [[ " $n1 " == * [a-z]* && " $n2 " != * [a-z]* ]]; then
62+ return 1 # n1 has suffix, so it's less than stable n2
63+ elif [[ " $n2 " == * [a-z]* && " $n1 " != * [a-z]* ]]; then
64+ return 0 # n2 has suffix, so n1 is greater
65+ fi
66+
67+ # Strip leading zeros and compare remaining parts
68+ n1=" ${n1# 0} " || n1=0
69+ n2=" ${n2# 0} " || n2=0
70+ done
71+
72+ return 0 # Versions are equal or unknown
73+ }
74+
75+ # Check if version meets minimum requirement (v >= min)
76+ version_satisfies () {
77+ local current=" $1 "
78+ local minimum=" $2 "
79+
80+ if ! version_gte " $current " " $minimum " ; then
81+ return 1
82+ fi
83+
84+ return 0
85+ }
86+
2687command_exists () {
2788 if ! [[ -x $( command -v " $1 " ) ]]; then
2889 return 1
@@ -964,6 +1025,7 @@ if build "libjxl" "0.11.2"; then
9641025 build_done " libjxl" $CURRENT_PACKAGE_VERSION
9651026fi
9661027CONFIGURE_OPTIONS+=(" --enable-libjxl" )
1028+ EXTRALIBS=" ${EXTRALIBS} -llcms2"
9671029
9681030if build " libwebp" " 1.6.0" ; then
9691031 # libwebp can fail to compile on Ubuntu if these flags were left set to CFLAGS
0 commit comments