Thursday, August 31, 2023

[fix] cad/oce: unreplaced variable on cmake files

Hi,

The following cmake files installed by cad/oce contain a variable
(${OCCT_INSTALL_BIN_LETTER}) that should've been replaced during
installation:

/usr/local/lib/cmake/opencascade/OpenCASCADEApplicationFrameworkTargets-release.cmake
/usr/local/lib/cmake/opencascade/OpenCASCADEDataExchangeTargets-release.cmake
/usr/local/lib/cmake/opencascade/OpenCASCADEDrawTargets-release.cmake
/usr/local/lib/cmake/opencascade/OpenCASCADEFoundationClassesTargets-release.cmake
/usr/local/lib/cmake/opencascade/OpenCASCADEModelingAlgorithmsTargets-release.cmake
/usr/local/lib/cmake/opencascade/OpenCASCADEModelingDataTargets-release.cmake
/usr/local/lib/cmake/opencascade/OpenCASCADEVisualizationTargets-release.cmake

To verify, run the following. You'll notice how the variable is
escaped (\${...}):

# pkg_add oce
$ grep OCCT_INSTALL_BIN_LETTER /usr/local/lib/cmake/opencascade/OpenCASCADE*

I'm working on porting FreeCAD (which depends on oce)
and I'm getting the following error during the configuration stage:

> CMake Error at /usr/local/lib/cmake/opencascade/OpenCASCADEFoundationClassesTargets.cmake:87 (message):
> The imported target "TKernel" references the file
>
> "/usr/local/lib${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.1.0"
>
> but this file does not exist. Possible reasons include:
>
> * The file was deleted, renamed, or moved to another location.
>
> * An install or uninstall procedure did not complete successfully.
>
> * The installation package was faulty and contained
>
> "/usr/local/lib/cmake/opencascade/OpenCASCADEFoundationClassesTargets.cmake"
>
> but not all the files it references.

The diff below is based on a patch from the FreeBSD port and should
fix this issue. The only consumer is cad/kicad and it built fine.

Kind regards,
Johannes

Index: Makefile
===================================================================
RCS file: /cvs/ports/cad/oce/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile 28 Feb 2023 21:22:28 -0000 1.9
+++ Makefile 31 Aug 2023 19:47:51 -0000
@@ -7,7 +7,7 @@ GH_ACCOUNT = tpaviot
GH_PROJECT = oce
GH_COMMIT = 98a788062f0f30593880b0df1bcf967408212ba4
DISTNAME = oce-7.6.0
-REVISION = 1
+REVISION = 2

.for LIB in TKBO TKBRep TKBin TKBinL TKBinTObj TKBinXCAF TKBool TKCAF TKCDF \
TKDCAF TKDraw TKFeat TKFillet TKG2d TKG3d TKGeomAlgo TKGeomBase TKHLR \
Index: patches/patch-adm_cmake_occt_macros_cmake
===================================================================
RCS file: /cvs/ports/cad/oce/patches/patch-adm_cmake_occt_macros_cmake,v
retrieving revision 1.2
diff -u -p -r1.2 patch-adm_cmake_occt_macros_cmake
--- patches/patch-adm_cmake_occt_macros_cmake 11 Mar 2022 18:24:30 -0000 1.2
+++ patches/patch-adm_cmake_occt_macros_cmake 31 Aug 2023 19:47:51 -0000
@@ -1,15 +1,12 @@
-Ugly hack on ALL_OCCT_TARGET_FILES: change later
-
Index: adm/cmake/occt_macros.cmake
--- adm/cmake/occt_macros.cmake.orig
+++ adm/cmake/occt_macros.cmake
-@@ -592,7 +592,8 @@ macro (OCCT_UPDATE_TARGET_FILE)
+@@ -592,7 +592,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
"cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
- file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
-+ file (GLOB ALL_OCCT_TARGET_FILES
-+ \"${PROJECT_BINARY_DIR}/CMakeFiles/Export/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
++ file (GLOB ALL_OCCT_TARGET_FILES \"\$ENV{DESTDIR}${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES})
file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT)
file (REMOVE \"\${TARGET_FILENAME}\")

No comments:

Post a Comment