# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit cmake desktop DESCRIPTION="A barcode encoding library supporting over 50 symbologies" HOMEPAGE="https://zint.org.uk/ https://sourceforge.net/projects/zint/ https://github.com/woo-j/zint/" SRC_URI="https://downloads.sourceforge.net/${PN}/${P}-src.tar.gz -> ${P}.tar.gz" S="${WORKDIR}/${P}-src" LICENSE="GPL-3" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="png qt5 qt6 static-libs test" RESTRICT="!test? ( test )" RDEPEND=" png? ( media-libs/libpng:0= ) qt5? ( >=dev-qt/designer-5.15.2:5 >=dev-qt/qtgui-5.15.2:5 >=dev-qt/qtwidgets-5.15.2:5 >=dev-qt/qtxml-5.15.2:5 test? ( >=dev-qt/qttest-5.15.2:5 ) ) qt6? ( !qt5? ( >=dev-qt/qtbase-6.1:6[gui,widgets] >=dev-qt/qttools-6.1:6 ) ) " DEPEND="${RDEPEND}" BDEPEND="" src_prepare() { sed -e 's/^\(Categories=\).*$/\1Graphics;/' -i zint-qt.desktop || die if use test ; then sed -e 's|LD_LIBRARY_PATH=\(\${CMAKE_BINARY_DIR}/backend\)|\0:\1/tests|' -i cmake/zint_add_test.cmake || die if use qt5 || use qt6 ; then sed -e '/add_subdirectory(tests)/d' -i backend_qt/CMakeLists.txt || die ewarn 'qzint test disabled because it needs an X11 display connection.' fi fi cmake_src_prepare } src_configure() { local mycmakeargs=( -DCMAKE_SKIP_RPATH:BOOL=ON -DZINT_STATIC:BOOL=$(usex static-libs) -DZINT_USE_PNG:BOOL=$(usex png) -DZINT_USE_QT:BOOL=$(usex qt5 yes $(usex qt6)) ) use qt5 || use qt6 && mycmakeargs+=( -DZINT_QT6:BOOL=$(usex !qt5) ) cmake_src_configure # Enabling ZINT_TEST causes extra debugging code to be inserted into # the installable library, so build a separate copy for testing. if use test ; then local BUILD_DIR="${BUILD_DIR}_test" mycmakeargs+=( -DZINT_TEST:BOOL=ON ) cmake_src_configure fi } src_compile() { cmake_src_compile if use test ; then local BUILD_DIR="${BUILD_DIR}_test" cmake_src_compile fi } src_test() { local BUILD_DIR="${BUILD_DIR}_test" # Tests can't be run in parallel, as they clobber the same temp files. local MAKEOPTS= cmake_src_test } src_install() { local DOCS=( README ChangeLog TODO docs/manual.txt ) cmake_src_install if use qt5 || use qt6 ; then doicon frontend_qt/images/scalable/zint-qt.svg domenu zint-qt.desktop fi }