summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sci-mathematics/cadabra/Manifest1
-rw-r--r--sci-mathematics/cadabra/cadabra-2.3.8.ebuild102
-rw-r--r--sci-mathematics/cadabra/files/cadabra2-CMake.patch69
-rw-r--r--sci-mathematics/cadabra/metadata.xml29
4 files changed, 201 insertions, 0 deletions
diff --git a/sci-mathematics/cadabra/Manifest b/sci-mathematics/cadabra/Manifest
new file mode 100644
index 000000000000..c133327bd4a3
--- /dev/null
+++ b/sci-mathematics/cadabra/Manifest
@@ -0,0 +1 @@
+DIST cadabra-2.3.8.tar.gz 24647809 BLAKE2B 70858dab32c31b75b32b9eceaa60166accb0167cd8873c0058e6ef8ccfd3e3643da20b96fce3dde8be0e3fc5fdd42e1e6dac8e394643786163095a72239701d5 SHA512 06ebb148d911094dbdcc76747404cf7eb8f31e3bc458a81a37d4ed3bee3df97fedb9f11ed2251c133914aa6482db5b01d8848ef356ea1a0c83f59e686eebcfa5
diff --git a/sci-mathematics/cadabra/cadabra-2.3.8.ebuild b/sci-mathematics/cadabra/cadabra-2.3.8.ebuild
new file mode 100644
index 000000000000..7d5bd7225161
--- /dev/null
+++ b/sci-mathematics/cadabra/cadabra-2.3.8.ebuild
@@ -0,0 +1,102 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MAJOR=$(ver_cut 1)
+CADABRA=${PN}${MAJOR}
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit xdg-utils python-single-r1 cmake
+
+DESCRIPTION="Field-theory motivated approach to computer algebra"
+HOMEPAGE="https://cadabra.science/"
+
+if [[ "${PV}" == *9999* ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/kpeeters/${CADABRA}.git"
+else
+ SRC_URI="https://github.com/kpeeters/${CADABRA}/archive/${PV}.tar.gz
+ -> ${P}.tar.gz"
+ S="${WORKDIR}"/${CADABRA}-${PV}
+ KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3"
+SLOT="0/${MAJOR}"
+IUSE="gtk +jupyter test"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ app-text/dvipng
+ dev-db/sqlite:3=
+ dev-libs/boost:=
+ dev-libs/gmp:=[cxx]
+ dev-libs/jsoncpp:=
+ dev-libs/libsigc++:2
+ dev-texlive/texlive-basic
+ $(python_gen_cond_dep '
+ dev-python/gmpy:2[${PYTHON_USEDEP}]
+ dev-python/matplotlib[${PYTHON_USEDEP}]
+ dev-python/sympy[${PYTHON_USEDEP}]
+ jupyter? ( dev-python/jupyter[${PYTHON_USEDEP}] )
+ ')
+ gtk? (
+ dev-cpp/glibmm:2
+ dev-cpp/gtkmm:3.0
+ dev-libs/glib:2
+ )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="$(python_gen_cond_dep 'dev-python/pybind11[${PYTHON_USEDEP}]')"
+
+PATCHES=( "${FILESDIR}"/${CADABRA}-CMake.patch )
+
+DOCS=( CODE_OF_CONDUCT.md CONTRIBUTING.md JUPYTER.rst README.rst)
+
+# Because we do not want to pull in "_XDG_DEPEND" dependencies with USE="-gtk"
+xdg_update() {
+ if use gtk ; then
+ xdg_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
+
+src_prepare() {
+ # Clean postinst script which calls libtool and icon-cache update
+ echo '#!/bin/sh' > "${S}"/config/postinst.in || die
+
+ # Fix "PYTHON_EXECUTABLE" in Jupyter kernel
+ sed -i "s|@PYTHON_EXECUTABLE@|${EPYTHON}|" \
+ "${S}"/jupyterkernel/kernelspec/kernel.json.in || die
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DENABLE_SYSTEM_JSONCPP=ON
+ -DPACKAGING_MODE=ON
+ -DUSE_PYTHON_3=ON
+ -DBUILD_AS_CPP_LIBRARY=OFF
+ -DENABLE_JUPYTER=OFF # special Xeus Jupyter kernel (uses xtl)
+ -DENABLE_MATHEMATICA=OFF
+ -DINSTALL_TARGETS_ONLY=OFF
+ -DBUILD_TESTS=$(usex test)
+ -DENABLE_FRONTEND=$(usex gtk)
+ -DENABLE_PY_JUPYTER=$(usex jupyter)
+ )
+ cmake_src_configure
+}
+
+pkg_postinst() {
+ xdg_update
+}
+
+pkg_postrm() {
+ xdg_update
+}
diff --git a/sci-mathematics/cadabra/files/cadabra2-CMake.patch b/sci-mathematics/cadabra/files/cadabra2-CMake.patch
new file mode 100644
index 000000000000..9000cd321db9
--- /dev/null
+++ b/sci-mathematics/cadabra/files/cadabra2-CMake.patch
@@ -0,0 +1,69 @@
+index 0f2ba31..7e6ace8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -166,7 +166,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+ message(FATAL_ERROR "GCC version must be at least 4.9 for regex support! See http://askubuntu.com/questions/428198/getting-installing-gcc-g-4-9-on-ubuntu and then set the environment variables CXX to g++-4.9 and CC to gcc-4.9. You may have to erase the build directory before re-running cmake.")
+ endif()
+ endif()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wall -fvisibility=hidden -Wno-unused-but-set-variable")
+ endif()
+
+ # Clang
+@@ -175,7 +174,6 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+ message(FATAL_ERROR "Clang version must be at least 3.5 to avoid known bugs.")
+ endif()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -fvisibility=hidden -Wall -Wextra -Wunused")
+ endif()
+
+ # Visual Studio
+index d21069e..69f4f52 100644
+--- a/c++lib/CMakeLists.txt
++++ b/c++lib/CMakeLists.txt
+@@ -48,14 +48,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
+ add_definitions("-Wall -g -Wno-unused-but-set-variable")
+ endif()
+
+-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+-endif()
+-
+-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+-endif()
+-
+ if(MSVC)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ set(MSVC_FLAGS
+index b7869a9..91567ec 100644
+--- a/frontend/gtkmm/CMakeLists.txt
++++ b/frontend/gtkmm/CMakeLists.txt
+@@ -160,9 +160,6 @@ if (NOT INSTALL_TARGETS_ONLY)
+ install(FILES ${CADABRA_IMAGES_DIR}/256x256/cadabra2-gtk.png DESTINATION ${ICON_PREFIX}/share/icons/hicolor/256x256/apps)
+ install(FILES ${CADABRA_IMAGES_DIR}/cadabra2-gtk.svg DESTINATION ${ICON_PREFIX}/share/icons/hicolor/scalable/apps)
+ install(FILES ${CADABRA_ROOT_DIR}/config/cadabra2-gtk.desktop DESTINATION ${ICON_PREFIX}/share/applications)
+- install(CODE "execute_process(COMMAND touch ${ICON_PREFIX_WITH_DESTDIR}/share/icons/hicolor/icon-theme.cache)")
+- install(CODE "execute_process(COMMAND gtk-update-icon-cache-3.0 {ICON_PREFIX_WITH_DESTDIR}/share/icons/hicolor)")
+- install(CODE "execute_process(COMMAND chmod go+r ${ICON_PREFIX_WITH_DESTDIR}/share/icons/hicolor/icon-theme.cache)")
+
+ # Install shared libraries on Windows.
+ # https://stackoverflow.com/questions/32662215/how-do-you-install-gtk-3-0-on-windows
+index 071bf11..bdfde1c 100644
+--- a/core/CMakeLists.txt
++++ b/core/CMakeLists.txt
+@@ -404,15 +404,6 @@ add_subdirectory(packages)
+ #
+ # https://stackoverflow.com/questions/21198030/installfiles-cmake-cfg-intdir-abc-win-dll-destination-bin
+
+-if(NOT WIN32)
+- # Remove any old cadabra2.so files in the global site-wide path which may have been
+- # left there from a previous install.
+- remove_file("${OLD_PYTHON_SITE_PATH}/cadabra2.${PYTHON_MOD_EXT}")
+- remove_file("${OLD_PYTHON_SITE_PATH}/cadabra2_defaults.py")
+- remove_file("${OLDER_PYTHON_SITE_PATH}/cadabra2.${PYTHON_MOD_EXT}")
+- remove_file("${OLDER_PYTHON_SITE_PATH}/cadabra2_defaults.py")
+-endif()
+-
+ install_directory_permissions(${PYTHON_SITE_PATH})
+
+ if (MSVC)
diff --git a/sci-mathematics/cadabra/metadata.xml b/sci-mathematics/cadabra/metadata.xml
new file mode 100644
index 000000000000..372b6a2d1f8a
--- /dev/null
+++ b/sci-mathematics/cadabra/metadata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci-mathematics@gentoo.org</email>
+ <name>Gentoo Mathematics Project</name>
+ </maintainer>
+ <longdescription>
+ Cadabra is a symbolic computer algebra system (CAS) designed specifically
+ for the solution of problems encountered in field theory. It has extensive
+ functionality for tensor computer algebra, tensor polynomial simplification
+ including multi-term symmetries, fermions and anti-commuting variables,
+ Clifford algebras and Fierz transformations, component computations,
+ implicit coordinate dependence, multiple index types and many more.
+ The input format is a subset of TeX.
+ Both a command-line and a graphical notebook interface are available, and
+ you can also use Cadabra from Jupyter by using the Cadabra Jupyter kernel.
+ </longdescription>
+ <upstream>
+ <changelog>https://github.com/kpeeters/cadabra2/releases/</changelog>
+ <bugs-to>https://github.com/kpeeters/cadabra2/issues/</bugs-to>
+ <remote-id type="github">kpeeters/cadabra2</remote-id>
+ <doc lang="en">https://cadabra.science/man.html</doc>
+ </upstream>
+ <use>
+ <flag name="jupyter">Build the Cadabra Jupyter kernel</flag>
+ </use>
+</pkgmetadata>