math/cadabra2: Update 2.1.6 -> 2.2.0

Port changes:
* Remove the overriding patch of boost::asio:
  now EINPROGRESS is handled properly, before it was not.
* Remove the overriding patch of websocketpp:
  added an equivalent patch into cadabra2 source,
  it is easier this way. Before such function didn't
  exist in the websocketpp interface.
* Add the patch for pull/82:
  missing #include / removal of unnecessary prefix calculation.
* Change cmake -> cmake:outsource.
* Switch to python3 because it links to python3 anyway,
  even though it claims to support python2.
* Add DOS2UNIX_FILES for cmake/version.cmake for one patched file.
* Remove post-patch: added a similar patch under files/
* Remove post-install: stripping is now done by the project.
* Remove post-install-GUI-on: icons are now installed by the project.

Testing:
* Runs fine, shows correct results for examples from the online manual.
This commit is contained in:
Yuri Victorovich 2018-03-31 22:55:33 +00:00
parent 89505369c5
commit f379a201bc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=466103
11 changed files with 130 additions and 153 deletions

View file

@ -1,18 +1,18 @@
# $FreeBSD$
PORTNAME= cadabra2
DISTVERSION= 2.1.6
PORTREVISION= 3
DISTVERSION= 2.2.0
CATEGORIES= math
PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
PATCHFILES= 5d52108df5b05eeba2ffbd7220776887297c2846.patch:-p1 # https://github.com/kpeeters/cadabra2/pull/82
MAINTAINER= yuri@FreeBSD.org
COMMENT= Computer algebra system for solving field theory problems
LICENSE= LGPL3
LICENSE_FILE= ${WRKSRC}/doc/license.txt
PATCH_DEPENDS= ${NONEXISTENT}:devel/boost-libs:extract \
${NONEXISTENT}:devel/websocketpp:extract
BUILD_DEPENDS= ${LOCALBASE}/include/websocketpp/client.hpp:devel/websocketpp
LIB_DEPENDS= ${PY_BOOST} \
libboost_system.so:devel/boost-libs \
@ -23,65 +23,29 @@ LIB_DEPENDS= ${PY_BOOST} \
RUN_DEPENDS= ${PYTHON_SITELIBDIR}/sympy/__init__.py:math/py-sympy@${PY_FLAVOR} \
${PYTHON_SITELIBDIR}/matplotlib/__init__.py:math/py-matplotlib@${PY_FLAVOR}
OPTIONS_DEFINE= GUI
OPTIONS_DEFAULT=GUI
USES= compiler:c++14-lang cmake gettext-runtime pkgconfig python:2.7 sqlite
USES= compiler:c++14-lang cmake:outsource dos2unix gettext-runtime localbase:ldflags pkgconfig python:3.4+ sqlite # USES=python picks random python versions
USE_GITHUB= yes
GH_ACCOUNT= kpeeters
GUI_USE= GNOME=gtkmm30,gdkpixbuf2
DOS2UNIX_FILES= cmake/version.cmake
USE_GNOME= glib20 glibmm libsigc++20
USE_TEX= base texmf texhash
USE_LDCONFIG= yes
OPTIONS_SUB= yes
GUI_INSTALLS_ICONS= yes
GUI_USES= desktop-file-utils
CMAKE_ARGS+= -DBOOST_ROOT=${LOCALBASE}
CMAKE_ARGS+= -DUSE_PYTHON_3:BOOL=OFF
GUI_CMAKE_BOOL= FRONTEND
CXXFLAGS+= -I${LOCALBASE}/include
CMAKE_ON= USE_PYTHON_3 # OFF doesn't work, still links to python3: https://github.com/kpeeters/cadabra2/issues/76
CMAKE_OFF= ENABLE_MATHEMATICA
CXXFLAGS+= -I${LOCALBASE}/include/jsoncpp
LDFLAGS+= -L${LOCALBASE}/lib -ljsoncpp
CMAKE_CXX_FLAGS=${CXXFLAGS}
CMAKE_INSTALL_PREFIX=${PREFIX}
LDFLAGS+= -ljsoncpp
post-extract:
OPTIONS_DEFINE= GUI
OPTIONS_DEFAULT= GUI
GUI_USES= desktop-file-utils
GUI_USE= GNOME=gtkmm30,gdkpixbuf2
GUI_CMAKE_BOOL= ENABLE_FRONTEND
GUI_INSTALLS_ICONS= yes
post-extract: # unbundle
@${RM} -r ${WRKSRC}/client_server/jsoncpp ${WRKSRC}/client_server/websocketpp
pre-patch:
# workaround for https://github.com/zaphoyd/websocketpp/issues/563, so that the local patch can be applied
@${MKDIR} ${WRKSRC}/override/include/boost/asio/detail/impl
@${CP} `${MAKE} -C ${PORTSDIR}/devel/boost-libs -V WRKSRC`/boost/asio/detail/impl/socket_ops.ipp \
${WRKSRC}/override/include/boost/asio/detail/impl/
# workaround for https://github.com/zaphoyd/websocketpp/issues/587, so that the local patch can be applied
@${MKDIR} ${WRKSRC}/override/include/websocketpp/transport/asio
@${CP} `${MAKE} -C ${PORTSDIR}/devel/websocketpp -V WRKSRC`/websocketpp/transport/asio/endpoint.hpp \
${WRKSRC}/override/include/websocketpp/transport/asio/
post-patch:
@${REINPLACE_CMD} -e 's|execute|#execute|' \
-e 's|"$${GIT_COMMIT_SERIAL}.$${GIT_SHORT_SHA}"|"FreeBSD port version=${PORTVERSION} tag=${GH_TAGNAME}"|' \
-e 's|set(CADABRA_VERSION_DATE "$${THE_DATE}"|set(CADABRA_VERSION_DATE "'`date "+%Y-%m-%d"`'"|' \
-e 's|include_directories(|include_directories($${PROJECT_SOURCE_DIR}/override/include |' \
${WRKSRC}/CMakeLists.txt
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/cadabra2html
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/cadabra-server
${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/cadabra2.so
post-install-GUI-on:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/cadabra2-gtk
@${GZIP_CMD} < ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/cadabra2-gtk.svg \
> ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/cadabra2-gtk.svgz
@${RM} ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/cadabra2-gtk.svg
@${LN} ${STAGEDIR}${PREFIX}/share/icons/hicolor/256x256/apps/cadabra2-gtk.png \
${STAGEDIR}${PREFIX}/share/icons/hicolor/256x256/apps/cadabra-gtk.png
@${LN} ${STAGEDIR}${PREFIX}/share/icons/hicolor/128x128/apps/cadabra2-gtk.png \
${STAGEDIR}${PREFIX}/share/icons/hicolor/128x128/apps/cadabra-gtk.png
@${LN} ${STAGEDIR}${PREFIX}/share/icons/hicolor/64x64/apps/cadabra2-gtk.png \
${STAGEDIR}${PREFIX}/share/icons/hicolor/64x64/apps/cadabra-gtk.png
@${LN} ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/cadabra2-gtk.svgz \
${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/cadabra-gtk.svgz
.include <bsd.port.mk>

View file

@ -1,3 +1,5 @@
TIMESTAMP = 1509811997
SHA256 (kpeeters-cadabra2-2.1.6_GH0.tar.gz) = 462d902393a7d17637846debcd7205478f46465d418fe3359a450168ad8810e0
SIZE (kpeeters-cadabra2-2.1.6_GH0.tar.gz) = 4595203
TIMESTAMP = 1522534466
SHA256 (kpeeters-cadabra2-2.2.0_GH0.tar.gz) = 4e0a408ab8fa611091bc4d776dd44efd730c2651e02e62cfd0251bd1d6b96249
SIZE (kpeeters-cadabra2-2.2.0_GH0.tar.gz) = 23915602
SHA256 (5d52108df5b05eeba2ffbd7220776887297c2846.patch) = 91c1259345332b9fc4b52eafa1c510d2a851b99ca708fa25af5673cdf737be87
SIZE (5d52108df5b05eeba2ffbd7220776887297c2846.patch) = 735

View file

@ -1,27 +1,35 @@
--- client_server/CMakeLists.txt.orig 2017-04-14 09:26:53 UTC
--- client_server/CMakeLists.txt.orig 2018-03-30 09:33:27 UTC
+++ client_server/CMakeLists.txt
@@ -90,21 +90,21 @@ add_definitions("-D_WEBSOCKETPP_CPP11_ST
@@ -28,7 +28,6 @@ find_package(Boost 1.53.0 COMPONENTS sys
set(CADABRA_SERVER_SRC
Server.cc
Snoop.cc
- jsoncpp/jsoncpp.cpp
../core/CdbPython.cc
../core/Stopwatch.cc
../core/ProgressMonitor.cc
@@ -43,7 +42,6 @@ set(CADABRA_CLIENT_SRC
../core/DataCell.cc
Actions.cc
Snoop.cc
- jsoncpp/jsoncpp.cpp
../libs/whereami/whereami.c
../core/InstallPrefix.cc
# ../libs/sqlite3/sqlite3.c
@@ -58,7 +56,6 @@ include_directories(
"../core"
"../libs/pybind11/include"
"websocketpp"
- "jsoncpp"
"../libs/internal/include"
"../libs/whereami"
${Boost_INCLUDE_DIRS}
@@ -114,7 +111,7 @@ add_executable(cadabra2html cadabra2html
target_link_libraries(cadabra2html cadabra_client)
# Create the server library
#link_directories(${UUID_LIBRARY_DIRS})
-add_library(cadabra_server SHARED Server.cc Snoop.cc jsoncpp/jsoncpp.cpp ../core/CdbPython.cc ../core/Stopwatch.cc ../core/ProgressMonitor.cc)
+add_library(cadabra_server SHARED Server.cc Snoop.cc ../core/CdbPython.cc ../core/Stopwatch.cc ../core/ProgressMonitor.cc)
target_link_libraries(cadabra_server ${Boost_LIBRARIES} ${SNOOP_LIBRARIES} sqlite3 ${PYTHON_LIBRARIES} ${GLIBMM3_LIBRARIES})
if (WIN32)
target_link_libraries(cadabra_server ws2_32 mswsock)
endif()
# Create the client library.
-add_library(cadabra_client SHARED ComputeThread.cc DocumentThread.cc DataCell.cc Actions.cc Snoop.cc jsoncpp/jsoncpp.cpp)
+add_library(cadabra_client SHARED ComputeThread.cc DocumentThread.cc DataCell.cc Actions.cc Snoop.cc)
target_link_libraries(cadabra_client ${Boost_LIBRARIES} sqlite3 ${PYTHON_LIBRARIES} ${GLIBMM3_LIBRARIES})
if (WIN32)
target_link_libraries(cadabra_client ws2_32)
endif()
# Create server binary
-include_directories("." "./websocketpp" "./jsoncpp")
+include_directories("." "./websocketpp")
add_executable(cadabra-server cadabra-server.cc)
add_executable(cadabra2html cadabra2html.cc DataCell.cc)
add_executable(cadabra2cadabra cadabra2cadabra.cc DataCell.cc)
# Client library
-add_library(cadabra_client STATIC ${CADABRA_CLIENT_SRC})
+add_library(cadabra_client SHARED ${CADABRA_CLIENT_SRC})
target_link_libraries(cadabra_client
${Boost_LIBRARIES}
${SQLITE3_LIBRARIES}

View file

@ -0,0 +1,11 @@
--- client_server/Server.cc.orig 2018-03-31 19:40:16 UTC
+++ client_server/Server.cc
@@ -466,7 +466,7 @@ void Server::run()
wserver.init_asio();
wserver.set_reuse_addr(true);
- wserver.listen(0);
+ wserver.listen(websocketpp::lib::asio::ip::tcp::v4(), 0); // makes up for a failed assumption that IPv6 is mapped into IPv4: (see net.inet6.ip6.v6only=0)
wserver.start_accept();
websocketpp::lib::asio::error_code ec;
auto p = wserver.get_local_endpoint(ec);

View file

@ -0,0 +1,20 @@
--- cmake/version.cmake.orig 2018-03-31 20:48:09 UTC
+++ cmake/version.cmake
@@ -3,13 +3,13 @@ set(CADABRA_VERSION_MINOR 2)
set(CADABRA_VERSION_PATCH 0)
set(CADABRA_VERSION_TWEAK 0)
set(COPYRIGHT_YEARS "2001-2018")
-execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_SHORT_SHA OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process(COMMAND git rev-list --count HEAD OUTPUT_VARIABLE GIT_COMMIT_SERIAL OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process(COMMAND git log -1 --date=short --pretty=format:%cd OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
+#execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_SHORT_SHA OUTPUT_STRIP_TRAILING_WHITESPACE)
+#execute_process(COMMAND git rev-list --count HEAD OUTPUT_VARIABLE GIT_COMMIT_SERIAL OUTPUT_STRIP_TRAILING_WHITESPACE)
+#execute_process(COMMAND git log -1 --date=short --pretty=format:%cd OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_SHORT_SHA)
set(CADABRA_VERSION_BUILD "${GIT_COMMIT_SERIAL}.${GIT_SHORT_SHA}")
else()
- set(CADABRA_VERSION_BUILD "private")
+ set(CADABRA_VERSION_BUILD "from the FreeBSD port")
endif()
if(GIT_COMMIT_DATE)
set(CADABRA_VERSION_DATE "${GIT_COMMIT_DATE}")

View file

@ -0,0 +1,19 @@
--- core/CMakeLists.txt.orig 2018-03-31 17:08:45 UTC
+++ core/CMakeLists.txt
@@ -197,7 +197,6 @@ include_directories(
"."
"../libs/internal/include"
"../libs/whereami"
- "../client_server/jsoncpp"
${Boost_INCLUDE_DIRS}
)
# FIXME: 2nd line is to find Config.hh
@@ -246,7 +245,7 @@ target_link_libraries(cadabra2python
)
# cadabra2cadabra
-add_executable(cadabra2cadabra cadabra2cadabra.cc DataCell.cc ../client_server/jsoncpp/jsoncpp.cpp ../libs/whereami/whereami.c InstallPrefix.cc)
+add_executable(cadabra2cadabra cadabra2cadabra.cc DataCell.cc ../libs/whereami/whereami.c InstallPrefix.cc)
target_link_libraries(cadabra2cadabra ${Boost_LIBRARIES})
# Mathematica WSTP test

View file

@ -1,8 +0,0 @@
--- core/cadabra2.in.orig 2017-05-17 08:17:17 UTC
+++ core/cadabra2.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python@PYTHON_POSTFIX@
+#!@PYTHON_EXECUTABLE@
#
# \ingroup pythoncore
#

View file

@ -1,6 +1,6 @@
--- frontend/gtkmm/CMakeLists.txt.orig 2017-02-03 07:40:10 UTC
--- frontend/gtkmm/CMakeLists.txt.orig 2018-03-30 09:33:27 UTC
+++ frontend/gtkmm/CMakeLists.txt
@@ -116,11 +116,11 @@ install(FILES ${PROJECT_SOURCE_DIR}/.
@@ -126,11 +126,11 @@ install(FILES ${PROJECT_SOURCE_DIR}/.
# there anyway.
# - gtk-update-icon-cache is broken and only works half of the time.
@ -16,7 +16,7 @@
#set(ICON_THEME ${ICON_PREFIX}/share/icons/hicolor/index.theme)
#if(EXISTS "${ICON_THEME}")
@@ -134,6 +134,6 @@ install(FILES ${PROJECT_SOURCE_DIR}/.
@@ -144,9 +144,9 @@ install(FILES ${PROJECT_SOURCE_DIR}/.
install(FILES ${PROJECT_SOURCE_DIR}/../../images/256x256/cadabra2-gtk.png DESTINATION ${ICON_PREFIX}/share/icons/hicolor/256x256/apps)
install(FILES ${PROJECT_SOURCE_DIR}/../../images/cadabra2-gtk.svg DESTINATION ${ICON_PREFIX}/share/icons/hicolor/scalable/apps)
install(FILES ${PROJECT_SOURCE_DIR}/../../config/cadabra2-gtk.desktop DESTINATION ${ICON_PREFIX}/share/applications)
@ -26,3 +26,6 @@
+#install(CODE "execute_process(COMMAND touch ${ICON_PREFIX}/share/icons/hicolor/icon-theme.cache)")
+#install(CODE "execute_process(COMMAND gtk-update-icon-cache-3.0 ${ICON_PREFIX}/share/icons/hicolor)")
+#install(CODE "execute_process(COMMAND chmod go+r ${ICON_PREFIX}/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

View file

@ -1,19 +0,0 @@
--- override/include/boost/asio/detail/impl/socket_ops.ipp.orig 2016-10-09 22:39:18 UTC
+++ override/include/boost/asio/detail/impl/socket_ops.ipp
@@ -469,7 +469,15 @@ template <typename SockLenType>
inline int call_connect(SockLenType msghdr::*,
socket_type s, const socket_addr_type* addr, std::size_t addrlen)
{
- return ::connect(s, addr, (SockLenType)addrlen);
+ int res = ::connect(s, addr, (SockLenType)addrlen);
+ if (res == -1 && errno==EINPROGRESS) {
+ fd_set write_fd;
+ FD_ZERO(&write_fd);
+ FD_SET(s, &write_fd);
+ res = ::select (s+1, NULL, &write_fd,NULL,NULL);
+ res = res > 0 ? 0 : res;
+ }
+ return res;
}
int connect(socket_type s, const socket_addr_type* addr,

View file

@ -1,20 +0,0 @@
--- override/include/websocketpp/transport/asio/endpoint.hpp.orig 2016-10-09 22:39:45 UTC
+++ override/include/websocketpp/transport/asio/endpoint.hpp
@@ -491,7 +491,7 @@ public:
* @param ec Set to indicate what error occurred, if any.
*/
void listen(uint16_t port, lib::error_code & ec) {
- listen(lib::asio::ip::tcp::v6(), port, ec);
+ listen(lib::asio::ip::tcp::v4(), port, ec);
}
/// Set up endpoint for listening on a port
@@ -507,7 +507,7 @@ public:
* @param ec Set to indicate what error occurred, if any.
*/
void listen(uint16_t port) {
- listen(lib::asio::ip::tcp::v6(), port);
+ listen(lib::asio::ip::tcp::v4(), port);
}
/// Set up endpoint for listening on a host and service (exception free)

View file

@ -1,29 +1,14 @@
%%GUI%%bin/cadabra2-gtk
bin/cadabra-server
bin/cadabra2
%%GUI%%bin/cadabra2-gtk
bin/cadabra2cadabra
bin/cadabra2html
bin/cadabra2python
lib/libcadabra_client.so
lib/libcadabra_server.so
%%GUI%%lib/libtexengine.so
%%PYTHON_SITELIBDIR%%/cadabra2.so
%%PYTHON_SITELIBDIR%%/cadabra2_defaults.py
%%PYTHON_SITELIBDIR%%/cdb/gauge_theory/__init__.py
%%PYTHON_SITELIBDIR%%/cdb/gauge_theory/instantons.py
%%PYTHON_SITELIBDIR%%/cdb/relativity/__init__.py
%%PYTHON_SITELIBDIR%%/cdb/relativity/schwarzschild.py
%%GUI%%share/applications/cadabra2-gtk.desktop
%%GUI%%%%DATADIR%%/images/cadabra2-gtk.png
%%GUI%%%%DATADIR%%/manual/algorithms/distribute.cnb
%%GUI%%share/icons/hicolor/256x256/apps/cadabra2-gtk.png
%%GUI%%share/icons/hicolor/256x256/apps/cadabra-gtk.png
%%GUI%%share/icons/hicolor/128x128/apps/cadabra2-gtk.png
%%GUI%%share/icons/hicolor/128x128/apps/cadabra-gtk.png
%%GUI%%share/icons/hicolor/64x64/apps/cadabra2-gtk.png
%%GUI%%share/icons/hicolor/64x64/apps/cadabra-gtk.png
%%GUI%%share/icons/hicolor/scalable/apps/cadabra2-gtk.svgz
%%GUI%%share/icons/hicolor/scalable/apps/cadabra-gtk.svgz
%%GUI%%%%TEXMFLOCALDIR%%/tex/latex/cadabra2/tableaux.sty
%%GUI%%%%DATADIR%%/latex/preamble.tex
%%GUI%%%%DATADIR%%/latex/tableaux.sty
%%GUI%%@dir %%DATADIR%%/manual/properties
%%GUI%%%%DATADIR%%/manual/algorithms/asym.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/canonicalise.cnb
@ -32,6 +17,7 @@ lib/libcadabra_server.so
%%GUI%%%%DATADIR%%/manual/algorithms/combine.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/complete.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/decompose_product.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/distribute.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/drop_weight.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/eliminate_kronecker.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/eliminate_metric.cnb
@ -52,7 +38,9 @@ lib/libcadabra_server.so
%%GUI%%%%DATADIR%%/manual/algorithms/product_rule.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/reduce_delta.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/rename_dummies.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/replace_match.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/rewrite_indices.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/simplify.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/sort_product.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/sort_spinors.cnb
%%GUI%%%%DATADIR%%/manual/algorithms/sort_sum.cnb
@ -104,4 +92,13 @@ lib/libcadabra_server.so
%%GUI%%%%DATADIR%%/manual/properties/WeightInherit.cnb
%%GUI%%%%DATADIR%%/notebook.html
%%GUI%%%%DATADIR%%/notebook.tex
%%GUI%%%%DATADIR%%/texengine/preamble.tex
%%DATADIR%%/python/cadabra2.so
%%DATADIR%%/python/cadabra2_defaults.py
%%DATADIR%%/python/cdb/gauge_theory/__init__.py
%%DATADIR%%/python/cdb/gauge_theory/instantons.py
%%DATADIR%%/python/cdb/relativity/__init__.py
%%DATADIR%%/python/cdb/relativity/schwarzschild.py
%%GUI%%share/icons/hicolor/128x128/apps/cadabra2-gtk.png
%%GUI%%share/icons/hicolor/256x256/apps/cadabra2-gtk.png
%%GUI%%share/icons/hicolor/64x64/apps/cadabra2-gtk.png
%%GUI%%share/icons/hicolor/scalable/apps/cadabra2-gtk.svg