summaryrefslogtreecommitdiffstats
path: root/media-libs/lcms/lcms-1.19-r1.ebuild
blob: 3cf1eaac93534804b0943f6368f7150d10358500 (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
# Copyright 1999-2020 Gentoo Authors
# Copyright 2020 The Trinity Desktop Project
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

PYTHON_COMPAT=( python2_7 )
inherit autotools eutils python-r1

DESCRIPTION="Lightweight, speed optimized color management engine"
HOMEPAGE="https://www.littlecms.com/"
SRC_URI="mirror://sourceforge/lcms/${PV}/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="jpeg python static-libs tiff zlib"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

# Don't use Gentoo mirrors
RESTRICT="mirror"

RDEPEND="
	jpeg? ( virtual/jpeg:0 )
	python? ( ${PYTHON_DEPS} )
	tiff? ( media-libs/tiff:0 )
	zlib? ( sys-libs/zlib )"
DEPEND="${RDEPEND}
	python? ( >=dev-lang/swig-1.3.31 )"

PATCHES=(
	"${FILESDIR}/${P}-disable_static_modules.patch"
	"${FILESDIR}/${P}-implicit.patch"
)

src_prepare() {
	# Python bindings are built/installed manually.
	sed -e "/SUBDIRS =/s/ python//" -i Makefile.am || die

	default

	eautoreconf

	# run swig to regenerate lcms_wrap.cxx and lcms.py (bug #148728)
	if use python; then
		cd python || die
		./swig_lcms || die "swig failed to regenerate files"
	fi
}

src_configure() {
	econf \
		--libdir="${EPREFIX}"/usr/$(get_libdir) \
		--bindir="${EPREFIX}"/usr/bin \
		--disable-dependency-tracking \
		$(use_enable static-libs static) \
		$(use_with jpeg) \
		$(use_with python) \
		$(use_with tiff) \
		$(use_with zlib)
}

src_compile() {
	default

	if use python; then
		local BUILD_DIR
		BUILD_DIR=python

		python_copy_sources

		building() {
			emake \
				LCMS_PYEXECDIR="${EPREFIX}$(python_get_sitedir)" \
				LCMS_PYINCLUDE="${EPREFIX}$(python_get_includedir)"
#               No corresponding functions in python-r1
#				LCMS_PYLIB="${EPREFIX}$(python_get_libdir)" \
#				PYTHON_VERSION="$(python_get_version)"
		}
		python_foreach_impl run_in_build_dir building
	fi
}

src_install() {
	DOCS=(AUTHORS README* INSTALL NEWS doc/*)

	default

	if use python; then
		local BUILD_DIR
		BUILD_DIR=python

		installation() {
			emake \
				DESTDIR="${D}" \
				LCMS_PYEXECDIR="${EPREFIX}$(python_get_sitedir)" \
				install
		}
		python_foreach_impl run_in_build_dir installation
	fi

	insinto /usr/share/lcms/profiles
	doins testbed/*.icm

	find "${ED}" -name '*.la' -delete || die
}