git: 3a63bbd85bd1 - main - cad/camotics: adding CAMotics, Simulation & Computer Aided Machining

From: Thierry Thomas <thierry_at_FreeBSD.org>
Date: Sat, 21 May 2022 09:10:00 UTC
The branch main has been updated by thierry:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3a63bbd85bd196569eca764dd9579e77eaf59a2d

commit 3a63bbd85bd196569eca764dd9579e77eaf59a2d
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2022-05-21 08:56:42 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2022-05-21 08:56:42 +0000

    cad/camotics: adding CAMotics, Simulation & Computer Aided Machining
    
    The latest stable release, v1.2.0, is for Python-2.7, this is why I
    ported this -RC1, but it is somewhat buggy. Do not hesitate to report
    any problem!
    
    PR:             262763
    Requested by:   luzpaz (at) pm.me
---
 cad/Makefile                                       |   1 +
 cad/camotics/Makefile                              | 102 +++++++++++++++++++++
 cad/camotics/distinfo                              |   3 +
 .../files/patch-config_qt5_____init____.py         |  26 ++++++
 cad/camotics/pkg-descr                             |   8 ++
 cad/camotics/pkg-plist                             |  10 ++
 6 files changed, 150 insertions(+)

diff --git a/cad/Makefile b/cad/Makefile
index d3459b8e3f19..3229fe0b7c5f 100644
--- a/cad/Makefile
+++ b/cad/Makefile
@@ -15,6 +15,7 @@
     SUBDIR += brlcad
     SUBDIR += calculix
     SUBDIR += calculix-ccx
+    SUBDIR += camotics
     SUBDIR += caneda
     SUBDIR += cascade
     SUBDIR += cascade-compiler
