Re: UPDATE: devel/cmake (switch to py3, enable DEBUG_PACKAGES, new {py,ruby,lua,java} handling)

2020-05-19 Thread Rafael Sadowski
On Tue May 19, 2020 at 11:31:07AM +0200, Landry Breuil wrote:
> On Mon, May 18, 2020 at 07:07:27AM +0200, Rafael Sadowski wrote:
> CONFIGURE_ARGS+= always scares me, what if something else down the chain
> does CONFIGURE_ARGS= and drops all the other bits ?

tldr: Don't worry, port-modules(5) do the magic for us.

For example: devel/catch2

$ make show=CONFIGURE_ARGS
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.7
-DPYTHON_LIBRARY_DIRS=/usr/local/lib/python3.7
-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.7m -DCMAKE_BUILD_TYPE=Release

If I add "CONFIGURE_ARGS = -DTEST=WTF" or "CONFIGURE_ARGS += -DTEST=WTF", we'll 
see:

$ make show=CONFIGURE_ARGS
-DTEST=WTF -DPYTHON_EXECUTABLE=/usr/local/bin/python3.7
-DPYTHON_LIBRARY_DIRS=/usr/local/lib/python3.7
-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.7m -DCMAKE_BUILD_TYPE=Release

... even if we add "CONFIGURE_ARGS =" (empty), we'll see:

$ make show=CONFIGURE_ARGS
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.7
-DPYTHON_LIBRARY_DIRS=/usr/local/lib/python3.7
-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.7m -DCMAKE_BUILD_TYPE=Release

Rafael



Re: UPDATE: devel/cmake (switch to py3, enable DEBUG_PACKAGES, new {py,ruby,lua,java} handling)

2020-05-19 Thread Landry Breuil
On Tue, May 19, 2020 at 02:25:55PM +0200, Rafael Sadowski wrote:
> > which patches this allows us to remove ?
> 
> diff --git 
> a/devel/cmake/patches/patch-Modules_CMakeDetermineJavaCompiler_cmake 
> b/devel/cmake/patches/patch-Modules_CMakeDetermineJavaCompiler_cmake
> diff --git a/devel/cmake/patches/patch-Modules_FindJNI_cmake 
> b/devel/cmake/patches/patch-Modules_FindJNI_cmake
> diff --git a/devel/cmake/patches/patch-Modules_FindJava_cmake 
> b/devel/cmake/patches/patch-Modules_FindJava_cmake
> diff --git a/devel/cmake/patches/patch-Modules_FindLua_cmake 
> b/devel/cmake/patches/patch-Modules_FindLua_cmake
> diff --git a/devel/cmake/patches/patch-Modules_FindOpenMP_cmake 
> b/devel/cmake/patches/patch-Modules_FindOpenMP_cmake
> diff --git a/devel/cmake/patches/patch-Modules_FindPythonLibs_cmake 
> b/devel/cmake/patches/patch-Modules_FindPythonLibs_cmake
> diff --git a/devel/cmake/patches/patch-Modules_FindRuby_cmake 
> b/devel/cmake/patches/patch-Modules_FindRuby_cmake
> diff --git 
> a/devel/cmake/patches/patch-Modules_Qt4ConfigDependentSettings_cmake 
> b/devel/cmake/patches/patch-Modules_Qt4ConfigDependentSettings_cmake

i was more expecting a list of patches to be removed in cmake consumer
ports :)

> > I'm scared. Now is the right time, but i expect many weird/random
> > build/runtime failures later on, which might not show up in 'just
> > running a bulk' ...
> > 
> 
> I do not expect too much impact. ;)

Famous last words..



Re: UPDATE: devel/cmake (switch to py3, enable DEBUG_PACKAGES, new {py,ruby,lua,java} handling)

2020-05-19 Thread Rafael Sadowski
On Tue May 19, 2020 at 11:31:07AM +0200, Landry Breuil wrote:
> On Mon, May 18, 2020 at 07:07:27AM +0200, Rafael Sadowski wrote:
> > This diff currently runs through a full amd64 bulk build. I send this
> > diff in advance to discuss it. Here a list of imported port changes:
> > 
> > - Update CMmke to 3.17.2
> > 
> > - Switch CMake to pyhton3
> 
> Makes 100% sense

