Skip to content

Commit

Permalink
Trac #29369: spkg-configure.m4 for brial
Browse files Browse the repository at this point in the history
Nothing unusual here except that this is a C++ library with no pkg-
config file, and that makes it a bit harder to search for. I've assumed
that any version we find is acceptable, which probably is not quite
true.

URL: https://trac.sagemath.org/29369
Reported by: mjo
Ticket author(s): Michael Orlitzky
Reviewer(s): Matthias Koeppe, Dima Pasechnik
  • Loading branch information
Release Manager committed Mar 29, 2020
2 parents ff04513 + 40a59a4 commit 5759437
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 18 deletions.
1 change: 1 addition & 0 deletions build/make/deps
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ sagelib: \
$(inst_ratpoints) \
$(inst_readline) \
$(inst_rw) \
$(inst_sage_brial) \
$(inst_sage_conf) \
$(inst_singular) \
$(inst_six) \
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/brial/checksums.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ tarball=brial-VERSION.tar.bz2
sha1=5795c0d73b63e9daa5318b0f22514b7797c59823
md5=fddbc0cebfbac161de110acf30a6b89d
cksum=2578889224
upstream_url=https://github.com/BRiAl/BRiAl/releases/download/VERSION/brial-VERSION.tar.bz2
2 changes: 1 addition & 1 deletion build/pkgs/brial/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
boost_cropped m4ri libpng $(PYTHON) | pip pkgconf
boost_cropped m4ri libpng | pkgconf

----------
All lines of this file are ignored except the first.
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/brial/distros/arch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brial
1 change: 1 addition & 0 deletions build/pkgs/brial/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brial
1 change: 1 addition & 0 deletions build/pkgs/brial/distros/debian.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libbrial-dev libbrial-groebner-dev
2 changes: 2 additions & 0 deletions build/pkgs/brial/distros/fedora.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brial
brial-devel
1 change: 1 addition & 0 deletions build/pkgs/brial/distros/gentoo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sci-libs/brial
1 change: 1 addition & 0 deletions build/pkgs/brial/distros/nix.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brial
47 changes: 47 additions & 0 deletions build/pkgs/brial/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
SAGE_SPKG_CONFIGURE([brial], [
SAGE_SPKG_DEPCHECK([boost m4ri], [
# If we're using the system m4ri and boost, ensure that we can
# compile and run an executable linked against both libbrial and
# libbrial_groebner (both are used by SageMath).
AC_LANG_PUSH(C++)
SAVED_LIBS=$LIBS
LIBS="$LIBS -lbrial -lbrial_groebner"
AC_MSG_CHECKING([if we can link against brial libraries])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#include <polybori.h>
#include <polybori/groebner/groebner_alg.h>
USING_NAMESPACE_PBORI
USING_NAMESPACE_PBORIGB
class MyConstant : public BooleConstant{
public: void negate() { this->m_value = !this->m_value; }
};
],[
BoolePolyRing r = BoolePolyRing(2, COrderEnums::dlex);
ReductionStrategy rs = ReductionStrategy(r);
rs.llReduceAll(); // uses groebner lib
if (2 != r.nVariables()) { return 1; }
if (r.constant(true) == r.constant(false)) { return 2; }
MyConstant f = MyConstant();
f.negate(); // ensures v1.1.0+ if m_value isn't const
if (!f.isOne()) { return 3; }
return 0;
])
],
[
AC_MSG_RESULT([yes])
sage_spkg_install_brial=no
],
[
AC_MSG_RESULT([no])
sage_spkg_install_brial=yes
])
LIBS=$SAVED_LIBS
AC_LANG_POP
],
[ # If we're installing sage's boost or m4ri, then we have to
# install its BRiAl, too.
sage_spkg_install_brial=yes
])
])
18 changes: 4 additions & 14 deletions build/pkgs/brial/spkg-install.in
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
cd src

export PYTHON=sage-python23

