app-office/lyx: rebase release to 1.5.5
[gentoo-soor-overlay.git] / app-office / lyx / lyx-1.5.5.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" # dev-tex/ivritex
25 IUSE="cups debug nls linguas_he latex"
26 RESTRICT="test"
27
28 RDEPEND="|| (
29                           (
30                                 x11-libs/qt-gui
31                                 x11-libs/qt-core
32                           )
33                           >=x11-libs/qt-4.1.1:4
34                         )
35                  x11-libs/libXrandr
36                  x11-libs/libXcursor
37                  x11-libs/libXrender
38                  x11-libs/libXfixes
39                  x11-libs/libXext
40                  x11-libs/libSM
41                  x11-libs/libICE
42                  x11-libs/libX11
43                  x11-libs/libXau
44                  x11-libs/libXdmcp
45                  media-gfx/imagemagick
46                  media-libs/libpng:1.2
47                  media-libs/fontconfig
48                  media-libs/freetype:2
49                  dev-libs/libxml2:2
50                  dev-libs/boost
51                  app-text/aiksaurus
52                  app-text/sgmltools-lite
53                  virtual/aspell-dict
54                  >=dev-lang/python-2.3.4
55                  cups? ( virtual/lpr )
56                  latex? (
57                                   virtual/latex-base
58                                   virtual/ghostscript
59                                   app-text/noweb
60                                   dev-tex/dvipost
61                                   dev-tex/chktex
62                                   || (
63                                            dev-tex/latex2html
64                                            dev-tex/tth
65                                            dev-tex/hevea
66                                            dev-tex/tex4ht
67                                          )
68                                 )
69                  linguas_he? ( dev-tex/ivritex )"
70
71 DEPEND="${RDEPEND}
72                 x11-proto/xproto
73                 nls? ( sys-devel/gettext )"
74
75 src_unpack() {
76         unpack ${A}
77         cd "${S}"
78         # bug #125309
79         epatch "${FILESDIR}"/${PN}-1.5.0-gentoo.patch || die
80 }
81
82 src_compile() {
83         append-flags "$(test-flags -fno-stack-protector -fno-stack-protector-all)"
84         replace-flags "-Os" "-O2"
85         tc-export CXX
86
87         unset LINGUAS
88
89         econf \
90                 $(use_enable nls) \
91                 $(use_enable debug) \
92                 --disable-pch --with-aspell --without-included-boost || \
93                 die "econf failed"
94         emake || die "emake failed"
95 }
96
97 src_install() {
98         local mylinguas="${LINGUAS}"
99
100         unset LINGUAS
101         emake DESTDIR="${D}" install || die "emake install failed"
102
103         LINGUAS="${mylinguas}"
104
105         dodoc ANNOUNCE ChangeLog NEWS README RELEASE-NOTES UPGRADING
106
107         if use linguas_he ; then
108                 insinto /usr/share/lyx/bind
109                 doins "${DISTDIR}"/hebrew.bind
110                 dodoc "${DISTDIR}"/preferences
111         fi
112
113         domenu "${FILESDIR}"/lyx.desktop
114
115         # install the latex-xft fonts, which should fix
116         # the problems outlined in bug #15629
117         # <obz@gentoo.org>
118         cd "${WORKDIR}"/${FONT_P}
119         emake DESTDIR="${D}" install || die "Font installation failed"
120
121         font_src_install
122
123         # fix for bug 91108
124         if use latex ; then
125                 dosym ../../../lyx/tex /usr/share/texmf/tex/latex/lyx
126         fi
127 }
128
129 pkg_postinst() {
130         font_pkg_postinst
131
132         # fix for bug 91108
133         if use latex ; then
134                 texhash
135         fi
136
137         if use linguas_he ; then
138                 elog
139                 elog "How to use Hebrew in LyX:"
140                 elog "bunzip2 /usr/share/doc/${PF}/preferences.bz2 into ~/.lyx/preferences"
141                 elog "or, read http://cs.haifa.ac.il/~dekelts/lyx/instructions2.html"
142                 elog "for instructions on using lyx's own preferences dialog to equal effect."
143                 elog
144         fi
145
146         elog
147         elog "There are known issues in the case of 1.4->1.5 config files transition."
148         elog "In case your File->Export list is incomplete try reconfiguring or even"
149         elog "remove the old configuration files in ~/.lyx ."
150         elog
151 }
152
153 pkg_postrm() {
154         if use latex ; then
155                 texhash
156         fi
157 }