git: 65291e9e1f50 - main - cad/camotics: upgrade to v1.3.0

From: Thierry Thomas <thierry_at_FreeBSD.org>
Date: Thu, 20 Apr 2023 15:33:40 UTC
The branch main has been updated by thierry:

URL: https://cgit.FreeBSD.org/ports/commit/?id=65291e9e1f5006354409b90829b98d37b47c60d9

commit 65291e9e1f5006354409b90829b98d37b47c60d9
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2023-04-20 15:31:48 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2023-04-20 15:31:48 +0000

    cad/camotics: upgrade to v1.3.0
    
    Changelog at
    <https://github.com/CauldronDevelopmentLLC/CAMotics/blob/master/CHANGELOG.md#v130>
---
 cad/camotics/Makefile                              | 30 ++++++++++++------
 cad/camotics/distinfo                              |  6 ++--
 cad/camotics/files/patch-SConstruct                | 36 ++++++++++++++++++++++
 .../files/patch-config_qt5_____init____.py         | 26 ----------------
 .../patch-src_camotics_contour_TriangleMesh.h      | 11 -------
 cad/camotics/pkg-plist                             | 36 ++++++++++++++++++++++
 6 files changed, 96 insertions(+), 49 deletions(-)

diff --git a/cad/camotics/Makefile b/cad/camotics/Makefile
index f9c58ffa78c1..b59e914b68a2 100644
--- a/cad/camotics/Makefile
+++ b/cad/camotics/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	CAMotics
 DISTVERSIONPREFIX=	v
-DISTVERSION=	1.2.2-rc1
-PORTREVISION=	3
+DISTVERSION=	1.3.0
 CATEGORIES=	cad
 
 MAINTAINER=	thierry@FreeBSD.org
@@ -30,7 +29,8 @@ GH_ACCOUNT=	CauldronDevelopmentLLC
 USES=		compiler:c++14-lang desktop-file-utils gettext-runtime gl gnome	\
 		localbase:ldflags mysql:client pkgconfig python qt:5 scons	\
 		shared-mime-info shebangfix sqlite ssl
-SHEBANG_FILES=	examples/python/camotics_python_example.py
+SHEBANG_FILES=	examples/python/camotics_python_example.py	\
+		tests/testHarness
 USE_GL=		gl glu
 USE_GNOME=	cairo
 USE_QT=		assistant buildtools core dbus gui linguisttools network opengl	\
