Skip to content

Commit

Permalink
math/mathpresso: New port: Mathematical expression parser and JIT com…
Browse files Browse the repository at this point in the history
…piler
  • Loading branch information
yurivict committed Dec 26, 2022
1 parent 88a9c76 commit 8898daa
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions math/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@
SUBDIR += mathlibtools
SUBDIR += mathmod
SUBDIR += mathomatic
SUBDIR += mathpresso
SUBDIR += matio
SUBDIR += matlab-installer
SUBDIR += maxima
Expand Down
34 changes: 34 additions & 0 deletions math/mathpresso/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
PORTNAME= mathpresso
DISTVERSION= g20211213
CATEGORIES= math

MAINTAINER= yuri@FreeBSD.org
COMMENT= Mathematical expression parser and JIT compiler
WWW= https://github.com/kobalicek/mathpresso

LICENSE= ZLIB
LICENSE_FILE= ${WRKSRC}/LICENSE.md

LIB_DEPENDS= libasmjit.so:devel/asmjit

USES= cmake:testing localbase:ldflags
USE_LDCONFIG= yes

USE_GITHUB= yes
GH_ACCOUNT= kobalicek
GH_TAGNAME= 9256fa3

CMAKE_ARGS= -DASMJIT_CFLAGS="-I${LOCALBASE}/include" -DASMJIT_LIBS=asmjit
CMAKE_TESTING_ON= MATHPRESSO_TEST
CMAKE_TESTING_TARGET= mptest

PLIST_FILES= include/mathpresso/mathpresso.h \
lib/libmathpresso.so

post-install: # workaround for https://github.com/kobalicek/mathpresso/issues/18
${INSTALL_LIB} ${BUILD_WRKSRC}/libmathpresso.so ${STAGEDIR}${PREFIX}/lib

post-test:
@cd ${TEST_WRKSRC} && ./mptest

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions math/mathpresso/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1672022436
SHA256 (kobalicek-mathpresso-g20211213-9256fa3_GH0.tar.gz) = 8c6e67abc5572ff34e6a29640089d03a63b680a5b216eda36fc8593396797f38
SIZE (kobalicek-mathpresso-g20211213-9256fa3_GH0.tar.gz) = 53143
28 changes: 28 additions & 0 deletions math/mathpresso/files/patch-CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- CMakeLists.txt.orig 2022-12-26 02:50:03 UTC
+++ CMakeLists.txt
@@ -13,12 +13,12 @@ if (NOT DEFINED MATHPRESSO_DIR)
set(MATHPRESSO_DIR "${CMAKE_CURRENT_LIST_DIR}")
endif()

-if (NOT DEFINED ASMJIT_DIR)
- set(ASMJIT_DIR "${MATHPRESSO_DIR}/../asmjit")
-endif()
+#if (NOT DEFINED ASMJIT_DIR)
+# set(ASMJIT_DIR "${MATHPRESSO_DIR}/../asmjit")
+#endif()

set(MATHPRESSO_DIR "${MATHPRESSO_DIR}" CACHE PATH "Location of 'mathpresso'")
-set(ASMJIT_DIR "${ASMJIT_DIR}" CACHE PATH "Location of 'asmjit'")
+#set(ASMJIT_DIR "${ASMJIT_DIR}" CACHE PATH "Location of 'asmjit'")

set(MATHPRESSO_TEST FALSE CACHE BOOL "Build 'mathpresso' test applications")
set(MATHPRESSO_EMBED FALSE CACHE BOOL "Embed 'mathpresso' library (no targets)")
@@ -53,7 +53,7 @@ endif()
if (NOT DEFINED ASMJIT_EMBED)
set(ASMJIT_EMBED TRUE)
endif()
-include("${ASMJIT_DIR}/CMakeLists.txt")
+#include("${ASMJIT_DIR}/CMakeLists.txt")

list(APPEND MATHPRESSO_DEPS ${ASMJIT_LIBS})
list(APPEND MATHPRESSO_PRIVATE_CFLAGS "${ASMJIT_CFLAGS}")
5 changes: 5 additions & 0 deletions math/mathpresso/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MathPresso is a C++ library designed to parse mathematical expressions and
compile them into machine code. It's much faster than traditional AST or
byte-code based evaluators, because there is basically no overhead in the
expression's execution. The JIT compiler is based on AsmJit and works on
X86 and X64 architectures.

0 comments on commit 8898daa

Please sign in to comment.