Allow to use xxdi, lightweight alternative to vim's "xxd -i"
authorBernard Cafarelli <bernard.cafarelli@gmail.com>
Tue, 18 Oct 2022 13:21:44 +0000 (15:21 +0200)
committerColin Clark <colin.clark@cclark.uk>
Wed, 19 Oct 2022 09:24:08 +0000 (10:24 +0100)
xxdi [0] is a lightweight script that can replace "xxd -i", which is now
needed to build geeqie. This is helpful on systems not running vim.
This checks for its availability on the system and falls back to
existing vim mode if not installed.

[0] https://github.com/gregkh/xxdi

scripts/generate-ClayRGB1998-icc-h.sh

index 14444f8..3f5d977 100755 (executable)
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+# Allow standalone replacement for xxd
+command -v xxdi.pl >/dev/null 2>&1 && XXD="xxdi.pl" || XXD="xxd -i"
+
 # To generate the required code, xxd has to run in the same folder as the source
 build_dir="$PWD"
 
 cd "$(dirname "$1")" || return 1
 
-xxd -i "$(basename "$1")" "$build_dir/$2"
+${XXD} "$(basename "$1")" "$build_dir/$2"