Merge remote-tracking branch 'github/pr/294'. Fixes bug 564194.
[gentoo.git] / x11-libs / fltk / fltk-1.3.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=4
6
7 inherit autotools eutils fdo-mime flag-o-matic versionator
8
9 MY_P=${P/_}
10
11 DESCRIPTION="C++ user interface toolkit for X and OpenGL"
12 HOMEPAGE="http://www.fltk.org/"
13 SRC_URI="http://fltk.org/pub/${PN}/${PV/_}/${P/_}-source.tar.gz"
14
15 SLOT="1"
16 LICENSE="FLTK LGPL-2"
17 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
18 IUSE="cairo debug doc examples games +opengl pdf static-libs +threads +xft +xinerama"
19
20 RDEPEND="
21         >=media-libs/libpng-1.2:0
22         virtual/jpeg:0
23         sys-libs/zlib
24         x11-libs/libICE
25         x11-libs/libSM
26         x11-libs/libXext
27         x11-libs/libXt
28         cairo? ( x11-libs/cairo )
29         opengl? ( virtual/opengl )
30         xinerama? ( x11-libs/libXinerama )
31         xft? ( x11-libs/libXft )"
32 DEPEND="${RDEPEND}
33         x11-proto/xextproto
34         doc? (
35                 app-doc/doxygen
36                 pdf? ( dev-texlive/texlive-latex )
37         )
38         xinerama? ( x11-proto/xineramaproto )"
39
40 INCDIR=${EPREFIX}/usr/include/fltk-${SLOT}
41 LIBDIR=${EPREFIX}/usr/$(get_libdir)/fltk-${SLOT}
42
43 S=${WORKDIR}/${MY_P}
44
45 src_prepare() {
46         rm -rf zlib jpeg png || die
47         epatch \
48                 "${FILESDIR}"/${PN}-1.3.1-as-needed.patch \
49                 "${FILESDIR}"/${PN}-1.3.2-desktop.patch \
50                 "${FILESDIR}"/${PN}-1.3.0-share.patch \
51                 "${FILESDIR}"/${PN}-1.3.0-conf-tests.patch
52         sed \
53                 -e 's:@HLINKS@::g' -i FL/Makefile.in || die
54         sed -i \
55                 -e '/C\(XX\)\?FLAGS=/s:@C\(XX\)\?FLAGS@::' \
56                 -e '/^LDFLAGS=/d' \
57                 "${S}/fltk-config.in" || die
58         # some fixes introduced because slotting
59         sed -i \
60                 -e '/RANLIB/s:$(libdir)/\(.*LIBNAME)\):$(libdir)/`basename \1`:g' \
61                 src/Makefile || die
62         # docs in proper docdir
63         sed -i \
64                 -e "/^docdir/s:fltk:${PF}/html:" \
65                 -e "/SILENT:/d" \
66                 makeinclude.in || die
67         sed -e "s/7/$(get_version_component_range 3)/" \
68                 "${FILESDIR}"/FLTKConfig.cmake > CMake/FLTKConfig.cmake
69         sed -e 's:-Os::g' -i configure.in || die
70         use prefix && append-ldflags -Wl,-rpath -Wl,"${LIBDIR}"
71         eautoconf
72 }
73
74 src_configure() {
75         econf \
76                 --includedir=${INCDIR}\
77                 --libdir=${LIBDIR} \
78                 --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
79                 --enable-largefile \
80                 --enable-shared \
81                 --enable-xdbe \
82                 --disable-localjpeg \
83                 --disable-localpng \
84                 --disable-localzlib \
85                 $(use_enable debug) \
86                 $(use_enable cairo) \
87                 $(use_enable opengl gl) \
88                 $(use_enable threads) \
89                 $(use_enable xft) \
90                 $(use_enable xinerama)
91 }
92
93 src_compile() {
94         default
95         if use doc; then
96                 cd "${S}"/documentation
97                 emake html
98                 if use pdf; then
99                         emake pdf
100                 fi
101         fi
102         if use games; then
103                 cd "${S}"/test
104                 emake blocks checkers sudoku
105         fi
106 }
107
108 src_install() {
109         default
110         emake -C fluid \
111                         DESTDIR="${D}" install-linux
112         if use doc; then
113                 emake -C documentation \
114                         DESTDIR="${D}" install
115         fi
116         local apps="fluid"
117         if use games; then
118                 emake -C test \
119                         DESTDIR="${D}" install-linux
120                 emake -C documentation \
121                         DESTDIR="${D}" install-linux
122                 apps="${apps} sudoku blocks checkers"
123         fi
124         for app in ${apps}; do
125                 dosym /usr/share/icons/hicolor/32x32/apps/${app}.png \
126                         /usr/share/pixmaps/${app}.png
127         done
128         dodoc CHANGES README CREDITS ANNOUNCEMENT
129
130         if use examples; then
131                 insinto /usr/share/doc/${PF}/examples
132                 doins test/*.{h,cxx,fl} test/demo.menu
133         fi
134
135         insinto /usr/share/cmake/Modules
136         doins CMake/FLTK*.cmake
137
138         echo "LDPATH=${LIBDIR}" > 99fltk-${SLOT}
139         echo "FLTK_DOCDIR=${EPREFIX}/usr/share/doc/${PF}/html" >> 99fltk-${SLOT}
140         doenvd 99fltk-${SLOT}
141
142         if ! use static-libs; then
143                 rm "${ED}"/usr/lib*/fltk-1/*.a || die
144         fi
145 }
146
147 pkg_postinst() {
148         fdo-mime_desktop_database_update
149 }
150
151 pkg_postrm() {
152         fdo-mime_desktop_database_update
153 }