git: 2dd141966bb5 - main - cad/sweethome3d: update the port to version 7.0 with many improvements

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Sat, 16 Jul 2022 05:07:49 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2dd141966bb51e13f8b0ba9601dba4283d7f25c3

commit 2dd141966bb51e13f8b0ba9601dba4283d7f25c3
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-07-16 05:05:00 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-07-16 05:05:00 +0000

    cad/sweethome3d: update the port to version 7.0 with many improvements
    
    Read the blog article* to learn about most prominent changes.  As for
    the port itself, addition of YafaRay rendering engine complicates the
    build process because it's not part of the upstream build system (they
    ship precompiled *.so files for MacOS, GNU/Linux, and Windows) and we
    cannot make use of `graphics/yafaray' port because they use some fork
    with a slightly different API.  Drop NO_ARCH because the package now
    contains CPU-specific binary code.
    
    Reported by:    portscout
    
    *) http://www.sweethome3d.com/blog/2022/07/13/sweet_home_3d_7_0.html
---
 cad/sweethome3d/Makefile                           | 34 +++++++++++++++++++---
 cad/sweethome3d/distinfo                           |  8 +++--
 cad/sweethome3d/files/patch-build.xml              | 29 +++++++++++++-----
 ...com_eteks_sweethome3d_SweetHome3DBootstrap.java | 14 +++++----
 4 files changed, 64 insertions(+), 21 deletions(-)

diff --git a/cad/sweethome3d/Makefile b/cad/sweethome3d/Makefile
index d5ed12cfbc8f..3d4a81a77534 100644
--- a/cad/sweethome3d/Makefile
+++ b/cad/sweethome3d/Makefile
@@ -1,10 +1,11 @@
 # Created by: Matthias Petermann <matthias@petermann-it.de>
 
 PORTNAME=	sweethome3d
-PORTVERSION=	6.6.4
+PORTVERSION=	7.0
 CATEGORIES=	cad java
 MASTER_SITES=	SF/${PORTNAME}/SweetHome3D-source/${DISTNAME}/
 DISTNAME=	SweetHome3D-${PORTVERSION}-src
+DISTFILES=	${DISTNAME}.zip
 
 MAINTAINER=	danfe@FreeBSD.org
 COMMENT=	Free interior 3D design application
@@ -12,14 +13,17 @@ COMMENT=	Free interior 3D design application
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING.TXT
 
-BUILD_DEPENDS=	java3d>=0:java/java3d
+BUILD_DEPENDS=	cmake:devel/cmake java3d>=0:java/java3d
 RUN_DEPENDS=	java3d>=0:java/java3d
 
-USES=		zip
-NO_ARCH=	yes
 USE_ANT=	yes
 USE_JAVA=	8
 
+USE_GITHUB=	nodefault
+GH_ACCOUNT=	puybaret:yr
+GH_PROJECT=	libYafaRay:yr
+GH_TAGNAME=	ef20db1:yr
+
 ALL_TARGET=	jarExecutable
 JARNAME=	SweetHome3D-${PORTVERSION}.jar
 
@@ -32,6 +36,28 @@ PLIST_FILES=	bin/sweethome3d \
 
 DESKTOP_ENTRIES="Sweet Home 3D" "" "${PORTNAME}-icon" "${PORTNAME}" "" false
 
+build-yafaray:
+	@${SED} -e '/^set(WITH_/s,ON),OFF),' \
+		${WRKSRC_yr}/CMakeConfig/UserConfig.template \
+		> ${WRKSRC_yr}/CMakeConfig/UserConfig.txt
+	cd ${WRKSRC_yr} && cmake \
+		-DUSER_INSTALL_PREFIX:PATH=${BUILD_WRKSRC}/build/yafaray \
+		. && ${MAKE_CMD} VERBOSE=1 install
+	${MV} ${BUILD_WRKSRC}/build/yafaray/lib/* ${BUILD_WRKSRC}/lib/yafaray
+
+pre-build: build-yafaray
+	cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV} ${ANT} ${MAKE_ARGS} build
+	cd ${BUILD_WRKSRC} && ${JAVAH} -jni -o \
+		src/com/eteks/sweethome3d/j3d/YafarayRenderer.h -cp \
+		classes:lib/j3dcore.jar:lib/vecmath.jar:build/SweetHome3D.jar \
+		com.eteks.sweethome3d.j3d.YafarayRenderer
+	cd ${BUILD_WRKSRC} && ${CXX} ${CXXFLAGS} -fPIC -std=c++11 \
+		-I${JAVA_HOME}/include -I${JAVA_HOME}/include/${OPSYS:tl} \
+		-I${WRKSRC_yr}/include \
+		src/com/eteks/sweethome3d/j3d/YafarayRenderer.cpp -shared \
+		-o lib/yafaray/libyafarayjni.so \
+		-Llib/yafaray -lyafaray_v3_core
+
 do-install:
 	${INSTALL_DATA} ${WRKSRC}/install/${JARNAME} \
 		${STAGEDIR}${JAVAJARDIR}/${JARNAME}
diff --git a/cad/sweethome3d/distinfo b/cad/sweethome3d/distinfo
index c7e59d94fd22..3cd28fa719fd 100644
--- a/cad/sweethome3d/distinfo
+++ b/cad/sweethome3d/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1639064376
-SHA256 (SweetHome3D-6.6.4-src.zip) = a0e7dfbe2ea3727fa4a6f0f41250b5be628ab68f8bde4dd833d4f6fd4e026477
-SIZE (SweetHome3D-6.6.4-src.zip) = 28771644
+TIMESTAMP = 1657726302
+SHA256 (SweetHome3D-7.0-src.zip) = af0d2c89605f53056a199685dba221dc13fcff008be79bf3a0463e74266b8403
+SIZE (SweetHome3D-7.0-src.zip) = 45275622
+SHA256 (puybaret-libYafaRay-ef20db1_GH0.tar.gz) = cbb9266cdc102395763abe02918097504d0f7c057883c0d9cb6aaf0af6a83d6f
+SIZE (puybaret-libYafaRay-ef20db1_GH0.tar.gz) = 1137154
diff --git a/cad/sweethome3d/files/patch-build.xml b/cad/sweethome3d/files/patch-build.xml
index 887430040876..88ab2adcf8d1 100644
--- a/cad/sweethome3d/files/patch-build.xml
+++ b/cad/sweethome3d/files/patch-build.xml
@@ -1,15 +1,28 @@
---- build.xml.orig	2017-02-01 12:42:14 UTC
+--- build.xml.orig	2022-07-13 08:03:06 UTC
 +++ build.xml
-@@ -271,12 +271,6 @@
-       <fileset dir="build">
+@@ -512,7 +512,6 @@ -->
+       <zipfileset src="build/Help.jar"/>
+       <fileset dir="lib">
+         <include name="*.jar"/>
+-        <include name="macosx/*.jar"/>
+         <include name="java3d-1.6/*.jar"/>
+         <exclude name="java3d-1.6/jogl-all.jar"/>
+       </fileset>
+@@ -520,15 +519,8 @@ -->
          <include name="java3d-1.6/jogl-java3d.jar"/>
        </fileset>
--      <fileset dir="lib">
+       <fileset dir="lib">
+-        <include name="windows/**/*.dll"/>
 -        <include name="java3d-1.6/windows/**/*.dll"/>
+-        <include name="yafaray/windows/**/*.dll"/>
+-        <include name="linux/**/*.so"/>
 -        <include name="java3d-1.6/linux/**/*.so"/>
+-        <include name="yafaray/linux/**/*.so"/>
 -        <include name="macosx/*.jnilib"/>
 -        <include name="java3d-1.6/macosx/*.dylib"/>
--      </fileset>
-     </jar>
-   </target>
- 
+-        <include name="yafaray/macosx/**/*.dylib"/>
++        <include name="yafaray/*.so"/>
++        <include name="yafaray/yafaray-plugins/*.so"/>
+       </fileset>
+       <fileset dir="libtest">
+         <include name="jnlp.jar"/>
diff --git a/cad/sweethome3d/files/patch-src_com_eteks_sweethome3d_SweetHome3DBootstrap.java b/cad/sweethome3d/files/patch-src_com_eteks_sweethome3d_SweetHome3DBootstrap.java
index ec57412c2e9d..253b9758373a 100644
--- a/cad/sweethome3d/files/patch-src_com_eteks_sweethome3d_SweetHome3DBootstrap.java
+++ b/cad/sweethome3d/files/patch-src_com_eteks_sweethome3d_SweetHome3DBootstrap.java
@@ -1,12 +1,14 @@
---- src/com/eteks/sweethome3d/SweetHome3DBootstrap.java.orig	2020-04-15 10:23:38 UTC
+--- src/com/eteks/sweethome3d/SweetHome3DBootstrap.java.orig	2022-07-13 08:03:06 UTC
 +++ src/com/eteks/sweethome3d/SweetHome3DBootstrap.java
-@@ -116,6 +116,9 @@ public class SweetHome3DBootstrap {
-         // Disable JOGL library loader
-         System.setProperty("jogamp.gluegen.UseTempJarCache", "false");
+@@ -135,6 +135,11 @@ public class SweetHome3DBootstrap {
+             "yafaray/macosx/libyafarayjni.dylib"}));
+         yafarayPluginsFolder = "yafaray/macosx/yafaray-plugins";
        }
 +    } else if ("FreeBSD".equals(operatingSystemName)) {
-+      extensionJarsAndDlls.add(System.getProperty("sun.boot.library.path")
-+        + "/libj3dcore-ogl.so");
++      extensionJarsAndDlls.addAll(Arrays.asList(new String[] {
++        System.getProperty("sun.boot.library.path") + "/libj3dcore-ogl.so",
++        "yafaray/libyafaray_v3_core.so", "yafaray/libyafarayjni.so" }));
++      yafarayPluginsFolder = "yafaray/yafaray-plugins";
      } else { // Other OS
        if ("1.5.2".equals(System.getProperty("com.eteks.sweethome3d.j3d.version", "1.6"))
            || "d3d".equals(System.getProperty("j3d.rend", "jogl"))