summaryrefslogtreecommitdiff
blob: 55270340c3543bf395695abae9c090493b785273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

if [[ ${KDE_BUILD_TYPE} != live ]]; then
	KDE_HANDBOOK="true"
	KDE_TEST="true"
fi
CMAKE_MAKEFILE_GENERATOR="emake"
CMAKE_MIN_VERSION="3.0"
inherit kde5 toolchain-funcs

DESCRIPTION="Digital photo management application"
HOMEPAGE="https://www.digikam.org/"

LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
IUSE="addressbook gphoto2 jpeg2k +kipi +lensfun marble semantic-desktop mysql opengl openmp +panorama scanner video X"

if [[ ${KDE_BUILD_TYPE} != live ]]; then

	MY_PV=${PV/_/-}
	MY_P=${PN}-${MY_PV}

	SRC_BRANCH=stable
	[[ ${PV} =~ beta[0-9]$ ]] && SRC_BRANCH=unstable
	SRC_URI="mirror://kde/${SRC_BRANCH}/digikam/${MY_P}.tar.xz"

	S="${WORKDIR}/${MY_P}/core"

fi

COMMON_DEPEND="
	$(add_frameworks_dep kcompletion)
	$(add_frameworks_dep kconfig)
	$(add_frameworks_dep kconfigwidgets)
	$(add_frameworks_dep kcoreaddons)
	$(add_frameworks_dep kiconthemes)
	$(add_frameworks_dep ki18n)
	$(add_frameworks_dep kio)
	$(add_frameworks_dep kjobwidgets)
	$(add_frameworks_dep knotifications)
	$(add_frameworks_dep knotifyconfig)
	$(add_frameworks_dep kservice)
	$(add_frameworks_dep ktextwidgets)
	$(add_frameworks_dep kwidgetsaddons)
	$(add_frameworks_dep kwindowsystem)
	$(add_frameworks_dep kxmlgui)
	$(add_frameworks_dep solid)
	$(add_kdeapps_dep libkexiv2)
	$(add_qt_dep qtconcurrent)
	$(add_qt_dep qtdbus)
	$(add_qt_dep qtgui)
	$(add_qt_dep qtprintsupport)
	$(add_qt_dep qtscript)
	$(add_qt_dep qtsql 'mysql?')
	$(add_qt_dep qtwebkit)
	$(add_qt_dep qtwidgets)
	$(add_qt_dep qtxml)
	dev-libs/boost[threads]
	dev-libs/expat
	media-gfx/exiv2:=
	media-libs/lcms:2
	media-libs/liblqr
	>=media-libs/libpgf-6.12.27
	media-libs/libpng:0=
	media-libs/opencv:=[-qt4]
	|| ( <media-libs/opencv-3.0.0 >=media-libs/opencv-3.1.0 )
	media-libs/tiff:0
	virtual/jpeg:0
	addressbook? (
		$(add_kdeapps_dep akonadi-contacts)
		$(add_kdeapps_dep kcontacts)
	)
	gphoto2? ( media-libs/libgphoto2:= )
	jpeg2k? ( media-libs/jasper )
	kipi? ( $(add_kdeapps_dep libkipi '' '16.03.80') )
	lensfun? ( media-libs/lensfun )
	marble? (
		$(add_frameworks_dep kbookmarks)
		$(add_frameworks_dep kitemmodels)
		$(add_kdeapps_dep marble)
	)
	mysql? ( virtual/mysql )
	opengl? (
		$(add_qt_dep qtopengl)
		virtual/opengl
	)
	panorama? ( $(add_frameworks_dep threadweaver) )
	scanner? ( $(add_kdeapps_dep libksane) )
	semantic-desktop? ( $(add_frameworks_dep kfilemetadata) )
	video? ( $(add_qt_dep qtmultimedia 'widgets') )
	X? (
		$(add_qt_dep qtx11extras)
		x11-libs/libX11
	)
"
DEPEND="${COMMON_DEPEND}
	dev-cpp/eigen:3
	sys-devel/gettext
	panorama? (
		sys-devel/bison
		sys-devel/flex
	)
"
RDEPEND="${COMMON_DEPEND}
	media-plugins/kipi-plugins:5
	panorama? ( media-gfx/hugin )
	!media-gfx/digikam:4
"

RESTRICT=test
# bug 366505

PATCHES=(
	"${FILESDIR}/${P}-i386-gcc61.patch"
	"${FILESDIR}/${P}-albums-crashfix.patch"
	"${FILESDIR}/${P}-memalloc-crash.patch"
)

# FIXME: Unbundle libraw (libs/rawengine/libraw)
pkg_pretend() {
	if use openmp ; then
		tc-has-openmp || die "Please switch to an openmp compatible compiler"
	fi
	kde5_pkg_pretend
}

src_prepare() {
	if [[ ${KDE_BUILD_TYPE} != live ]]; then
		# prepare the translations
		mv "${WORKDIR}/${MY_P}/po" po || die
		find po -name "*.po" -and -not -name "digikam.po" -delete || die
		echo "set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)" >> CMakeLists.txt || die
		echo "find_package(Gettext REQUIRED)" >> CMakeLists.txt || die
		echo "add_subdirectory( po )" >> CMakeLists.txt || die

		if use handbook; then
			# subdirs need to be preserved b/c relative paths...
			# doc-translated is, in fact, broken, and ignored
			mv "${WORKDIR}/${MY_P}/doc/${PN}" doc-default || die
			echo "add_subdirectory( doc-default )" >> CMakeLists.txt || die
		fi
	fi

	kde5_src_prepare
}

src_configure() {
	# LQR = only allows to choose between bundled/external
	local mycmakeargs=(
		-DENABLE_AKONADICONTACTSUPPORT=$(usex addressbook)
		-DENABLE_KFILEMETADATASUPPORT=$(usex semantic-desktop)
		-DENABLE_MYSQLSUPPORT=$(usex mysql)
		-DENABLE_MEDIAPLAYER=$(usex video)
		-DENABLE_OPENCV3=$(has_version ">=media-libs/opencv-3" && echo yes || echo no)
		$(cmake-utils_use_find_package gphoto2 Gphoto2)
		$(cmake-utils_use_find_package jpeg2k Jasper)
		$(cmake-utils_use_find_package kipi KF5Kipi)
		$(cmake-utils_use_find_package lensfun LensFun)
		$(cmake-utils_use_find_package marble Marble)
		$(cmake-utils_use_find_package opengl OpenGL)
		$(cmake-utils_use_find_package openmp OpenMP)
		$(cmake-utils_use_find_package panorama KF5ThreadWeaver)
		$(cmake-utils_use_find_package scanner KF5Sane)
		$(cmake-utils_use_find_package X X11)
	)

	kde5_src_configure
}