summaryrefslogtreecommitdiff
path: root/media-libs/libcaca/libcaca-0.99_beta20-r1.ebuild
blob: 778efae5f231a0a44dc07fb79c33ab28f5e32422 (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
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools flag-o-matic toolchain-funcs multilib-minimal

MY_PV=${PV/_beta/.beta}
MY_P=${PN}-${MY_PV}
DESCRIPTION="A library that creates colored ASCII-art graphics"
HOMEPAGE="http://libcaca.zoy.org/"
SRC_URI="https://github.com/cacalabs/libcaca/releases/download/v${MY_PV}/${MY_P}.tar.bz2"
S="${WORKDIR}/${MY_P}"

LICENSE="GPL-2 ISC LGPL-2.1 WTFPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
IUSE="doc imlib ncurses opengl slang static-libs test truetype X"
RESTRICT="!test? ( test )"

DEPEND="
	imlib? ( >=media-libs/imlib2-1.4.6-r2[${MULTILIB_USEDEP}] )
	ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
	opengl? (
		>=virtual/glu-9.0-r1[${MULTILIB_USEDEP}]
		>=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}]
		>=media-libs/freeglut-2.8.1[${MULTILIB_USEDEP}]
		truetype? ( >=media-libs/ftgl-2.1.3_rc5 )
	)
	slang? ( >=sys-libs/slang-2.2.4-r1 )
	X? (
		>=x11-libs/libX11-1.6.2
		>=x11-libs/libXt-1.1.4
	)
"
RDEPEND="${DEPEND}"
BDEPEND="
	virtual/pkgconfig
	doc? (
		app-text/doxygen
		virtual/latex-base
		>=dev-texlive/texlive-fontsrecommended-2012
		>=dev-texlive/texlive-latexextra-2012
		dev-texlive/texlive-latexrecommended
	)
	test? ( dev-util/cppunit )
"

DOCS=( AUTHORS NEWS NOTES README THANKS )

PATCHES=(
	"${FILESDIR}/fix-css-path.patch"  # bug 543870
	"${FILESDIR}/configure-lto.patch"  # upstream PR 76
	"${FILESDIR}/${P}-linking.patch"  # upstream PR 70 related
)

src_prepare() {
	# bug #339962
	sed -i -e '/doxygen_tests = check-doxygen/d' caca/t/Makefile.am || die

	sed -i \
		-e 's:-g -O2 -fno-strength-reduce -fomit-frame-pointer::' \
		-e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' \
		configure.ac || die

	if ! use truetype; then
		sed -i -e '/PKG_CHECK_MODULES/s:ftgl:dIsAbLe&:' configure.ac || die
	fi

	# fix docs install path, bug 543870#c14
	sed -i "s/libcaca-dev/${PF}/g" doc/Makefile.am || die

	default
	eautoreconf
}

src_configure() {
	if use imlib && ! use X; then
		append-cflags -DX_DISPLAY_MISSING
	fi

	# bug #653400
	append-cxxflags -std=c++11

	# bug #601902, bug #825058
	use ncurses && append-libs $($(tc-getPKG_CONFIG) --libs tinfow || die)

	# https://github.com/cacalabs/libcaca/issues/86
	append-flags -fno-strict-overflow

	multilib-minimal_src_configure
}

multilib_src_configure() {
	if multilib_is_native_abi; then
		# bug #44128
		export VARTEXFONTS="${T}/fonts"
	fi

	local myeconfargs=(
		$(use_enable static-libs static)
		$(multilib_native_use_enable slang)
		$(multilib_native_use_enable ncurses)
		$(multilib_native_use_enable X x11)
		$(multilib_native_use_with X x)
		--x-libraries=/usr/$(get_libdir)
		$(use_enable opengl gl)
		--enable-cxx
		$(use_enable imlib imlib2)
		$(use_enable test cppunit)
		--disable-java
		--disable-ruby
		--disable-python
		--disable-csharp
		$(multilib_native_use_enable doc)
	)

	# CONFIG_SHELL: ./configure script uses [[ … ~= … ]] among other bashisms
	CONFIG_SHELL="${BROOT}"/bin/bash ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}

multilib_src_compile() {
	emake V=1
}

multilib_src_test() {
	emake V=1 -j1 check
}

multilib_src_install_all() {
	einstalldocs

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