app-text/llpp: x86 stable wrt bug #614852
[gentoo.git] / app-text / llpp / llpp-26b.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit eutils multilib toolchain-funcs vcs-snapshot
7
8 DESCRIPTION="graphical PDF viewer which aims to superficially resemble less(1)"
9 HOMEPAGE="http://repo.or.cz/w/llpp.git"
10 SRC_URI="http://repo.or.cz/llpp.git/snapshot/606ca0f5b7d9c1f031e558c17d66591daa04e3a4.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="amd64 ~ppc x86"
15 IUSE="+ocamlopt static"
16
17 LIB_DEPEND=">=app-text/mupdf-1.11:0=[static-libs]
18         media-libs/openjpeg:2[static-libs]
19         media-libs/fontconfig:1.0[static-libs]
20         media-libs/freetype:2[static-libs]
21         media-libs/jbig2dec[static-libs]
22         sys-libs/zlib[static-libs]
23         virtual/jpeg:0[static-libs]
24         x11-libs/libX11[static-libs]"
25 RDEPEND="x11-misc/xsel
26         !static? ( ${LIB_DEPEND//\[static-libs]} )"
27 DEPEND="${RDEPEND}
28         static? ( ${LIB_DEPEND}
29                 app-arch/bzip2[static-libs]
30                 media-libs/libXcm[static-libs]
31                 x11-libs/libXau[static-libs]
32                 x11-libs/libXdmcp[static-libs]
33                 x11-libs/libXmu[static-libs] )
34         >=dev-lang/ocaml-4.02[ocamlopt?]
35         dev-ml/lablgl[glut,ocamlopt?]"
36
37 RESTRICT="!ocamlopt? ( strip )"
38
39 PATCHES=( "${FILESDIR}"/${PN}-26b-WM_CLASS.patch )
40
41 src_compile() {
42         local ocaml=$(usex ocamlopt ocamlopt.opt ocamlc.opt)
43         local cmo=$(usex ocamlopt cmx cmo)
44         local cma=$(usex ocamlopt cmxa cma)
45         local ccopt="$(freetype-config --cflags ) -O -include ft2build.h -D_GNU_SOURCE -DUSE_FONTCONFIG -std=c99 -Wextra -Wall -pedantic-errors -Wunused-parameter -Wsign-compare -Wshadow"
46         if use static ; then
47                 local cclib=""
48                 local slib=""
49                 local spath=( ${EROOT}usr/$(get_libdir) $($(tc-getPKG_CONFIG) --libs-only-L --static mupdf x11 ${egl} | sed 's:-L::g') )
50                 for slib in $($(tc-getPKG_CONFIG) --libs-only-l --static mupdf x11 ${egl} fontconfig) -ljpeg -ljbig2dec ; do
51                         case ${slib} in
52                                 -lm|-ldl|-lpthread)
53                                         einfo "${slib}: shared"
54                                         cclib+="${slib} " ;;
55                                 *)
56                                         local ccnew=$(find ${spath} -name "lib${slib/-l}.a")
57                                         einfo "${slib}: use ${ccnew}"
58                                         cclib+="${ccnew} " ;;
59                         esac
60                 done
61         else
62                 local cclib="$($(tc-getPKG_CONFIG) --libs mupdf x11 ${egl} fontconfig) -lpthread"
63         fi
64
65         verbose() { echo "$@" >&2 ; "$@" || die ; }
66         verbose sh mkhelp.sh KEYS ${PV} > help.ml
67         verbose printf 'let version ="%s";;\n' ${PV} >> help.ml
68         verbose ${ocaml} -c -o link.o -ccopt "${ccopt}" link.c
69         verbose ${ocaml} -c -o keys.${cmo} keys.ml
70         verbose ${ocaml} -c -o help.${cmo} help.ml
71         verbose ${ocaml} -c -o utils.${cmo} utils.ml
72         verbose ${ocaml} -c -o wsi/x11/wsi.cmi wsi/x11/wsi.mli
73         verbose ${ocaml} -c -o wsi/x11/wsi.${cmo} -I wsi/x11 wsi/x11/wsi.ml
74         verbose ${ocaml} -c -o parser.${cmo} parser.ml
75         verbose ${ocaml} -c -o config.${cmo} -I +lablGL -I wsi/x11 config.ml
76         verbose ${ocaml} -c -o main.${cmo} -I +lablGL -I wsi/x11 main.ml
77         verbose ${ocaml} $(usex ocamlopt "" -custom) -o llpp -I +lablGL -I wsi/x11 \
78                 str.${cma} unix.${cma} lablgl.${cma} link.o \
79             -cclib "${cclib}" \
80                 help.${cmo} utils.${cmo} parser.${cmo} wsi.${cmo} config.${cmo} main.${cmo}
81 }
82
83 src_install() {
84         dobin ${PN} misc/${PN}ac
85         dodoc KEYS README Thanks
86 }