Re: git: 12594e1aee7b - main - math/mathex: new port, C++ library to parse/evaluate mathematical expressions

From: Daniel Engberg <daniel.engberg.lists_at_pyret.net>
Date: Fri, 21 Jun 2024 12:13:00 UTC
On 2024-06-21T13:15:55.000+02:00, Thierry Thomas <thierry@FreeBSD.org>
wrote:

> The branch main has been updated by thierry:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=12594e1aee7b17507b85b8a0ee762a678b3ff79e
> 
> commit 12594e1aee7b17507b85b8a0ee762a678b3ff79e
> 
> Author:     Thierry Thomas <thierry@FreeBSD.org>
> 
> AuthorDate: 2024-06-21 09:22:25 +0000
> 
> Commit:     Thierry Thomas <thierry@FreeBSD.org>
> 
> CommitDate: 2024-06-21 11:15:52 +0000
> 
>     math/mathex: new port, C++ library to parse/evaluate mathematical expressions
> 
>     
> 
>     Remark: upstream seems inactive, but MathEx is still used by Gmsh.
> 
> ---
> 
>  math/Makefile                    |  1 +
> 
>  math/mathex/Makefile             | 44 ++++++++++++++++++++++++++++++++++++++++
> 
>  math/mathex/distinfo             |  3 +++
> 
>  math/mathex/files/patch-makefile | 22 ++++++++++++++++++++
> 
>  math/mathex/pkg-descr            |  4 ++++
> 
>  5 files changed, 74 insertions(+)
> 
> diff --git a/math/Makefile b/math/Makefile
> 
> index 44e78e22da9a..de329683fee5 100644
> 
> --- a/math/Makefile
> 
> +++ b/math/Makefile
> 
> @@ -487,6 +487,7 @@
> 
>      SUBDIR += m4rie
> 
>      SUBDIR += mate-calc
> 
>      SUBDIR += math77
> 
> +    SUBDIR += mathex
> 
>      SUBDIR += mathgl
> 
>      SUBDIR += mathicsscript
> 
>      SUBDIR += mathmod
> 
> diff --git a/math/mathex/Makefile b/math/mathex/Makefile
> 
> new file mode 100644
> 
> index 000000000000..3de5bbbd8e5a
> 
> --- /dev/null
> 
> +++ b/math/mathex/Makefile
> 
> @@ -0,0 +1,44 @@
> 
> +PORTNAME=    mathex
> 
> +DISTVERSION=    0.3-b
> 
> +CATEGORIES=    math science devel
> 
> +MASTER_SITES=    SF/sscilib/mathex
> 
> +
> 
> +MAINTAINER=    thierry@FreeBSD.org
> 
> +COMMENT=    C++ library fo parse/evaluate mathematical expression
> 
> +WWW=        https://sscilib.sourceforge.net/
> 
> +
> 
> +LICENSE=    LGPL21
> 
> +LICENSE_FILE=    ${WRKSRC}/license.txt
> 
> +
> 
> +USES=        dos2unix zip
> 
> +DOS2UNIX_FILES=    makefile
> 
> +
> 
> +WRKSRC=        ${WRKDIR}/${PORTNAME}
> 
> +MAKEFILE=    makefile
> 
> +ALL_TARGET=    ${PORTNAME}
> 
> +USE_LDCONFIG=    yes
> 
> +
> 
> +PLIST_FILES=    ${PREFIX}/include/mathex.h    \
> 
> +        ${PREFIX}/lib/lib${PORTNAME}.so    \
> 
> +        ${PREFIX}/lib/lib${PORTNAME}.so.0
> 
> +PLIST_FILES+=    ${PROGS:C|^|${PREFIX}/bin/|}
> 
> +
> 
> +PROGS=        curvetest inttest tabletest userfunctest
> 
> +
> 
> +OPTIONS_DEFINE=    EXAMPLES
> 
> +
> 
> +post-build:
> 
> +    (cd ${WRKSRC} &&    \
> 
> +    ${CXX} ${LDFLAGS} -shared -o lib${PORTNAME}.so.0 -Wl,-soname,lib${PORTNAME}.so.0 ${PORTNAME}.o)
> 
> +
> 
> +do-install:
> 
> +    ${INSTALL_DATA} ${WRKSRC}/mathex.h ${STAGEDIR}${PREFIX}/include/
> 
> +    ${INSTALL_LIB} ${WRKSRC}/lib${PORTNAME}.so.0 ${STAGEDIR}${PREFIX}/lib/
> 
> +    ${LN} -s lib${PORTNAME}.so.0 ${STAGEDIR}${PREFIX}/lib/lib${PORTNAME}.so
> 
> +
> 
> +do-install-EXAMPLES-on:
> 
> +.for p in ${PROGS}
> 
> +    ${INSTALL_PROGRAM} ${WRKSRC}/${p} ${STAGEDIR}${PREFIX}/bin/
> 
> +.endfor
> 
> +
> 
> +.include <bsd.port.mk> [http://bsd.port.mk>];
> 
> diff --git a/math/mathex/distinfo b/math/mathex/distinfo
> 
> new file mode 100644
> 
> index 000000000000..0d63b2aaf216
> 
> --- /dev/null
> 
> +++ b/math/mathex/distinfo
> 
> @@ -0,0 +1,3 @@
> 
> +TIMESTAMP = 1718957652
> 
> +SHA256 (mathex-0.3-b.zip [http://mathex-0.3-b.zip]) = 8b3ac4e7620e7ffe04deaae9562a37e1e1a375cf589eec06ee3e7a04ea5c9fcc
> 
> +SIZE (mathex-0.3-b.zip [http://mathex-0.3-b.zip]) = 31441
> 
> diff --git a/math/mathex/files/patch-makefile b/math/mathex/files/patch-makefile
> 
> new file mode 100644
> 
> index 000000000000..714e89ccb09a
> 
> --- /dev/null
> 
> +++ b/math/mathex/files/patch-makefile
> 
> @@ -0,0 +1,22 @@
> 
> +--- makefile.orig    2024-06-21 08:45:06 UTC
> 
> ++++ makefile
> 
> +@@ -78,9 +78,9 @@
> 
> + ##############################
> 
> + #  current compiler settings #
> 
> + ##############################
> 
> +-CC        = g++
> 
> +-CFLAGS = -Wall -ggdb -c -o
> 
> +-LFLAGS    = -ggdb -o
> 
> ++CC        = ${CXX}
> 
> ++CFLAGS += -fPIC -c -o
> 
> ++LFLAGS    = ${LDFLAGS} -o
> 
> + # for g++ link  as C++. Thus, is not need to specify stdc++
> 
> + # LIBS      = -lm  -lstdc++
> 
> + LIBS      = -lm
> 
> +@@ -162,4 +162,4 @@ clear:
> 
> + clear:
> 
> +     rm $(OBJECTS)
> 
> + 
> 
> +-# end of makefile
> 
> +\ No newline at end of file
> 
> ++# end of makefile
> 
> diff --git a/math/mathex/pkg-descr b/math/mathex/pkg-descr
> 
> new file mode 100644
> 
> index 000000000000..5b11c45a3736
> 
> --- /dev/null
> 
> +++ b/math/mathex/pkg-descr
> 
> @@ -0,0 +1,4 @@
> 
> +MathEx is a C++ library to parse/evaluate mathematical expression.
> 
> +
> 
> +It is part of the SSCILIB (Small Scientific Library), a collection of small
> 
> +library package to help development of scientific applications.

A bit cleaner and likely sustainable solution would be to import the
CMake build from Fedora/Macports which would likely remove all the
manual workarounds for upstream's Makefile.

https://src.fedoraproject.org/rpms/mathex/blob/rawhide/f/CMakeLists.txt

https://github.com/macports/macports-ports/blob/master/math/mathex/files/CMakeLists.txt

Best regards,

Daniel