# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=imgbrd-grabber
pkgver=7.1.1
pkgrel=0
pkgdesc="Powerful imageboard/booru downloader"
options="!check" # Tests requires graphics
url="https://bionus.github.io/imgbrd-grabber"
arch="all !mips64 !mips64el" # nodejs restrictions
license="Apache-2.0"
makedepends="cmake nodejs qt5-qtdeclarative-dev qt5-qtmultimedia-dev
	qt5-qtbase-mysql qt5-qtbase-odbc qt5-qtbase-sqlite qt5-qtbase-tds
	qt5-qtscript-dev qt5-qtbase-dev qt5-qttools-dev npm"
source="$pkgname-$pkgver.tar.gz::https://github.com/Bionus/imgbrd-grabber/archive/v${pkgver}.tar.gz"

build() {
	sed -i 's|USE_QSCINTILLA 1|USE_QSCINTILLA 0|' gui/CMakeLists.txt
	sed -i 's|USE_BREAKPAD 1|USE_BREAKPAD 0|' gui/CMakeLists.txt
	sed -i '/add_subdirectory(tests)/d' CMakeLists.txt

	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS}
	make
}

package() {
	make DESTDIR="$pkgdir" install
	touch "$pkgdir"/usr/share/Grabber/settings.ini
}

sha512sums="facbf6e24ca916273c1ec796ceb22abb67765a7c1c992ff37b426f512da5f7d6e40595c54b5240b8692e95892ecb999e76bdbd0e24c0e42ff346e6bbf722f7b2  imgbrd-grabber-7.1.1.tar.gz"