From aa1cdd522107fb534b60635333024d51422129c4 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 13 Nov 2020 22:08:49 +0100 Subject: [PATCH] [polymake] move dependency tree artifact generator from init_block to jl script (#2092) for compatibility with julia 1.6+ (then we can use it in Polymake.jl but also in the ci for libpolymake_julia) --- P/polymake/build_tarballs.jl | 36 ++++------------- .../bundled/patches/generate_deps_tree.jl | 39 +++++++++++++++++++ 2 files changed, 46 insertions(+), 29 deletions(-) create mode 100644 P/polymake/bundled/patches/generate_deps_tree.jl diff --git a/P/polymake/build_tarballs.jl b/P/polymake/build_tarballs.jl index cebde5acd66..3d6f038b948 100644 --- a/P/polymake/build_tarballs.jl +++ b/P/polymake/build_tarballs.jl @@ -3,7 +3,7 @@ using BinaryBuilder, Pkg name = "polymake" -version = v"4.2.0" +version = v"4.2.1" # Collection of sources required to build polymake sources = [ @@ -72,7 +72,7 @@ ninja -v -C build/Opt install if [[ $target == *darwin* ]]; then atomic_patch -R -p1 ../patches/polymake-cross-build.patch fi -install -m 444 -D support/*.pl $prefix/share/polymake/support/ +install -m 644 -D support/*.pl $prefix/share/polymake/support/ # replace miniperl sed -i -e "s/miniperl-for-build/perl/" ${libdir}/polymake/config.ninja ${bindir}/polymake* @@ -88,6 +88,9 @@ sed -e "s#${prefix}#\${prefix}#g" ${libdir}/polymake/config.ninja > ${libdir}/po # cleanup symlink tree rm -rf ${prefix}/deps +# copy julia script to generate dependency-tree at load time +cp ../patches/generate_deps_tree.jl $prefix/share/polymake + install_license COPYING """ @@ -105,6 +108,7 @@ products = [ LibraryProduct("libpolymake-apps-rt", :libpolymake_apps_rt; dont_dlopen=true) ExecutableProduct("polymake", :polymake) ExecutableProduct("polymake-config", Symbol("polymake_config")) + FileProduct("share/polymake/generate_deps_tree.jl", :generate_deps_tree) ] # Dependencies that must be installed before this package can be built @@ -123,31 +127,5 @@ dependencies = [ ] # Build the tarballs, and possibly a `build.jl` as well. -build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version=v"7", init_block=""" - - mutable_artifacts_toml = joinpath(dirname(@__DIR__), "MutableArtifacts.toml") - polymake_tree = "polymake_tree" - polymake_tree_hash = artifact_hash(polymake_tree, mutable_artifacts_toml) - - # create a directory tree for polymake with links to dependencies - # looking similiar to the tree in the build environment - # for compiling wrappers at run-time - polymake_tree_hash = create_artifact() do art_dir - mkpath(joinpath(art_dir,"deps")) - for dep in [FLINT_jll, GMP_jll, MPFR_jll, PPL_jll, Perl_jll, bliss_jll, boost_jll, cddlib_jll, lrslib_jll, normaliz_jll] - symlink(dep.artifact_dir, joinpath(art_dir,"deps","\$dep")) - end - for dir in readdir(polymake_jll.artifact_dir) - symlink(joinpath(polymake_jll.artifact_dir,dir), joinpath(art_dir,dir)) - end - end - bind_artifact!(mutable_artifacts_toml, - polymake_tree, - polymake_tree_hash; - force=true - ) - - # Point polymake to our custom tree - ENV["POLYMAKE_DEPS_TREE"] = artifact_path(polymake_tree_hash) -""") +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version=v"7") diff --git a/P/polymake/bundled/patches/generate_deps_tree.jl b/P/polymake/bundled/patches/generate_deps_tree.jl new file mode 100644 index 00000000000..80ece78c16b --- /dev/null +++ b/P/polymake/bundled/patches/generate_deps_tree.jl @@ -0,0 +1,39 @@ +using Pkg.Artifacts +using polymake_jll + +function prepare_deps_tree() + mutable_artifacts_toml = joinpath(dirname(pathof(polymake_jll)), "..", "MutableArtifacts.toml") + polymake_tree = "polymake_tree" + polymake_tree_hash = artifact_hash(polymake_tree, mutable_artifacts_toml) + + # create a directory tree for polymake with links to dependencies + # looking similiar to the tree in the build environment + # for compiling wrappers at run-time + polymake_tree_hash = create_artifact() do art_dir + mkpath(joinpath(art_dir,"deps")) + for dep in [polymake_jll.FLINT_jll, + polymake_jll.GMP_jll, + polymake_jll.MPFR_jll, + polymake_jll.PPL_jll, + polymake_jll.Perl_jll, + polymake_jll.bliss_jll, + polymake_jll.boost_jll, + polymake_jll.cddlib_jll, + polymake_jll.lrslib_jll, + polymake_jll.normaliz_jll] + symlink(dep.artifact_dir, joinpath(art_dir,"deps","$dep")) + end + for dir in readdir(polymake_jll.artifact_dir) + symlink(joinpath(polymake_jll.artifact_dir,dir), joinpath(art_dir,dir)) + end + end + + bind_artifact!(mutable_artifacts_toml, + polymake_tree, + polymake_tree_hash; + force=true + ) + + # Point polymake to our custom tree + return artifact_path(polymake_tree_hash) +end