61b5632816639d83ef90a04c6f3c43f2c5d70c4e
[gentoo-soor-overlay.git] / app-office / lyx / lyx-9999.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 autotools subversion eutils flag-o-matic font toolchain-funcs
8
9 FONT_P="latex-xft-fonts-0.1"
10
11 DESCRIPTION="WYSIWYM frontend for LaTeX, DocBook, etc."
12 HOMEPAGE="http://www.lyx.org/"
13 ESVN_REPO_URI="svn://svn.lyx.org/lyx/lyx-devel/trunk"
14 SRC_URI="ftp://ftp.lyx.org/pub/lyx/contrib/${FONT_P}.tar.gz
15                  linguas_he? (
16                                            http://cs.haifa.ac.il/~dekelts/lyx/files/hebrew.bind
17                                            http://cs.haifa.ac.il/~dekelts/lyx/files/preferences
18                                          )"
19
20 LICENSE="GPL-2"
21 SLOT="0"
22 KEYWORDS=""
23 IUSE="cups debug latex monolithic nls linguas_he"
24 RESTRICT="test"
25
26 RDEPEND="|| (
27                           (
28                                 x11-libs/qt-core:4
29                                 x11-libs/qt-gui:4
30                           )
31                           >=x11-libs/qt-4.2:4
32                         )
33                  x11-libs/libXrandr
34                  x11-libs/libXcursor
35                  x11-libs/libXrender
36                  x11-libs/libXfixes
37                  x11-libs/libXext
38                  x11-libs/libSM
39                  x11-libs/libICE
40                  x11-libs/libX11
41                  x11-libs/libXau
42                  x11-libs/libXdmcp
43                  media-gfx/imagemagick
44                  media-libs/libpng
45                  media-libs/fontconfig
46                  media-libs/freetype
47                  dev-libs/libxml2
48                  dev-libs/boost
49                  >=sys-devel/gcc-4.1
50                  app-text/aiksaurus
51                  app-text/sgmltools-lite
52                  virtual/aspell-dict
53                  virtual/python
54                  cups? ( virtual/lpr )
55                  latex? (
56                                   virtual/latex-base
57                                   virtual/ghostscript
58                                   app-text/noweb
59                                   dev-tex/dvipost
60                                   dev-tex/chktex
61                                   || (
62                                            dev-tex/latex2html
63                                            dev-tex/tth
64                                            dev-tex/hevea
65                                            dev-tex/tex4ht
66                                          )
67                                 )
68                  linguas_he? ( dev-tex/ivritex )"
69
70 DEPEND="${RDEPEND}
71                 x11-proto/xproto
72                 nls? ( sys-devel/gettext )"
73
74 S="${WORKDIR}"/${P}
75
76 pkg_setup() {
77         if use monolithic; then
78                 ewarn ":WARNING:"
79                 ewarn "Bulding LyX with USE=monolithic needs 512Mb of RAM or more"
80                 ewarn "for each make job (-j). Don't come crying to me if you run"
81                 ewarn "out of ram."
82         fi
83 }
84
85 src_unpack() {
86         unpack ${A}
87         subversion_fetch || die "Fetch with SVN failed kthnx."
88         cd "${S}"
89         epatch "${FILESDIR}"/${PN}-1.5.0-gentoo.patch || die
90
91         # trunk needs to regen with autotools
92         # lets use gentoo tools instead of the lyx script,
93         # which calls aclocal, autoheader, automake, autoconf
94         rm -rf "${S}"/autom4te.cache
95         eaclocal
96         eautoheader
97         eautomake
98         eautoconf
99 }
100
101 src_compile() {
102         append-flags "$(test-flags -fno-stack-protector -fno-stack-protector-all)"
103         replace-flags "-Os" "-O2"
104         tc-export CXX
105
106         unset LINGUAS
107
108         if use monolithic; then
109                 monolithic="--enable-monolithic-client"
110                 monolithic="${monolithic} --enable-monolithic-insets"
111                 monolithic="${monolithic} --enable-monolithic-mathed"
112                 monolithic="${monolithic} --enable-monolithic-core"
113                 monolithic="${monolithic} --enable-monolithic-tex2lyx"
114                 monolithic="${monolithic} --enable-monolithic-frontend-qt4"
115         fi
116
117         if use debug; then
118                 build_type="--enable-build-type=development"
119         else
120                 build_type="--enable-build-type=release"
121         fi
122
123         econf ${monolithic} \
124                 $(use_enable nls) \
125                 $(use_enable debug) \
126                 ${build_type} \
127                 --disable-pch --with-aspell --without-included-boost || die "econf failed"
128         emake || die "emake failed"
129 }
130
131 src_install() {
132         local mylinguas="${LINGUAS}"
133
134         unset LINGUAS
135         emake DESTDIR="${D}" install || die "emake install failed"
136
137         LINGUAS="${mylinguas}"
138
139         dodoc ANNOUNCE ChangeLog NEWS README RELEASE-NOTES UPGRADING
140
141         if use linguas_he ; then
142                 insinto /usr/share/lyx/bind
143                 doins "${DISTDIR}"/hebrew.bind
144                 dodoc "${DISTDIR}"/preferences
145         fi
146
147         domenu "${FILESDIR}"/lyx.desktop
148
149         cd "${WORKDIR}"/${FONT_P}
150         emake DESTDIR="${D}" install || die "Font installation failed"
151
152         font_src_install
153
154         if use latex ; then
155                 dosym ../../../lyx/tex /usr/share/texmf/tex/latex/lyx
156         fi
157 }
158
159 pkg_postinst() {
160         font_pkg_postinst
161
162         if use latex ; then
163                 texhash
164         fi
165
166         if use linguas_he ; then
167                 elog
168                 elog "How to use Hebrew in LyX:"
169                 elog "bunzip2 /usr/share/doc/${PF}/preferences.bz2 into ~/.lyx/preferences"
170                 elog "or, read http://cs.haifa.ac.il/~dekelts/lyx/instructions2.html"
171                 elog "for instructions on using lyx's own preferences dialog to equal effect."
172                 elog
173         fi
174
175         elog
176         elog "There are known issues in the case of 1.4->1.5 config files transition."
177         elog "In case your File->Export list is incomplete try reconfiguring or even"
178         elog "remove the old configuration files in ~/.lyx ."
179         elog
180 }
181
182 pkg_postrm() {
183         if use latex ; then
184                 texhash
185         fi
186 }