Skip to content

Commit

Permalink
[SPEX] Add builder (#5504)
Browse files Browse the repository at this point in the history
* add SPEX builder

* gcc 9

* c99

* add back gcc9

* compile only SPEX

* patch and manually build libraries

* typo

* attempt to fix windows build

* typos in if

* change deps, remove experimental plats

* Update S/SPEX/build_tarballs.jl

Co-authored-by: Mosè Giordano <[email protected]>

* Try 6.1.2 GMP

* Try error msg recommendation

Co-authored-by: Mosè Giordano <[email protected]>
  • Loading branch information
Will Kimmerer and giordano authored Sep 17, 2022
1 parent 7a5b427 commit 3f9ce08
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
57 changes: 57 additions & 0 deletions S/SPEX/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using BinaryBuilder, Pkg

name = "SPEX"
version = v"1.1.5"

# Collection of sources required to build SuiteSparse:GraphBLAS
sources = [
GitSource("https://github.com/clouren/SPEX",
"9471682b072419063d73bc950949bf3458b187f9"),
DirectorySource("./bundled")
]

# Bash recipe for building across all platforms
script = raw"""
# Compile GraphBLAS
cd ${WORKSPACE}/srcdir/SPEX
atomic_patch -p1 ../werror.patch
CFLAGS="${CFLAGS} -std=c99"
cd ${WORKSPACE}/srcdir/SPEX/SPEX/SPEX_Util
if [[ "${target}" == *mingw* ]]; then
make library -j${nproc} UNAME=Windows SO_OPTS="${SO_OPTS} -shared -L${libdir}"
else
make library -j${nproc}
fi
cp ${WORKSPACE}/srcdir/SPEX/include/SPEX_Util.h ${includedir}
cp ${WORKSPACE}/srcdir/SPEX/lib/libspexutil* ${libdir}
cd ${WORKSPACE}/srcdir/SPEX/SPEX/SPEX_Left_LU
if [[ "${target}" == *mingw* ]]; then
make library UNAME=Windows SO_OPTS="${SO_OPTS} -shared -L${libdir}"
else
make library -j${nproc}
fi
cp ${WORKSPACE}/srcdir/SPEX/include/SPEX_Left_LU.h ${includedir}
cp ${WORKSPACE}/srcdir/SPEX/lib/libspexleftlu* ${libdir}
install_license ${WORKSPACE}/srcdir/SPEX/SPEX/LICENSE.txt
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products = [
LibraryProduct("libspexutil", :libspexutil),
LibraryProduct("libspexleftlu", :libspexleftlu)
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("SuiteSparse_jll"),
Dependency("GMP_jll", v"6.2.0"),
Dependency("MPFR_jll", v"4.1.1")
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"9", julia_compat="1.6")
26 changes: 26 additions & 0 deletions S/SPEX/bundled/werror.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/SPEX/SPEX_Left_LU/Lib/Makefile b/SPEX/SPEX_Left_LU/Lib/Makefile
index 72e207a..7032800 100644
--- a/SPEX/SPEX_Left_LU/Lib/Makefile
+++ b/SPEX/SPEX_Left_LU/Lib/Makefile
@@ -22,7 +22,7 @@ SUITESPARSE ?= $(realpath $(CURDIR)/../../..)
include ../../../SuiteSparse_config/SuiteSparse_config.mk

# uncomment for extra error checking:
-CFLAGS += -Wall -Wextra -Wpedantic -Werror
+CFLAGS += -Wall -Wextra -Wpedantic

# SPEX_Left LU depends on SuiteSparse_config, AMD, COLAMD, M, GMP, and MPFR
LDLIBS += -lspexutil -lsuitesparseconfig -lamd -lcolamd -lm -lgmp -lmpfr
diff --git a/SPEX/SPEX_Util/Lib/Makefile b/SPEX/SPEX_Util/Lib/Makefile
index 754ab87..7ac6e88 100644
--- a/SPEX/SPEX_Util/Lib/Makefile
+++ b/SPEX/SPEX_Util/Lib/Makefile
@@ -22,7 +22,7 @@ SUITESPARSE ?= $(realpath $(CURDIR)/../../..)
include ../../../SuiteSparse_config/SuiteSparse_config.mk

# uncomment for extra error checking:
-CFLAGS += -Wall -Wextra -Wpedantic -Werror
+CFLAGS += -Wall -Wextra -Wpedantic

# SPEX_Util depends on SuiteSparse_config, AMD, COLAMD, M, GMP, and MPFR
LDLIBS += -lsuitesparseconfig -lamd -lcolamd -lm -lgmp -lmpfr

0 comments on commit 3f9ce08

Please sign in to comment.