diff --git a/cad/camotics/Makefile b/cad/camotics/Makefile
new file mode 100644
index 000000000000..08ccaaec69c9
--- /dev/null
+++ b/cad/camotics/Makefile
@@ -0,0 +1,102 @@
+# Created by: thierry@pompo.net
+
+PORTNAME=	CAMotics
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.2.2-rc1
+CATEGORIES=	cad
+
+MAINTAINER=	thierry@FreeBSD.org
+COMMENT=	3-axis CNC GCode simulator
+
+LICENSE=	GPLv2+
+
+BUILD_DEPENDS=	boost-libs>0:devel/boost-libs	\
+		${LOCALBASE}/lib/libdxflib.a:cad/qcad	\
+		${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}
+LIB_DEPENDS=	libv8.so:lang/v8		\
+		libre2.so:devel/re2		\
+		libcbang0.so:devel/cbang	\
+		liblz4.so:archivers/liblz4	\
+		libevent.so:devel/libevent	\
+		libexpat.so:textproc/expat2	\
+		libyaml.so:textproc/libyaml	\
+		libsnappy.so:archivers/snappy	\
+		libsysinfo.so:devel/libsysinfo	\
+		libleveldb.so:databases/leveldb
+
+USE_GITHUB=	yes
+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
+USE_GL=		gl glu
+USE_GNOME=	cairo
+USE_QT=		assistant buildtools core dbus gui linguisttools network opengl	\
+		websockets widgets
+QT5_INC=	-I${LOCALBASE}/include/qt5	\
+		-I${LOCALBASE}/include/qt5/QtCore	\
+		-I${LOCALBASE}/include/qt5/QtGui	\
+		-I${LOCALBASE}/include/qt5/QtNetwork	\
+		-I${LOCALBASE}/include/qt5/QtOpenGL	\
+		-I${LOCALBASE}/include/qt5/QtWidgets
+QT5_LIBS_=	${qt-core_LIB}	\
+		${qt-gui_LIB}	\
+		${qt-network_LIB}	\
+		${qt-opengl_LIB}	\
+		${qt-websockets_LIB}	\
+		${qt-widgets_LIB}
+QT5_LIBS=	-L${QT_LIBDIR} ${QT5_LIBS_:C/^lib/-l/:C/.so//}
+
+OPTIONS_DEFINE=		EXAMPLES
+PORTEXAMPLES=	*
+
+MAKE_ARGS+=	cc="${CC}"	\
+		cxx="${CXX}"	\
+		cxxstd="c++14"	\
+		ccflags="${CCFLAGS}"	\
+		cxxflags="${CXXFLAGS} ${QT5_INC}"	\
+		linkflags="${LDFLAGS} ${QT5_LIBS}"	\
+		libpath="${LIBPATH}"	\
+		sharedlib=1	\
+		install_prefix="${STAGEDIR}${PREFIX}"	\
+		compiler="${CHOSEN_COMPILER_TYPE:C/gcc/gnu/}"	\
+		disable_local="zlib bzip2 lz4 sqlite3 expat libevent re2 libyaml"
+MAKE_ENV+=	QT5DIR="${LOCALBASE}"	\
+		CBANG_HOME="${WRKDIR}/cbang"
+.if defined(WITH_DEBUG)
+MAKE_ARGS+=	debug=1 strict=0
+.endif
+
+TEST_WRKSRC=	${WRKSRC}/tests
+DO_MAKE_TEST=	${SETENV} ${TEST_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${TEST_ARGS}
+
+pre-configure:
+	${CP} -R ${LOCALBASE}/share/cbang ${WRKDIR}
+	${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
+
+post-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/metainfo	\
+		${STAGEDIR}${PREFIX}/share/mime/packages
+	${INSTALL_DATA} ${WRKSRC}/CAMotics.desktop	\
+		${STAGEDIR}${PREFIX}/share/applications/
+	${INSTALL_DATA} ${WRKSRC}/CAMotics.appdata.xml	\
+		${STAGEDIR}${PREFIX}/share/metainfo
+	${INSTALL_DATA} ${WRKSRC}/mime.xml	\
+		${STAGEDIR}${PREFIX}/share/mime/packages/${PORTNAME}.xml
+	${INSTALL_DATA} ${WRKSRC}/images/*.png	\
+		${STAGEDIR}${PREFIX}/share/pixmaps
+
+post-install-EXAMPLES-on:
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}
+
+#do-test:
+#	(cd ${TEST_WRKSRC} && ./testHarness)
+
+.include <bsd.port.mk>
diff --git a/cad/camotics/distinfo b/cad/camotics/distinfo
new file mode 100644
index 000000000000..8968e40da060
--- /dev/null
+++ b/cad/camotics/distinfo
@@ -0,0 +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
diff --git a/cad/camotics/files/patch-config_qt5_____init____.py b/cad/camotics/files/patch-config_qt5_____init____.py
new file mode 100644
index 000000000000..4e48a0bdd748
--- /dev/null
+++ b/cad/camotics/files/patch-config_qt5_____init____.py
@@ -0,0 +1,26 @@
+--- 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/pkg-descr b/cad/camotics/pkg-descr
new file mode 100644
index 000000000000..3a522a9100c8
--- /dev/null
+++ b/cad/camotics/pkg-descr
@@ -0,0 +1,8 @@
+CAMotics is an Open-Source software which can simulate 3-axis NC machining. It
+is a fast, flexible and user friendly simulation software for the DIY and
+Open-Source community.
+
+
+
+WWW: http://camotics.org/
+WWW: https://github.com/CauldronDevelopmentLLC/CAMotics
diff --git a/cad/camotics/pkg-plist b/cad/camotics/pkg-plist
new file mode 100644
index 000000000000..42f0cd651e07
--- /dev/null
+++ b/cad/camotics/pkg-plist
@@ -0,0 +1,10 @@
+bin/camotics
+bin/camsim
+bin/gcodetool
+bin/planner
+bin/tplang
+share/applications/CAMotics.desktop
+share/metainfo/CAMotics.appdata.xml
+share/mime/packages/CAMotics.xml
+share/pixmaps/camotics-logo.png
+share/pixmaps/camotics.png