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/files/, dev-lang/julia/
Date: Mon, 03 Jan 2022 21:37:56
Message-Id: 1641245841.a7d6cd18bbe50650f8afddb5948c11c149679403.tamiko@gentoo
1 commit: a7d6cd18bbe50650f8afddb5948c11c149679403
2 Author: Janusz Andrzejewski <janusz.andrzejewski <AT> gmail <DOT> com>
3 AuthorDate: Sat Dec 25 20:00:00 2021 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 3 21:37:21 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7d6cd18
7
8 dev-lang/julia: version bump to 1.7.0
9
10 The ebuild for julia 1.7.0 with patches:
11 - llvm 13 compatibility
12 - libgit1.2 compatibility
13 - avoid hardcoded libraries
14 - do not build the library a second time
15 - do not set rpaths
16
17 Some patches come from Arch Linux.
18
19 [Matthias Maier]
20 - renamed patches
21 - misc cleanup
22
23 Package-Manager: Portage-3.0.28, Repoman-3.0.3
24 Signed-off-by: Janusz Andrzejewski <janusz.andrzejewski <AT> gmail.com>
25 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
26
27 dev-lang/julia/Manifest | 1 +
28 .../julia/files/julia-1.7.0-do_not_set_rpath.patch | 29 ++
29 .../julia/files/julia-1.7.0-hardcoded-libs.patch | 72 ++++
30 dev-lang/julia/files/julia-1.7.0-libgit-1.2.patch | 17 +
31 .../files/julia-1.7.0-llvm_13_compat_part_1.patch | 172 ++++++++++
32 .../files/julia-1.7.0-llvm_13_compat_part_2.patch | 80 +++++
33 .../files/julia-1.7.0-llvm_13_compat_part_3.patch | 375 +++++++++++++++++++++
34 .../files/julia-1.7.0-make-install-no-build.patch | 17 +
35 dev-lang/julia/julia-1.7.0.ebuild | 179 ++++++++++
36 9 files changed, 942 insertions(+)
37
38 diff --git a/dev-lang/julia/Manifest b/dev-lang/julia/Manifest
39 index b8aa8b1d3b74..35b63a65c103 100644
40 --- a/dev-lang/julia/Manifest
41 +++ b/dev-lang/julia/Manifest
42 @@ -1,6 +1,7 @@
43 DIST julia-1.5.3.tar.gz 6949901 BLAKE2B 08f8496980a9bbb9effc0c72cb6b7a5ce1dbd1774735caa366ddc1bb5404117111c624a639f6eb48360061f9fc597a7b37dff24f8555f03ebc4a22524cbeb3b8 SHA512 9e644a64fd6e2caf0390a2bc470084406c078244e65b70a2e3b031d5806c1dff780273ccccfe4bccfd8c03778b7d3a44de7a84bd13f3512afe6864efa5a730fc
44 DIST julia-1.6.0.tar.gz 7711314 BLAKE2B 135862347a7f3a954acb8d8e17350fbdda84b4813d8498b862e107836a0d29d6e70a26c39c0c29655e6348a5a3afd5b4d7e9824cb88c9e8d31c4515468f46d5b SHA512 41dea60c08882a8f8f9024eb2285c30dbbc68e2256ed6afd5bf956a1828239128b2f39b4ce733a438eafe3b2324ff06dec5c1eb7c9b0f838b2daa972f587d909
45 DIST julia-1.6.3.tar.gz 7734900 BLAKE2B 679851ee159ac83f49e54f1d71068d4abde919a0da39475dccaecc97e705b87db70c38a55fbc7a0cfacc774291013b189fb516817d6c6e67ca5ccfbb515c3f90 SHA512 a622fddc9e9f3f47037053a1e722153a567c065723f99a97912f8c5a6c2a22c3be0be674325361dd1b04601bbe6c6f204c66004ce887f3f7822e8204fd6855de
46 +DIST julia-1.7.0-full.tar.gz 255670801 BLAKE2B e7c5be50ab9e7014f028cf7d0530b269e78dd798dc3d4a88af2ed9fa1331694e39fbcae26d2cae6f15aaf1087656384c9872f344f99121406abdf2902a200176 SHA512 00e1bfe354010f5d900476e46b471c4425b711fff5a2aa0ac9e5dbe6ff02245011d4297e4703f2d46f7d4e7b6d97ffaf1bc63170edbfec440196c5ec75c984ce
47 DIST julia-Pkg-49908bffe83790bc7cf3c5d46faf3667f8902ad4.tar.gz 389738 BLAKE2B 1ed9201badf0a1db5142e0566bfe085b364e4681670937ac5fa53c15312ff8eb29d5e783b75fe3f4f379b041ba38c66ce94962fa7d98fcfd0b7b49acd1749d69 SHA512 a85aa80b3080794a8e3ae5ce54856e63457c461659c12fde5dde1b5ec33176ea06af49ee516d01ccd7b78d8358de2fe0ffcd5c6a6d5a5088cdcd76a0133780eb
48 DIST julia-UnicodeData-13.0.0.txt 1851767 BLAKE2B 72bbcf352f2f6a004abb3f351fe5da160e83644feea8de0ca154b5a1aa78f36cb04b252d0c7b64a5eeca388e600b2875bb76bc2746ee799a1a6eff97c1fe8b06 SHA512 1a4a662e2ab33469976bf5f91aa6933ed9b73f6d4179a2daffb349e1869d7d6cfa885b164e82d15dcdad7458cd451c81add58d875eb0c70de854589dc97b2055
49 DIST julia-dsfmt-2.2.3.tar.gz 291773 BLAKE2B 6ffae90494d72527920c80fc0fb005da1c7b84f8a03a7ecb0789434c0fff97359e5098e85431896dffccc7d5148c414e847aaba5feef648b8788421a466ff65e SHA512 6d8ddcd01aab3f9039f4f0288a8af53e290cc2f293ed8c4a8c9f3b3f12398e7eedfce8016117b425766ba89c61c86c13b3e420035b5f9bf91315b8b814c03662
50
51 diff --git a/dev-lang/julia/files/julia-1.7.0-do_not_set_rpath.patch b/dev-lang/julia/files/julia-1.7.0-do_not_set_rpath.patch
52 new file mode 100644
53 index 000000000000..24f12d261053
54 --- /dev/null
55 +++ b/dev-lang/julia/files/julia-1.7.0-do_not_set_rpath.patch
56 @@ -0,0 +1,29 @@
57 +--- a/Makefile 2021-12-21 09:38:26.782829864 +0100
58 ++++ b/Makefile 2021-12-21 10:52:40.760565902 +0100
59 +@@ -336,7 +336,7 @@
60 + install_name_tool -add_rpath @executable_path/$(build_libdir_rel) @executable_path/$(libdir_rel) $(DESTDIR)$(bindir)/$$j; \
61 + done
62 + endif
63 +-else ifneq (,$(findstring $(OS),Linux FreeBSD))
64 ++else ifneq (,$(findstring $(OS),FreeBSD))
65 + for j in $(JL_TARGETS) ; do \
66 + $(PATCHELF) --set-rpath '$$ORIGIN/$(private_libdir_rel):$$ORIGIN/$(libdir_rel)' $(DESTDIR)$(bindir)/$$j; \
67 + done
68 +@@ -357,7 +357,7 @@
69 + endif
70 +
71 + # Set rpath for libjulia-internal, which is moving from `../lib` to `../lib/julia`. We only need to do this for Linux/FreeBSD
72 +-ifneq (,$(findstring $(OS),Linux FreeBSD))
73 ++ifneq (,$(findstring $(OS),FreeBSD))
74 + $(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
75 + ifeq ($(BUNDLE_DEBUG_LIBS),1)
76 + $(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal-debug.$(SHLIB_EXT)
77 +@@ -365,7 +365,7 @@
78 + endif
79 +
80 + # Set rpath for LLVM.so which is `$ORIGIN/../lib` moving from `../lib` to `../lib/julia`. We only need to do this for Linux/FreeBSD
81 +-ifneq (,$(findstring $(OS),Linux FreeBSD))
82 ++ifneq (,$(findstring $(OS),FreeBSD))
83 + $(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libLLVM.$(SHLIB_EXT)
84 + endif
85 +
86
87 diff --git a/dev-lang/julia/files/julia-1.7.0-hardcoded-libs.patch b/dev-lang/julia/files/julia-1.7.0-hardcoded-libs.patch
88 new file mode 100644
89 index 000000000000..be7d20368f6d
90 --- /dev/null
91 +++ b/dev-lang/julia/files/julia-1.7.0-hardcoded-libs.patch
92 @@ -0,0 +1,72 @@
93 +This pacth comes from:
94 + https://raw.githubusercontent.com/archlinux/svntogit-community/packages/julia/trunk/julia-hardcoded-libs.patch
95 +
96 +diff --git a/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl b/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
97 +index a7ca666b23..b84a42f4e7 100644
98 +--- a/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
99 ++++ b/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
100 +@@ -31,9 +31,9 @@ elseif Sys.isapple()
101 + const libmbedtls = "@rpath/libmbedtls.13.dylib"
102 + const libmbedx509 = "@rpath/libmbedx509.1.dylib"
103 + else
104 +- const libmbedcrypto = "libmbedcrypto.so.5"
105 +- const libmbedtls = "libmbedtls.so.13"
106 +- const libmbedx509 = "libmbedx509.so.1"
107 ++ const libmbedcrypto = "libmbedcrypto.so"
108 ++ const libmbedtls = "libmbedtls.so"
109 ++ const libmbedx509 = "libmbedx509.so"
110 + end
111 +
112 + function __init__()
113 +diff --git a/stdlib/libLLVM_jll/src/libLLVM_jll.jl b/stdlib/libLLVM_jll/src/libLLVM_jll.jl
114 +index fa45e754e5..b51812e3a8 100644
115 +--- a/stdlib/libLLVM_jll/src/libLLVM_jll.jl
116 ++++ b/stdlib/libLLVM_jll/src/libLLVM_jll.jl
117 +@@ -23,7 +23,7 @@ if Sys.iswindows()
118 + elseif Sys.isapple()
119 + const libLLVM = "@rpath/libLLVM.dylib"
120 + else
121 +- const libLLVM = "libLLVM-12jl.so"
122 ++ const libLLVM = "libLLVM.so"
123 + end
124 +
125 + function __init__()
126 +diff --git a/stdlib/nghttp2_jll/src/nghttp2_jll.jl b/stdlib/nghttp2_jll/src/nghttp2_jll.jl
127 +index 8b98c76ac5..77ad9e3800 100644
128 +--- a/stdlib/nghttp2_jll/src/nghttp2_jll.jl
129 ++++ b/stdlib/nghttp2_jll/src/nghttp2_jll.jl
130 +@@ -22,7 +22,7 @@ if Sys.iswindows()
131 + elseif Sys.isapple()
132 + const libnghttp2 = "@rpath/libnghttp2.14.dylib"
133 + else
134 +- const libnghttp2 = "libnghttp2.so.14"
135 ++ const libnghttp2 = "libnghttp2.so"
136 + end
137 +
138 + function __init__()
139 +diff --git a/stdlib/LibGit2_jll/src/LibGit2_jll.jl b/stdlib/LibGit2_jll/src/LibGit2_jll.jl
140 +index f0d4b5dda6..2ed3017b51 100644
141 +--- a/stdlib/LibGit2_jll/src/LibGit2_jll.jl
142 ++++ b/stdlib/LibGit2_jll/src/LibGit2_jll.jl
143 +@@ -23,7 +23,7 @@ if Sys.iswindows()
144 + elseif Sys.isapple()
145 + const libgit2 = "@rpath/libgit2.1.1.dylib"
146 + else
147 +- const libgit2 = "libgit2.so.1.1"
148 ++ const libgit2 = "libgit2.so"
149 + end
150 +
151 + function __init__()
152 +diff --git a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
153 +index 215de8aed6..918d1ffdc2 100644
154 +--- a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
155 ++++ b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
156 +@@ -22,7 +22,7 @@ if Sys.iswindows()
157 + elseif Sys.isapple()
158 + const libopenlibm = "@rpath/libopenlibm.3.dylib"
159 + else
160 +- const libopenlibm = "libopenlibm.so.3"
161 ++ const libopenlibm = "libopenlibm.so"
162 + end
163 +
164 + function __init__()
165
166 diff --git a/dev-lang/julia/files/julia-1.7.0-libgit-1.2.patch b/dev-lang/julia/files/julia-1.7.0-libgit-1.2.patch
167 new file mode 100644
168 index 000000000000..f0abc7b8f60d
169 --- /dev/null
170 +++ b/dev-lang/julia/files/julia-1.7.0-libgit-1.2.patch
171 @@ -0,0 +1,17 @@
172 +This patch comes from
173 + https://raw.githubusercontent.com/archlinux/svntogit-community/packages/julia/trunk/julia-libgit-1.2.patch
174 +
175 +diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl
176 +index 9ffcaa3646..5f571e7b26 100644
177 +--- a/stdlib/LibGit2/src/types.jl
178 ++++ b/stdlib/LibGit2/src/types.jl
179 +@@ -230,6 +230,9 @@ Matches the [`git_remote_callbacks`](https://libgit2.org/libgit2/#HEAD/type/git_
180 + push_update_reference::Ptr{Cvoid} = C_NULL
181 + push_negotiation::Ptr{Cvoid} = C_NULL
182 + transport::Ptr{Cvoid} = C_NULL
183 ++ @static if LibGit2.VERSION >= v"1.2.0"
184 ++ remote_ready::Ptr{Cvoid} = C_NULL
185 ++ end
186 + payload::Any = nothing
187 + @static if LibGit2.VERSION >= v"0.99.0"
188 + resolve_url::Ptr{Cvoid} = C_NULL
189
190 diff --git a/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_1.patch b/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_1.patch
191 new file mode 100644
192 index 000000000000..1398be7ec873
193 --- /dev/null
194 +++ b/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_1.patch
195 @@ -0,0 +1,172 @@
196 +This patch is from the julialang repository:
197 + https://github.com/JuliaLang/julia/commit/677ce6d3.patch
198 +but reference comes form ARCH Linux juia package
199 + https://github.com/archlinux/svntogit-community/tree/packages/julia/trunk
200 +
201 +From 677ce6d3adc2f70886f72795b0e5c739e75730ee Mon Sep 17 00:00:00 2001
202 +From: Valentin Churavy <v.churavy@×××××.com>
203 +Date: Sat, 28 Aug 2021 16:48:32 +0200
204 +Subject: [PATCH] [LLVM] Adapt to LLVM 13 changes
205 +
206 +---
207 + src/cgutils.cpp | 8 +++++++-
208 + src/codegen.cpp | 2 +-
209 + src/disasm.cpp | 8 ++++++++
210 + src/jitlayers.cpp | 7 +++++++
211 + src/llvm-late-gc-lowering.cpp | 5 +++--
212 + src/llvm-multiversioning.cpp | 5 +++++
213 + src/llvm-remove-addrspaces.cpp | 8 ++++++++
214 + 7 files changed, 39 insertions(+), 4 deletions(-)
215 +
216 +diff --git a/src/cgutils.cpp b/src/cgutils.cpp
217 +index 4e9917b6b078..928e1a07b2f1 100644
218 +--- a/src/cgutils.cpp
219 ++++ b/src/cgutils.cpp
220 +@@ -2757,8 +2757,14 @@ static jl_value_t *static_constant_instance(Constant *constant, jl_value_t *jt)
221 + size_t nargs;
222 + if (const auto *CC = dyn_cast<ConstantAggregate>(constant))
223 + nargs = CC->getNumOperands();
224 +- else if (const auto *CAZ = dyn_cast<ConstantAggregateZero>(constant))
225 ++ else if (const auto *CAZ = dyn_cast<ConstantAggregateZero>(constant)) {
226 ++#if JL_LLVM_VERSION >= 130000
227 ++ // SVE: Elsewhere we use `getMinKownValue`
228 ++ nargs = CAZ->getElementCount().getFixedValue();
229 ++#else
230 + nargs = CAZ->getNumElements();
231 ++#endif
232 ++ }
233 + else if (const auto *CDS = dyn_cast<ConstantDataSequential>(constant))
234 + nargs = CDS->getNumElements();
235 + else
236 +diff --git a/src/codegen.cpp b/src/codegen.cpp
237 +index 5cc9f66ffaef..9000513151fe 100644
238 +--- a/src/codegen.cpp
239 ++++ b/src/codegen.cpp
240 +@@ -7394,7 +7394,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
241 + #endif
242 + continue;
243 + }
244 +- assert(find(pred_begin(PhiBB), pred_end(PhiBB), FromBB) != pred_end(PhiBB)); // consistency check
245 ++ assert(std::find(pred_begin(PhiBB), pred_end(PhiBB), FromBB) != pred_end(PhiBB)); // consistency check
246 + TerminatorInst *terminator = FromBB->getTerminator();
247 + if (!terminator->getParent()->getUniqueSuccessor()) {
248 + // Can't use `llvm::SplitCriticalEdge` here because
249 +diff --git a/src/disasm.cpp b/src/disasm.cpp
250 +index 6157873ad71c..589f618396ea 100644
251 +--- a/src/disasm.cpp
252 ++++ b/src/disasm.cpp
253 +@@ -857,8 +857,16 @@ static void jl_dump_asm_internal(
254 + assert(MRI && "Unable to create target register info!");
255 +
256 + std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
257 ++#if JL_LLVM_VERSION >= 130000
258 ++ MCSubtargetInfo *MSTI = TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features);
259 ++ assert(MSTI && "Unable to create subtarget info!");
260 ++
261 ++ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), MSTI, &SrcMgr);
262 ++ MOFI->initMCObjectFileInfo(Ctx, /* PIC */ false, /* LargeCodeModel */ false);
263 ++#else
264 + MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
265 + MOFI->InitMCObjectFileInfo(TheTriple, /* PIC */ false, Ctx);
266 ++#endif
267 +
268 + // Set up Subtarget and Disassembler
269 + std::unique_ptr<MCSubtargetInfo>
270 +diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
271 +index 60b1903aaa80..12497cadf491 100644
272 +--- a/src/jitlayers.cpp
273 ++++ b/src/jitlayers.cpp
274 +@@ -10,6 +10,9 @@
275 + #include <llvm/Analysis/TargetTransformInfo.h>
276 + #include <llvm/ExecutionEngine/Orc/CompileUtils.h>
277 + #include <llvm/ExecutionEngine/Orc/ExecutionUtils.h>
278 ++#if JL_LLVM_VERSION >= 130000
279 ++#include <llvm/ExecutionEngine/Orc/ExecutorProcessControl.h>
280 ++#endif
281 + #include <llvm/Support/DynamicLibrary.h>
282 + #include <llvm/Support/FormattedStream.h>
283 + #include <llvm/Support/SmallVectorMemoryBuffer.h>
284 +@@ -654,7 +657,11 @@ JuliaOJIT::JuliaOJIT(TargetMachine &TM, LLVMContext *LLVMCtx)
285 + MemMgr(createRTDyldMemoryManager()),
286 + JuliaListener(CreateJuliaJITEventListener()),
287 + TSCtx(std::unique_ptr<LLVMContext>(LLVMCtx)),
288 ++#if JL_LLVM_VERSION >= 130000
289 ++ ES(cantFail(orc::SelfExecutorProcessControl::Create())),
290 ++#else
291 + ES(),
292 ++#endif
293 + GlobalJD(ES.createBareJITDylib("JuliaGlobals")),
294 + JD(ES.createBareJITDylib("JuliaOJIT")),
295 + ObjectLayer(
296 +diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
297 +index 0aac7638be0d..db8b19bacea5 100644
298 +--- a/src/llvm-late-gc-lowering.cpp
299 ++++ b/src/llvm-late-gc-lowering.cpp
300 +@@ -709,7 +709,7 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
301 + else
302 + Numbers[i] = Number;
303 + }
304 +- if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
305 ++ if (auto VTy = dyn_cast<FixedVectorType>(SI->getType())) {
306 + if (NumRoots != Numbers.size()) {
307 + // broadcast the scalar root number to fill the vector
308 + assert(NumRoots == 1);
309 +@@ -736,11 +736,12 @@ void LateLowerGCFrame::LiftPhi(State &S, PHINode *Phi) {
310 + SmallVector<PHINode *, 2> lifted;
311 + std::vector<int> Numbers;
312 + unsigned NumRoots = 1;
313 +- if (auto VTy = dyn_cast<VectorType>(Phi->getType())) {
314 ++ if (auto VTy = dyn_cast<FixedVectorType>(Phi->getType())) {
315 + NumRoots = VTy->getNumElements();
316 + Numbers.resize(NumRoots);
317 + }
318 + else {
319 ++ // TODO: SVE
320 + assert(isa<PointerType>(Phi->getType()) && "unimplemented");
321 + }
322 + for (unsigned i = 0; i < NumRoots; ++i) {
323 +diff --git a/src/llvm-multiversioning.cpp b/src/llvm-multiversioning.cpp
324 +index 68081eb53d3a..a82600162fa9 100644
325 +--- a/src/llvm-multiversioning.cpp
326 ++++ b/src/llvm-multiversioning.cpp
327 +@@ -403,7 +403,12 @@ void CloneCtx::clone_function(Function *F, Function *new_f, ValueToValueMapTy &v
328 + vmap[&*J] = &*DestI++;
329 + }
330 + SmallVector<ReturnInst*,8> Returns;
331 ++#if JL_LLVM_VERSION >= 130000
332 ++ // We are cloning into the same module
333 ++ CloneFunctionInto(new_f, F, vmap, CloneFunctionChangeType::GlobalChanges, Returns);
334 ++#else
335 + CloneFunctionInto(new_f, F, vmap, true, Returns);
336 ++#endif
337 + }
338 +
339 + // Clone all clone_all targets. Makes sure that the base targets are all available.
340 +diff --git a/src/llvm-remove-addrspaces.cpp b/src/llvm-remove-addrspaces.cpp
341 +index ada10c8d5f1f..7c6ef093fbce 100644
342 +--- a/src/llvm-remove-addrspaces.cpp
343 ++++ b/src/llvm-remove-addrspaces.cpp
344 +@@ -345,7 +345,11 @@ bool RemoveAddrspacesPass::runOnModule(Module &M)
345 + for (auto MD : MDs)
346 + NGV->addMetadata(
347 + MD.first,
348 ++#if JL_LLVM_VERSION >= 130000
349 ++ *MapMetadata(MD.second, VMap));
350 ++#else
351 + *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs));
352 ++#endif
353 +
354 + copyComdat(NGV, GV);
355 +
356 +@@ -372,7 +376,11 @@ bool RemoveAddrspacesPass::runOnModule(Module &M)
357 + NF,
358 + F,
359 + VMap,
360 ++#if JL_LLVM_VERSION >= 130000
361 ++ CloneFunctionChangeType::GlobalChanges,
362 ++#else
363 + /*ModuleLevelChanges=*/true,
364 ++#endif
365 + Returns,
366 + "",
367 + nullptr,
368
369 diff --git a/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_2.patch b/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_2.patch
370 new file mode 100644
371 index 000000000000..5a8c2cde93d5
372 --- /dev/null
373 +++ b/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_2.patch
374 @@ -0,0 +1,80 @@
375 +This patch is from julialang repository:
376 + https://github.com/JuliaLang/julia/commit/47f9139e.patch
377 +but reference comes form ARCH Linux juia package
378 + https://github.com/archlinux/svntogit-community/tree/packages/julia/trunk
379 +
380 +From 47f9139e88917813cb7beee5e690c48c2ac65de4 Mon Sep 17 00:00:00 2001
381 +From: Xuanda Yang <th3charlie@×××××.com>
382 +Date: Wed, 9 Jun 2021 22:35:14 +0800
383 +Subject: [PATCH] codegen: replace deprecated llvm::VectorType::getNumElements
384 + with new APIs (#41144)
385 +
386 +---
387 + src/llvm-late-gc-lowering.cpp | 29 ++++++++++++++++++++++++++---
388 + 1 file changed, 26 insertions(+), 3 deletions(-)
389 +
390 +diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
391 +index 50015045151b..4df303462d96 100644
392 +--- a/src/llvm-late-gc-lowering.cpp
393 ++++ b/src/llvm-late-gc-lowering.cpp
394 +@@ -396,8 +396,14 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
395 + }
396 + if (isa<ArrayType>(T))
397 + count *= cast<ArrayType>(T)->getNumElements();
398 +- else if (isa<VectorType>(T))
399 ++ else if (isa<VectorType>(T)) {
400 ++#if JL_LLVM_VERSION >= 120000
401 ++ ElementCount EC = cast<VectorType>(T)->getElementCount();
402 ++ count *= EC.getKnownMinValue();
403 ++#else
404 + count *= cast<VectorType>(T)->getNumElements();
405 ++#endif
406 ++ }
407 + }
408 + if (count == 0)
409 + all = false;
410 +@@ -408,8 +414,14 @@ unsigned getCompositeNumElements(Type *T) {
411 + return ST->getNumElements();
412 + else if (auto *AT = dyn_cast<ArrayType>(T))
413 + return AT->getNumElements();
414 +- else
415 ++ else {
416 ++#if JL_LLVM_VERSION >= 120000
417 ++ ElementCount EC = cast<VectorType>(T)->getElementCount();
418 ++ return EC.getKnownMinValue();
419 ++#else
420 + return cast<VectorType>(T)->getNumElements();
421 ++#endif
422 ++ }
423 + }
424 +
425 + // Walk through a Type, and record the element path to every tracked value inside
426 +@@ -625,8 +637,14 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
427 + }
428 + std::vector<int> Numbers;
429 + unsigned NumRoots = 1;
430 +- if (auto VTy = dyn_cast<VectorType>(SI->getType()))
431 ++ if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
432 ++#if JL_LLVM_VERSION >= 120000
433 ++ ElementCount EC = VTy->getElementCount();
434 ++ Numbers.resize(EC.getKnownMinValue(), -1);
435 ++#else
436 + Numbers.resize(VTy->getNumElements(), -1);
437 ++#endif
438 ++ }
439 + else
440 + assert(isa<PointerType>(SI->getType()) && "unimplemented");
441 + assert(!isTrackedValue(SI));
442 +@@ -686,7 +704,12 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
443 + assert(NumRoots == 1);
444 + int Number = Numbers[0];
445 + Numbers.resize(0);
446 ++#if JL_LLVM_VERSION >= 120000
447 ++ ElementCount EC = VTy->getElementCount();
448 ++ Numbers.resize(EC.getKnownMinValue(), Number);
449 ++#else
450 + Numbers.resize(VTy->getNumElements(), Number);
451 ++#endif
452 + }
453 + }
454 + if (!isa<PointerType>(SI->getType()))
455
456 diff --git a/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_3.patch b/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_3.patch
457 new file mode 100644
458 index 000000000000..43b7925a9ce7
459 --- /dev/null
460 +++ b/dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_3.patch
461 @@ -0,0 +1,375 @@
462 +This patch is from:
463 + https://raw.githubusercontent.com/archlinux/svntogit-community/packages/julia/trunk/julia-llvm13.patch
464 +
465 +From 9daa25a5f331a7e1c0f0b222373a853c2ce1462d Mon Sep 17 00:00:00 2001
466 +From: Valentin Churavy <v.churavy@×××××.com>
467 +Date: Tue, 12 Oct 2021 11:56:19 -0400
468 +Subject: [PATCH 2/6] WIP: add Type to ByVal attribute
469 +
470 +---
471 + src/abi_aarch64.cpp | 2 +-
472 + src/abi_arm.cpp | 2 +-
473 + src/abi_llvm.cpp | 2 +-
474 + src/abi_ppc64le.cpp | 6 +++++-
475 + src/abi_win32.cpp | 6 +++++-
476 + src/abi_win64.cpp | 9 +++++++--
477 + src/abi_x86.cpp | 8 ++++++--
478 + src/abi_x86_64.cpp | 11 ++++++++++-
479 + src/ccall.cpp | 4 ++--
480 + 9 files changed, 38 insertions(+), 12 deletions(-)
481 +
482 +diff --git a/src/abi_aarch64.cpp b/src/abi_aarch64.cpp
483 +index ce94cc66f0..7ffe107d61 100644
484 +--- a/src/abi_aarch64.cpp
485 ++++ b/src/abi_aarch64.cpp
486 +@@ -194,7 +194,7 @@ Type *isHFAorHVA(jl_datatype_t *dt, size_t &nele) const
487 + return NULL;
488 + }
489 +
490 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
491 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
492 + {
493 + // B.2
494 + // If the argument type is an HFA or an HVA, then the argument is used
495 +diff --git a/src/abi_arm.cpp b/src/abi_arm.cpp
496 +index 1a5d3d0651..ed846dfafb 100644
497 +--- a/src/abi_arm.cpp
498 ++++ b/src/abi_arm.cpp
499 +@@ -23,7 +23,7 @@
500 +
501 + struct ABI_ARMLayout : AbiLayout {
502 +
503 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
504 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
505 + {
506 + return false;
507 + }
508 +diff --git a/src/abi_llvm.cpp b/src/abi_llvm.cpp
509 +index 1ab30da1b2..dba8f4aa8a 100644
510 +--- a/src/abi_llvm.cpp
511 ++++ b/src/abi_llvm.cpp
512 +@@ -45,7 +45,7 @@ bool use_sret(jl_datatype_t *ty) override
513 + return false;
514 + }
515 +
516 +-bool needPassByRef(jl_datatype_t *ty, AttrBuilder &ab) override
517 ++bool needPassByRef(jl_datatype_t *ty, AttrBuilder &ab, Type *Ty) override
518 + {
519 + return false;
520 + }
521 +diff --git a/src/abi_ppc64le.cpp b/src/abi_ppc64le.cpp
522 +index dd6f927d9c..35e444ef77 100644
523 +--- a/src/abi_ppc64le.cpp
524 ++++ b/src/abi_ppc64le.cpp
525 +@@ -101,12 +101,16 @@ bool use_sret(jl_datatype_t *dt) override
526 + return false;
527 + }
528 +
529 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
530 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
531 + {
532 + jl_datatype_t *ty0 = NULL;
533 + bool hva = false;
534 + if (jl_datatype_size(dt) > 64 && isHFA(dt, &ty0, &hva) > 8) {
535 ++#if JL_LLVM_VERSION < 120000
536 + ab.addAttribute(Attribute::ByVal);
537 ++#else
538 ++ ab.addByValAttr(Ty);
539 ++#endif
540 + return true;
541 + }
542 + return false;
543 +diff --git a/src/abi_win32.cpp b/src/abi_win32.cpp
544 +index af16a0310b..0b34f840e4 100644
545 +--- a/src/abi_win32.cpp
546 ++++ b/src/abi_win32.cpp
547 +@@ -49,11 +49,15 @@ bool use_sret(jl_datatype_t *dt) override
548 + return true;
549 + }
550 +
551 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
552 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
553 + {
554 + // Use pass by reference for all structs
555 + if (dt->layout->nfields > 0) {
556 ++#if JL_LLVM_VERSION < 120000
557 + ab.addAttribute(Attribute::ByVal);
558 ++#else
559 ++ ab.addByValAttr(Ty);
560 ++#endif
561 + return true;
562 + }
563 + return false;
564 +diff --git a/src/abi_win64.cpp b/src/abi_win64.cpp
565 +index 16e46a9703..f47802edf1 100644
566 +--- a/src/abi_win64.cpp
567 ++++ b/src/abi_win64.cpp
568 +@@ -56,14 +56,19 @@ bool use_sret(jl_datatype_t *dt) override
569 + return true;
570 + }
571 +
572 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
573 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
574 + {
575 + nargs++;
576 + size_t size = jl_datatype_size(dt);
577 + if (win64_reg_size(size))
578 + return false;
579 +- if (nargs <= 4)
580 ++ if (nargs <= 4) {
581 ++#if JL_LLVM_VERSION < 120000
582 + ab.addAttribute(Attribute::ByVal);
583 ++#else
584 ++ ab.addByValAttr(Ty);
585 ++#endif
586 ++ }
587 + return true;
588 + }
589 +
590 +diff --git a/src/abi_x86.cpp b/src/abi_x86.cpp
591 +index 7a65de028e..c6c0282602 100644
592 +--- a/src/abi_x86.cpp
593 ++++ b/src/abi_x86.cpp
594 +@@ -67,12 +67,16 @@ bool use_sret(jl_datatype_t *dt) override
595 + return true;
596 + }
597 +
598 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
599 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
600 + {
601 + size_t size = jl_datatype_size(dt);
602 + if (is_complex64(dt) || is_complex128(dt) || (jl_is_primitivetype(dt) && size <= 8))
603 + return false;
604 +- ab.addAttribute(Attribute::ByVal);
605 ++#if JL_LLVM_VERSION < 120000
606 ++ ab.addAttribute(Attribute::ByVal);
607 ++#else
608 ++ ab.addByValAttr(Ty);
609 ++#endif
610 + return true;
611 + }
612 +
613 +diff --git a/src/abi_x86_64.cpp b/src/abi_x86_64.cpp
614 +index ac28af3011..5f8256dee4 100644
615 +--- a/src/abi_x86_64.cpp
616 ++++ b/src/abi_x86_64.cpp
617 +@@ -178,11 +178,15 @@ bool use_sret(jl_datatype_t *dt) override
618 + return sret;
619 + }
620 +
621 +-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
622 ++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
623 + {
624 + Classification cl = classify(dt);
625 + if (cl.isMemory) {
626 ++#if JL_LLVM_VERSION < 120000
627 + ab.addAttribute(Attribute::ByVal);
628 ++#else
629 ++ ab.addByValAttr(Ty);
630 ++#endif
631 + return true;
632 + }
633 +
634 +@@ -202,7 +206,12 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
635 + else if (jl_is_structtype(dt)) {
636 + // spill to memory even though we would ordinarily pass
637 + // it in registers
638 ++#if JL_LLVM_VERSION < 120000
639 + ab.addAttribute(Attribute::ByVal);
640 ++#else
641 ++ Type* Ty = preferred_llvm_type(dt, false);
642 ++ ab.addByValAttr(Ty);
643 ++#endif
644 + return true;
645 + }
646 + return false;
647 +diff --git a/src/ccall.cpp b/src/ccall.cpp
648 +index 66ab84c264..e21c717d41 100644
649 +--- a/src/ccall.cpp
650 ++++ b/src/ccall.cpp
651 +@@ -291,7 +291,7 @@ class AbiLayout {
652 + public:
653 + virtual ~AbiLayout() {}
654 + virtual bool use_sret(jl_datatype_t *ty) = 0;
655 +- virtual bool needPassByRef(jl_datatype_t *ty, AttrBuilder&) = 0;
656 ++ virtual bool needPassByRef(jl_datatype_t *ty, AttrBuilder&, Type* llvm_t) = 0;
657 + virtual Type *preferred_llvm_type(jl_datatype_t *ty, bool isret) const = 0;
658 + };
659 +
660 +@@ -1077,7 +1077,7 @@ std::string generate_func_sig(const char *fname)
661 + }
662 +
663 + // Whether or not LLVM wants us to emit a pointer to the data
664 +- bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab);
665 ++ bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab, t);
666 +
667 + if (jl_is_cpointer_type(tti)) {
668 + pat = t;
669 +
670 +From 1fe19a197ebbe33c9e60b2ca7d30c2573772b476 Mon Sep 17 00:00:00 2001
671 +From: Valentin Churavy <v.churavy@×××××.com>
672 +Date: Thu, 21 Oct 2021 20:32:39 -0400
673 +Subject: [PATCH 4/6] [LLVM/Win32] Force stack alignment on module
674 +
675 +---
676 + src/aotcompile.cpp | 3 +++
677 + src/ccall.cpp | 3 +++
678 + src/codegen.cpp | 11 ++++++++++-
679 + 3 files changed, 16 insertions(+), 1 deletion(-)
680 +
681 +diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
682 +index ffd43ee8d48d..d3dfc744fcd0 100644
683 +--- a/src/aotcompile.cpp
684 ++++ b/src/aotcompile.cpp
685 +@@ -550,6 +550,9 @@ void jl_dump_native_impl(void *native_code,
686 + std::unique_ptr<Module> sysimage(new Module("sysimage", Context));
687 + sysimage->setTargetTriple(data->M->getTargetTriple());
688 + sysimage->setDataLayout(data->M->getDataLayout());
689 ++#if JL_LLVM_VERSION >= 130000
690 ++ sysimage->setOverrideStackAlignment(data->M->getOverrideStackAlignment());
691 ++#endif
692 + data->M.reset(); // free memory for data->M
693 +
694 + if (sysimg_data) {
695 +diff --git a/src/ccall.cpp b/src/ccall.cpp
696 +index fb70e53e2814..dd7626c918d0 100644
697 +--- a/src/ccall.cpp
698 ++++ b/src/ccall.cpp
699 +@@ -891,6 +891,9 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
700 + // copy module properties that should always match
701 + Mod->setTargetTriple(jl_Module->getTargetTriple());
702 + Mod->setDataLayout(jl_Module->getDataLayout());
703 ++#if JL_LLVM_VERSION >= 130000
704 ++ Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment());
705 ++#endif
706 +
707 + // verify the definition
708 + Function *def = Mod->getFunction(ir_name);
709 +diff --git a/src/codegen.cpp b/src/codegen.cpp
710 +index b09eb8db04e0..bc4ea7711a04 100644
711 +--- a/src/codegen.cpp
712 ++++ b/src/codegen.cpp
713 +@@ -1707,6 +1707,14 @@ static void jl_setup_module(Module *m, const jl_cgparams_t *params = &jl_default
714 + llvm::DEBUG_METADATA_VERSION);
715 + m->setDataLayout(jl_data_layout);
716 + m->setTargetTriple(jl_TargetMachine->getTargetTriple().str());
717 ++
718 ++#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_) && JL_LLVM_VERSIOn >= 130000
719 ++ // tell Win32 to assume the stack is always 16-byte aligned,
720 ++ // and to ensure that it is 16-byte aligned for out-going calls,
721 ++ // to ensure compatibility with GCC codes
722 ++ m->setOverrideStackAlignment(16;)
723 ++#endif
724 ++
725 + }
726 +
727 + Module *jl_create_llvm_module(StringRef name)
728 +@@ -8235,10 +8243,11 @@ extern "C" void jl_init_llvm(void)
729 +
730 + TargetOptions options = TargetOptions();
731 + //options.PrintMachineCode = true; //Print machine code produced during JIT compiling
732 +-#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
733 ++#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_) && JL_LLVM_VERSION <= 120000
734 + // tell Win32 to assume the stack is always 16-byte aligned,
735 + // and to ensure that it is 16-byte aligned for out-going calls,
736 + // to ensure compatibility with GCC codes
737 ++ // In LLVM 13 and onwards this has turned into a module option
738 + options.StackAlignmentOverride = 16;
739 + #endif
740 + #ifdef JL_DEBUG_BUILD
741 +
742 +From 7a320647976eb97fdd169b5e85397b9e493e4569 Mon Sep 17 00:00:00 2001
743 +From: Valentin Churavy <v.churavy@×××××.com>
744 +Date: Fri, 22 Oct 2021 15:35:38 -0400
745 +Subject: [PATCH 5/6] StackProtector is now a module flag
746 +
747 +---
748 + src/aotcompile.cpp | 1 +
749 + src/ccall.cpp | 1 +
750 + src/codegen.cpp | 6 ++++--
751 + 3 files changed, 6 insertions(+), 2 deletions(-)
752 +
753 +diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
754 +index d3dfc744fcd0..05fcca50c4ee 100644
755 +--- a/src/aotcompile.cpp
756 ++++ b/src/aotcompile.cpp
757 +@@ -551,6 +551,7 @@ void jl_dump_native_impl(void *native_code,
758 + sysimage->setTargetTriple(data->M->getTargetTriple());
759 + sysimage->setDataLayout(data->M->getDataLayout());
760 + #if JL_LLVM_VERSION >= 130000
761 ++ sysimage->setStackProtectorGuard(data->M->getStackProtectorGuard());
762 + sysimage->setOverrideStackAlignment(data->M->getOverrideStackAlignment());
763 + #endif
764 + data->M.reset(); // free memory for data->M
765 +diff --git a/src/ccall.cpp b/src/ccall.cpp
766 +index dd7626c918d0..647735edb37d 100644
767 +--- a/src/ccall.cpp
768 ++++ b/src/ccall.cpp
769 +@@ -892,6 +892,7 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
770 + Mod->setTargetTriple(jl_Module->getTargetTriple());
771 + Mod->setDataLayout(jl_Module->getDataLayout());
772 + #if JL_LLVM_VERSION >= 130000
773 ++ Mod->setStackProtectorGuard(jl_Module->getStackProtectorGuard());
774 + Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment());
775 + #endif
776 +
777 +diff --git a/src/codegen.cpp b/src/codegen.cpp
778 +index bc4ea7711a04..1a7017d3aeb7 100644
779 +--- a/src/codegen.cpp
780 ++++ b/src/codegen.cpp
781 +@@ -1714,7 +1714,9 @@ static void jl_setup_module(Module *m, const jl_cgparams_t *params = &jl_default
782 + // to ensure compatibility with GCC codes
783 + m->setOverrideStackAlignment(16;)
784 + #endif
785 +-
786 ++#if defined(JL_DEBUG_BUILD) && JL_LLVM_VERSION >= 130000
787 ++ m->setStackProtectorGuard("global");
788 ++#endif
789 + }
790 +
791 + Module *jl_create_llvm_module(StringRef name)
792 +
793 +From e323fc8f7be4ce053dec613076d7dd7517515134 Mon Sep 17 00:00:00 2001
794 +From: Valentin Churavy <v.churavy@×××××.com>
795 +Date: Sun, 24 Oct 2021 15:18:23 -0400
796 +Subject: [PATCH 6/6] Cleanup MachineObjectFileInfo handling in disassembly
797 +
798 +---
799 + src/disasm.cpp | 18 +++++++++---------
800 + 1 file changed, 9 insertions(+), 9 deletions(-)
801 +
802 +diff --git a/src/disasm.cpp b/src/disasm.cpp
803 +index 73b394b77d0b..25e7841bde85 100644
804 +--- a/src/disasm.cpp
805 ++++ b/src/disasm.cpp
806 +@@ -860,21 +860,21 @@ static void jl_dump_asm_internal(
807 + std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TheTriple.str()));
808 + assert(MRI && "Unable to create target register info!");
809 +
810 +- std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
811 +-#if JL_LLVM_VERSION >= 130000
812 +- MCSubtargetInfo *MSTI = TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features);
813 +- assert(MSTI && "Unable to create subtarget info!");
814 ++ std::unique_ptr<llvm::MCSubtargetInfo> STI(
815 ++ TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
816 ++ assert(STI && "Unable to create subtarget info!");
817 +
818 +- MCContext Ctx(TheTriple, MAI.get(), MRI.get(), MSTI, &SrcMgr);
819 +- MOFI->initMCObjectFileInfo(Ctx, /* PIC */ false, /* LargeCodeModel */ false);
820 ++#if JL_LLVM_VERSION >= 130000
821 ++ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), &SrcMgr);
822 ++ std::unique_ptr<MCObjectFileInfo> MOFI(
823 ++ TheTarget->createMCObjectFileInfo(Ctx, /*PIC=*/false, /*LargeCodeModel=*/ false));
824 ++ Ctx.setObjectFileInfo(MOFI.get());
825 + #else
826 ++ std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
827 + MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
828 + MOFI->InitMCObjectFileInfo(TheTriple, /* PIC */ false, Ctx);
829 + #endif
830 +
831 +- // Set up Subtarget and Disassembler
832 +- std::unique_ptr<MCSubtargetInfo>
833 +- STI(TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
834 + std::unique_ptr<MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI, Ctx));
835 + if (!DisAsm) {
836 + rstream << "ERROR: no disassembler for target " << TheTriple.str();
837
838 diff --git a/dev-lang/julia/files/julia-1.7.0-make-install-no-build.patch b/dev-lang/julia/files/julia-1.7.0-make-install-no-build.patch
839 new file mode 100644
840 index 000000000000..0632a6e726f7
841 --- /dev/null
842 +++ b/dev-lang/julia/files/julia-1.7.0-make-install-no-build.patch
843 @@ -0,0 +1,17 @@
844 +This pacth comes from
845 + https://raw.githubusercontent.com/archlinux/svntogit-community/packages/julia/trunk/make-install-no-build.patch
846 +
847 +--- julia-1.3.0/Makefile.orig 2019-12-06 12:54:23.879790955 +0000
848 ++++ julia-1.3.0/Makefile 2019-12-06 12:54:36.329952953 +0000
849 +@@ -277,11 +277,6 @@
850 +
851 +
852 + install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
853 +-ifeq ($(BUNDLE_DEBUG_LIBS),1)
854 +- @$(MAKE) $(QUIET_MAKE) all
855 +-else
856 +- @$(MAKE) $(QUIET_MAKE) release
857 +-endif
858 + @for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(libexecdir); do \
859 + mkdir -p $(DESTDIR)$$subdir; \
860 + done
861
862 diff --git a/dev-lang/julia/julia-1.7.0.ebuild b/dev-lang/julia/julia-1.7.0.ebuild
863 new file mode 100644
864 index 000000000000..57c446a0e3ab
865 --- /dev/null
866 +++ b/dev-lang/julia/julia-1.7.0.ebuild
867 @@ -0,0 +1,179 @@
868 +# Copyright 1999-2021 Gentoo Authors
869 +# Distributed under the terms of the GNU General Public License v2
870 +
871 +EAPI=7
872 +
873 +inherit llvm pax-utils toolchain-funcs
874 +
875 +# correct versions for stdlibs are in deps/checksums
876 +# for everything else, run with network-sandbox and wait for the crash
877 +
878 +MY_LLVM_V="13.0.1"
879 +
880 +DESCRIPTION="High-performance programming language for technical computing"
881 +HOMEPAGE="https://julialang.org/"
882 +
883 +SRC_URI="
884 + https://github.com/JuliaLang/julia/releases/download/v${PV}/${P}-full.tar.gz
885 +"
886 +
887 +LICENSE="MIT"
888 +SLOT="0"
889 +KEYWORDS="~amd64 ~x86"
890 +IUSE="+system-llvm"
891 +
892 +RDEPEND="
893 + system-llvm? ( sys-devel/llvm:13=[llvm_targets_NVPTX(-)] )
894 +"
895 +LLVM_MAX_SLOT=13
896 +
897 +RDEPEND+="
898 + app-arch/p7zip
899 + dev-libs/gmp:0=
900 + dev-libs/libgit2:0
901 + >=dev-libs/libpcre2-10.23:0=[jit,unicode]
902 + dev-libs/mpfr:0=
903 + dev-libs/libutf8proc:0=[-cjk]
904 + dev-util/patchelf
905 + >=net-libs/mbedtls-2.2
906 + net-misc/curl[http2,ssh]
907 + sci-libs/amd:0=
908 + sci-libs/arpack:0=
909 + sci-libs/camd:0=
910 + sci-libs/ccolamd:0=
911 + sci-libs/cholmod:0=
912 + sci-libs/colamd:0=
913 + sci-libs/fftw:3.0=[threads]
914 + sci-libs/openlibm:0=
915 + sci-libs/spqr:0=
916 + sci-libs/umfpack:0=
917 + >=sci-mathematics/dsfmt-2.2.4
918 + >=sys-libs/libunwind-1.1:0=
919 + sys-libs/zlib:0=
920 + >=virtual/blas-3.6
921 + virtual/lapack"
922 +
923 +DEPEND="${RDEPEND}
924 + dev-util/patchelf
925 + virtual/pkgconfig
926 + !system-llvm? ( dev-util/cmake )"
927 +
928 +PATCHES=(
929 + "${FILESDIR}/${PN}"-1.4.0-no_symlink_llvm.patch
930 + "${FILESDIR}/${PN}"-1.7.0-llvm_13_compat_part_1.patch
931 + "${FILESDIR}/${PN}"-1.7.0-llvm_13_compat_part_2.patch
932 + "${FILESDIR}/${PN}"-1.7.0-llvm_13_compat_part_3.patch
933 + "${FILESDIR}/${PN}"-1.7.0-libgit-1.2.patch
934 + "${FILESDIR}/${PN}"-1.7.0-make-install-no-build.patch
935 + "${FILESDIR}/${PN}"-1.7.0-hardcoded-libs.patch
936 + "${FILESDIR}/${PN}"-1.7.0-do_not_set_rpath.patch
937 +)
938 + # just remove patchelf from linux ?? just my own solution to sigsegv error ??
939 + #"${FILESDIR}/${PN}"-turnoff-patchelf.patch
940 +
941 +pkg_setup() {
942 + use system-llvm && llvm_pkg_setup
943 +}
944 +
945 +src_unpack() {
946 + local tounpack=(${A})
947 + # the main source tree, followed by deps
948 + unpack "${tounpack[0]}"
949 +
950 + mkdir -p "${S}/deps/srccache/"
951 + for i in "${tounpack[@]:1}"; do
952 + cp "${DISTDIR}/${i}" "${S}/deps/srccache/${i#julia-}" || die
953 + done
954 +}
955 +
956 +src_prepare() {
957 + default
958 +
959 + # Sledgehammer:
960 + # - prevent fetching of bundled stuff in compile and install phase
961 + # - respect CFLAGS
962 + # - respect EPREFIX and Gentoo specific paths
963 +
964 + sed -i \
965 + -e "\|SHIPFLAGS :=|c\\SHIPFLAGS := ${CFLAGS}" \
966 + Make.inc || die
967 +
968 + sed -i \
969 + -e "s|ar -rcs|$(tc-getAR) -rcs|g" \
970 + src/Makefile || die
971 +
972 + # disable doc install starting git fetching
973 + sed -i -e 's~install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html~install: $(build_depsbindir)/stringreplace~' Makefile || die
974 +}
975 +
976 +src_configure() {
977 + use system-llvm && ewarn "You have enabled system-llvm. This is unsupported by upstream and may not work."
978 +
979 + # julia does not play well with the system versions of libuv
980 + # USE_SYSTEM_LIBM=0 implies using external openlibm
981 + cat <<-EOF > Make.user
982 + LOCALBASE:="${EPREFIX}/usr"
983 + override prefix:="${EPREFIX}/usr"
984 + override libdir:="\$(prefix)/$(get_libdir)"
985 + override CC:=$(tc-getCC)
986 + override CXX:=$(tc-getCXX)
987 + override AR:=$(tc-getAR)
988 +
989 + BUNDLE_DEBUG_LIBS:=0
990 + USE_BINARYBUILDER:=0
991 + USE_SYSTEM_CSL:=1
992 + USE_SYSTEM_LLVM:=$(usex system-llvm 1 0)
993 + USE_SYSTEM_LIBUNWIND:=1
994 + USE_SYSTEM_PCRE:=1
995 + USE_SYSTEM_LIBM:=0
996 + USE_SYSTEM_OPENLIBM:=1
997 + USE_SYSTEM_DSFMT:=1
998 + USE_SYSTEM_BLAS:=1
999 + USE_SYSTEM_LAPACK:=1
1000 + USE_SYSTEM_GMP:=1
1001 + USE_SYSTEM_MPFR:=1
1002 + USE_SYSTEM_SUITESPARSE:=1
1003 + USE_SYSTEM_LIBUV:=0
1004 + USE_SYSTEM_UTF8PROC:=1
1005 + USE_SYSTEM_MBEDTLS:=1
1006 + USE_SYSTEM_LIBSSH2:=1
1007 + USE_SYSTEM_NGHTTP2:=1
1008 + USE_SYSTEM_CURL:=1
1009 + USE_SYSTEM_LIBGIT2:=1
1010 + USE_SYSTEM_PATCHELF:=1
1011 + USE_SYSTEM_ZLIB:=1
1012 + USE_SYSTEM_P7ZIP:=1
1013 + VERBOSE:=1
1014 + EOF
1015 +}
1016 +
1017 +src_compile() {
1018 + # Julia accesses /proc/self/mem on Linux
1019 + addpredict /proc/self/mem
1020 +
1021 + default
1022 + pax-mark m "$(file usr/bin/julia-* | awk -F : '/ELF/ {print $1}')"
1023 +}
1024 +
1025 +src_install() {
1026 + emake install DESTDIR="${D}"
1027 +
1028 + if ! use system-llvm ; then
1029 + local llvmslot=$(ver_cut 1 ${MY_LLVM_V})
1030 + cp "${S}/usr/lib/libLLVM-${llvmslot}jl.so" "${ED}/usr/$(get_libdir)/julia/" || die
1031 + fi
1032 +
1033 + dodoc README.md
1034 +
1035 + mv "${ED}"/usr/etc/julia "${ED}"/etc || die
1036 + rmdir "${ED}"/usr/etc || die
1037 + mv "${ED}"/usr/share/doc/julia/html "${ED}"/usr/share/doc/"${PF}" || die
1038 + rmdir "${ED}"/usr/share/doc/julia || die
1039 +
1040 + # The appdata directory is deprecated.
1041 + mv "${ED}"/usr/share/{appdata,metainfo}/ || die
1042 +}
1043 +
1044 +pkg_postinst() {
1045 + elog "To use Plots, you will need to install sci-visualization/gr."
1046 +}