Files
haikuports/media-gfx/hvif_tools/hvif_tools-2.1.5.recipe
2025-12-26 15:49:38 +10:00

139 lines
3.5 KiB
Bash

SUMMARY="Tools for converting between HVIF, IOM, SVG and PNG icon formats"
DESCRIPTION="A comprehensive set of command-line tools for working with Haiku Vector Icon Format (HVIF) and Icon-O-Matic (IOM) files.
icon2icon:
- Converts between HVIF, IOM, SVG and PNG.
- Full HVIF format support with coordinate transformation.
- Solid colors and gradients (linear, radial, diamond, conic, XY, sqrt-XY).
- Fill and stroke rendering via transformers.
- BMessage-based IOM format parsing.
- SVG parsing via NanoSVG library.
iom2hvif:
- Convert Icon-O-Matic files to HVIF format.
- Native Haiku implementation using Haiku API.
- Direct IOM to HVIF conversion without intermediate formats.
- Write icons to HVIF files or file/folder attributes.
- Batch processing support for multiple files.
- Based on Haiku Icon-O-Matic implementation.
img2svg:
- Advanced bitmap to SVG vectorization.
- Color quantization with adaptive palettes.
- Multiple simplification algorithms (Douglas-Peucker, Visvalingam-Whyatt).
- Geometric shape detection.
- Background removal with auto-detection.
- Gradient detection and region merging.
Inkscape extensions:
- Import/export for HVIF and IOM formats
"
HOMEPAGE="https://github.com/threedeyes/hvif-tools/"
COPYRIGHT="2025 Gerasim Troeglazov"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/threedeyes/hvif-tools/releases/download/$portVersion/hvif-tools-$portVersion.tar.gz"
CHECKSUM_SHA256="06e73c402b2ef10759ce40f3698cc1a67a39b93100711ac77ef18f226620f123"
SOURCE_DIR="hvif-tools-$portVersion"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%.*}"
PROVIDES="
hvif_tools$secondaryArchSuffix = $portVersion
cmd:icon2icon$commandSuffix
cmd:iom2hvif$commandSuffix
cmd:img2svg$commandSuffix
cmd:msgdump$commandSuffix
lib:libhviftools$secondaryArchSuffix = $libVersionCompat
lib:libimagetracer$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libagg$secondaryArchSuffix
"
if [ "$targetArchitecture" = x86_gcc2 ]; then
REPLACES="
hvif_tools
"
fi
PROVIDES_devel="
hvif_tools${secondaryArchSuffix}_devel = $portVersion
devel:libhviftools$secondaryArchSuffix = $libVersionCompat
devel:libimagetracer$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
hvif_tools$secondaryArchSuffix == $portVersion base
haiku$secondaryArchSuffix
devel:libagg$secondaryArchSuffix
"
PROVIDES_inkscape="
hvif_tools${secondaryArchSuffix}_inkscape = $portVersion
"
REQUIRES_inkscape="
haiku$secondaryArchSuffix
hvif_tools$secondaryArchSuffix == $portVersion base
cssselect_python310
lxml_python310
numpy_python310
tinycss2_python310
cmd:python3
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libagg$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
cmake -Bbuild -S. \
$cmakeDirArgs \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
-DINKSCAPE_EXT_DIR=$dataDir/inkscape/extensions \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_IOM2HVIF=ON \
-DBUILD_MSGDUMP=ON \
-DBUILD_INKSCAPE_EXTENSIONS=ON
make -C build $jobArgs
}
INSTALL()
{
make -C build install
prepareInstalledDevelLibs \
libhviftools \
libimagetracer
# inkscape extensions package
packageEntries inkscape \
$dataDir
# devel package
packageEntries devel \
$developDir \
$libDir/cmake
}