ddc4aa352fb8ef3e720e2a4fe38e1492c9706d5b
[gentoo-soor-overlay.git] / app-office / lyx / lyx-1.5.4.ebuild
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="1"
6
7 inherit eutils flag-o-matic font toolchain-funcs
8
9 MY_P="${P/_}"
10 S="${WORKDIR}/${MY_P}"
11 FONT_P="latex-xft-fonts-0.1"
12 FONT_S="${WORKDIR}/${FONT_P}"
13 DESCRIPTION="WYSIWYM frontend for LaTeX, DocBook, etc."
14 HOMEPAGE="http://www.lyx.org/"
15 SRC_URI="ftp://ftp.lyx.org/pub/lyx/stable/${P}.tar.bz2
16                  ftp://ftp.lyx.org/pub/lyx/contrib/${FONT_P}.tar.gz
17                  linguas_he? (
18                                            http://cs.haifa.ac.il/~dekelts/lyx/files/hebrew.bind
19                                            http://cs.haifa.ac.il/~dekelts/lyx/files/preferences
20                                          )"
21
22 LICENSE="GPL-2"
23 SLOT="0"
24 KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86"
25 IUSE="cups debug nls linguas_he latex"
26 RESTRICT="test"
27
28 RDEPEND="|| (
29                           =x11-libs/qt-4.2*
30                           =x11-libs/qt-4.3*
31                         )
32                  x11-libs/libXrandr
33                  x11-libs/libXcursor
34                  x11-libs/libXrender
35                  x11-libs/libXfixes
36                  x11-libs/libXext
37                  x11-libs/libSM
38                  x11-libs/libICE
39                  x11-libs/libX11
40                  x11-libs/libXau
41                  x11-libs/libXdmcp
42                  media-gfx/imagemagick
43                  media-libs/libpng
44                  media-libs/fontconfig
45                  media-libs/freetype
46                  dev-libs/libxml2
47                  dev-libs/boost
48                  app-text/aiksaurus
49                  app-text/sgmltools-lite
50                  virtual/aspell-dict
51                  virtual/python
52                  cups? ( virtual/lpr )
53                  latex? (
54                                   virtual/latex-base
55                                   virtual/ghostscript
56                                   app-text/noweb
57                                   dev-tex/dvipost
58                                   dev-tex/chktex
59                                   || (
60                                            dev-tex/latex2html
61                                            dev-tex/tth
62                                            dev-tex/hevea
63                                            dev-tex/tex4ht
64                                          )
65                                 )
66                  linguas_he? ( dev-tex/ivritex )"
67
68 DEPEND="${RDEPEND}
69                 x11-proto/xproto
70                 nls? ( sys-devel/gettext )"
71
72 src_unpack() {
73         unpack ${A}
74         cd "${S}"
75         epatch "${FILESDIR}"/${PN}-1.5.0-gentoo.patch || die
76 }
77
78 src_compile() {
79         append-flags "$(test-flags -fno-stack-protector -fno-stack-protector-all)"
80         replace-flags "-Os" "-O2"
81         tc-export CXX
82
83         unset LINGUAS
84
85         econf \
86                 $(use_enable nls) \
87                 $(use_enable debug) \
88                 --disable-pch --with-aspell --without-included-boost || \
89                 die "econf failed"
90         emake || die "emake failed"
91 }
92
93 src_install() {
94         local mylinguas="${LINGUAS}"
95
96         unset LINGUAS
97         emake DESTDIR="${D}" install || die "emake install failed"
98
99         LINGUAS="${mylinguas}"
100
101         dodoc ANNOUNCE ChangeLog NEWS README RELEASE-NOTES UPGRADING
102
103         if use linguas_he ; then
104                 insinto /usr/share/lyx/bind
105                 doins "${DISTDIR}"/hebrew.bind
106                 dodoc "${DISTDIR}"/preferences
107         fi
108
109         domenu "${FILESDIR}"/lyx.desktop
110
111         cd "${WORKDIR}"/${FONT_P}
112         emake DESTDIR="${D}" install || die "Font installation failed"
113
114         font_src_install
115
116         if use latex ; then
117                 dosym ../../../lyx/tex /usr/share/texmf/tex/latex/lyx
118         fi
119 }
120
121 pkg_postinst() {
122         font_pkg_postinst
123
124         if use latex ; then
125                 texhash
126         fi
127
128         if use linguas_he ; then
129                 elog
130                 elog "How to use Hebrew in LyX:"
131                 elog "bunzip2 /usr/share/doc/${PF}/preferences.bz2 into ~/.lyx/preferences"
132                 elog "or, read http://cs.haifa.ac.il/~dekelts/lyx/instructions2.html"
133                 elog "for instructions on using lyx's own preferences dialog to equal effect."
134                 elog
135         fi
136
137         elog
138         elog "There are known issues in the case of 1.4->1.5 config files transition."
139         elog "In case your File->Export list is incomplete try reconfiguring or even"
140         elog "remove the old configuration files in ~/.lyx ."
141         elog
142 }
143
144 pkg_postrm() {
145         if use latex ; then
146                 texhash
147         fi
148 }