build: Add detection script for a better package maintenance experience

This commit is contained in:
Vladimir Vaskov
2025-01-17 17:56:31 +03:00
parent 5b59b42746
commit 3663272063
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
#!/bin/bash
pc_file=$(find "/usr/lib64/pkgconfig" -maxdepth 1 -type f -name "libphosh-*.pc" | head -n 1)
if [ -z "$pc_file" ]; then
echo "File libphosh-*.pc not found."
exit 1
fi
version=$(basename "$pc_file" | sed -E 's/^libphosh-([0-9.]+)\.pc$/\1/')
if [ -z "$version" ]; then
echo "Can't detect version of $pc_file."
exit 1
fi
echo $version
exit 0