... we tried before, without luck. It works with my  cmake.port.mk
solution. Some cmake+py ports do it wrong, this diff fixes the ports
automatically)

> 
> > - Remove all Modules under files. This should no longer be necessary.
> 
> I like that idea, provided that doesnt cause subtle build config changes
> that will result in runtime breakage... where do our modules come from ?
> taken from upstream at some point, then tweaked for our needs ? were
> those changes upstreamed and are not needed now, are the upstream
> modules better now so that we dont need our local ones ?

No idea, no comments, no useful commit msg (as I remember), it happened
before I got involved.

> 
> > - Remove our self hacked MODJAVA* MODLUA* MODPY* MODRUBY* modules.
> >   - Instead we help the original cmake modules, see cmake.port.mk. That
> > saves and all these patches and is in my opinion more correct!
> 
> From my understanding of the patch, the idea is to only set some module
> vars if the corresponding MODULE is enabled, instead of setting the vars
> in all cases ?

Correct and this is the right way.

> are we sure ordering of module inclusion doesnt matter then ?

We are setting a cmake option, the order does not matter, if someone
overwrites it, hopefully he knows what he is doing. If not we have to
find this corner cases.

> CONFIGURE_ARGS+= always scares me, what if something else down the chain
> does CONFIGURE_ARGS= and drops all the other bits ?

Use on your own risk. I'm gonna take a look around our tree.

> 
> which patches this allows us to remove ?

diff --git a/devel/cmake/patches/patch-Modules_CMakeDetermineJavaCompiler_cmake 
b/devel/cmake/patches/patch-Modules_CMakeDetermineJavaCompiler_cmake
diff --git a/devel/cmake/patches/patch-Modules_FindJNI_cmake 
b/devel/cmake/patches/patch-Modules_FindJNI_cmake
diff --git a/devel/cmake/patches/patch-Modules_FindJava_cmake 
b/devel/cmake/patches/patch-Modules_FindJava_cmake
diff --git a/devel/cmake/patches/patch-Modules_FindLua_cmake 
b/devel/cmake/patches/patch-Modules_FindLua_cmake
diff --git a/devel/cmake/patches/patch-Modules_FindOpenMP_cmake 
b/devel/cmake/patches/patch-Modules_FindOpenMP_cmake
diff --git a/devel/cmake/patches/patch-Modules_FindPythonLibs_cmake 
b/devel/cmake/patches/patch-Modules_FindPythonLibs_cmake
diff --git a/devel/cmake/patches/patch-Modules_FindRuby_cmake 
b/devel/cmake/patches/patch-Modules_FindRuby_cmake
diff --git a/devel/cmake/patches/patch-Modules_Qt4ConfigDependentSettings_cmake 
b/devel/cmake/patches/patch-Modules_Qt4ConfigDependentSettings_cmake

> 
> > - Fix cmake debug packages:
> >   - If DEBUG_PACKAGES set don't create install stripa rule. Idea by
> > landry@
> 
> Long-term, i think upstream should be consulted about that. Upstreaming
> that would be nice, instead of a local patch/hack. That said,
> patch-Source_cmInstallTargetGenerator_cxx needs a comment :)

We'll have to do more cleaning for that. The other BSDs have almost no
patches. There is of course a comment in 
patch-Source_cmInstallTargetGenerator_cxx.

> 
> > What do you think? I would like to commit this diff if the bulk build
> > is successful.
> > 
> > Opinions?
> 
> I'm scared. Now is the right time, but i expect many weird/random
> build/runtime failures later on, which might not show up in 'just
> running a bulk' ...
> 

I do not expect too much impact. ;)



Re: UPDATE: devel/cmake (switch to py3, enable DEBUG_PACKAGES, new {py,ruby,lua,java} handling)

2020-05-19 Thread Landry Breuil
On Mon, May 18, 2020 at 07:07:27AM +0200, Rafael Sadowski wrote:
> This diff currently runs through a full amd64 bulk build. I send this
> diff in advance to discuss it. Here a list of imported port changes:
> 
> - Update CMmke to 3.17.2
> 
> - Switch CMake to pyhton3

