|
| 1 | +# Autogenerated wrapper script for libpolymake_julia_jll for x86_64-apple-darwin14-cxx11 |
| 2 | +export libpolymake_julia, polymake_run_script, type_translator |
| 3 | + |
| 4 | +using CompilerSupportLibraries_jll |
| 5 | +using libcxxwrap_julia_jll |
| 6 | +using polymake_jll |
| 7 | +## Global variables |
| 8 | +PATH = "" |
| 9 | +LIBPATH = "" |
| 10 | +LIBPATH_env = "DYLD_FALLBACK_LIBRARY_PATH" |
| 11 | +LIBPATH_default = "~/lib:/usr/local/lib:/lib:/usr/lib" |
| 12 | + |
| 13 | +# Relative path to `libpolymake_julia` |
| 14 | +const libpolymake_julia_splitpath = ["lib", "libpolymake_julia.dylib"] |
| 15 | + |
| 16 | +# This will be filled out by __init__() for all products, as it must be done at runtime |
| 17 | +libpolymake_julia_path = "" |
| 18 | + |
| 19 | +# libpolymake_julia-specific global declaration |
| 20 | +# This will be filled out by __init__() |
| 21 | +libpolymake_julia_handle = C_NULL |
| 22 | + |
| 23 | +# This must be `const` so that we can use it with `ccall()` |
| 24 | +const libpolymake_julia = "@rpath/libpolymake_julia.dylib" |
| 25 | + |
| 26 | + |
| 27 | +# Relative path to `polymake_run_script` |
| 28 | +const polymake_run_script_splitpath = ["bin", "polymake_run_script"] |
| 29 | + |
| 30 | +# This will be filled out by __init__() for all products, as it must be done at runtime |
| 31 | +polymake_run_script_path = "" |
| 32 | + |
| 33 | +# polymake_run_script-specific global declaration |
| 34 | +function polymake_run_script(f::Function; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true) |
| 35 | + global PATH, LIBPATH |
| 36 | + env_mapping = Dict{String,String}() |
| 37 | + if adjust_PATH |
| 38 | + if !isempty(get(ENV, "PATH", "")) |
| 39 | + env_mapping["PATH"] = string(PATH, ':', ENV["PATH"]) |
| 40 | + else |
| 41 | + env_mapping["PATH"] = PATH |
| 42 | + end |
| 43 | + end |
| 44 | + if adjust_LIBPATH |
| 45 | + LIBPATH_base = get(ENV, LIBPATH_env, expanduser(LIBPATH_default)) |
| 46 | + if !isempty(LIBPATH_base) |
| 47 | + env_mapping[LIBPATH_env] = string(LIBPATH, ':', LIBPATH_base) |
| 48 | + else |
| 49 | + env_mapping[LIBPATH_env] = LIBPATH |
| 50 | + end |
| 51 | + end |
| 52 | + withenv(env_mapping...) do |
| 53 | + f(polymake_run_script_path) |
| 54 | + end |
| 55 | +end |
| 56 | + |
| 57 | + |
| 58 | +# Relative path to `type_translator` |
| 59 | +const type_translator_splitpath = ["share", "libpolymake_julia", "type_translator.jl"] |
| 60 | + |
| 61 | +# This will be filled out by __init__() for all products, as it must be done at runtime |
| 62 | +type_translator_path = "" |
| 63 | + |
| 64 | +# type_translator-specific global declaration |
| 65 | +# This will be filled out by __init__() |
| 66 | +type_translator = "" |
| 67 | + |
| 68 | + |
| 69 | +""" |
| 70 | +Open all libraries |
| 71 | +""" |
| 72 | +function __init__() |
| 73 | + global artifact_dir = abspath(artifact"libpolymake_julia") |
| 74 | + |
| 75 | + # Initialize PATH and LIBPATH environment variable listings |
| 76 | + global PATH_list, LIBPATH_list |
| 77 | + # From the list of our dependencies, generate a tuple of all the PATH and LIBPATH lists, |
| 78 | + # then append them to our own. |
| 79 | + foreach(p -> append!(PATH_list, p), (CompilerSupportLibraries_jll.PATH_list, libcxxwrap_julia_jll.PATH_list, polymake_jll.PATH_list,)) |
| 80 | + foreach(p -> append!(LIBPATH_list, p), (CompilerSupportLibraries_jll.LIBPATH_list, libcxxwrap_julia_jll.LIBPATH_list, polymake_jll.LIBPATH_list,)) |
| 81 | + |
| 82 | + global libpolymake_julia_path = normpath(joinpath(artifact_dir, libpolymake_julia_splitpath...)) |
| 83 | + |
| 84 | + # Manually `dlopen()` this right now so that future invocations |
| 85 | + # of `ccall` with its `SONAME` will find this path immediately. |
| 86 | + global libpolymake_julia_handle = dlopen(libpolymake_julia_path) |
| 87 | + push!(LIBPATH_list, dirname(libpolymake_julia_path)) |
| 88 | + |
| 89 | + global polymake_run_script_path = normpath(joinpath(artifact_dir, polymake_run_script_splitpath...)) |
| 90 | + |
| 91 | + push!(PATH_list, dirname(polymake_run_script_path)) |
| 92 | + global type_translator_path = normpath(joinpath(artifact_dir, type_translator_splitpath...)) |
| 93 | + |
| 94 | + global type_translator = type_translator_path |
| 95 | + # Filter out duplicate and empty entries in our PATH and LIBPATH entries |
| 96 | + filter!(!isempty, unique!(PATH_list)) |
| 97 | + filter!(!isempty, unique!(LIBPATH_list)) |
| 98 | + global PATH = join(PATH_list, ':') |
| 99 | + global LIBPATH = join(vcat(LIBPATH_list, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)]), ':') |
| 100 | + |
| 101 | + |
| 102 | +end # __init__() |
| 103 | + |
0 commit comments