@@ -49,7 +49,12 @@ QT5_LIBS_=	${qt-core_LIB}	\
 		${qt-widgets_LIB}
 QT5_LIBS=	-L${QT_LIBDIR} ${QT5_LIBS_:C/^lib/-l/:C/.so//}
 
-OPTIONS_DEFINE=		EXAMPLES
+DATADIR=	${PREFIX}/share/${PORTNAME:tl}
+DOCSDIR=	${PREFIX}/share/doc/${PORTNAME:tl}
+EXAMPLESDIR=	${PREFIX}/share/examples/${PORTNAME:tl}
+
+OPTIONS_DEFINE=	DOCS EXAMPLES
+PORTDOCS=	*
 PORTEXAMPLES=	*
 
 MAKE_ARGS+=	cc="${CC}"	\
@@ -60,6 +65,7 @@ MAKE_ARGS+=	cc="${CC}"	\
 		linkflags="${LDFLAGS} ${QT5_LIBS}"	\
 		libpath="${LIBPATH}"	\
 		sharedlib=1	\
+		wrap_glibc=0	\
 		install_prefix="${STAGEDIR}${PREFIX}"	\
 		compiler="${CHOSEN_COMPILER_TYPE:C/gcc/gnu/}"	\
 		disable_local="zlib bzip2 lz4 sqlite3 expat libevent re2 libyaml"
@@ -69,6 +75,8 @@ MAKE_ENV+=	QT5DIR="${LOCALBASE}"	\
 MAKE_ARGS+=	debug=1 strict=0
 .endif
 
+BIN2STRIP=	camotics camsim gcodetool planner tplang
+
 TEST_WRKSRC=	${WRKSRC}/tests
 DO_MAKE_TEST=	${SETENV} ${TEST_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${TEST_ARGS}
 
@@ -77,10 +85,13 @@ pre-configure:
 	${RLN} ${LOCALBASE}/include ${WRKDIR}/cbang/
 	${REINPLACE_CMD} -e "/python_version/s|'3'|'${PYTHON_VER}'|"	\
 		${WRKSRC}/SConstruct
-	${REINPLACE_CMD} -e 's|/usr/bin/env python2| ${PYTHON_CMD}|'	\
-		${TEST_WRKSRC}/testHarness
+	${REINPLACE_CMD} -e 's|/share/doc/camotics/examples|/${EXAMPLESDIR_REL}|'	\
+		${WRKSRC}/src/camotics/qt/QtWin.cpp
 
 post-install:
+.for pgm in ${BIN2STRIP}
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${pgm}
+.endfor
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/metainfo	\
 		${STAGEDIR}${PREFIX}/share/mime/packages
 	${INSTALL_DATA} ${WRKSRC}/CAMotics.desktop	\
@@ -91,12 +102,13 @@ post-install:
 		${STAGEDIR}${PREFIX}/share/mime/packages/${PORTNAME}.xml
 	${INSTALL_DATA} ${WRKSRC}/images/*.png	\
 		${STAGEDIR}${PREFIX}/share/pixmaps
+	${MV} ${STAGEDIR}${PREFIX}/share/doc/${PORTNAME:tl}/examples	\
+		${STAGEDIR}${EXAMPLESDIR}
 
 post-install-EXAMPLES-on:
-	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
 	cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}
 
-#do-test:
-#	(cd ${TEST_WRKSRC} && ./testHarness)
+do-test:
+	(cd ${TEST_WRKSRC} && ./testHarness)
 
 .include <bsd.port.mk>
diff --git a/cad/camotics/distinfo b/cad/camotics/distinfo
index 8968e40da060..66a134ad704d 100644
--- a/cad/camotics/distinfo
+++ b/cad/camotics/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1652128288
-SHA256 (CauldronDevelopmentLLC-CAMotics-v1.2.2-rc1_GH0.tar.gz) = c928d58c31b42eb970ed4022fac86c73a082c67b336eb4a83cd1100d4dee2e60
-SIZE (CauldronDevelopmentLLC-CAMotics-v1.2.2-rc1_GH0.tar.gz) = 12570228
+TIMESTAMP = 1681837454
+SHA256 (CauldronDevelopmentLLC-CAMotics-v1.3.0_GH0.tar.gz) = d863781be2a5f4af8d9594e95cb6a752a67e034985dc522c7a95ddb4238150be
+SIZE (CauldronDevelopmentLLC-CAMotics-v1.3.0_GH0.tar.gz) = 12578545
diff --git a/cad/camotics/files/patch-SConstruct b/cad/camotics/files/patch-SConstruct
new file mode 100644
index 000000000000..08c6a6aad122
--- /dev/null
+++ b/cad/camotics/files/patch-SConstruct
@@ -0,0 +1,36 @@
+--- SConstruct.orig	2023-03-09 16:07:30 UTC
++++ SConstruct
+@@ -15,12 +15,15 @@ env.CBLoadTools(
+ env.Tool('config', toolpath = [cbang])
+ env.CBLoadTools(
+     'compiler cbang dist opengl dxflib python build_info packager resources')
++# See https://github.com/CauldronDevelopmentLLC/CAMotics/issues/389 for wrap_glibc
+ env.CBAddVariables(
+     ('install_prefix', 'Installation directory prefix', '/usr/local/'),
+     BoolVariable('qt_deps', 'Enable Qt package dependencies', True),
+     ('python_version', 'Set python version', '3'),
+     BoolVariable('with_tpl', 'Enable TPL', True),
+     BoolVariable('with_gui', 'Enable graphical user interface', True),
++    BoolVariable('wrap_glibc', 'Enable GlibC function wrapping',
++                 env['PLATFORM'] == 'posix'),
+     )
+ conf = env.CBConfigure()
+ 
+@@ -111,7 +114,7 @@ if not env.GetOption('clean'):
+     if env.get('static') or env.get('mostly_static'):
+         conf.CBCheckLib('selinux')
+ 
+-    if env['PLATFORM'] == 'posix':
++    if env['wrap_glibc']:
+         funcs = 'log logf exp expf pow powf memcpy'.split()
+         flags = list(map(lambda n: '-Wl,--wrap=' + n, funcs))
+         env.AppendUnique(LINKFLAGS = flags)
+@@ -154,7 +157,7 @@ if env['with_tpl']: src += Glob('src/tplang/*.cpp')
+ subdirs = ['', 'sim', 'probe', 'opt', 'project', 'contour', 'render']
+ for subdir in subdirs: src += Glob('src/camotics/%s/*.cpp' % subdir)
+ if env['with_tpl']: src += Glob('src/tplang/*.cpp')
+-src += ['src/glibc.c']
++if env['wrap_glibc']: src += ['src/glibc.c']
+ 
+ src = list(map(lambda path: re.sub(r'^src/', 'build/', str(path)), src))
+ 
diff --git a/cad/camotics/files/patch-config_qt5_____init____.py b/cad/camotics/files/patch-config_qt5_____init____.py
deleted file mode 100644
index 4e48a0bdd748..000000000000
--- a/cad/camotics/files/patch-config_qt5_____init____.py
+++ /dev/null
@@ -1,26 +0,0 @@
---- config/qt5/__init__.py.orig	2021-07-27 23:51:08 UTC
-+++ config/qt5/__init__.py
-@@ -710,6 +710,13 @@ def generate(env):
-     Action = SCons.Action.Action
-     Builder = SCons.Builder.Builder
- 
-+    version = tuple(map(int, SCons.__version__.split('.')))
-+
-+    QT5_MOCDEFINES = \
-+        '${_defines(QT5_MOCDEFPREFIX, CPPDEFINES, QT5_MOCDEFSUFFIX, __env__'
-+    if (4, 2, 0) <= version: QT5_MOCDEFINES += ', TARGET, SOURCE'
-+    QT5_MOCDEFINES += ')}'
-+
-     env['QT5DIR'] = _detect(env)
-     env.Replace(
-         QT5DIR  = _detect(env),
-@@ -762,8 +769,7 @@ def generate(env):
-         QT5_QRCCXXPREFIX = 'qrc_',
-         QT5_MOCDEFPREFIX = '-D',
-         QT5_MOCDEFSUFFIX = '',
--        QT5_MOCDEFINES = '${_defines(QT5_MOCDEFPREFIX, CPPDEFINES, '
--        'QT5_MOCDEFSUFFIX, __env__)}',
-+        QT5_MOCDEFINES = QT5_MOCDEFINES,
-         QT5_MOCCPPPATH = [],
-         QT5_MOCINCFLAGS = '$( ${_concat(QT5_MOCINCPREFIX, QT5_MOCCPPPATH, '
-         'INCSUFFIX, __env__, RDirs)} $)',
diff --git a/cad/camotics/files/patch-src_camotics_contour_TriangleMesh.h b/cad/camotics/files/patch-src_camotics_contour_TriangleMesh.h
deleted file mode 100644
index 02e8a834dddf..000000000000
--- a/cad/camotics/files/patch-src_camotics_contour_TriangleMesh.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/camotics/contour/TriangleMesh.h.orig	2021-07-27 23:51:08 UTC
-+++ src/camotics/contour/TriangleMesh.h
-@@ -52,7 +52,7 @@ namespace CAMotics {
- 
- 
-     struct VertexSort {
--      bool operator() (const Vertex *a, const Vertex *b) {return *a < *b;}
-+      bool operator() (const Vertex *a, const Vertex *b) const {return *a < *b;}
-     };
- 
- 
diff --git a/cad/camotics/pkg-plist b/cad/camotics/pkg-plist
index 42f0cd651e07..f14dafac73c5 100644
--- a/cad/camotics/pkg-plist
+++ b/cad/camotics/pkg-plist
@@ -3,8 +3,44 @@ bin/camsim
 bin/gcodetool
 bin/planner
 bin/tplang
+share/appdata/CAMotics.appdata.xml
 share/applications/CAMotics.desktop
+%%DATADIR%%/machines/LICENSE.md
+%%DATADIR%%/machines/bf20.json
+%%DATADIR%%/machines/bf20.tco
+%%DATADIR%%/machines/cobra.json
+%%DATADIR%%/machines/cobra.tco
+%%DATADIR%%/machines/dummy.json
+%%DATADIR%%/machines/dummy.tco
+%%DATADIR%%/machines/milly.json
+%%DATADIR%%/machines/milly.tco
+%%DATADIR%%/machines/miss_marple.json
+%%DATADIR%%/machines/miss_marple.tco
+%%DATADIR%%/machines/robodrill.json
+%%DATADIR%%/machines/robodrill.tco
+%%DATADIR%%/machines/shapeoko_2.json
+%%DATADIR%%/machines/shapeoko_2.tco
+%%DATADIR%%/machines/shapeoko_3.json
+%%DATADIR%%/machines/shapeoko_3.tco
+%%DATADIR%%/machines/sprite.json
+%%DATADIR%%/machines/sprite.tco
+%%DATADIR%%/machines/taig.json
+%%DATADIR%%/machines/taig.tco
+%%DATADIR%%/machines/x-carve.json
+%%DATADIR%%/machines/x-carve.tco
+%%DATADIR%%/machines/yohudi.json
+%%DATADIR%%/machines/yohudi.tco
+%%DATADIR%%/tpl_lib/clipper/clipper.js
+%%DATADIR%%/tpl_lib/clipper/package.json
+%%DATADIR%%/tpl_lib/dxf/dxf.tpl
+%%DATADIR%%/tpl_lib/dxf/package.json
+%%DATADIR%%/tpl_lib/hersheytext.json
+%%DATADIR%%/tpl_lib/poly/package.json
+%%DATADIR%%/tpl_lib/poly/poly.tpl
+share/icons/hicolor/128x128/apps/camotics.png
 share/metainfo/CAMotics.appdata.xml
 share/mime/packages/CAMotics.xml
+share/mime/packages/camotics.xml
 share/pixmaps/camotics-logo.png
+share/pixmaps/camotics-pkg-bg.png
 share/pixmaps/camotics.png