From 62d437f0f9d4f7792e13c4bdcf88e6cfcd8346e4 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Wed, 25 Mar 2020 12:18:52 +0100 Subject: [PATCH 01/11] add basic ccall test for flint (malloc+free) --- test/runtests.jl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index f7c4c84..6f0cabf 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,18 @@ using LoadFlint using Test +using Libdl # Just successfully loading LoadFlint is a good first test -# TODO: add some trivial ccall's into flint +@testset "LoadFlint" begin + @test occursin("libgmp", LoadFlint.libgmp) + @test occursin("libflint", LoadFlint.libflint) + + l = dllist() + @test length(filter(x->occursin("libflint", x), l)) == 1 + x = Ptr{Nothing}(0) + @test (x = ccall((:flint_malloc,LoadFlint.libflint), Ptr{Nothing}, (UInt,), 8)) != C_NULL + @test ccall((:flint_free,LoadFlint.libflint), Nothing ,(Ptr{Nothing},),x) == nothing + + # TODO maybe test fmpz? +end From ec84f5ab200b84fd23e996b14af955faa2f1c273 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 20 Mar 2020 00:10:13 +0100 Subject: [PATCH 02/11] use pkg artifacts add legacy mode for old julia version via build.jl remove source build FLINT_PATH for custom flint installations with julia 1.2 or older dont touch gmp memory functions --- .gitignore | 2 +- Project.toml | 4 +- deps/build.jl | 301 +++++----------------------- deps/build_flint.v0.0.0-dd1021a6.jl | 38 ++++ deps/generate_buildjl.jl | 226 +++++++++++++++++++++ src/LoadFlint.jl | 61 +++--- 6 files changed, 336 insertions(+), 296 deletions(-) create mode 100644 deps/build_flint.v0.0.0-dd1021a6.jl create mode 100644 deps/generate_buildjl.jl diff --git a/.gitignore b/.gitignore index de73e7a..fecc452 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /deps/build.log -/deps/build_*.jl /deps/deps.jl /deps/usr/ +Manifest.toml diff --git a/Project.toml b/Project.toml index f27a204..c7a0224 100644 --- a/Project.toml +++ b/Project.toml @@ -4,8 +4,10 @@ authors = ["Claus Fieker "] version = "0.1.3" [deps] -Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232" +GMP_jll = "781609d7-10c4-51f6-84f2-b8444358ff6d" +Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +flint_jll = "cabf4574-4f87-5802-9a0b-e4b5b01a80fc" [compat] BinaryProvider = "0.4, 0.5" diff --git a/deps/build.jl b/deps/build.jl index 6172336..9a7ac82 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,273 +1,62 @@ -using Libdl - -using BinaryProvider - -# Parse some basic command-line arguments -const verbose = "--verbose" in ARGS - -issource_build = "NEMO_SOURCE_BUILD" in keys(ENV) && ENV["NEMO_SOURCE_BUILD"] == "1" - -const prefixpath = joinpath(@__DIR__, "usr") - -const wdir = joinpath(@__DIR__) - -if !issource_build - # Dependencies that must be installed before this package can be built - dependencies = [ - # This has to be in sync with the corresponding commit in the source build below (for flint, arb, antic) - "https://github.com/JuliaPackaging/Yggdrasil/releases/download/GMP-v6.1.2-1/build_GMP.v6.1.2.jl", - "https://github.com/JuliaPackaging/Yggdrasil/releases/download/MPFR-v4.0.2-1/build_MPFR.v4.0.2.jl", - "https://github.com/thofma/Flint2Builder/releases/download/f46562/build_libflint.v0.0.0-f465622699d5c4c22bb3617596f8ae86e4570652.jl" - ] - - const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) - - products = [] - - for url in dependencies - build_file = joinpath(@__DIR__, basename(url)) - if !isfile(build_file) - download(url, build_file) - end - end - - # Execute the build scripts for the dependencies in an isolated module to avoid overwriting - # any variables/constants here - for url in dependencies - build_file = joinpath(@__DIR__, basename(url)) - m = @eval module $(gensym()); include($build_file); end - append!(products, m.products) - end +# this file is only for julia older than 1.3 - filenames = ["libgmp.la", "libgmpxx.la", "libmpfr.la"] - for filename in filenames - fpath = joinpath(prefixpath, "lib", filename) - txt = read(fpath, String) - open(fpath, "w") do f - write(f, replace(txt, "/workspace/destdir" => prefixpath)) - end - end - -else - println("Doing a source build for C dependencies...") - if "NEMO_BUILD_THREADS" in keys(ENV) - build_threads = ENV["NEMO_BUILD_THREADS"] - println("Using $build_threads threads for building as specified by NEMO_BUILD_THREADS.") - else - build_threads = Sys.CPU_THREADS - println("Using $build_threads threads (detected that many CPU threads).") - end - - @show M4_VERSION = "1.4.17" - @show YASM_VERSION = "1.3.0" - @show MPIR_VERSION = "3.0.0-90740d8fdf03b941b55723b449831c52fd7f51ca" - @show MPFR_VERSION = "4.0.0" - @show FLINT_VERSION = "f465622699d5c4c22bb3617596f8ae86e4570652" - @show ARB_VERSION = "6c3738555d00b8b8b24a1f5e0065ef787432513c" - @show ANTIC_VERSION = "364f97edd9b6af537787113cf910f16d7bbc48a3" - - if Sys.iswindows() - error("Source build not available on Windows") - end - - println("Removing old binaries ...") - - rm(prefixpath, force = true, recursive = true) - mkdir(prefixpath) - mkdir(joinpath(prefixpath, "lib")) - - if Sys.isapple() && !("CC" in keys(ENV)) - ENV["CC"] = "clang" - ENV["CXX"] = "clang++" - end - - LDFLAGS = "-Wl,-rpath,$prefixpath/lib -Wl,-rpath,\$\$ORIGIN/../share/julia/site/v$(VERSION.major).$(VERSION.minor)/Nemo/local/lib" - DLCFLAGS = "-fPIC -fno-common" - - cd(wdir) +using Libdl - try - run(`m4 --version`) - catch - println("Building m4 ... ") - M4_FILE = "m4-" * M4_VERSION * ".tar.bz2" - download("http://ftp.gnu.org/gnu/m4/$M4_FILE", joinpath(wdir, "$M4_FILE")) +if "FLINT_PATH" in keys(ENV) - run(`tar -xvf $M4_FILE`) - run(`rm $M4_FILE`) - cd(joinpath("$wdir", "m4-$M4_VERSION")) - run(`./configure --prefix=$prefixpath`) - run(`make`) - run(`make install`) - println("DONE") + if VERSION >= v"1.3.0-rc4" + error("please use Pkg Overrides.toml for custom flint installations in julia >= 1.3") end - cd(wdir) - - # install yasm - - if !ispath(joinpath(wdir, "yasm-$YASM_VERSION")) - println("Building yasm ... ") - YASM_FILE = "yasm-" * YASM_VERSION * ".tar.gz" - download("https://github.com/yasm/yasm/archive/v$(YASM_VERSION).tar.gz", YASM_FILE) - run(`tar -xvf $YASM_FILE`) - run(`rm $YASM_FILE`) - cd(joinpath("$wdir","yasm-$YASM_VERSION")) - run(`./autogen.sh`) - run(`./configure`) - run(`make`) - println("DONE") - end - - cd(wdir) - - # install GMP/MPIR - - MPIR_FILE = "mpir-" * MPIR_VERSION * ".tar.bz2" - - if !ispath(joinpath(wdir, "mpir-$MPIR_VERSION")) - println("Downloading MPIR sources ... ") - download("http://nemocas.org/binaries/$MPIR_FILE", joinpath(wdir, MPIR_FILE)) - println("DONE") - end - - println("Building MPIR ... ") - if isfile(joinpath(wdir, MPIR_FILE)) - run(`tar -xvf $MPIR_FILE`) - run(`rm $MPIR_FILE`) - end - cd("$wdir/mpir-$MPIR_VERSION") - try - run(`m4 --version`) - run(`./configure --with-yasm=$wdir/yasm-$YASM_VERSION/yasm --prefix=$prefixpath --enable-gmpcompat --disable-static --enable-shared`) - catch - run(`./configure --with-yasm=$wdir/yasm-$YASM_VERSION/yasm --prefix=$prefixpath M4=$prefixpath/bin/m4 --enable-gmpcompat --disable-static --enable-shared`) - end - run(`make -j$build_threads`) - run(`make install`) - cd(wdir) - run(`rm -rf bin`) - println("DONE") - - cd(wdir) - - # install MPFR - - MPFR_FILE = "mpfr-" * MPFR_VERSION * ".tar.bz2" - - if !ispath(joinpath(wdir, "mpfr-$MPFR_VERSION")) - println("Downloading MPFR sources ... ") - download("http://ftp.vim.org/ftp/gnu/mpfr/$MPFR_FILE", joinpath(wdir, MPFR_FILE)) - - println("DONE") - end - - println("Building MPFR ... ") - if isfile(joinpath(wdir, MPFR_FILE)) - run(`tar -xvf $MPFR_FILE`) - run(`rm $MPFR_FILE`) - end - cd("$wdir/mpfr-$MPFR_VERSION") - withenv("LD_LIBRARY_PATH"=>"$prefixpath/lib", "LDFLAGS"=>LDFLAGS) do - run(`./configure --prefix=$prefixpath --with-gmp=$prefixpath --disable-static --enable-shared`) - run(`make -j$build_threads`) - run(`make install`) - end - println("DONE") - - cd(wdir) - - # INSTALL FLINT - - try - println("Cloning flint2 ... ") - run(`git clone https://github.com/wbhart/flint2.git`) - cd(joinpath("$wdir", "flint2")) - run(`git checkout $FLINT_VERSION`) - cd(wdir) - catch - if ispath(joinpath("$wdir", "flint2")) - open(`patch -R --forward -d flint2 -r -`, "r", open("../deps-PIE-ftbfs.patch")) - cd(joinpath("$wdir", "flint2")) - run(`git fetch`) - run(`git checkout $FLINT_VERSION`) - cd(wdir) - end - end - open(`patch --forward -d flint2 -r -`, "r", open("../deps-PIE-ftbfs.patch")) - println("DONE") + flint_path = ENV["FLINT_PATH"] + if !isfile(flint_path) + error("FLINT_PATH: file does not exists") + end - println("Building flint ... ") - cd(joinpath("$wdir", "flint2")) - withenv("LD_LIBRARY_PATH"=>"$prefixpath/lib", "LDFLAGS"=>LDFLAGS) do - run(`./configure --prefix=$prefixpath --disable-static --enable-shared --with-mpir=$prefixpath --with-mpfr=$prefixpath`) - run(`make -j$build_threads`) - run(`make install`) - end + open(joinpath(@__DIR__,"deps.jl"), "w") do f + println(f, """ +using Libdl +libflint = "$flint_path" +if Libdl.dlopen_e(libflint) in (C_NULL, nothing) + error("$(libflint) cannot be opened, Please check FLINT_PATH environment variable and re-run Pkg.build("LoadFlint"), then restart Julia.") +end +""") + end - println("DONE") +elseif VERSION < v"1.3.0-rc4" - cd(wdir) + using BinaryProvider - # INSTALL ARB + # Parse some basic command-line arguments + const verbose = "--verbose" in ARGS - println("Cloning arb ... ") - try - run(`git clone https://github.com/fredrik-johansson/arb.git`) - cd(joinpath("$wdir", "arb")) - run(`git checkout $ARB_VERSION`) - cd(wdir) - catch - if ispath(joinpath("$wdir", "arb")) - #open(`patch -R --forward -d arb -r -`, "r", open("../deps-PIE-ftbfs.patch")) - cd(joinpath("$wdir", "arb")) - run(`git fetch`) - run(`git checkout $ARB_VERSION`) - cd(wdir) - end - end - println("DONE") + dependencies = [ + # This has to be in sync with the jll packages (using generate_build.jl and build_tarballs.jl from Yggdrasil) + "build_flint.v0.0.0-dd1021a6.jl", + ] + # GMP and MPFR are not needed as julia should have those loaded already - println("Building arb ... ") - cd(joinpath("$wdir", "arb")) - withenv("LD_LIBRARY_PATH"=>"$prefixpath/lib", "LDFLAGS"=>LDFLAGS) do - run(`./configure --prefix=$prefixpath --disable-static --enable-shared --with-mpir=$prefixpath --with-mpfr=$prefixpath --with-flint=$prefixpath`) - run(`make -j$build_threads`) - run(`make install`) - end - println("DONE") + const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) - cd(wdir) + products = [] - # INSTALL ANTIC + # Execute the build scripts for the dependencies in an isolated module to avoid overwriting + # any variables/constants here + for file in dependencies + build_file = joinpath(@__DIR__, file) + m = @eval module $(gensym()); include($build_file); end + append!(products, m.products) + end - println("Cloning antic ... ") - try - run(`git clone https://github.com/wbhart/antic.git`) - cd(joinpath("$wdir", "antic")) - run(`git checkout $ANTIC_VERSION`) - cd(wdir) - catch - if ispath(joinpath("$wdir", "antic")) - #open(`patch -R --forward -d antic -r -`, "r", open("../deps-PIE-ftbfs.patch")) - cd(joinpath("$wdir", "antic")) - run(`git fetch`) - run(`git checkout $ANTIC_VERSION`) - cd(wdir) - end - end - println("DONE") + write_deps_file(joinpath(@__DIR__, "deps.jl"), Array{Product,1}(products), verbose=verbose) - println("Building antic ... ") - cd(joinpath("$wdir", "antic")) - withenv("LD_LIBRARY_PATH"=>"$prefixpath/lib", "LDFLAGS"=>LDFLAGS) do - run(`./configure --prefix=$prefixpath --disable-static --enable-shared --with-mpir=$prefixpath --with-mpfr=$prefixpath --with-flint=$prefixpath`) - run(`make -j$build_threads`) - run(`make install`) - end - println("DONE") - cd(wdir) end -push!(Libdl.DL_LOAD_PATH, joinpath(prefixpath, "lib"), joinpath(prefixpath, "bin")) - +# we do libgmp manually to avoid loading the one from BinaryBuilder and the julia one +open(joinpath(@__DIR__,"deps.jl"), "a") do f + println(f, """ +gmpname = Sys.iswindows() ? "libgmp-10" : "libgmp." +f = filter(x->occursin(gmpname, x), dllist()) +libgmp = f[1] +""") +end diff --git a/deps/build_flint.v0.0.0-dd1021a6.jl b/deps/build_flint.v0.0.0-dd1021a6.jl new file mode 100644 index 0000000..e4fc6ec --- /dev/null +++ b/deps/build_flint.v0.0.0-dd1021a6.jl @@ -0,0 +1,38 @@ +using BinaryProvider # requires BinaryProvider 0.3.0 or later + +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, ["libflint"], :libflint), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/benlorenz/flint_jll.jl/releases/download/flint-v0.0.0-dd1021a6+0" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + MacOS(:x86_64) => ("$bin_prefix/flint.v0.0.0-dd1021a6.x86_64-apple-darwin14.tar.gz", "98a310eaaf2e57c32864f940b104ef28ffbcec51dab4210eef71d43d1450f1d7"), + Linux(:x86_64, libc=:glibc) => ("$bin_prefix/flint.v0.0.0-dd1021a6.x86_64-linux-gnu.tar.gz", "99ed739e541bf735cb187b4d798677b101f8c766d122686dcdfec0f311fd0a91"), + Windows(:x86_64) => ("$bin_prefix/flint.v0.0.0-dd1021a6.x86_64-w64-mingw32.tar.gz", "260be0340c194490a28642a1195d97183e7224e576d006d10f165c701b1f4002"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") +end + +# If we have a download, and we are unsatisfied (or the version we're +# trying to install is not itself installed) then load it up! +if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/generate_buildjl.jl b/deps/generate_buildjl.jl new file mode 100644 index 0000000..c626fea --- /dev/null +++ b/deps/generate_buildjl.jl @@ -0,0 +1,226 @@ +#!/usr/bin/env julia + +using GitHub, BinaryBuilder, Pkg, Pkg.PlatformEngines, SHA + +""" + extract_platform_key(path::AbstractString) + +Given the path to a tarball, return the platform key of that tarball. If none +can be found, prints a warning and return the current platform suffix. +""" +function extract_platform_key(path::AbstractString) + try + return extract_name_version_platform_key(path)[3] + catch + @warn("Could not extract the platform key of $(path); continuing...") + return platform_key_abi() + end +end + +""" + extract_name_version_platform_key(path::AbstractString) + +Given the path to a tarball, return the name, platform key and version of that +tarball. If any of those things cannot be found, throw an error. +""" +function extract_name_version_platform_key(path::AbstractString) + m = match(r"^(.*?)\.v(.*?)\.([^\.\-]+-[^\.\-]+-([^\-]+-){0,2}[^\-]+).tar.gz$", basename(path)) + if m === nothing + error("Could not parse name, platform key and version from $(path)") + end + name = m.captures[1] + version = VersionNumber(m.captures[2]) + platkey = platform_key_abi(m.captures[3]) + return name, version, platkey +end + +function product_hashes_from_github_release(repo_name::AbstractString, tag_name::AbstractString; + verbose::Bool = true) + # Get list of files within this release + release = GitHub.gh_get_json(GitHub.DEFAULT_API, "/repos/$(repo_name)/releases/tags/$(tag_name)", auth=BinaryBuilder.github_auth()) + + # Try to extract the platform key from each, use that to find all tarballs + function can_extract_platform(filename) + # Short-circuit build.jl because that's quite often there. :P + if startswith(filename, "build") && endswith(filename, ".jl") + return false + end + + unknown_platform = typeof(extract_platform_key(filename)) <: UnknownPlatform + if unknown_platform && verbose + @info("Ignoring file $(filename); can't extract its platform key") + end + return !unknown_platform + end + assets = [a for a in release["assets"] if can_extract_platform(a["name"])] + + # Download each tarball, hash it, and reconstruct product_hashes. + product_hashes = Dict() + mktempdir() do d + for asset in assets + # For each asset (tarball), download it + filepath = joinpath(d, asset["name"]) + url = asset["browser_download_url"] + download(url, filepath) + + # Hash it + hash = open(filepath) do file + return bytes2hex(sha256(file)) + end + + # Then fit it into our product_hashes + file_triplet = triplet(extract_platform_key(asset["name"])) + product_hashes[file_triplet] = (asset["name"], hash) + + if verbose + @info("Calculated $hash for $(asset["name"])") + end + end + end + + return product_hashes +end + +function print_buildjl(io::IO, products::Vector, product_hashes::Dict, + bin_path::AbstractString) + print(io, """ + using BinaryProvider # requires BinaryProvider 0.3.0 or later + + # Parse some basic command-line arguments + const verbose = "--verbose" in ARGS + const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) + """) + + # Print out products + print(io, "products = [\n") + for prod in products + print(io, " $(repr(prod)),\n") + end + print(io, "]\n\n") + + # Print binary locations/tarball hashes + print(io, """ + # Download binaries from hosted location + bin_prefix = "$bin_path" + + # Listing of files generated by BinaryBuilder: + """) + + println(io, "download_info = Dict(") + for platform in sort(collect(keys(product_hashes))) + fname, hash = product_hashes[platform] + pkey = platform_key_abi(platform) + println(io, " $(pkey) => (\"\$bin_prefix/$(fname)\", \"$(hash)\"),") + end + println(io, ")\n") + + print(io, """ + # Install unsatisfied or updated dependencies: + unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) + dl_info = choose_download(download_info, platform_key_abi()) + if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\\\"\$(Sys.MACHINE)\\\", parsed as \\\"\$(triplet(platform_key_abi()))\\\") is not supported by this package!") + end + + # If we have a download, and we are unsatisfied (or the version we're + # trying to install is not itself installed) then load it up! + if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) + end + + # Write out a deps.jl file that will contain mappings for our products + write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) + """) +end + + + +if length(ARGS) < 1 || length(ARGS) > 3 + @error("Usage: generate_buildjl.jl path/to/build_tarballs.jl [ ]") + exit(1) +end + +build_tarballs_path = ARGS[1] +@info "Build tarballs script: $(build_tarballs_path)" +src_name = basename(dirname(build_tarballs_path)) +if 2 <= length(ARGS) <= 3 + repo_name = ARGS[2] +else + repo_name = "JuliaBinaryWrappers/$(src_name)_jll.jl" +end +@info "Repo name: $(repo_name)" + +if length(ARGS) == 3 + tag_name = ARGS[3] +else + ctx = Pkg.Types.Context() + # Force-update the registry here, since we may have pushed a new version recently + BinaryBuilder.update_registry(ctx) + versions = VersionNumber[] + paths = Pkg.Operations.registered_paths(ctx.env, BinaryBuilder.jll_uuid("$(src_name)_jll")) + if any(p -> isfile(joinpath(p, "Package.toml")), paths) + # Find largest version number that matches ours in the registered paths + for path in paths + append!(versions, Pkg.Compress.load_versions(joinpath(path, "Versions.toml"))) + end + end + if !isempty(versions) + last_version = maximum(versions) + tag_name = "$(src_name)-v$(last_version)" + else + @error("""Unable to determine latest version of $(src_name), + please specify it as third argument to this script: + generate_buildjl.jl $(build_tarballs_path) $(repo_name) """) + exit(1) + end +end +@info "Tag name: $(tag_name)" + +# First, snarf out the Product variables: +if !isfile(build_tarballs_path) + @error("Unable to open $(build_tarballs_path)") + exit(1) +end + +m = Module(:__anon__) +Core.eval(m, quote + using BinaryBuilder, Pkg.BinaryPlatforms + + # Override BinaryBuilder functionality so that it doesn't actually do anything + # it just saves the inputs so that we can mess around with them: + _name = nothing + _version = nothing + _producs = nothing + function build_tarballs(A, name, version, sources, script, platforms, products, dependencies; kwargs...) + global _name = name + global _version = version + + # Peel off the functionalization of Products + if isa(products, Function) + products = products(Prefix(".")) + end + global _products = products + return nothing + end +end) +include_string(m, String(read(build_tarballs_path))) +name, version, products = Core.eval(m, quote + _name, _version, _products +end) + +product_hashes = product_hashes_from_github_release(repo_name, tag_name) + +mkpath(joinpath(@__DIR__, "build")) +buildjl_path = joinpath(@__DIR__, "build", "build_$(name).v$(version).jl") +bin_path = "https://github.com/$(repo_name)/releases/download/$(tag_name)" +@info("Writing out to $(buildjl_path)") +open(buildjl_path, "w") do io + print_buildjl(io, products, product_hashes, bin_path) +end + +# julia --color=yes generate_buildjl.jl somewhere/Flint2Builder/build_tarballs.jl benlorenz/flint_jll.jl flint-v0.0.0-dd1021a6+0 +# build_flint...jl needs some extra fixes afterwards to work diff --git a/src/LoadFlint.jl b/src/LoadFlint.jl index e918def..b168025 100644 --- a/src/LoadFlint.jl +++ b/src/LoadFlint.jl @@ -2,59 +2,44 @@ module LoadFlint using Libdl -const pkgdir = realpath(joinpath(dirname(@__DIR__))) -const libdir = joinpath(pkgdir, "deps", "usr", "lib") -const bindir = joinpath(pkgdir, "deps", "usr", "bin") -if Sys.iswindows() - libgmp = joinpath(bindir, "libgmp-10") - libflint = joinpath(bindir, "libflint") +if VERSION > v"1.3.0-rc4" + # this should do the dlopen vor 1.3 and later + using flint_jll else - libgmp = joinpath(libdir, "libgmp") - libflint = joinpath(libdir, "libflint") + deps_dir = joinpath(@__DIR__, "..", "deps") + include(joinpath(deps_dir,"deps.jl")) end const __isthreaded = Ref(false) function __init__() - global libflint, libgmp + if VERSION < v"1.3.0-rc4" + # this does the dlopen for 1.0-1.2 + check_deps() + end l = dllist() - f = filter(x->occursin("libflint", x), l) - new_flint = true - if length(f) == 1 - global libflint = f[1] - new_flint = false - elseif length(f) > 0 - error("too many flint") + if length(f) != 1 + error("there should be exactly one libflint, but we have: ", f) end - tmp = Sys.iswindows() ? "libgmp-10" : "libgmp" + tmp = Sys.iswindows() ? "libgmp-10" : "libgmp." f = filter(x->occursin(tmp, x), l) - new_gmp = true - if length(f) == 1 - global libgmp = f[1] - new_gmp = false - elseif length(f) > 0 - global libgmp = f[1] - @warn "More than one copy of gmp already loaded, using the 1st one" - new_gmp = false + if length(f) != 1 + # TODO: + # at the moment there doesnt seem to be a way to avoid this + # because julia comes with libgmp + # and GMP_jll will load another libgmp + @warn("there should be exactly one libgmp, but we have: ", f) end + global libgmp = f[1] - if new_gmp && !Sys.iswindows() && !__isthreaded[] - lf = dllist(libgmp) - fm = dlsym(lf, :__gmp_set_memory_functions) - ccall(fm, Nothing, - (Ptr{Nothing},Ptr{Nothing},Ptr{Nothing}), - cglobal(:jl_gc_counted_malloc), - cglobal(:jl_gc_counted_realloc_with_old_size), - cglobal(:jl_gc_counted_free_with_size)) - end - - if new_flint && !Sys.iswindows() && !__isthreaded[] - lf = dlopen(libflint) - fm = dlsym(lf, :__flint_set_memory_functions) + if !Sys.iswindows() && !__isthreaded[] + # variable libflint comes from deps file or flint_jll + flint_handle = dlopen(libflint,RTLD_NOLOAD) #to match the global gmp ones + fm = dlsym(flint_handle, :__flint_set_memory_functions) ccall(fm, Nothing, (Ptr{Nothing},Ptr{Nothing},Ptr{Nothing},Ptr{Nothing}), cglobal(:jl_malloc), From d1d74fe622e03f340956053db81cae628c80c21b Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sat, 4 Apr 2020 10:55:10 +0200 Subject: [PATCH 03/11] update for upstream FLINT_jll --- Project.toml | 2 +- deps/build.jl | 11 +++-- deps/build_FLINT.v0.0.1.jl | 48 ++++++++++++++++++++++ deps/build_GMP.v6.1.2.jl | 62 +++++++++++++++++++++++++++++ deps/build_MPFR.v4.0.2.jl | 48 ++++++++++++++++++++++ deps/build_flint.v0.0.0-dd1021a6.jl | 38 ------------------ deps/generate_buildjl.jl | 4 +- src/LoadFlint.jl | 6 +-- 8 files changed, 171 insertions(+), 48 deletions(-) create mode 100644 deps/build_FLINT.v0.0.1.jl create mode 100644 deps/build_GMP.v6.1.2.jl create mode 100644 deps/build_MPFR.v4.0.2.jl delete mode 100644 deps/build_flint.v0.0.0-dd1021a6.jl diff --git a/Project.toml b/Project.toml index c7a0224..da7dd18 100644 --- a/Project.toml +++ b/Project.toml @@ -5,9 +5,9 @@ version = "0.1.3" [deps] BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232" +FLINT_jll = "e134572f-a0d5-539d-bddf-3cad8db41a82" GMP_jll = "781609d7-10c4-51f6-84f2-b8444358ff6d" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" -flint_jll = "cabf4574-4f87-5802-9a0b-e4b5b01a80fc" [compat] BinaryProvider = "0.4, 0.5" diff --git a/deps/build.jl b/deps/build.jl index 9a7ac82..3d7b68d 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -32,9 +32,13 @@ elseif VERSION < v"1.3.0-rc4" dependencies = [ # This has to be in sync with the jll packages (using generate_build.jl and build_tarballs.jl from Yggdrasil) - "build_flint.v0.0.0-dd1021a6.jl", + "build_FLINT.v0.0.1.jl", ] - # GMP and MPFR are not needed as julia should have those loaded already + # GMP is not needed on unix as julia should have those loaded already + if Sys.iswindows() + pushfirst!(dependencies,"build_MPFR.v4.0.2.jl") + pushfirst!(dependencies,"build_GMP.v6.1.2.jl") + end const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) @@ -55,8 +59,7 @@ end # we do libgmp manually to avoid loading the one from BinaryBuilder and the julia one open(joinpath(@__DIR__,"deps.jl"), "a") do f println(f, """ -gmpname = Sys.iswindows() ? "libgmp-10" : "libgmp." -f = filter(x->occursin(gmpname, x), dllist()) +f = filter(x->occursin(r"libgmp(-10|\\.)", x), dllist()) libgmp = f[1] """) end diff --git a/deps/build_FLINT.v0.0.1.jl b/deps/build_FLINT.v0.0.1.jl new file mode 100644 index 0000000..3a0d754 --- /dev/null +++ b/deps/build_FLINT.v0.0.1.jl @@ -0,0 +1,48 @@ +using BinaryProvider # requires BinaryProvider 0.3.0 or later + +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, ["libflint"], :libflint), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/JuliaBinaryWrappers/FLINT_jll.jl/releases/download/FLINT-v0.0.1+0" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + Linux(:aarch64, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.aarch64-linux-gnu.tar.gz", "ec9887a7f7fa75cd40cbf9816d4aa85c14682be8c122f2767dd33d6e3485c57d"), + Linux(:aarch64, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.aarch64-linux-musl.tar.gz", "2095b17382f4f6e93cc9c6682ce1bca2b5446e40ef3befcc8a39b58fbe021cf7"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/FLINT.v0.0.1.armv7l-linux-gnueabihf.tar.gz", "8a90c173a644001f781d4045e02cc3683c28ea7503c380d4500636827afe4b6b"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/FLINT.v0.0.1.armv7l-linux-musleabihf.tar.gz", "75a5b34ba2362f4b480218090cc0d1c955bf339ee036cf7e318b1c0e463b4f3b"), + Linux(:i686, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.i686-linux-gnu.tar.gz", "efda0718eac26e25a6a91f7407836779d1ce7de3518e5f8ca4e940eecc1f7cba"), + Linux(:i686, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.i686-linux-musl.tar.gz", "9504a94062e5836c47c5cb731e8c967b917230e50f99e8b82bbfd9ca87b7d878"), + Windows(:i686) => ("$bin_prefix/FLINT.v0.0.1.i686-w64-mingw32.tar.gz", "c0a5fc39425467da297ccab4c10c7f4065cf06f2b846b033ebbc455dfa2efdc0"), + Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.powerpc64le-linux-gnu.tar.gz", "3c8aaa11fbd591b21fe2defb4b0429fb025e375990c71dbd09cf1f496353dfd8"), + MacOS(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-apple-darwin14.tar.gz", "24ac5e8e9891426c221bca1009fb99b8799a4c1c0a037d8b54fdbb09000e0813"), + Linux(:x86_64, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.x86_64-linux-gnu.tar.gz", "68319251b42c7fc306ca92a6c9c9c5883bdbf41833c388c214f3f3672cb03ad0"), + Linux(:x86_64, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.x86_64-linux-musl.tar.gz", "9ca6dd40dbff5d7b43ddad0206e27c6e4c5570cd87d1248911c63d9a0ce17e60"), + FreeBSD(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-unknown-freebsd11.1.tar.gz", "b7c82997dbb802eb5fc5b0aaad6ca5ce61306af821141c3b47a4f65da1818ff0"), + Windows(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-w64-mingw32.tar.gz", "02c0a3bc08e00d3ad59a00173407b62fe91c1269e5903f8b7365f856ec233f82"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") +end + +# If we have a download, and we are unsatisfied (or the version we're +# trying to install is not itself installed) then load it up! +if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/build_GMP.v6.1.2.jl b/deps/build_GMP.v6.1.2.jl new file mode 100644 index 0000000..ac8a889 --- /dev/null +++ b/deps/build_GMP.v6.1.2.jl @@ -0,0 +1,62 @@ +using BinaryProvider # requires BinaryProvider 0.3.0 or later + +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, ["libgmp"], :libgmp), + LibraryProduct(prefix, ["libgmpxx"], :libgmpxx), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/JuliaBinaryWrappers/GMP_jll.jl/releases/download/GMP-v6.1.2+5" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-gnu-cxx03.tar.gz", "c8dd7e07cb82260ef34682e08ef6d2924a610569e2f5cd98419bb2dcb6e60524"), + Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-gnu-cxx11.tar.gz", "130bf229c56f25e396366553752f6215be5491520556b3fda8ed79f76af4eca7"), + Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-musl-cxx03.tar.gz", "e39b05c2379a311a426946150e5e10baff03f1d44ae03bb359e2594d9973411e"), + Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-musl-cxx11.tar.gz", "0bb07a22a7cd5dc1028db8b1dc6bfc897bc8bad67d42ea644d58b63c67ac87d8"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-gnueabihf-cxx03.tar.gz", "c65ef226121b2f83dff5e0706f9c2a9c89d631a9e696ec4245db8f34d523a1b4"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-gnueabihf-cxx11.tar.gz", "4e4694472e941f3f16632bdf532d953948a1d86845867bca324b424a444470d7"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-musleabihf-cxx03.tar.gz", "1d027c2279bc7fb965d29936b4fdd94aec6fce73fa078512eb66b112b007a7ed"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-musleabihf-cxx11.tar.gz", "bd54dffd382b6a973a3ff3351a2360419efda4d0aed1895b10485b68cc04d2f5"), + Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-gnu-cxx03.tar.gz", "924ce570a667e554be131b6f016e7be4a4d9bcb3805674f284dac732be59c664"), + Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-gnu-cxx11.tar.gz", "f06a382cf1de344e492dbcc947d32b0344cbe524f95f55de0c26fa0d69e3dd09"), + Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-musl-cxx03.tar.gz", "b81b8c73c6a09e6ec9365b3801a5a8694a7b8fec9dbe21575aec45bcb00ebba9"), + Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-musl-cxx11.tar.gz", "a9b24f822050a99f20370bb66807d2e011e2d5c8f66db625f636795700b3a7e4"), + Windows(:i686, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-w64-mingw32-cxx03.tar.gz", "bfa320b37a0c5597809792b33e472ae573c3ae3b9823dcb51bc93f4594f24c59"), + Windows(:i686, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-w64-mingw32-cxx11.tar.gz", "c02853d8e5cf0c89611030d28ff930c2ca3ff412440a4da74ff49ff9511f8f7c"), + Linux(:powerpc64le, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.powerpc64le-linux-gnu-cxx03.tar.gz", "c803fa0fa7152091df080c25569fd35e724d33a5761d793e7be9134498eab1ac"), + Linux(:powerpc64le, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.powerpc64le-linux-gnu-cxx11.tar.gz", "e9e507486448a730e0a87c7229bf360b46254893cadc67da5c7d2306437c0e1e"), + MacOS(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-apple-darwin14-cxx03.tar.gz", "4a7ea5d8efe6909bddb5a82fe497e680c15e2b1c847a06a13fc64597bec32ac5"), + MacOS(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-apple-darwin14-cxx11.tar.gz", "8693d06c3ad2d1442722a85519d754619f4ed998b9189f13659e20db2a2a6681"), + Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-gnu-cxx03.tar.gz", "738390b5d59be5650af95c03d82eb90193d53a2deea4f009e574e47748d80cf3"), + Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-gnu-cxx11.tar.gz", "ab29a335c8341add421739ee0fbe989b49e5e8b2fd9995904689eeee6bdb5534"), + Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-musl-cxx03.tar.gz", "39342be3866d7171b64ab492499a10030071965549d5d409d8867d06bbac105b"), + Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-musl-cxx11.tar.gz", "14c421bc4a8a429fadcd42b5206bbfb53bb709f6f95d9af4bf18a6fa58c4cd67"), + FreeBSD(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-unknown-freebsd11.1-cxx03.tar.gz", "bdeeb7504760c248aa8121acc433d8104381d618f5144c21e56bd8ebb4167051"), + FreeBSD(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-unknown-freebsd11.1-cxx11.tar.gz", "324c09761ff49f4cb523fe8ef721bbf40f601029a3b4f3df74daeecaeccf89d7"), + Windows(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-w64-mingw32-cxx03.tar.gz", "362a38432bfeeda17d1b02bbc83e5f83ef8276ae4dc732b0fc7237966bf58e4e"), + Windows(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-w64-mingw32-cxx11.tar.gz", "2c50fc577ee090d46faba104ba3a4f328cc642024377bcfd968f48fe93954bca"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") +end + +# If we have a download, and we are unsatisfied (or the version we're +# trying to install is not itself installed) then load it up! +if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/build_MPFR.v4.0.2.jl b/deps/build_MPFR.v4.0.2.jl new file mode 100644 index 0000000..965a6f4 --- /dev/null +++ b/deps/build_MPFR.v4.0.2.jl @@ -0,0 +1,48 @@ +using BinaryProvider # requires BinaryProvider 0.3.0 or later + +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, ["libmpfr"], :libmpfr), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/JuliaBinaryWrappers/MPFR_jll.jl/releases/download/MPFR-v4.0.2+2" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + Linux(:aarch64, libc=:glibc) => ("$bin_prefix/MPFR.v4.0.2.aarch64-linux-gnu.tar.gz", "59831a83ec6e77311c2726936f03976c6a4fa24db10168189260eba2a403a038"), + Linux(:aarch64, libc=:musl) => ("$bin_prefix/MPFR.v4.0.2.aarch64-linux-musl.tar.gz", "9fdacfaa54fb1fbfc2f1c7be8d04549438d35897f42151728adf3e1790ed3c07"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/MPFR.v4.0.2.armv7l-linux-gnueabihf.tar.gz", "3779f74ac34afc6b746d672f896d4174a804cc80cf3272e11a9e20928af36ea7"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/MPFR.v4.0.2.armv7l-linux-musleabihf.tar.gz", "09b89c05f5726fc920c4db311c4027573ff7025ade5d570625b0b84c78959c0a"), + Linux(:i686, libc=:glibc) => ("$bin_prefix/MPFR.v4.0.2.i686-linux-gnu.tar.gz", "263416d4779f0f18865581487c3dacd1cf9c61f3ef801374dc2f8d762621f7ec"), + Linux(:i686, libc=:musl) => ("$bin_prefix/MPFR.v4.0.2.i686-linux-musl.tar.gz", "663128695369365a55cb7c8c115fcb219f9f96eaad8e91936ef2b76c81eaa242"), + Windows(:i686) => ("$bin_prefix/MPFR.v4.0.2.i686-w64-mingw32.tar.gz", "494832d8383d141c042a8d42249634fb566ad26748cbfa7f13ad0b048b598ea3"), + Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/MPFR.v4.0.2.powerpc64le-linux-gnu.tar.gz", "b9f1ff23eafa8de4694cbb182713d11788e0fa405562231402d3caf2978c8e9d"), + MacOS(:x86_64) => ("$bin_prefix/MPFR.v4.0.2.x86_64-apple-darwin14.tar.gz", "c94934ececef9817750c16e3ef5d3660521656ecc4c8afb3e2a39afe7fc6325b"), + Linux(:x86_64, libc=:glibc) => ("$bin_prefix/MPFR.v4.0.2.x86_64-linux-gnu.tar.gz", "c77f9f5e926f7245eed9d8db2b05e175d2030bad8e760e56c6eeb8fe465fddf8"), + Linux(:x86_64, libc=:musl) => ("$bin_prefix/MPFR.v4.0.2.x86_64-linux-musl.tar.gz", "c7320331de2f61fdd6fed71d336a7843023efe7601ac18ec5dc7136e72223a46"), + FreeBSD(:x86_64) => ("$bin_prefix/MPFR.v4.0.2.x86_64-unknown-freebsd11.1.tar.gz", "52afe44547762bda507a99aa5dcc1e04d2866f9483a9c1bc31789e8a7a12bedf"), + Windows(:x86_64) => ("$bin_prefix/MPFR.v4.0.2.x86_64-w64-mingw32.tar.gz", "7ef5c44de77a6e6d53caa14d98547b2e02023a83314c492e001cf4f88f6bbd73"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") +end + +# If we have a download, and we are unsatisfied (or the version we're +# trying to install is not itself installed) then load it up! +if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/build_flint.v0.0.0-dd1021a6.jl b/deps/build_flint.v0.0.0-dd1021a6.jl deleted file mode 100644 index e4fc6ec..0000000 --- a/deps/build_flint.v0.0.0-dd1021a6.jl +++ /dev/null @@ -1,38 +0,0 @@ -using BinaryProvider # requires BinaryProvider 0.3.0 or later - -# Parse some basic command-line arguments -const verbose = "--verbose" in ARGS -const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) -products = [ - LibraryProduct(prefix, ["libflint"], :libflint), -] - -# Download binaries from hosted location -bin_prefix = "https://github.com/benlorenz/flint_jll.jl/releases/download/flint-v0.0.0-dd1021a6+0" - -# Listing of files generated by BinaryBuilder: -download_info = Dict( - MacOS(:x86_64) => ("$bin_prefix/flint.v0.0.0-dd1021a6.x86_64-apple-darwin14.tar.gz", "98a310eaaf2e57c32864f940b104ef28ffbcec51dab4210eef71d43d1450f1d7"), - Linux(:x86_64, libc=:glibc) => ("$bin_prefix/flint.v0.0.0-dd1021a6.x86_64-linux-gnu.tar.gz", "99ed739e541bf735cb187b4d798677b101f8c766d122686dcdfec0f311fd0a91"), - Windows(:x86_64) => ("$bin_prefix/flint.v0.0.0-dd1021a6.x86_64-w64-mingw32.tar.gz", "260be0340c194490a28642a1195d97183e7224e576d006d10f165c701b1f4002"), -) - -# Install unsatisfied or updated dependencies: -unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) -dl_info = choose_download(download_info, platform_key_abi()) -if dl_info === nothing && unsatisfied - # If we don't have a compatible .tar.gz to download, complain. - # Alternatively, you could attempt to install from a separate provider, - # build from source or something even more ambitious here. - error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") -end - -# If we have a download, and we are unsatisfied (or the version we're -# trying to install is not itself installed) then load it up! -if unsatisfied || !isinstalled(dl_info...; prefix=prefix) - # Download and install binaries - install(dl_info...; prefix=prefix, force=true, verbose=verbose) -end - -# Write out a deps.jl file that will contain mappings for our products -write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/generate_buildjl.jl b/deps/generate_buildjl.jl index c626fea..fad62c2 100644 --- a/deps/generate_buildjl.jl +++ b/deps/generate_buildjl.jl @@ -222,5 +222,5 @@ open(buildjl_path, "w") do io print_buildjl(io, products, product_hashes, bin_path) end -# julia --color=yes generate_buildjl.jl somewhere/Flint2Builder/build_tarballs.jl benlorenz/flint_jll.jl flint-v0.0.0-dd1021a6+0 -# build_flint...jl needs some extra fixes afterwards to work +# julia --color=yes generate_buildjl.jl Yggdrasil/F/FLINT/build_tarballs.jl +# one needs to add prefix as first argument to LibraryProduct afterwards diff --git a/src/LoadFlint.jl b/src/LoadFlint.jl index b168025..cfa34ee 100644 --- a/src/LoadFlint.jl +++ b/src/LoadFlint.jl @@ -4,7 +4,7 @@ using Libdl if VERSION > v"1.3.0-rc4" # this should do the dlopen vor 1.3 and later - using flint_jll + using FLINT_jll else deps_dir = joinpath(@__DIR__, "..", "deps") include(joinpath(deps_dir,"deps.jl")) @@ -24,8 +24,8 @@ function __init__() error("there should be exactly one libflint, but we have: ", f) end - tmp = Sys.iswindows() ? "libgmp-10" : "libgmp." - f = filter(x->occursin(tmp, x), l) + # the -10 / . at the end is important to avoid matching libgmpxx + f = filter(x->occursin(r"libgmp(-10|\.)", x), dllist()) if length(f) != 1 # TODO: # at the moment there doesnt seem to be a way to avoid this From 2c2930ce90495b66557705ed8f10e1b66801c00c Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Wed, 15 Apr 2020 00:17:03 +0200 Subject: [PATCH 04/11] cleanup --- Project.toml | 1 + deps/build.jl | 22 +++++++++------------- src/LoadFlint.jl | 15 +++++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Project.toml b/Project.toml index da7dd18..3b4a101 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232" FLINT_jll = "e134572f-a0d5-539d-bddf-3cad8db41a82" GMP_jll = "781609d7-10c4-51f6-84f2-b8444358ff6d" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +MPFR_jll = "3a97d323-0669-5f0c-9066-3539efd106a3" [compat] BinaryProvider = "0.4, 0.5" diff --git a/deps/build.jl b/deps/build.jl index 3d7b68d..d03a492 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -20,6 +20,10 @@ libflint = "$flint_path" if Libdl.dlopen_e(libflint) in (C_NULL, nothing) error("$(libflint) cannot be opened, Please check FLINT_PATH environment variable and re-run Pkg.build("LoadFlint"), then restart Julia.") end +# there must be some libgmp loaded for libflint +libgmp = filter(x->occursin(r"libgmp[.-]", x), dllist())[1] +libmpfr = filter(x->occursin(r"libmpfr[.-]", x), dllist())[1] + """) end @@ -30,15 +34,14 @@ elseif VERSION < v"1.3.0-rc4" # Parse some basic command-line arguments const verbose = "--verbose" in ARGS + # GMP and MPFR might not be needed on unix as julia should have those loaded already + # but on windows flint will not load without them so we put leave them here for simplicity dependencies = [ # This has to be in sync with the jll packages (using generate_build.jl and build_tarballs.jl from Yggdrasil) + "build_GMP.v6.1.2.jl", + "build_MPFR.v4.0.2.jl", "build_FLINT.v0.0.1.jl", - ] - # GMP is not needed on unix as julia should have those loaded already - if Sys.iswindows() - pushfirst!(dependencies,"build_MPFR.v4.0.2.jl") - pushfirst!(dependencies,"build_GMP.v6.1.2.jl") - end + ] const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) @@ -56,10 +59,3 @@ elseif VERSION < v"1.3.0-rc4" end -# we do libgmp manually to avoid loading the one from BinaryBuilder and the julia one -open(joinpath(@__DIR__,"deps.jl"), "a") do f - println(f, """ -f = filter(x->occursin(r"libgmp(-10|\\.)", x), dllist()) -libgmp = f[1] -""") -end diff --git a/src/LoadFlint.jl b/src/LoadFlint.jl index cfa34ee..614f8d3 100644 --- a/src/LoadFlint.jl +++ b/src/LoadFlint.jl @@ -3,7 +3,10 @@ module LoadFlint using Libdl if VERSION > v"1.3.0-rc4" - # this should do the dlopen vor 1.3 and later + # this should do the dlopen for 1.3 and later + # and imports the libxxx variables + using GMP_jll + using MPFR_jll using FLINT_jll else deps_dir = joinpath(@__DIR__, "..", "deps") @@ -24,16 +27,16 @@ function __init__() error("there should be exactly one libflint, but we have: ", f) end - # the -10 / . at the end is important to avoid matching libgmpxx - f = filter(x->occursin(r"libgmp(-10|\.)", x), dllist()) - if length(f) != 1 - # TODO: + # the [.-] at the end is important to avoid matching libgmpxx + f = filter(x->occursin(r"libgmp[.-]", x), dllist()) + if length(f) == 0 + error("there should be at least one libgmp loaded.") + elseif length(f) > 1 # at the moment there doesnt seem to be a way to avoid this # because julia comes with libgmp # and GMP_jll will load another libgmp @warn("there should be exactly one libgmp, but we have: ", f) end - global libgmp = f[1] if !Sys.iswindows() && !__isthreaded[] # variable libflint comes from deps file or flint_jll From 6223331706880b679ca14b1b6fa3f8c2e1248029 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 19 Apr 2020 00:53:11 +0200 Subject: [PATCH 05/11] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3b4a101..75e638f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LoadFlint" uuid = "472f376f-f1cf-461b-9ac1-d103423be9b7" authors = ["Claus Fieker "] -version = "0.1.3" +version = "0.1.4" [deps] BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232" From 56e89f4383c834c53791396b9257d5bb7de43c02 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 7 Jun 2020 00:38:15 +0200 Subject: [PATCH 06/11] bump gmp and flint remove generate_buildjl which is available in yggdrasil --- deps/build.jl | 2 +- deps/build_FLINT.v0.0.1.jl | 48 -------- deps/build_FLINT.v2.6.0.jl | 48 ++++++++ deps/build_GMP.v6.1.2.jl | 52 ++++----- deps/generate_buildjl.jl | 226 ------------------------------------- 5 files changed, 75 insertions(+), 301 deletions(-) delete mode 100644 deps/build_FLINT.v0.0.1.jl create mode 100644 deps/build_FLINT.v2.6.0.jl delete mode 100644 deps/generate_buildjl.jl diff --git a/deps/build.jl b/deps/build.jl index d03a492..c6c7558 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -40,7 +40,7 @@ elseif VERSION < v"1.3.0-rc4" # This has to be in sync with the jll packages (using generate_build.jl and build_tarballs.jl from Yggdrasil) "build_GMP.v6.1.2.jl", "build_MPFR.v4.0.2.jl", - "build_FLINT.v0.0.1.jl", + "build_FLINT.v2.6.0.jl", ] const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) diff --git a/deps/build_FLINT.v0.0.1.jl b/deps/build_FLINT.v0.0.1.jl deleted file mode 100644 index 3a0d754..0000000 --- a/deps/build_FLINT.v0.0.1.jl +++ /dev/null @@ -1,48 +0,0 @@ -using BinaryProvider # requires BinaryProvider 0.3.0 or later - -# Parse some basic command-line arguments -const verbose = "--verbose" in ARGS -const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) -products = [ - LibraryProduct(prefix, ["libflint"], :libflint), -] - -# Download binaries from hosted location -bin_prefix = "https://github.com/JuliaBinaryWrappers/FLINT_jll.jl/releases/download/FLINT-v0.0.1+0" - -# Listing of files generated by BinaryBuilder: -download_info = Dict( - Linux(:aarch64, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.aarch64-linux-gnu.tar.gz", "ec9887a7f7fa75cd40cbf9816d4aa85c14682be8c122f2767dd33d6e3485c57d"), - Linux(:aarch64, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.aarch64-linux-musl.tar.gz", "2095b17382f4f6e93cc9c6682ce1bca2b5446e40ef3befcc8a39b58fbe021cf7"), - Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/FLINT.v0.0.1.armv7l-linux-gnueabihf.tar.gz", "8a90c173a644001f781d4045e02cc3683c28ea7503c380d4500636827afe4b6b"), - Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/FLINT.v0.0.1.armv7l-linux-musleabihf.tar.gz", "75a5b34ba2362f4b480218090cc0d1c955bf339ee036cf7e318b1c0e463b4f3b"), - Linux(:i686, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.i686-linux-gnu.tar.gz", "efda0718eac26e25a6a91f7407836779d1ce7de3518e5f8ca4e940eecc1f7cba"), - Linux(:i686, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.i686-linux-musl.tar.gz", "9504a94062e5836c47c5cb731e8c967b917230e50f99e8b82bbfd9ca87b7d878"), - Windows(:i686) => ("$bin_prefix/FLINT.v0.0.1.i686-w64-mingw32.tar.gz", "c0a5fc39425467da297ccab4c10c7f4065cf06f2b846b033ebbc455dfa2efdc0"), - Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.powerpc64le-linux-gnu.tar.gz", "3c8aaa11fbd591b21fe2defb4b0429fb025e375990c71dbd09cf1f496353dfd8"), - MacOS(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-apple-darwin14.tar.gz", "24ac5e8e9891426c221bca1009fb99b8799a4c1c0a037d8b54fdbb09000e0813"), - Linux(:x86_64, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.x86_64-linux-gnu.tar.gz", "68319251b42c7fc306ca92a6c9c9c5883bdbf41833c388c214f3f3672cb03ad0"), - Linux(:x86_64, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.x86_64-linux-musl.tar.gz", "9ca6dd40dbff5d7b43ddad0206e27c6e4c5570cd87d1248911c63d9a0ce17e60"), - FreeBSD(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-unknown-freebsd11.1.tar.gz", "b7c82997dbb802eb5fc5b0aaad6ca5ce61306af821141c3b47a4f65da1818ff0"), - Windows(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-w64-mingw32.tar.gz", "02c0a3bc08e00d3ad59a00173407b62fe91c1269e5903f8b7365f856ec233f82"), -) - -# Install unsatisfied or updated dependencies: -unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) -dl_info = choose_download(download_info, platform_key_abi()) -if dl_info === nothing && unsatisfied - # If we don't have a compatible .tar.gz to download, complain. - # Alternatively, you could attempt to install from a separate provider, - # build from source or something even more ambitious here. - error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") -end - -# If we have a download, and we are unsatisfied (or the version we're -# trying to install is not itself installed) then load it up! -if unsatisfied || !isinstalled(dl_info...; prefix=prefix) - # Download and install binaries - install(dl_info...; prefix=prefix, force=true, verbose=verbose) -end - -# Write out a deps.jl file that will contain mappings for our products -write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/build_FLINT.v2.6.0.jl b/deps/build_FLINT.v2.6.0.jl new file mode 100644 index 0000000..95d772a --- /dev/null +++ b/deps/build_FLINT.v2.6.0.jl @@ -0,0 +1,48 @@ +using BinaryProvider # requires BinaryProvider 0.3.0 or later + +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, ["libflint"], :libflint), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/JuliaBinaryWrappers/FLINT_jll.jl/releases/download/FLINT-v2.6.0+0" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + Linux(:aarch64, libc=:glibc) => ("$bin_prefix/FLINT.v2.6.0.aarch64-linux-gnu.tar.gz", "5b14f4c383488c116c2a1755d90bba2c8d73b40efc51e0f0594e5e28dad6a0ee"), + Linux(:aarch64, libc=:musl) => ("$bin_prefix/FLINT.v2.6.0.aarch64-linux-musl.tar.gz", "ebeba3bf7a9e6007cdb2cc0d5f8f43e5dbd0ba51e0a5b8ae550e1c7364a280c8"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/FLINT.v2.6.0.armv7l-linux-gnueabihf.tar.gz", "d506142b9a4744e6e8ea8279c6097d7d8ccceb99a830d82d84f140d7fe4dc574"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/FLINT.v2.6.0.armv7l-linux-musleabihf.tar.gz", "07308f6bf6db8d3c7e7be043217985e751441df57baf14702ae00ab074499fc0"), + Linux(:i686, libc=:glibc) => ("$bin_prefix/FLINT.v2.6.0.i686-linux-gnu.tar.gz", "d92b523d17e68890f512f90709918dec6a42ff048f511eefefd726283156b8b9"), + Linux(:i686, libc=:musl) => ("$bin_prefix/FLINT.v2.6.0.i686-linux-musl.tar.gz", "024ed3f104a92b34629f36d9bb9ca10c8e75e2a129df3974ea6ef14c94b3c438"), + Windows(:i686) => ("$bin_prefix/FLINT.v2.6.0.i686-w64-mingw32.tar.gz", "21b57a6458e3398cb132d1989819387132553235d95567942eda95a395a85c6a"), + Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/FLINT.v2.6.0.powerpc64le-linux-gnu.tar.gz", "b6d37bc7ba18a171f7b56a8c5c2eb857c32cf76827cf540446e8f086ec9392cb"), + MacOS(:x86_64) => ("$bin_prefix/FLINT.v2.6.0.x86_64-apple-darwin14.tar.gz", "0e39a384e45f82bed87f3b472e768a17ade4a5773770c3359b38854e974542d6"), + Linux(:x86_64, libc=:glibc) => ("$bin_prefix/FLINT.v2.6.0.x86_64-linux-gnu.tar.gz", "8137bd0cf4b0fd3808b2d4bc574c005a40275a272ce4e64fc5ee1a1855ae2fae"), + Linux(:x86_64, libc=:musl) => ("$bin_prefix/FLINT.v2.6.0.x86_64-linux-musl.tar.gz", "dd63d941088ef5232207f6cfd2cf02f1003b969ec78c5b4e85ee32578087d273"), + FreeBSD(:x86_64) => ("$bin_prefix/FLINT.v2.6.0.x86_64-unknown-freebsd11.1.tar.gz", "19820b1fed197923d9d152df213fc76cca8b38f73a999391653c97d8d4327ea1"), + Windows(:x86_64) => ("$bin_prefix/FLINT.v2.6.0.x86_64-w64-mingw32.tar.gz", "9ccf3eb9b8ee8d2cfcd501e9e44273ee25a6cd0e903daf3fc2861eb9ab831a12"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") +end + +# If we have a download, and we are unsatisfied (or the version we're +# trying to install is not itself installed) then load it up! +if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) diff --git a/deps/build_GMP.v6.1.2.jl b/deps/build_GMP.v6.1.2.jl index ac8a889..200f0f8 100644 --- a/deps/build_GMP.v6.1.2.jl +++ b/deps/build_GMP.v6.1.2.jl @@ -13,32 +13,32 @@ bin_prefix = "https://github.com/JuliaBinaryWrappers/GMP_jll.jl/releases/downloa # Listing of files generated by BinaryBuilder: download_info = Dict( - Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-gnu-cxx03.tar.gz", "c8dd7e07cb82260ef34682e08ef6d2924a610569e2f5cd98419bb2dcb6e60524"), - Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-gnu-cxx11.tar.gz", "130bf229c56f25e396366553752f6215be5491520556b3fda8ed79f76af4eca7"), - Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-musl-cxx03.tar.gz", "e39b05c2379a311a426946150e5e10baff03f1d44ae03bb359e2594d9973411e"), - Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-musl-cxx11.tar.gz", "0bb07a22a7cd5dc1028db8b1dc6bfc897bc8bad67d42ea644d58b63c67ac87d8"), - Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-gnueabihf-cxx03.tar.gz", "c65ef226121b2f83dff5e0706f9c2a9c89d631a9e696ec4245db8f34d523a1b4"), - Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-gnueabihf-cxx11.tar.gz", "4e4694472e941f3f16632bdf532d953948a1d86845867bca324b424a444470d7"), - Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-musleabihf-cxx03.tar.gz", "1d027c2279bc7fb965d29936b4fdd94aec6fce73fa078512eb66b112b007a7ed"), - Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-musleabihf-cxx11.tar.gz", "bd54dffd382b6a973a3ff3351a2360419efda4d0aed1895b10485b68cc04d2f5"), - Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-gnu-cxx03.tar.gz", "924ce570a667e554be131b6f016e7be4a4d9bcb3805674f284dac732be59c664"), - Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-gnu-cxx11.tar.gz", "f06a382cf1de344e492dbcc947d32b0344cbe524f95f55de0c26fa0d69e3dd09"), - Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-musl-cxx03.tar.gz", "b81b8c73c6a09e6ec9365b3801a5a8694a7b8fec9dbe21575aec45bcb00ebba9"), - Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-musl-cxx11.tar.gz", "a9b24f822050a99f20370bb66807d2e011e2d5c8f66db625f636795700b3a7e4"), - Windows(:i686, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-w64-mingw32-cxx03.tar.gz", "bfa320b37a0c5597809792b33e472ae573c3ae3b9823dcb51bc93f4594f24c59"), - Windows(:i686, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-w64-mingw32-cxx11.tar.gz", "c02853d8e5cf0c89611030d28ff930c2ca3ff412440a4da74ff49ff9511f8f7c"), - Linux(:powerpc64le, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.powerpc64le-linux-gnu-cxx03.tar.gz", "c803fa0fa7152091df080c25569fd35e724d33a5761d793e7be9134498eab1ac"), - Linux(:powerpc64le, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.powerpc64le-linux-gnu-cxx11.tar.gz", "e9e507486448a730e0a87c7229bf360b46254893cadc67da5c7d2306437c0e1e"), - MacOS(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-apple-darwin14-cxx03.tar.gz", "4a7ea5d8efe6909bddb5a82fe497e680c15e2b1c847a06a13fc64597bec32ac5"), - MacOS(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-apple-darwin14-cxx11.tar.gz", "8693d06c3ad2d1442722a85519d754619f4ed998b9189f13659e20db2a2a6681"), - Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-gnu-cxx03.tar.gz", "738390b5d59be5650af95c03d82eb90193d53a2deea4f009e574e47748d80cf3"), - Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-gnu-cxx11.tar.gz", "ab29a335c8341add421739ee0fbe989b49e5e8b2fd9995904689eeee6bdb5534"), - Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-musl-cxx03.tar.gz", "39342be3866d7171b64ab492499a10030071965549d5d409d8867d06bbac105b"), - Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-musl-cxx11.tar.gz", "14c421bc4a8a429fadcd42b5206bbfb53bb709f6f95d9af4bf18a6fa58c4cd67"), - FreeBSD(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-unknown-freebsd11.1-cxx03.tar.gz", "bdeeb7504760c248aa8121acc433d8104381d618f5144c21e56bd8ebb4167051"), - FreeBSD(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-unknown-freebsd11.1-cxx11.tar.gz", "324c09761ff49f4cb523fe8ef721bbf40f601029a3b4f3df74daeecaeccf89d7"), - Windows(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-w64-mingw32-cxx03.tar.gz", "362a38432bfeeda17d1b02bbc83e5f83ef8276ae4dc732b0fc7237966bf58e4e"), - Windows(:x86_64, compiler_abi=CompilerABI(:gcc_any,:cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-w64-mingw32-cxx11.tar.gz", "2c50fc577ee090d46faba104ba3a4f328cc642024377bcfd968f48fe93954bca"), + Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-gnu-cxx03.tar.gz", "c8dd7e07cb82260ef34682e08ef6d2924a610569e2f5cd98419bb2dcb6e60524"), + Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-gnu-cxx11.tar.gz", "130bf229c56f25e396366553752f6215be5491520556b3fda8ed79f76af4eca7"), + Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-musl-cxx03.tar.gz", "e39b05c2379a311a426946150e5e10baff03f1d44ae03bb359e2594d9973411e"), + Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.aarch64-linux-musl-cxx11.tar.gz", "0bb07a22a7cd5dc1028db8b1dc6bfc897bc8bad67d42ea644d58b63c67ac87d8"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-gnueabihf-cxx03.tar.gz", "c65ef226121b2f83dff5e0706f9c2a9c89d631a9e696ec4245db8f34d523a1b4"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-gnueabihf-cxx11.tar.gz", "4e4694472e941f3f16632bdf532d953948a1d86845867bca324b424a444470d7"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-musleabihf-cxx03.tar.gz", "1d027c2279bc7fb965d29936b4fdd94aec6fce73fa078512eb66b112b007a7ed"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.armv7l-linux-musleabihf-cxx11.tar.gz", "bd54dffd382b6a973a3ff3351a2360419efda4d0aed1895b10485b68cc04d2f5"), + Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-gnu-cxx03.tar.gz", "924ce570a667e554be131b6f016e7be4a4d9bcb3805674f284dac732be59c664"), + Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-gnu-cxx11.tar.gz", "f06a382cf1de344e492dbcc947d32b0344cbe524f95f55de0c26fa0d69e3dd09"), + Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-musl-cxx03.tar.gz", "b81b8c73c6a09e6ec9365b3801a5a8694a7b8fec9dbe21575aec45bcb00ebba9"), + Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-linux-musl-cxx11.tar.gz", "a9b24f822050a99f20370bb66807d2e011e2d5c8f66db625f636795700b3a7e4"), + Windows(:i686, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.i686-w64-mingw32-cxx03.tar.gz", "bfa320b37a0c5597809792b33e472ae573c3ae3b9823dcb51bc93f4594f24c59"), + Windows(:i686, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.i686-w64-mingw32-cxx11.tar.gz", "c02853d8e5cf0c89611030d28ff930c2ca3ff412440a4da74ff49ff9511f8f7c"), + Linux(:powerpc64le, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.powerpc64le-linux-gnu-cxx03.tar.gz", "c803fa0fa7152091df080c25569fd35e724d33a5761d793e7be9134498eab1ac"), + Linux(:powerpc64le, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.powerpc64le-linux-gnu-cxx11.tar.gz", "e9e507486448a730e0a87c7229bf360b46254893cadc67da5c7d2306437c0e1e"), + MacOS(:x86_64, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-apple-darwin14-cxx03.tar.gz", "4a7ea5d8efe6909bddb5a82fe497e680c15e2b1c847a06a13fc64597bec32ac5"), + MacOS(:x86_64, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-apple-darwin14-cxx11.tar.gz", "8693d06c3ad2d1442722a85519d754619f4ed998b9189f13659e20db2a2a6681"), + Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-gnu-cxx03.tar.gz", "738390b5d59be5650af95c03d82eb90193d53a2deea4f009e574e47748d80cf3"), + Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-gnu-cxx11.tar.gz", "ab29a335c8341add421739ee0fbe989b49e5e8b2fd9995904689eeee6bdb5534"), + Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-musl-cxx03.tar.gz", "39342be3866d7171b64ab492499a10030071965549d5d409d8867d06bbac105b"), + Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-linux-musl-cxx11.tar.gz", "14c421bc4a8a429fadcd42b5206bbfb53bb709f6f95d9af4bf18a6fa58c4cd67"), + FreeBSD(:x86_64, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-unknown-freebsd11.1-cxx03.tar.gz", "bdeeb7504760c248aa8121acc433d8104381d618f5144c21e56bd8ebb4167051"), + FreeBSD(:x86_64, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-unknown-freebsd11.1-cxx11.tar.gz", "324c09761ff49f4cb523fe8ef721bbf40f601029a3b4f3df74daeecaeccf89d7"), + Windows(:x86_64, compiler_abi=CompilerABI(:gcc_any, :cxx03)) => ("$bin_prefix/GMP.v6.1.2.x86_64-w64-mingw32-cxx03.tar.gz", "362a38432bfeeda17d1b02bbc83e5f83ef8276ae4dc732b0fc7237966bf58e4e"), + Windows(:x86_64, compiler_abi=CompilerABI(:gcc_any, :cxx11)) => ("$bin_prefix/GMP.v6.1.2.x86_64-w64-mingw32-cxx11.tar.gz", "2c50fc577ee090d46faba104ba3a4f328cc642024377bcfd968f48fe93954bca"), ) # Install unsatisfied or updated dependencies: diff --git a/deps/generate_buildjl.jl b/deps/generate_buildjl.jl deleted file mode 100644 index fad62c2..0000000 --- a/deps/generate_buildjl.jl +++ /dev/null @@ -1,226 +0,0 @@ -#!/usr/bin/env julia - -using GitHub, BinaryBuilder, Pkg, Pkg.PlatformEngines, SHA - -""" - extract_platform_key(path::AbstractString) - -Given the path to a tarball, return the platform key of that tarball. If none -can be found, prints a warning and return the current platform suffix. -""" -function extract_platform_key(path::AbstractString) - try - return extract_name_version_platform_key(path)[3] - catch - @warn("Could not extract the platform key of $(path); continuing...") - return platform_key_abi() - end -end - -""" - extract_name_version_platform_key(path::AbstractString) - -Given the path to a tarball, return the name, platform key and version of that -tarball. If any of those things cannot be found, throw an error. -""" -function extract_name_version_platform_key(path::AbstractString) - m = match(r"^(.*?)\.v(.*?)\.([^\.\-]+-[^\.\-]+-([^\-]+-){0,2}[^\-]+).tar.gz$", basename(path)) - if m === nothing - error("Could not parse name, platform key and version from $(path)") - end - name = m.captures[1] - version = VersionNumber(m.captures[2]) - platkey = platform_key_abi(m.captures[3]) - return name, version, platkey -end - -function product_hashes_from_github_release(repo_name::AbstractString, tag_name::AbstractString; - verbose::Bool = true) - # Get list of files within this release - release = GitHub.gh_get_json(GitHub.DEFAULT_API, "/repos/$(repo_name)/releases/tags/$(tag_name)", auth=BinaryBuilder.github_auth()) - - # Try to extract the platform key from each, use that to find all tarballs - function can_extract_platform(filename) - # Short-circuit build.jl because that's quite often there. :P - if startswith(filename, "build") && endswith(filename, ".jl") - return false - end - - unknown_platform = typeof(extract_platform_key(filename)) <: UnknownPlatform - if unknown_platform && verbose - @info("Ignoring file $(filename); can't extract its platform key") - end - return !unknown_platform - end - assets = [a for a in release["assets"] if can_extract_platform(a["name"])] - - # Download each tarball, hash it, and reconstruct product_hashes. - product_hashes = Dict() - mktempdir() do d - for asset in assets - # For each asset (tarball), download it - filepath = joinpath(d, asset["name"]) - url = asset["browser_download_url"] - download(url, filepath) - - # Hash it - hash = open(filepath) do file - return bytes2hex(sha256(file)) - end - - # Then fit it into our product_hashes - file_triplet = triplet(extract_platform_key(asset["name"])) - product_hashes[file_triplet] = (asset["name"], hash) - - if verbose - @info("Calculated $hash for $(asset["name"])") - end - end - end - - return product_hashes -end - -function print_buildjl(io::IO, products::Vector, product_hashes::Dict, - bin_path::AbstractString) - print(io, """ - using BinaryProvider # requires BinaryProvider 0.3.0 or later - - # Parse some basic command-line arguments - const verbose = "--verbose" in ARGS - const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) - """) - - # Print out products - print(io, "products = [\n") - for prod in products - print(io, " $(repr(prod)),\n") - end - print(io, "]\n\n") - - # Print binary locations/tarball hashes - print(io, """ - # Download binaries from hosted location - bin_prefix = "$bin_path" - - # Listing of files generated by BinaryBuilder: - """) - - println(io, "download_info = Dict(") - for platform in sort(collect(keys(product_hashes))) - fname, hash = product_hashes[platform] - pkey = platform_key_abi(platform) - println(io, " $(pkey) => (\"\$bin_prefix/$(fname)\", \"$(hash)\"),") - end - println(io, ")\n") - - print(io, """ - # Install unsatisfied or updated dependencies: - unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) - dl_info = choose_download(download_info, platform_key_abi()) - if dl_info === nothing && unsatisfied - # If we don't have a compatible .tar.gz to download, complain. - # Alternatively, you could attempt to install from a separate provider, - # build from source or something even more ambitious here. - error("Your platform (\\\"\$(Sys.MACHINE)\\\", parsed as \\\"\$(triplet(platform_key_abi()))\\\") is not supported by this package!") - end - - # If we have a download, and we are unsatisfied (or the version we're - # trying to install is not itself installed) then load it up! - if unsatisfied || !isinstalled(dl_info...; prefix=prefix) - # Download and install binaries - install(dl_info...; prefix=prefix, force=true, verbose=verbose) - end - - # Write out a deps.jl file that will contain mappings for our products - write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) - """) -end - - - -if length(ARGS) < 1 || length(ARGS) > 3 - @error("Usage: generate_buildjl.jl path/to/build_tarballs.jl [ ]") - exit(1) -end - -build_tarballs_path = ARGS[1] -@info "Build tarballs script: $(build_tarballs_path)" -src_name = basename(dirname(build_tarballs_path)) -if 2 <= length(ARGS) <= 3 - repo_name = ARGS[2] -else - repo_name = "JuliaBinaryWrappers/$(src_name)_jll.jl" -end -@info "Repo name: $(repo_name)" - -if length(ARGS) == 3 - tag_name = ARGS[3] -else - ctx = Pkg.Types.Context() - # Force-update the registry here, since we may have pushed a new version recently - BinaryBuilder.update_registry(ctx) - versions = VersionNumber[] - paths = Pkg.Operations.registered_paths(ctx.env, BinaryBuilder.jll_uuid("$(src_name)_jll")) - if any(p -> isfile(joinpath(p, "Package.toml")), paths) - # Find largest version number that matches ours in the registered paths - for path in paths - append!(versions, Pkg.Compress.load_versions(joinpath(path, "Versions.toml"))) - end - end - if !isempty(versions) - last_version = maximum(versions) - tag_name = "$(src_name)-v$(last_version)" - else - @error("""Unable to determine latest version of $(src_name), - please specify it as third argument to this script: - generate_buildjl.jl $(build_tarballs_path) $(repo_name) """) - exit(1) - end -end -@info "Tag name: $(tag_name)" - -# First, snarf out the Product variables: -if !isfile(build_tarballs_path) - @error("Unable to open $(build_tarballs_path)") - exit(1) -end - -m = Module(:__anon__) -Core.eval(m, quote - using BinaryBuilder, Pkg.BinaryPlatforms - - # Override BinaryBuilder functionality so that it doesn't actually do anything - # it just saves the inputs so that we can mess around with them: - _name = nothing - _version = nothing - _producs = nothing - function build_tarballs(A, name, version, sources, script, platforms, products, dependencies; kwargs...) - global _name = name - global _version = version - - # Peel off the functionalization of Products - if isa(products, Function) - products = products(Prefix(".")) - end - global _products = products - return nothing - end -end) -include_string(m, String(read(build_tarballs_path))) -name, version, products = Core.eval(m, quote - _name, _version, _products -end) - -product_hashes = product_hashes_from_github_release(repo_name, tag_name) - -mkpath(joinpath(@__DIR__, "build")) -buildjl_path = joinpath(@__DIR__, "build", "build_$(name).v$(version).jl") -bin_path = "https://github.com/$(repo_name)/releases/download/$(tag_name)" -@info("Writing out to $(buildjl_path)") -open(buildjl_path, "w") do io - print_buildjl(io, products, product_hashes, bin_path) -end - -# julia --color=yes generate_buildjl.jl Yggdrasil/F/FLINT/build_tarballs.jl -# one needs to add prefix as first argument to LibraryProduct afterwards From e7dbb4747bfecdda4e6fa90341c02806a5cd2741 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 19 Apr 2020 00:48:13 +0200 Subject: [PATCH 07/11] add revdep tests --- .travis.yml | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 34c1456..4ee480e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: julia +dist: bionic os: - linux @@ -17,8 +18,43 @@ branches: - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ # release tags notifications: - - email: false + email: false jobs: allow_failures: - julia: nightly + include: + - &test-revdeps-short + stage: test revdeps + os: linux + julia: 1.0 + script: + - julia --project=revdeps -e 'using Pkg; Pkg.develop(PackageSpec(path=Base.pwd())); Pkg.build("LoadFlint");' + - julia --project=revdeps -e 'using Pkg; Pkg.add("Nemo"); Pkg.build("Nemo"); Pkg.test("Nemo");' + - <<: *test-revdeps-short + os: osx + julia: 1.0 + - <<: *test-revdeps-short + os: windows + julia: 1.0 + - <<: *test-revdeps-short + os: windows + julia: 1.4 + - &test-revdeps-full + stage: test revdeps full + os: linux + julia: 1.4 + script: + - julia --project=revdeps -e 'using Pkg; Pkg.develop(PackageSpec(path=Base.pwd())); Pkg.build("LoadFlint");' + - julia --project=revdeps -e 'using Pkg; Pkg.add("Nemo"); Pkg.build("Nemo"); Pkg.test("Nemo");' + - julia --project=revdeps -e 'using Pkg; Pkg.add("Polymake"); Pkg.build("Polymake"); Pkg.test("Polymake");' + - julia --project=revdeps -e 'using Polymake; c = polytope.cube(3); using Nemo; CC, s = Nemo.PolynomialRing(ComplexField(256), "s"); println(s);' + - <<: *test-revdeps-full + os: linux + julia: 1.3 + - <<: *test-revdeps-full + os: osx + julia: 1.4 + - <<: *test-revdeps-full + os: osx + julia: 1.3 From 8a9dd24c238aa703539c5db959a12d1b76054d43 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 19 Jun 2020 23:17:18 +0200 Subject: [PATCH 08/11] minor improvements --- deps/build.jl | 2 +- src/LoadFlint.jl | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index c6c7558..c62ca5e 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -35,7 +35,7 @@ elseif VERSION < v"1.3.0-rc4" const verbose = "--verbose" in ARGS # GMP and MPFR might not be needed on unix as julia should have those loaded already - # but on windows flint will not load without them so we put leave them here for simplicity + # but on windows flint will not load without them so we leave them here for simplicity dependencies = [ # This has to be in sync with the jll packages (using generate_build.jl and build_tarballs.jl from Yggdrasil) "build_GMP.v6.1.2.jl", diff --git a/src/LoadFlint.jl b/src/LoadFlint.jl index 614f8d3..608b151 100644 --- a/src/LoadFlint.jl +++ b/src/LoadFlint.jl @@ -13,6 +13,8 @@ else include(joinpath(deps_dir,"deps.jl")) end +libflint_handle = C_NULL + const __isthreaded = Ref(false) function __init__() @@ -30,19 +32,20 @@ function __init__() # the [.-] at the end is important to avoid matching libgmpxx f = filter(x->occursin(r"libgmp[.-]", x), dllist()) if length(f) == 0 - error("there should be at least one libgmp loaded.") + error("there must be at least one libgmp loaded.") elseif length(f) > 1 # at the moment there doesnt seem to be a way to avoid this # because julia comes with libgmp # and GMP_jll will load another libgmp - @warn("there should be exactly one libgmp, but we have: ", f) + @debug("there should be exactly one libgmp, but we have: ", f) end + # variable libflint comes from deps file or flint_jll + global libflint_handle = dlopen(libflint,RTLD_NOLOAD) + if !Sys.iswindows() && !__isthreaded[] - # variable libflint comes from deps file or flint_jll - flint_handle = dlopen(libflint,RTLD_NOLOAD) #to match the global gmp ones - fm = dlsym(flint_handle, :__flint_set_memory_functions) + fm = dlsym(libflint_handle, :__flint_set_memory_functions) ccall(fm, Nothing, (Ptr{Nothing},Ptr{Nothing},Ptr{Nothing},Ptr{Nothing}), cglobal(:jl_malloc), From dcd6d5583f759c8476097ba0f64a8e58b2535eb8 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 19 Jun 2020 23:19:55 +0200 Subject: [PATCH 09/11] Revert "bump gmp and flint" This partially reverts commit 56e89f4383c834c53791396b9257d5bb7de43c02, to switch to the older flint for testing. Also add compat to use old flint_jll. --- Project.toml | 1 + deps/build.jl | 2 +- deps/build_FLINT.v0.0.1.jl | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 deps/build_FLINT.v0.0.1.jl diff --git a/Project.toml b/Project.toml index 75e638f..5773481 100644 --- a/Project.toml +++ b/Project.toml @@ -13,6 +13,7 @@ MPFR_jll = "3a97d323-0669-5f0c-9066-3539efd106a3" [compat] BinaryProvider = "0.4, 0.5" julia = "1" +FLINT_jll = "0.0.1" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/deps/build.jl b/deps/build.jl index c62ca5e..d64b0d6 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -40,7 +40,7 @@ elseif VERSION < v"1.3.0-rc4" # This has to be in sync with the jll packages (using generate_build.jl and build_tarballs.jl from Yggdrasil) "build_GMP.v6.1.2.jl", "build_MPFR.v4.0.2.jl", - "build_FLINT.v2.6.0.jl", + "build_FLINT.v0.0.1.jl", ] const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) diff --git a/deps/build_FLINT.v0.0.1.jl b/deps/build_FLINT.v0.0.1.jl new file mode 100644 index 0000000..3a0d754 --- /dev/null +++ b/deps/build_FLINT.v0.0.1.jl @@ -0,0 +1,48 @@ +using BinaryProvider # requires BinaryProvider 0.3.0 or later + +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, ["libflint"], :libflint), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/JuliaBinaryWrappers/FLINT_jll.jl/releases/download/FLINT-v0.0.1+0" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + Linux(:aarch64, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.aarch64-linux-gnu.tar.gz", "ec9887a7f7fa75cd40cbf9816d4aa85c14682be8c122f2767dd33d6e3485c57d"), + Linux(:aarch64, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.aarch64-linux-musl.tar.gz", "2095b17382f4f6e93cc9c6682ce1bca2b5446e40ef3befcc8a39b58fbe021cf7"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/FLINT.v0.0.1.armv7l-linux-gnueabihf.tar.gz", "8a90c173a644001f781d4045e02cc3683c28ea7503c380d4500636827afe4b6b"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/FLINT.v0.0.1.armv7l-linux-musleabihf.tar.gz", "75a5b34ba2362f4b480218090cc0d1c955bf339ee036cf7e318b1c0e463b4f3b"), + Linux(:i686, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.i686-linux-gnu.tar.gz", "efda0718eac26e25a6a91f7407836779d1ce7de3518e5f8ca4e940eecc1f7cba"), + Linux(:i686, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.i686-linux-musl.tar.gz", "9504a94062e5836c47c5cb731e8c967b917230e50f99e8b82bbfd9ca87b7d878"), + Windows(:i686) => ("$bin_prefix/FLINT.v0.0.1.i686-w64-mingw32.tar.gz", "c0a5fc39425467da297ccab4c10c7f4065cf06f2b846b033ebbc455dfa2efdc0"), + Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.powerpc64le-linux-gnu.tar.gz", "3c8aaa11fbd591b21fe2defb4b0429fb025e375990c71dbd09cf1f496353dfd8"), + MacOS(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-apple-darwin14.tar.gz", "24ac5e8e9891426c221bca1009fb99b8799a4c1c0a037d8b54fdbb09000e0813"), + Linux(:x86_64, libc=:glibc) => ("$bin_prefix/FLINT.v0.0.1.x86_64-linux-gnu.tar.gz", "68319251b42c7fc306ca92a6c9c9c5883bdbf41833c388c214f3f3672cb03ad0"), + Linux(:x86_64, libc=:musl) => ("$bin_prefix/FLINT.v0.0.1.x86_64-linux-musl.tar.gz", "9ca6dd40dbff5d7b43ddad0206e27c6e4c5570cd87d1248911c63d9a0ce17e60"), + FreeBSD(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-unknown-freebsd11.1.tar.gz", "b7c82997dbb802eb5fc5b0aaad6ca5ce61306af821141c3b47a4f65da1818ff0"), + Windows(:x86_64) => ("$bin_prefix/FLINT.v0.0.1.x86_64-w64-mingw32.tar.gz", "02c0a3bc08e00d3ad59a00173407b62fe91c1269e5903f8b7365f856ec233f82"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") +end + +# If we have a download, and we are unsatisfied (or the version we're +# trying to install is not itself installed) then load it up! +if unsatisfied || !isinstalled(dl_info...; prefix=prefix) + # Download and install binaries + install(dl_info...; prefix=prefix, force=true, verbose=verbose) +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) From cbc18e38f9416f805b97f2b3af6ed86913348cff Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Mon, 22 Jun 2020 10:31:34 +0200 Subject: [PATCH 10/11] travis: work around Pkg.jl / JULIA_PROJECT weirdness .... --- .travis.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ee480e..27d90fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,9 @@ jobs: os: linux julia: 1.0 script: - - julia --project=revdeps -e 'using Pkg; Pkg.develop(PackageSpec(path=Base.pwd())); Pkg.build("LoadFlint");' - - julia --project=revdeps -e 'using Pkg; Pkg.add("Nemo"); Pkg.build("Nemo"); Pkg.test("Nemo");' + - export JULIA_PROJECT=revdeps + - julia -e 'using Pkg; Pkg.develop(PackageSpec(path=Base.pwd())); Pkg.build("LoadFlint");' + - julia -e 'using Pkg; Pkg.add("Nemo"); Pkg.build("Nemo"); Pkg.test("Nemo");' - <<: *test-revdeps-short os: osx julia: 1.0 @@ -45,10 +46,13 @@ jobs: os: linux julia: 1.4 script: - - julia --project=revdeps -e 'using Pkg; Pkg.develop(PackageSpec(path=Base.pwd())); Pkg.build("LoadFlint");' - - julia --project=revdeps -e 'using Pkg; Pkg.add("Nemo"); Pkg.build("Nemo"); Pkg.test("Nemo");' - - julia --project=revdeps -e 'using Pkg; Pkg.add("Polymake"); Pkg.build("Polymake"); Pkg.test("Polymake");' - - julia --project=revdeps -e 'using Polymake; c = polytope.cube(3); using Nemo; CC, s = Nemo.PolynomialRing(ComplexField(256), "s"); println(s);' + - export JULIA_PROJECT=revdeps + - julia -e 'using Pkg; Pkg.develop(PackageSpec(path=Base.pwd())); Pkg.build("LoadFlint");' + - julia -e 'using Pkg; Pkg.add("Nemo"); Pkg.build("Nemo");' + - julia -e 'using Pkg; Pkg.test("Nemo");' + - julia -e 'using Pkg; Pkg.add("Polymake"); Pkg.build("Polymake");' + - julia -e 'using Pkg; Pkg.test("Polymake");' + - julia -e 'using Polymake; c = polytope.cube(3); using Nemo; CC, s = Nemo.PolynomialRing(ComplexField(256), "s"); println(s);' - <<: *test-revdeps-full os: linux julia: 1.3 From 1196ff59e83557c0d8624248a43b6a77cd2ecdbe Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Tue, 23 Jun 2020 11:05:29 +0200 Subject: [PATCH 11/11] bump to 0.2 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5773481..0d3c069 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LoadFlint" uuid = "472f376f-f1cf-461b-9ac1-d103423be9b7" authors = ["Claus Fieker "] -version = "0.1.4" +version = "0.2.0" [deps] BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"