From 83791f77c774984fd8fcbb268fa479f070cfa761 Mon Sep 17 00:00:00 2001 From: bzinberg Date: Tue, 11 May 2021 16:00:50 -0400 Subject: [PATCH] Migrate from BinDeps to BinaryBuilder / JLL (#40) * Migrate from BinDeps to BinaryBuilder / JLL, except the nash part * Remove `BinDeps` and `Homebrew` dependencies (fixes https://github.com/JuliaPolyhedra/LRSLib.jl/issues/38) * Add `lrslib_jll` dependency * Delete `deps/` (it's no longer used) * make method signature more specific, so that there is no ambiguity with its Polyhedra.jl parent * dummy commit to trigger CI re-run * bump Polyhedra.jl dependency to 0.6.14 * Require lrslib_jll >= 0.2.0 See https://github.com/JuliaPackaging/Yggdrasil/pull/2875 * No need to specialize to HIndex anymore See discussion in https://github.com/JuliaPolyhedra/LRSLib.jl/pull/40#discussion_r618711213 * Require lrslib_jll == 0.2.0 See https://github.com/JuliaPolyhedra/LRSLib.jl/pull/40#discussion_r618712598 --- Project.toml | 10 ++-- deps/.gitignore | 6 --- deps/build.jl | 110 --------------------------------------- deps/makefile.liblrsnash | 7 --- deps/makefile.osx.patch | 11 ---- src/LRSLib.jl | 8 +-- 6 files changed, 5 insertions(+), 147 deletions(-) delete mode 100644 deps/.gitignore delete mode 100644 deps/build.jl delete mode 100644 deps/makefile.liblrsnash delete mode 100644 deps/makefile.osx.patch diff --git a/Project.toml b/Project.toml index edc429c..ba83c87 100644 --- a/Project.toml +++ b/Project.toml @@ -4,18 +4,16 @@ repo = "https://github.com/JuliaPolyhedra/LRSLib.jl.git" version = "0.5.0" [deps] -BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee" -Homebrew = "d9be37ee-ecc9-5288-90f1-b9ca67657a75" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029" +lrslib_jll = "3873f7d0-7b7c-52c3-bdf4-8ab39b8f337a" [compat] -BinDeps = "0.7, 0.8, 1" -Homebrew = "0.7" -Polyhedra = "0.6.8" -julia = "1" +Polyhedra = "0.6.14" +julia = "1.3" +lrslib_jll = "= 0.2.0" [extras] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/deps/.gitignore b/deps/.gitignore deleted file mode 100644 index 42ced35..0000000 --- a/deps/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -builds -deps.jl -downloads -src -usr -build.log diff --git a/deps/build.jl b/deps/build.jl deleted file mode 100644 index 7ce503f..0000000 --- a/deps/build.jl +++ /dev/null @@ -1,110 +0,0 @@ -using BinDeps -using Libdl - -@BinDeps.setup - -lrslib_commit = "d8b723a2c315614979a8354f9e768d273d14a215" -#lrsname = "lrslib-061" -lrsname = "lrslib-$lrslib_commit" -lrsnashname = "lrsnashlib-$lrslib_commit" -lrslibname = "liblrs" - -# julia installs libgmp10 but not libgmp-dev since it -# does not have to compile C program with GMP, -# e.g. it does not need the headers. -# FIXME BinDeps doesn't work with header, it only works for libraries because it checks for the .so -# It sees libgmp.so (installed by libgmp10 as a julia dependency) and thinks that it's ok but -# it does not have the headers -#libgmpdev = library_dependency("libgmp-dev", aliases=["libgmp"]) -liblrs = library_dependency("liblrs", aliases=[lrsname, "liblrsgmp"])#, depends=[libgmpdev]) -liblrsnash = library_dependency("liblrsnash", aliases=[lrsnashname, "liblrsnashgmp"]) - -official_repo = "http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/$lrsname.tar.gz" -forked_repo = "https://github.com/JuliaPolyhedra/lrslib/archive/$lrslib_commit.zip" - -#GMP -@static if Sys.islinux() - const has_apt = try success(`apt-get -v`) catch e false end - const has_yum = try success(`yum --version`) catch e false end - const has_pacman = try success(`pacman -Qq`) catch e false end - if has_apt || has_yum - if has_apt - pkgname = "libgmp-dev" - pkgman = "apt-get" - else - pkgname = "libgmp-devel or gmp-devel" - pkgman = "yum" - end - - println("Warning: The compilation of LRS requires the header gmp.h provided by the package $pkgname.") - println("If the compilation fails, please install it as follows:") - println("\$ sudo $pkgman install $pkgname") - end -end - -#LRS -provides(Sources, - Dict(URI(forked_repo) => liblrs), unpacked_dir="$lrsname") - -lrssrcdir = joinpath(BinDeps.srcdir(liblrs), lrsname) -lrsprefixdir = joinpath(BinDeps.usrdir(liblrs)) -lrslibdir = joinpath(lrsprefixdir, "lib") - -targetdirs = AbstractString["$lrslibname.$(Libdl.dlext)"] -patchdir = BinDeps.depsdir(liblrs) - -@static if Sys.isapple() - using Homebrew - Homebrew.add("gmp") - homebrew_includedir = joinpath(Homebrew.brew_prefix, "include") - homebrew_libdir = joinpath(Homebrew.brew_prefix, "lib") - provides(BuildProcess, - (@build_steps begin - GetSources(liblrs) - CreateDirectory(lrsprefixdir) - CreateDirectory(lrslibdir) - @build_steps begin - ChangeDirectory(lrssrcdir) - FileRule(joinpath(lrslibdir,"$lrslibname.$(Libdl.dlext)"),@build_steps begin - pipeline(`cat $patchdir/makefile.osx.patch`, `patch`) - `make $lrslibname.$(Libdl.dlext).0 SONAME=$lrslibdir/$lrslibname.$(Libdl.dlext) SHLIB=$lrslibname.$(Libdl.dlext).0 SHLINK=$lrslibname.$(Libdl.dlext) INCLUDEDIR=$homebrew_includedir LIBDIR=$homebrew_libdir` - `cp $lrslibname.$(Libdl.dlext).0 $lrslibdir/$lrslibname.$(Libdl.dlext)` - end) - end - end),liblrs) - provides(BuildProcess, - (@build_steps begin - ChangeDirectory(lrssrcdir) - FileRule(joinpath(lrslibdir,"liblrsnash.$(Libdl.dlext)"),@build_steps begin - `cp $patchdir/makefile.liblrsnash $lrssrcdir` - `make -f makefile.liblrsnash SHLIB=liblrsnash.$(Libdl.dlext) LIBLRSDIR=$lrslibdir INCLUDEDIR=$homebrew_includedir LIBDIR=$homebrew_libdir` - `cp liblrsnash.$(Libdl.dlext) $lrslibdir/liblrsnash.$(Libdl.dlext)` - end) - end),liblrsnash) -else - provides(BuildProcess, - (@build_steps begin - GetSources(liblrs) - CreateDirectory(lrsprefixdir) - CreateDirectory(lrslibdir) - @build_steps begin - ChangeDirectory(lrssrcdir) - FileRule(joinpath(lrslibdir,"$lrslibname.$(Libdl.dlext)"),@build_steps begin - `make $lrslibname.$(Libdl.dlext).0 SONAME=$lrslibname.$(Libdl.dlext) SHLIB=$lrslibname.$(Libdl.dlext).0` - `cp $lrslibname.$(Libdl.dlext).0 $lrslibdir/$lrslibname.$(Libdl.dlext)` - end) - end - end),liblrs) - provides(BuildProcess, - (@build_steps begin - ChangeDirectory(lrssrcdir) - FileRule(joinpath(lrslibdir,"liblrsnash.$(Libdl.dlext)"),@build_steps begin - `cp $patchdir/makefile.liblrsnash $lrssrcdir` - `make -f makefile.liblrsnash SHLIB=liblrsnash.$(Libdl.dlext) LIBLRSDIR=$lrslibdir` - `cp liblrsnash.$(Libdl.dlext) $lrslibdir/liblrsnash.$(Libdl.dlext)` - end) - end),liblrsnash) -end - -BinDeps.@install Dict([(:liblrs, :liblrs), - (:liblrsnash, :liblrsnash)]) diff --git a/deps/makefile.liblrsnash b/deps/makefile.liblrsnash deleted file mode 100644 index 39fbcdf..0000000 --- a/deps/makefile.liblrsnash +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEDIR = /usr/include -LIBDIR = /usr/lib -SHLIB = liblrsnash.so -#LIBLRSDIR = /PATH/TO/liblrs.so - -all: lrsnashlib.c lrsnashlib.h - $(CC) -shared -fPIC -O3 -o $(SHLIB) lrsnashlib.c -L$(LIBLRSDIR) -llrs -L${LIBDIR} -lgmp -Wl,-rpath,$(LIBLRSDIR) -DGMP -DMA -DLRS_QUIET -I${INCLUDEDIR} diff --git a/deps/makefile.osx.patch b/deps/makefile.osx.patch deleted file mode 100644 index 6ef9d72..0000000 --- a/deps/makefile.osx.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- makefile.orig 2018-07-03 13:37:36.000000000 +0900 -+++ makefile 2019-01-20 12:17:48.000000000 +0900 -@@ -204,7 +204,7 @@ SHLIBBIN=lrs-shared redund-shared lrsnas - # Building (linking) the shared library, and relevant symlinks. - - ${SHLIB}: ${SHLIBOBJ} -- $(CC) -shared -Wl,-soname=$(SONAME) $(SHLIBFLAGS) -o $@ ${SHLIBOBJ} -lgmp -+ $(CC) -shared -Wl,-install_name,$(SONAME) $(SHLIBFLAGS) -o $@ ${SHLIBOBJ} -L${LIBDIR} -lgmp - - ${SONAME}: ${SHLIB} - ln -sf ${SHLIB} ${SONAME} diff --git a/src/LRSLib.jl b/src/LRSLib.jl index cd8d34a..7789e2d 100644 --- a/src/LRSLib.jl +++ b/src/LRSLib.jl @@ -1,16 +1,10 @@ module LRSLib -using BinDeps using Polyhedra using LinearAlgebra +using lrslib_jll using Markdown -if isfile(joinpath(dirname(@__FILE__),"..","deps","deps.jl")) - include("../deps/deps.jl") - else - error("LRSLib not properly installed. Please run Pkg.build(\"LRSLib\")") -end - macro lrs_ccall(f, args...) quote ret = ccall(($"lrs_$(f)_gmp", liblrs), $(map(esc,args)...))