Makes 100% sense

> - Remove all Modules under files. This should no longer be necessary.

I like that idea, provided that doesnt cause subtle build config changes
that will result in runtime breakage... where do our modules come from ?
taken from upstream at some point, then tweaked for our needs ? were
those changes upstreamed and are not needed now, are the upstream
modules better now so that we dont need our local ones ?

> - Remove our self hacked MODJAVA* MODLUA* MODPY* MODRUBY* modules.
>   - Instead we help the original cmake modules, see cmake.port.mk. That
> saves and all these patches and is in my opinion more correct!

>From my understanding of the patch, the idea is to only set some module
vars if the corresponding MODULE is enabled, instead of setting the vars
in all cases ? are we sure ordering of module inclusion doesnt matter then ?
CONFIGURE_ARGS+= always scares me, what if something else down the chain
does CONFIGURE_ARGS= and drops all the other bits ?

which patches this allows us to remove ?

> - Fix cmake debug packages:
>   - If DEBUG_PACKAGES set don't create install stripa rule. Idea by
> landry@

Long-term, i think upstream should be consulted about that. Upstreaming
that would be nice, instead of a local patch/hack. That said,
patch-Source_cmInstallTargetGenerator_cxx needs a comment :)

> What do you think? I would like to commit this diff if the bulk build
> is successful.
> 
> Opinions?

I'm scared. Now is the right time, but i expect many weird/random
build/runtime failures later on, which might not show up in 'just
running a bulk' ...

Landry



UPDATE: devel/cmake (switch to py3, enable DEBUG_PACKAGES, new {py,ruby,lua,java} handling)

2020-05-17 Thread Rafael Sadowski
This diff currently runs through a full amd64 bulk build. I send this
diff in advance to discuss it. Here a list of imported port changes:

- Update CMmke to 3.17.2

- Switch CMake to pyhton3

- Remove all Modules under files. This should no longer be necessary.

- Remove our self hacked MODJAVA* MODLUA* MODPY* MODRUBY* modules.
  - Instead we help the original cmake modules, see cmake.port.mk. That
saves and all these patches and is in my opinion more correct!

- Fix cmake debug packages:
  - If DEBUG_PACKAGES set don't create install stripa rule. Idea by
landry@

What do you think? I would like to commit this diff if the bulk build
is successful.

Opinions?

diff --git a/devel/cmake/Makefile b/devel/cmake/Makefile
index 91b69c9cf98..4492613f889 100644
--- a/devel/cmake/Makefile
+++ b/devel/cmake/Makefile
@@ -4,11 +4,10 @@ DPB_PROPERTIES =  parallel
 
 COMMENT =  portable build system
 
-VER =  3.16.2
+VER =  3.17.2
 EPOCH =0
 DISTNAME = cmake-${VER}
 CATEGORIES =   devel
-REVISION = 1
 
 HOMEPAGE = https://www.cmake.org/
 
@@ -22,7 +21,11 @@ WANTLIB += jsoncpp m rhash uv z
 
 COMPILER = base-clang ports-gcc
 
-BUILD_DEPENDS +=   textproc/py-sphinx>=1.4
+MODULES =  lang/python
+MODPY_VERSION =${MODPY_DEFAULT_VERSION_3}
+MODPY_RUNDEP = No
+
+BUILD_DEPENDS =textproc/py-sphinx${MODPY_FLAVOR}
 
 LIB_DEPENDS =  archivers/libarchive \
devel/libuv \
@@ -38,7 +41,7 @@ CONFIGURE_ARGS =  --datadir=share/cmake \
--no-qt-gui \
--parallel=${MAKE_JOBS} \
--prefix=${PREFIX} \
-   --sphinx-build=${LOCALBASE}/bin/sphinx-build \
+   
--sphinx-build=${LOCALBASE}/bin/sphinx-build${MODPY_BIN_SUFFIX} \
--sphinx-html \
--sphinx-man \
--system-libs \
@@ -71,7 +74,6 @@ post-patch:
${WRKSRC}/Modules/FindDCMTK.cmake \
 
 pre-configure:
