Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/julia/, dev-lang/julia/files/
Date: Sat, 24 Sep 2016 21:26:05
Message-Id: 1474751936.7628bf334fad3d3ab0b4130992392ecd45d512a4.tamiko@gentoo
1 commit: 7628bf334fad3d3ab0b4130992392ecd45d512a4
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 24 17:22:15 2016 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 24 21:18:56 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7628bf33
7
8 dev-lang/julia: add a live ebuild
9
10 Package-Manager: portage-2.2.28
11
12 .../julia/files/julia-9999-fix_build_system.patch | 70 ++++++++
13 dev-lang/julia/julia-9999.ebuild | 181 +++++++++++++++++++++
14 2 files changed, 251 insertions(+)
15
16 diff --git a/dev-lang/julia/files/julia-9999-fix_build_system.patch b/dev-lang/julia/files/julia-9999-fix_build_system.patch
17 new file mode 100644
18 index 00000000..4ed2822
19 --- /dev/null
20 +++ b/dev-lang/julia/files/julia-9999-fix_build_system.patch
21 @@ -0,0 +1,70 @@
22 +diff --git a/Make.inc b/Make.inc
23 +index 651c9df..ff01872 100644
24 +--- a/Make.inc
25 ++++ b/Make.inc
26 +@@ -389,7 +389,7 @@ ifneq ($(OS), WINNT)
27 + JCXXFLAGS += -pedantic
28 + endif
29 + DEBUGFLAGS := -O0 -ggdb2 -DJL_DEBUG_BUILD -fstack-protector-all
30 +-SHIPFLAGS := -O3 -ggdb2 -falign-functions
31 ++SHIPFLAGS := GENTOOCFLAGS
32 + endif
33 +
34 + ifeq ($(USECLANG),1)
35 +@@ -400,7 +400,7 @@ JCFLAGS := -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
36 + JCPPFLAGS := -fasynchronous-unwind-tables
37 + JCXXFLAGS := -pipe $(fPIC) -fno-rtti -pedantic
38 + DEBUGFLAGS := -O0 -g -DJL_DEBUG_BUILD -fstack-protector-all
39 +-SHIPFLAGS := -O3 -g
40 ++SHIPFLAGS := GENTOOCFLAGS
41 + ifeq ($(OS), Darwin)
42 + ifeq ($(USE_LIBCPP), 1)
43 + CC += -stdlib=libc++ -mmacosx-version-min=10.7
44 +@@ -427,7 +427,7 @@ JCFLAGS := -std=gnu11 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
45 + JCPPFLAGS :=
46 + JCXXFLAGS := -pipe $(fPIC) -fno-rtti
47 + DEBUGFLAGS := -O0 -g -DJL_DEBUG_BUILD -fstack-protector-all
48 +-SHIPFLAGS := -O3 -g -falign-functions
49 ++SHIPFLAGS := GENTOOCFLAGS
50 + endif
51 +
52 + ifeq ($(USECCACHE), 1)
53 +diff --git a/doc/Makefile b/doc/Makefile
54 +index 0749d73..f4d49ec 100644
55 +--- a/doc/Makefile
56 ++++ b/doc/Makefile
57 +@@ -62,7 +62,7 @@ help:
58 + @echo " doctest to run all doctests embedded in the documentation (if enabled)"
59 +
60 + clean:
61 +- -rm -rf _build/*
62 ++ @echo "Do not clean doc/_build/html. Just use it..."
63 +
64 + cleanall: clean
65 +
66 +diff --git a/src/Makefile b/src/Makefile
67 +index d7ec864..61d2470 100644
68 +--- a/src/Makefile
69 ++++ b/src/Makefile
70 +@@ -66,20 +66,8 @@ HEADERS := $(addprefix $(SRCDIR)/,julia.h julia_threads.h julia_internal.h optio
71 +
72 + # In LLVM < 3.4, --ldflags includes both options and libraries, so use it both before and after --libs
73 + # In LLVM >= 3.4, --ldflags has only options, and --system-libs has the libraries.
74 +-ifneq ($(USE_LLVM_SHLIB),1)
75 +-LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags) $(shell $(LLVM_CONFIG_HOST) --libs $(LLVM_LIBS)) $(shell $(LLVM_CONFIG_HOST) --ldflags) $(shell $(LLVM_CONFIG_HOST) --system-libs 2> /dev/null)
76 +-else
77 +-ifeq ($(LLVM_USE_CMAKE),1)
78 +-LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM
79 +-else
80 +-ifeq ($(OS),WINNT)
81 +-LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM-$(LLVM_VER_SHORT)
82 +-else
83 +-LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM-$(shell $(LLVM_CONFIG_HOST) --version)
84 +-endif # OS == WINNT
85 +-endif # LLVM_USE_CMAKE == 1
86 ++LLVMLINK = $(call exec,$(LLVM_CONFIG) --ldflags) $(call exec,$(LLVM_CONFIG) --libs) $(call exec,$(LLVM_CONFIG) --ldflags) $(call exec,$(LLVM_CONFIG) --system-libs)
87 + FLAGS += -DLLVM_SHLIB
88 +-endif # USE_LLVM_SHLIB == 1
89 +
90 + COMMON_LIBS := -L$(build_shlibdir) -L$(build_libdir) $(LIBUV) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(LLVMLINK) $(OSLIBS)
91 + DEBUG_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a $(COMMON_LIBS)
92
93 diff --git a/dev-lang/julia/julia-9999.ebuild b/dev-lang/julia/julia-9999.ebuild
94 new file mode 100644
95 index 00000000..80df05f1
96 --- /dev/null
97 +++ b/dev-lang/julia/julia-9999.ebuild
98 @@ -0,0 +1,181 @@
99 +# Copyright 1999-2016 Gentoo Foundation
100 +# Distributed under the terms of the GNU General Public License v2
101 +# $Id$
102 +
103 +EAPI=6
104 +
105 +RESTRICT="test"
106 +
107 +inherit git-r3 elisp-common eutils multilib pax-utils toolchain-funcs
108 +
109 +DESCRIPTION="High-performance programming language for technical computing"
110 +HOMEPAGE="http://julialang.org/"
111 +SRC_URI=""
112 +EGIT_REPO_URI="git://github.com/JuliaLang/julia.git"
113 +
114 +LICENSE="MIT"
115 +SLOT="0"
116 +KEYWORDS=""
117 +IUSE="emacs"
118 +
119 +RDEPEND="
120 + dev-lang/R:0=
121 + dev-libs/double-conversion:0=
122 + dev-libs/gmp:0=
123 + dev-libs/libgit2:0=
124 + dev-libs/mpfr:0=
125 + dev-libs/openspecfun
126 + sci-libs/arpack:0=
127 + sci-libs/camd:0=
128 + sci-libs/cholmod:0=
129 + sci-libs/fftw:3.0=[threads]
130 + sci-libs/openlibm:0=
131 + sci-libs/spqr:0=
132 + sci-libs/umfpack:0=
133 + sci-mathematics/glpk:0=
134 + >=sys-devel/llvm-3.5:0=
135 + >=sys-libs/libunwind-1.1:7=
136 + sys-libs/readline:0=
137 + sys-libs/zlib:0=
138 + >=virtual/blas-1.1
139 + virtual/lapack
140 + emacs? ( app-emacs/ess )"
141 +
142 +DEPEND="${RDEPEND}
143 + dev-util/patchelf
144 + virtual/pkgconfig"
145 +
146 +PATCHES=(
147 + "${FILESDIR}"/${PN}-9999-fix_build_system.patch
148 +)
149 +
150 +src_prepare() {
151 + epatch "${PATCHES[@]}"
152 +
153 + eapply_user
154 +
155 + # Sledgehammer:
156 + # - respect CFLAGS
157 + # - respect EPREFIX and Gentoo specific paths
158 + # - fix BLAS and LAPACK link interface
159 +
160 + sed -i \
161 + -e 's|$(JLDOWNLOAD)|${EPREFIX}/bin/true|' \
162 + -e 's|git submodule|${EPREFIX}/bin/true|g' \
163 + -e "s|GENTOOCFLAGS|${CFLAGS}|g" \
164 + -e "s|/usr/include|${EPREFIX%/}/usr/include|g" \
165 + deps/Makefile || die
166 +
167 + local libblas="$($(tc-getPKG_CONFIG) --libs-only-l blas)"
168 + libblas="${libblas%% *}"
169 + libblas="lib${libblas#-l}"
170 + local liblapack="$($(tc-getPKG_CONFIG) --libs-only-l lapack)"
171 + liblapack="${liblapack%% *}"
172 + liblapack="lib${liblapack#-l}"
173 +
174 + sed -i \
175 + -e "s|\(JULIA_EXECUTABLE = \)\(\$(JULIAHOME)/julia\)|\1 LD_LIBRARY_PATH=\$(BUILD)/$(get_libdir) \2|" \
176 + -e "s|GENTOOCFLAGS|${CFLAGS}|g" \
177 + -e "s|LIBDIR = lib|LIBDIR = $(get_libdir)|" \
178 + -e "s|/usr/lib|${EPREFIX}/usr/$(get_libdir)|" \
179 + -e "s|/usr/include|${EPREFIX}/usr/include|" \
180 + -e "s|\$(BUILD)/lib|\$(BUILD)/$(get_libdir)|" \
181 + -e "s|^JULIA_COMMIT = .*|JULIA_COMMIT = v${PV}|" \
182 + -e "s|-lblas|$($(tc-getPKG_CONFIG) --libs blas)|" \
183 + -e "s|= libblas|= ${libblas}|" \
184 + -e "s|-llapack|$($(tc-getPKG_CONFIG) --libs lapack)|" \
185 + -e "s|= liblapack|= ${liblapack}|" \
186 + Make.inc || die
187 +
188 + sed -i \
189 + -e "s|,lib)|,$(get_libdir))|g" \
190 + -e "s|\$(BUILD)/lib|\$(BUILD)/$(get_libdir)|g" \
191 + Makefile || die
192 +
193 + sed -i \
194 + -e "s|ar -rcs|$(tc-getAR) -rcs|g" \
195 + src/Makefile || die
196 +}
197 +
198 +src_configure() {
199 + # julia does not play well with the system versions of
200 + # dsfmt, libuv, pcre2 and utf8proc
201 + cat <<-EOF > Make.user
202 + USE_SYSTEM_DSFMT=0
203 + USE_SYSTEM_LIBUV=0
204 + USE_SYSTEM_PCRE=0
205 + USE_SYSTEM_RMATH=0
206 + USE_SYSTEM_UTF8PROC=0
207 + USE_LLVM_SHLIB=1
208 + USE_SYSTEM_ARPACK=1
209 + USE_SYSTEM_BLAS=1
210 + USE_SYSTEM_FFTW=1
211 + USE_SYSTEM_GMP=1
212 + USE_SYSTEM_GRISU=1
213 + USE_SYSTEM_LAPACK=1
214 + USE_SYSTEM_LIBGIT2=1
215 + USE_SYSTEM_LIBM=1
216 + USE_SYSTEM_LIBUNWIND=1
217 + USE_SYSTEM_LLVM=1
218 + USE_SYSTEM_MPFR=1
219 + USE_SYSTEM_OPENLIBM=1
220 + USE_SYSTEM_OPENSPECFUN=1
221 + USE_SYSTEM_PATCHELF=1
222 + USE_SYSTEM_READLINE=1
223 + USE_SYSTEM_SUITESPARSE=1
224 + USE_SYSTEM_ZLIB=1
225 + VERBOSE=1
226 + EOF
227 +
228 +}
229 +
230 +src_compile() {
231 +
232 + # Julia accesses /proc/self/mem on Linux
233 + addpredict /proc/self/mem
234 +
235 + emake cleanall
236 + emake julia-release \
237 + prefix="/usr" DESTDIR="${D}" CC="$(tc-getCC)" CXX="$(tc-getCXX)"
238 + pax-mark m $(file usr/bin/julia-* | awk -F : '/ELF/ {print $1}')
239 + emake
240 + use emacs && elisp-compile contrib/julia-mode.el
241 +}
242 +
243 +src_test() {
244 + emake test
245 +}
246 +
247 +src_install() {
248 + emake install \
249 + prefix="/usr" DESTDIR="${D}" CC="$(tc-getCC)" CXX="$(tc-getCXX)"
250 + cat > 99julia <<-EOF
251 + LDPATH=${EROOT%/}/usr/$(get_libdir)/julia
252 + EOF
253 + doenvd 99julia
254 +
255 + if use emacs; then
256 + elisp-install "${PN}" contrib/julia-mode.el
257 + elisp-site-file-install "${FILESDIR}"/63julia-gentoo.el
258 + fi
259 + dodoc README.md
260 +
261 + mv "${ED}"/usr/etc/julia "${ED}"/etc || die
262 + rmdir "${ED}"/usr/etc || die
263 + rmdir "${ED}"/usr/libexec || die
264 + mv "${ED}"/usr/share/doc/julia/{examples,html} \
265 + "${ED}"/usr/share/doc/${P} || die
266 + rmdir "${ED}"/usr/share/doc/julia || die
267 + if [[ $(get_libdir) != lib ]]; then
268 + mkdir -p "${ED}"/usr/$(get_libdir) || die
269 + mv "${ED}"/usr/lib/julia "${ED}"/usr/$(get_libdir)/julia || die
270 + fi
271 +}
272 +
273 +pkg_postinst() {
274 + use emacs && elisp-site-regen
275 +}
276 +
277 +pkg_postrm() {
278 + use emacs && elisp-site-regen
279 +}