[KDE/Mac] Review Request 122114: [OS X] adaptations of the build system (CMake files) to MacPorts
Friedrich W. H. Kossebau
kossebau at kde.org
Tue Jan 20 19:43:31 UTC 2015
> On Jan. 17, 2015, 10:49 p.m., Friedrich W. H. Kossebau wrote:
> > cmake/modules/FindOpenJPEG.cmake, line 14
> > <https://git.reviewboard.kde.org/r/122114/diff/1/?file=342456#file342456line14>
> >
> > Hm, these // things at least need a comment, because this strange path will surprise any clueless reader of the code.
> >
> > But then I wonder if this is a standard approach to this problem. Adding a hack like this just for MacPorts opens the can for all distris to add hacks for some custom solutions.
> >
> > I propose we first look for a more cmake/usual solution for the problem of supporting non-standard installation paths of used libs.
>
> René J.V. Bertin wrote:
> I agree that this change is a weird one to propose "upstream" (i.e. here), and almost excluded it.
> Yes, it's a standard approach for MacPorts to use a patch file to insert a placeholder into files, that is replaced with the actual prefix path later on. It's my version of that approach to use a placeholder that evaluates to the default prefix path under standard path normalisation rules.
>
> Looking at the issue again, I realise that another approach is possible too here: using a variable that is already available to cmake.
>
> This is the cmake invocation is it current is generated through my Portfile; ${CMAKE_INSTALL_PREFIX} would be the obvious choice (i.e. //opt//local//include/openjpeg-1.5 would become something like ${CMAKE_INSTALL_PREFIX}/include/openjpeg-1.5?) :
>
> `cmake -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH=${prefix}/lib -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib -DCMAKE_SYSTEM_PREFIX_PATH="${prefix};/usr" -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev -DCMAKE_MODULE_PATH="${prefix}/share/cmake/Modules;${prefix}/share/cmake/Modules" -DBUILD_SHARED_LIBS=ON -DBUNDLE_INSTALL_DIR=/Applications/MacPorts/KDE4 -DKDE_DISTRIBUTION_TEXT="MacPorts/Mac OS X" -DQT_QT_INCLUDE_DIR=${prefix}/include/qt4 -DQT_QMAKESPEC=macx-g++ -DQT_ZLIB_LIBRARY=${prefix}/lib/libz.dylib -DQT_PNG_LIBRARY=${prefix}/lib/libpng.dylib -DDOCBOOKXSL_DIR=${prefix}/share/xsl/docbook-xsl -DGETTEXT_INCLUDE_DIR=${prefix}/include -DGETTEXT_LIBRARY=${prefix}/lib/libgettextlib.dylib -DGIF_INCLUDE_DIR=${prefix}/include -DGIF_LIBRARY=${prefix}/lib/libgif.dylib -DJASPER_INCLUDE_DIR=${prefix}/include -DJASPER_LIBRARY=${prefix}/lib/libjasper.dylib -DJPEG_INCLUDE_DIR=${prefix}/include -DJPEG_LIBRARY=${prefix}/lib/libjpeg.dylib -DLBER_LIBRARIES=${prefix}/lib/liblber.dylib -DLDAP_INCLUDE_DIR=${prefix}/include -DLDAP_LIBRARIES=${prefix}/lib/libldap.dylib -DLIBEXSLT_INCLUDE_DIR=${prefix}/include -DLIBEXSLT_LIBRARIES=${prefix}/lib/libexslt.dylib -DLIBICALSS_LIBRARY=${prefix}/lib/libicalss.dylib -DLIBICAL_INCLUDE_DIRS=${prefix}/include -DLIBICAL_LIBRARY=${prefix}/lib/libical.dylib -DLIBINTL_INCLUDE_DIR=${prefix}/include -DLIBINTL_LIBRARY=${prefix}/lib/libintl.dylib -DLIBXML2_INCLUDE_DIR=${prefix}/include/libxml2 -DLIBXML2_LIBRARIES=${prefix}/lib/libxml2.dylib -DLIBXML2_XMLLINT_EXECUTABLE=${prefix}/bin/xmllint -DLIBXSLT_INCLUDE_DIR=${prefix}/include -DLIBXSLT_LIBRARIES=${prefix}/lib/libxslt.dylib -DMYSQLD_EXECUTABLE=${prefix}/libexec/mysqld -DMYSQL_INCLUDE_DIR=${prefix}/include/mysql5/mysql -DMYSQL_LIB_DIR=${prefix}/lib/mysql5/mysql -DMYSQLCONFIG_EXECUTABLE=${prefix}/bin/mysql_config5 -DOPENAL_INCLUDE_DIR=/System/Library/Frameworks/OpenAL.framework/Headers -DOPENAL_LIBRARY=/System/Library/Frameworks/OpenAL.framework -DPNG_INCLUDE_DIR=${prefix}/include -DPNG_PNG_INCLUDE_DIR=${prefix}/include -DPNG_LIBRARY=${prefix}/lib/libpng.dylib -DTIFF_INCLUDE_DIR=${prefix}/include -DTIFF_LIBRARY=${prefix}/lib/libtiff.dylib -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_STRIP:FILEPATH=/bin/echo -DPhonon_DIR=${prefix}/share/cmake/modules/phonon -DICONV_INCLUDE_DIR=${prefix}/include -DICONV_LIBRARIES=${prefix}/lib/libiconv.dylib -DFreeTDS_INCLUDE_DIR=${prefix}/include/freetds -DFreeTDS_LIBRARIES=${prefix}/lib/libsybdb.dylib -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.9" -DCMAKE_OSX_SYSROOT="/" ../${worksrcpath}`
>
> Friedrich W. H. Kossebau wrote:
> CMAKE_INSTALL_PREFIX might not be the best solution when trying to follow cmake's philosophy, as this var is only about to which prefix the current software should be installed.
> Looking into http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:find_path and other Find*.cmake macros it seems that making use of `CMAKE_SYSTEM_PREFIX_PATH` (and/or `ENV Project_ROOT`) might be closer to the cmake ideas. Some search hits seemed to hint that cmake already supports MacPorts & Fink, so the extra paths should already be added to `CMAKE_SYSTEM_PREFIX_PATH`.
>
> Please check by adding some `message(STATUS "Content of CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")` and see if whatever special parts are part already (seems that CMAKE_INSTALL_PREFIX is also added there, so might be duplicated). Oh, I just see in your cmake invocation snippet that `-DCMAKE_SYSTEM_PREFIX_PATH="${prefix};/usr"` is passed. No idea how that is generated, but whereever it is might be the correct place to control the extra root vars (which might be prefix in all cases) where MacPorts specific stuff should be found.
>
> So could you please try if these find commands work for you?
>
> FindOpenJPEG.cmake:
> ```
> FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h
> PATHS
> /usr/local/include/openjpeg
> /usr/local/include
> /usr/include/openjpeg
> /usr/include/openjpeg-1.5
> /usr/include
> PATH_SUFFIXES
> openjpeg-1.5
> openjpeg
> )
> ```
> (not touching the list in PATHS, even if possible half could be dropped)
>
> FindPqxx.cmake:
> ```
> find_path(PQXX_INCLUDE_DIR pqxx
> PATHS
> # ENV PQXX_ROOT perhaps as well?
> /usr/include/pqxx
> /usr/local/include/pqxx
> PATH_SUFFIXES
> pqxx
> )
> ```
>
> FindVc.cmake:
> ```
> find_package(Vc ${Vc_FIND_VERSION} QUIET NO_MODULE PATHS $ENV{HOME} /opt/Vc PATH_SUFFIXES Vc)
> ```
>
> René J.V. Bertin wrote:
> > message(STATUS "Content of CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")
> prints:
> ```
> Content of CMAKE_SYSTEM_PREFIX_PATH: /opt/local;/usr;/usr/local;/usr;/;/Volumes/Debian/MP9;/opt/local;//usr;/sw;/opt/local
> ```
>
> /Volumes/Debian/MP9 is the target of the symlink /opt/local on my system; /sw is where Fink would be installed (not present on my system).
>
> Your modification to FindOpenJPEG.cmake works, I've dropped trying to build with pqxx (and its dependencies) for now so I can only assume that the same mod should work there too.
>
> Friedrich W. H. Kossebau wrote:
> Ah, good if it works. So we can support MacPorts with cleaner code :) Want me to create a separate review request while your build is down?
>
> René J.V. Bertin wrote:
> What would be the point of a separate RR?
That was just to speed things up in case your build problems persists for more than a week or longer :)
Hm, the updated patch is not the final version, or should it?
- Friedrich W. H.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/122114/#review74205
-----------------------------------------------------------
On Jan. 20, 2015, 7:42 p.m., René J.V. Bertin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122114/
> -----------------------------------------------------------
>
> (Updated Jan. 20, 2015, 7:42 p.m.)
>
>
> Review request for Calligra and KDE Software on Mac OS X.
>
>
> Repository: calligra
>
>
> Description
> -------
>
> This patch adapts the build system to OS X with KDE4, Qt4 and other dependencies installed through MacPorts.
>
> In order of appearance in the patch file:
> - `-DQT_EXCEPTIONS`: this is for use with Qt built with its -no-exceptions option, which MacPorts provides as an optional variant.
> - Newer OS X variants only provide the clang compiler
> - The default install location for MacPorts is `/opt/local`, but this can be changed by the user. The header and library search paths required for OpenJPEG, libpqxx and OpenVC are added using `//opt//local//` which is of course equivalent to `/opt/local` but easier to search-and-replace with the true install location in MacPorts' post-patch stage.
> - the product set for OS X has been extended to all applications and features that build and make sense. (Calligra Gemini builds, but does not function properly.)
>
> A "Portfile" and accompanying patches that don't have the vocation to be included "upstream" in calligra will be uploaded to MacPorts' trac system soon.
>
>
> Diffs
> -----
>
> CMakeLists.txt facb5f9
> cmake/modules/FindOpenJPEG.cmake 6bfd93c
> cmake/modules/FindPqxx.cmake 3e24a0c
> cmake/modules/FindVc.cmake bb9823f
> cmake/productsets/osx.cmake 1fe8f1c
>
> Diff: https://git.reviewboard.kde.org/r/122114/diff/
>
>
> Testing
> -------
>
> On OS X 10.9.5 with kdelibs 4.14.4 and Qt 4.8.6 installed through MacPorts.
>
>
> Thanks,
>
> René J.V. Bertin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20150120/f1aa90e9/attachment-0001.html>
More information about the kde-mac
mailing list