-   cp ${FILESDIR}/*.cmake ${WRKSRC}/Modules/
find ${WRKSRC}/Modules -name "*.cmake" -exec ${SUBST_CMD} {} +
find ${WRKSRC}/Tests -name "CMakeLists.txt" -exec ${SUBST_CMD} {} +
${SUBST_CMD} ${SUBST_FILES}
diff --git a/devel/cmake/cmake.port.mk b/devel/cmake/cmake.port.mk
index 750b671b47a..ab14ee38ca2 100644
--- a/devel/cmake/cmake.port.mk
+++ b/devel/cmake/cmake.port.mk
@@ -50,16 +50,34 @@ _MODCMAKE_GEN = "Unix Makefiles"
 DPB_PROPERTIES += nojunk
 .endif
 
-CONFIGURE_ENV +=   MODJAVA_VER=${MODJAVA_VER} \
-   MODLUA_VERSION=${MODLUA_VERSION} \
-   MODLUA_BIN=${MODLUA_BIN} \
-   MODLUA_INCL_DIR=${MODLUA_INCL_DIR} \
-   MODPY_VERSION=${MODPY_VERSION} \
-   MODPY_BIN=${MODPY_BIN} \
-   MODPY_INCDIR=${MODPY_INCDIR} \
-   MODPY_LIBDIR=${MODPY_LIBDIR} \
-   MODRUBY_REV=${MODRUBY_REV} \
-   MODTCL_VERSION=${MODTCL_VERSION} \
+# JAVA
+.if ${MODULES:Mjava}
+CONFIGURE_ENV +=   JAVA_HOME=${JAVA_HOME}
+MAKE_ENV +=JAVA_HOME=${JAVA_HOME}
+.endif
+
+# Python
+.if ${MODULES:Mlang/python}
+# 
https://cmake.org/cmake/help/latest/module/FindPython3.html#artifacts-specification
+CONFIGURE_ARGS +=  -DPYTHON_EXECUTABLE=${MODPY_BIN}
+CONFIGURE_ARGS +=  -DPYTHON_LIBRARY_DIRS=${MODPY_LIBDIR}
+CONFIGURE_ARGS +=  -DPYTHON_INCLUDE_DIR=${MODPY_INCDIR}
+.endif
+
+# Lua
+.if ${MODULES:Mlang/lua}
+CONFIGURE_ARGS +=  -DLUA_INCLUDE_DIR=${MODLUA_INCL_DIR}
+.endif
+
+# Ruby
+.if ${MODULES:Mlang/ruby}
+# https://cmake.org/cmake/help/latest/module/FindRuby.html
+CONFIGURE_ARGS +=  -DRUBY_EXECUTABLE=${RUBY}
+.endif
+
+# XXX Remove hackish patches
+# Tcl/Tk
+CONFIGURE_ENV +=   MODTCL_VERSION=${MODTCL_VERSION} \
MODTK_VERSION=${MODTK_VERSION} \
MODTCL_INCDIR=${MODTCL_INCDIR} \
MODTK_INCDIR=${MODTK_INCDIR} \
diff --git a/devel/cmake/distinfo b/devel/cmake/distinfo
index 0ff61db04f0..e56e6ac943f 100644
--- a/devel/cmake/distinfo
+++ b/devel/cmake/distinfo
@@ -1,2 +1,2 @@
-SHA256 (cmake-3.16.2.tar.gz) = jAl4bsYMor41TCmCkHLDgRPekYTymSjrnahEal8s5qk=
-SIZE (cmake-3.16.2.tar.gz) = 9109837
+SHA256 (cmake-3.17.2.tar.gz) = /HcyTE+CCgkFKneFVJuANf+NNGHe1bvYDSUq59HNOqU=
+SIZE (cmake-3.17.2.tar.gz) = 9469251
diff --git a/devel/cmake/files/FindIconv.cmake 
b/devel/cmake/files/FindIconv.cmake
deleted file mode 100644
index 028df5c1ae5..000
--- a/devel/cmake/files/FindIconv.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-# - Try to find Iconv 
-# Once done this will define 
-# 
-#  ICONV_FOUND - system has Iconv 
-#  ICONV_INCLUDE_DIR - the Iconv include directory 
-#  ICONV_LIBRARIES - Link these to use Iconv 
-#  ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
-#