513c1b915934d516d431f7e44203ab1591e1a647
[gentoo.git] / x11-libs / fltk / fltk-1.3.3-r3.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit autotools eutils fdo-mime flag-o-matic
8
9 DESCRIPTION="C++ user interface toolkit for X and OpenGL"
10 HOMEPAGE="http://www.fltk.org/"
11 SRC_URI="http://fltk.org/pub/${PN}/${PV}/${P}-source.tar.gz"
12
13 SLOT="1"
14 LICENSE="FLTK LGPL-2"
15 KEYWORDS="~alpha amd64 arm hppa ~ia64 ~mips ppc ppc64 ~sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
16 IUSE="cairo debug doc examples games +opengl static-libs +threads +xft +xinerama"
17
18 RDEPEND="
19         >=media-libs/libpng-1.2:0
20         virtual/jpeg:0
21         sys-libs/zlib
22         x11-libs/libICE
23         x11-libs/libSM
24         x11-libs/libXext
25         x11-libs/libXt
26         cairo? ( x11-libs/cairo )
27         opengl? ( virtual/opengl )
28         xinerama? ( x11-libs/libXinerama )
29         xft? ( x11-libs/libXft )"
30 DEPEND="${RDEPEND}
31         x11-proto/xextproto
32         doc? ( app-doc/doxygen )
33         xinerama? ( x11-proto/xineramaproto )"
34
35 FLTK_INCDIR=${EPREFIX}/usr/include/fltk
36 FLTK_LIBDIR=${EPREFIX}/usr/$(get_libdir)/fltk
37
38 src_prepare() {
39         rm -rf zlib jpeg png || die
40         epatch \
41                 "${FILESDIR}"/${PN}-1.3.2-desktop.patch \
42                 "${FILESDIR}"/${PN}-1.3.0-share.patch \
43                 "${FILESDIR}"/${PN}-1.3.2-conf-tests.patch \
44                 "${FILESDIR}"/${PN}-1.3.2-jpeg-9a.patch \
45                 "${FILESDIR}"/${PN}-1.3.3-visibility.patch \
46                 "${FILESDIR}"/${PN}-1.3.3-fl_open_display.patch \
47                 "${FILESDIR}"/${PN}-1.3.3-fltk-config.patch \
48                 "${FILESDIR}"/${PN}-1.3.3-xutf8-visibility.patch
49
50         sed -i \
51                 -e 's:@HLINKS@::g' FL/Makefile.in || die
52         # some fixes introduced because slotting
53         sed -i \
54                 -e '/RANLIB/s:$(libdir)/\(.*LIBNAME)\):$(libdir)/`basename \1`:g' \
55                 src/Makefile || die
56         # docs in proper docdir
57         sed -i \
58                 -e "/^docdir/s:fltk:${PF}/html:" \
59                 -e "/SILENT:/d" \
60                 makeinclude.in || die
61         sed -e "s/7/${PV}/" \
62                 < "${FILESDIR}"/FLTKConfig.cmake \
63                 > CMake/FLTKConfig.cmake || die
64         sed -e 's:-Os::g' -i configure.in || die
65
66         use prefix && append-ldflags -Wl,-rpath -Wl,"${FLTK_LIBDIR}"
67
68         # also in Makefile:config.guess config.sub:
69         cp misc/config.{guess,sub} . || die
70
71         eautoconf
72 }
73
74 src_configure() {
75         econf \
76                 --includedir=${FLTK_INCDIR}\
77                 --libdir=${FLTK_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
96         if use doc; then
97                 emake -C documentation html
98         fi
99
100         if use games; then
101                 emake -C test blocks checkers sudoku
102         fi
103 }
104
105 src_test() {
106         emake -C test
107 }
108
109 src_install() {
110         default
111
112         emake -C fluid \
113                         DESTDIR="${D}" install-linux
114         if use doc; then
115                 emake -C documentation \
116                         DESTDIR="${D}" install
117         fi
118
119         local apps="fluid"
120         if use games; then
121                 emake -C test \
122                         DESTDIR="${D}" install-linux
123                 emake -C documentation \
124                         DESTDIR="${D}" install-linux
125                 apps+=" sudoku blocks checkers"
126         fi
127
128         for app in ${apps}; do
129                 dosym /usr/share/icons/hicolor/32x32/apps/${app}.png \
130                         /usr/share/pixmaps/${app}.png
131         done
132
133         dodoc CHANGES README CREDITS ANNOUNCEMENT
134
135         if use examples; then
136                 insinto /usr/share/doc/${PF}/examples
137                 doins test/*.{h,cxx,fl} test/demo.menu
138         fi
139
140         insinto /usr/share/cmake/Modules
141         doins CMake/FLTK*.cmake
142
143         echo "LDPATH=${FLTK_LIBDIR}" > 99fltk
144         echo "FLTK_DOCDIR=${EPREFIX}/usr/share/doc/${PF}/html" >> 99fltk
145         doenvd 99fltk
146
147         # FIXME: This is bad, but building only shared libraries is hardly supported
148         # FIXME: The executables in test/ are linking statically against libfltk
149         if ! use static-libs; then
150                 rm "${ED}"/usr/lib*/fltk/*.a || die
151         fi
152
153         prune_libtool_files
154 }
155
156 pkg_postinst() {
157         fdo-mime_desktop_database_update
158 }
159
160 pkg_postrm() {
161         fdo-mime_desktop_database_update
162 }