@@ -181,16 +181,16 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
181181 verbose && println (" Already in build directory" )
182182 end
183183
184- file_name = splitext (basename (julia_program))[1 ]
185- o_file = file_name * " .o"
186- s_file = " lib" * file_name * " .$(Libdl. dlext) "
187- e_file = file_name * (is_windows () ? " .exe" : " " )
184+ julia_program_basename = splitext (basename (julia_program))[1 ]
185+ o_file = julia_program_basename * " .o"
186+ s_file = " lib" * julia_program_basename * " .$(Libdl. dlext) "
187+ e_file = julia_program_basename * (is_windows () ? " .exe" : " " )
188+ tmp_dir = " tmp_v$VERSION "
188189
189190 # TODO : these should probably be emitted from julia-config also:
190191 shlibdir = is_windows () ? JULIA_HOME : abspath (JULIA_HOME, Base. LIBDIR)
191192 private_shlibdir = abspath (JULIA_HOME, Base. PRIVATE_LIBDIR)
192193
193- delete_object = false
194194 if object || shared || executable
195195 julia_cmd = ` $(Base. julia_cmd ()) `
196196 if length (julia_cmd. exec) != 5 || ! all (startswith .(julia_cmd. exec[2 : 5 ], [" -C" , " -J" , " --compile" , " --depwarn" ]))
@@ -210,16 +210,15 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
210210 expr = "
211211 VERSION >= v\" 0.7+\" && Base.init_load_path($(repr (JULIA_HOME)) ) # initialize location of site-packages
212212 empty!(Base.LOAD_CACHE_PATH) # reset / remove any builtin paths
213- push!(Base.LOAD_CACHE_PATH, abspath(\" cache_ji_v $VERSION \" )) # enable usage of precompiled files
213+ push!(Base.LOAD_CACHE_PATH, abspath(\" $tmp_dir \" )) # enable usage of precompiled files
214214 include($(repr (julia_program)) ) # include \" julia_program\" file
215215 empty!(Base.LOAD_CACHE_PATH) # reset / remove build-system-relative paths"
216216 command = ` $julia_cmd -e $expr `
217- verbose && println (" Build \" .ji\" files local cache :\n $command " )
217+ verbose && println (" Build \" .ji\" files:\n $command " )
218218 run (command)
219- command = ` $julia_cmd --output-o $o_file -e $expr `
219+ command = ` $julia_cmd --output-o $( joinpath (tmp_dir, o_file)) -e $expr `
220220 verbose && println (" Build object file \" $o_file \" :\n $command " )
221221 run (command)
222- object || (delete_object = true )
223222 end
224223
225224 if shared || executable
@@ -231,9 +230,9 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
231230 end
232231
233232 if shared || executable
234- command = ` $cc -m64 -shared -o $s_file $o_file $cflags $ldflags $ldlibs `
233+ command = ` $cc -m64 -shared -o $s_file $( joinpath (tmp_dir, o_file)) $cflags $ldflags $ldlibs `
235234 if is_apple ()
236- command = ` $command -Wl,-install_name,@rpath/lib$file_name .dylib`
235+ command = ` $command -Wl,-install_name,@rpath/lib$julia_program_basename .dylib`
237236 elseif is_windows ()
238237 command = ` $command -Wl,--export-all-symbols`
239238 end
@@ -252,11 +251,6 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
252251 run (command)
253252 end
254253
255- if delete_object && isfile (o_file)
256- verbose && println (" Delete object file \" $o_file \" " )
257- rm (o_file)
258- end
259-
260254 if julialibs
261255 verbose && println (" Sync Julia libraries:" )
262256 libfiles = String[]
0 commit comments