#
# BRiAl consists of a C++ library and a Python module
#
# First, install the library
# BRiAl consists of a both C++ library and a SageMath-specific python
# module. This spkg installs only the C++ library; the python module
# is installed by the "sage_brial" spkg.
#

cd src
sdh_configure \
--enable-shared --disable-static \
--with-boost-unit-test-framework=no
sdh_make
sdh_make_install

#
# Next, install the Python module
#

cd sage-brial && sdh_pip_install .
1 change: 0 additions & 1 deletion build/pkgs/brial/spkg-legacy-uninstall.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
echo "Cleaning out old PolyBoRi and BRiAl installations"
rm -rf "$SAGE_LOCAL"/lib/python*/site-packages/{polybori,brial}
rm -f "$SAGE_LOCAL"/lib/lib{polybori,brial}*
rm -rf "$SAGE_LOCAL"/include/polybori*
rm -rf "$SAGE_LOCAL"/share/polybori
19 changes: 19 additions & 0 deletions build/pkgs/sage_brial/SPKG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
= BRiAl =

== Description ==

BRiAl is the successor to PolyBoRi.

The core of PolyBoRi is a C++ library, which provides high-level data
types for Boolean polynomials and monomials, exponent vectors, as well
as for the underlying polynomial rings and subsets of the powerset of
the Boolean variables. This SPKG is a (sage) python wrapper around the
functionality of the C++ library.

== License ==

GPL version 2 or later

== Upstream Contact ==

https://github.com/BRiAl/BRiAl
5 changes: 5 additions & 0 deletions build/pkgs/sage_brial/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=brial-VERSION.tar.bz2
sha1=5795c0d73b63e9daa5318b0f22514b7797c59823
md5=fddbc0cebfbac161de110acf30a6b89d
cksum=2578889224
upstream_url=https://github.com/BRiAl/BRiAl/releases/download/VERSION/brial-VERSION.tar.bz2
5 changes: 5 additions & 0 deletions build/pkgs/sage_brial/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
brial $(PYTHON) | pip

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
1 change: 1 addition & 0 deletions build/pkgs/sage_brial/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.5
7 changes: 7 additions & 0 deletions build/pkgs/sage_brial/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# BRiAl consists of a both C++ library and a SageMath-specific python
# module. This spkg installs only the python module; the C++ library
# is installed by the "brial" spkg.
#
export PYTHON=sage-python23
cd src/sage-brial && sdh_pip_install .
2 changes: 2 additions & 0 deletions build/pkgs/sage_brial/spkg-legacy-uninstall.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "Cleaning out old PolyBoRi and BRiAl installations"
rm -rf "$SAGE_LOCAL"/lib/python*/site-packages/{polybori,brial}
1 change: 1 addition & 0 deletions build/pkgs/sage_brial/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
standard
2 changes: 1 addition & 1 deletion m4/sage_spkg_configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ AC_DEFUN([SAGE_SPKG_CONFIGURE], [
AC_DEFUN([SAGE_SPKG_DEPCHECK], [
m4_foreach_w([DEP], $1, [
AC_REQUIRE([SAGE_SPKG_CONFIGURE_]m4_toupper(DEP))])
AC_MSG_CHECKING([whether any of $1 is installed or will be installed as SPKG])
AC_MSG_CHECKING([whether any of $1 is installed as or will be installed as SPKG])
AS_IF([test x = y m4_foreach_w([DEP], $1, [ -o [x$sage_spkg_install_]DEP = xyes])], [
AC_MSG_RESULT([yes; install SPKG_NAME as well])
[sage_spkg_install_]SPKG_NAME=yes], [
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def installed_packages(exclude_pip=True):
EXAMPLES::
sage: installed_packages() # optional - build
{...'brial': ...'pynac': ...}
{...'alabaster': ...'pynac': ...}
.. SEEALSO::
Expand Down

0 comments on commit 5759437

Please sign in to comment.