317
|
1 # Copyright 1999-2011 Gentoo Foundation
|
|
2 # Distributed under the terms of the GNU General Public License v2
|
|
3 # $Header: /var/cvsroot/gentoo-x86/dev-lang/erlang/erlang-14.2.4.ebuild,v 1.2 2011/12/07 17:44:39 ulm Exp $
|
|
4
|
|
5 EAPI=3
|
|
6 WX_GTK_VER="2.8"
|
|
7
|
|
8 inherit elisp-common eutils java-pkg-opt-2 multilib versionator wxwidgets
|
|
9
|
|
10 # NOTE: If you need symlinks for binaries please tell maintainers or
|
|
11 # open up a bug to let it be created.
|
|
12
|
|
13 # erlang uses a really weird versioning scheme which caused quite a few problems
|
|
14 # already. Thus we do a slight modification converting all letters to digits to
|
|
15 # make it more sane (see e.g. #26420)
|
|
16
|
|
17 # the next line selects the right source.
|
|
18 ERL_VER=($(get_version_components))
|
333
|
19 MY_PV="R$(get_major_version)B0${ERL_VER[2]}"
|
317
|
20
|
|
21 # ATTN!! Take care when processing the C, etc version!
|
|
22 MY_P=otp_src_${MY_PV}
|
|
23
|
|
24 DESCRIPTION="Erlang programming language, runtime environment, and large collection of libraries"
|
|
25 HOMEPAGE="http://www.erlang.org/"
|
|
26 SRC_URI="http://www.erlang.org/download/${MY_P}.tar.gz
|
|
27 http://erlang.org/download/otp_doc_man_${MY_PV}.tar.gz
|
|
28 doc? ( http://erlang.org/download/otp_doc_html_${MY_PV}.tar.gz )"
|
|
29
|
|
30 LICENSE="ErlPL-1.1"
|
|
31 SLOT="0"
|
|
32 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x64-solaris"
|
|
33 IUSE="doc emacs halfword hipe java kpoll odbc smp sctp ssl tk wxwidgets"
|
|
34
|
|
35 RDEPEND=">=dev-lang/perl-5.6.1
|
|
36 ssl? ( >=dev-libs/openssl-0.9.7d )
|
|
37 emacs? ( virtual/emacs )
|
|
38 java? ( >=virtual/jdk-1.2 )
|
|
39 odbc? ( dev-db/unixODBC )"
|
|
40 DEPEND="${RDEPEND}
|
|
41 wxwidgets? ( x11-libs/wxGTK:2.8[opengl] )
|
|
42 sctp? ( net-misc/lksctp-tools )
|
|
43 tk? ( dev-lang/tk )"
|
|
44
|
|
45 S="${WORKDIR}/${MY_P}"
|
|
46
|
|
47 SITEFILE=50${PN}-gentoo.el
|
|
48
|
|
49 pkg_setup() {
|
|
50 use wxwidgets && wxwidgets_pkg_setup
|
|
51 if use halfword ; then
|
|
52 use amd64 || die "halfword support is limited to amd64"
|
|
53 fi
|
|
54 }
|
|
55
|
|
56 src_prepare() {
|
|
57 use odbc || sed -i 's: odbc : :' lib/Makefile
|
|
58
|
|
59 # bug 263129, don't ignore LDFLAGS, reported upstream
|
|
60 sed -e 's:LDFLAGS = \$(DED_LDFLAGS):LDFLAGS += \$(DED_LDFLAGS):' -i "${S}"/lib/megaco/src/flex/Makefile.in || die
|
|
61
|
|
62 if ! use wxwidgets; then
|
|
63 sed -i 's: wx : :' lib/Makefile
|
|
64 rm -rf lib/wx
|
|
65 fi
|
|
66
|
|
67 # Nasty workaround, reported upstream
|
|
68 cp "${S}"/lib/configure.in.src "${S}"/lib/configure.in || die
|
|
69
|
|
70 # prevent configure from injecting -m32 by default on Darwin, bug #334155
|
|
71 # Nasty hack
|
|
72 sed -i -e 's/Darwin-i386/Darwin-NO/' configure.in || die
|
|
73 sed -i -e '/\<\(LD\|C\)FLAGS="-m32/s/-m32//' erts/configure.in || die
|
|
74
|
|
75 # bug 383697
|
|
76 sed -i '1i#define OF(x) x' erts/emulator/drivers/common/gzio.c || die
|
|
77 }
|
|
78
|
|
79 src_configure() {
|
|
80 use java || export JAVAC=false
|
|
81
|
|
82 econf \
|
|
83 --enable-threads \
|
|
84 --enable-shared-zlib \ \
|
|
85 $(use_enable sctp) \
|
|
86 $(use_enable halfword halfword-emulator) \
|
|
87 $(use_enable hipe) \
|
|
88 $(use_with ssl ssl "${EPREFIX}"/usr) \
|
|
89 $(use_enable ssl dynamic-ssl-lib) \
|
|
90 $(use_enable kpoll kernel-poll) \
|
|
91 $(use_enable smp smp-support) \
|
|
92 || die
|
|
93 }
|
|
94
|
|
95 src_compile() {
|
|
96 use java || export JAVAC=false
|
|
97 emake -j1 || die
|
|
98
|
|
99 if use emacs ; then
|
|
100 pushd lib/tools/emacs
|
|
101 elisp-compile *.el || die
|
|
102 popd
|
|
103 fi
|
|
104 }
|
|
105
|
|
106 extract_version() {
|
|
107 sed -n -e "/^$2 = \(.*\)$/s::\1:p" "${S}/$1/vsn.mk"
|
|
108 }
|
|
109
|
|
110 src_install() {
|
|
111 local ERL_LIBDIR=/usr/$(get_libdir)/erlang
|
|
112 local ERL_INTERFACE_VER=$(extract_version lib/erl_interface EI_VSN)
|
|
113 local ERL_ERTS_VER=$(extract_version erts VSN)
|
|
114
|
|
115 emake -j1 INSTALL_PREFIX="${D}" install || die
|
|
116 dodoc AUTHORS README.md
|
|
117
|
|
118 dosym "${ERL_LIBDIR}/bin/erl" /usr/bin/erl
|
|
119 dosym "${ERL_LIBDIR}/bin/erlc" /usr/bin/erlc
|
|
120 dosym "${ERL_LIBDIR}/bin/escript" /usr/bin/escript
|
|
121 dosym \
|
|
122 "${ERL_LIBDIR}/lib/erl_interface-${ERL_INTERFACE_VER}/bin/erl_call" \
|
|
123 /usr/bin/erl_call
|
|
124 dosym "${ERL_LIBDIR}/erts-${ERL_ERTS_VER}/bin/beam" /usr/bin/beam
|
|
125 use smp && dosym "${ERL_LIBDIR}/erts-${ERL_ERTS_VER}/bin/beam.smp" /usr/bin/beam.smp
|
|
126
|
|
127 ## Remove ${D} from the following files
|
|
128 sed -e "s:${D}::g" -i "${ED}${ERL_LIBDIR}/bin/erl" || die
|
|
129 sed -e "s:${D}::g" -i "${ED}${ERL_LIBDIR}/bin/start" || die
|
|
130 grep -rle "${D}" "${ED}/${ERL_LIBDIR}/erts-${ERL_ERTS_VER}" | xargs sed -i -e "s:${D}::g"
|
|
131
|
|
132 ## Clean up the no longer needed files
|
|
133 rm "${ED}/${ERL_LIBDIR}/Install"||die
|
|
134
|
|
135 for i in "${WORKDIR}"/man/man* ; do
|
|
136 dodir "${ERL_LIBDIR}/${i##${WORKDIR}}"
|
|
137 done
|
|
138 for file in "${WORKDIR}"/man/man*/*.[1-9]; do
|
|
139 # doman sucks so we can't use it
|
|
140 cp ${file} "${ED}/${ERL_LIBDIR}"/man/man${file##*.}/
|
|
141 done
|
|
142 # extend MANPATH, so the normal man command can find it
|
|
143 # see bug 189639
|
|
144 dodir /etc/env.d/
|
|
145 echo "MANPATH=\"${EPREFIX}${ERL_LIBDIR}/man\"" > "${ED}/etc/env.d/90erlang"
|
|
146
|
|
147 if use doc ; then
|
|
148 dohtml -A README,erl,hrl,c,h,kwc,info -r \
|
|
149 "${WORKDIR}"/doc "${WORKDIR}"/lib "${WORKDIR}"/erts-*
|
|
150 fi
|
|
151
|
|
152 if use emacs ; then
|
|
153 pushd "${S}"
|
|
154 elisp-install erlang lib/tools/emacs/*.{el,elc}
|
|
155 sed -e "s:/usr/share:${EPREFIX}/usr/share:g" \
|
|
156 "${FILESDIR}"/${SITEFILE} > "${T}"/${SITEFILE}
|
|
157 elisp-site-file-install "${T}"/${SITEFILE}
|
|
158 popd
|
|
159 fi
|
|
160
|
|
161 # prepare erl for SMP, fixes bug #188112
|
|
162 use smp && sed -i -e 's:\(exec.*erlexec\):\1 -smp:' \
|
|
163 "${ED}/${ERL_LIBDIR}/bin/erl"
|
|
164
|
|
165 newinitd "${FILESDIR}"/epmd.init epmd || die
|
|
166 }
|
|
167
|
|
168 pkg_postinst() {
|
|
169 use emacs && elisp-site-regen
|
|
170 elog
|
|
171 elog "If you need a symlink to one of Erlang's binaries,"
|
|
172 elog "please open a bug on http://bugs.gentoo.org/"
|
|
173 elog
|
|
174 elog "Gentoo's versioning scheme differs from the author's, so please refer to this version as ${MY_PV}"
|
|
175 elog
|
|
176 }
|
|
177
|
|
178 pkg_postrm() {
|
|
179 use emacs && elisp-site-regen
|
|
180 }
|