trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2016

Re: [trinity-devel] CMake + tdelfeditor × versioned libraries

From: Fat-Zer <fatzer2@...>
Date: Tue, 15 Mar 2016 15:43:33 +0300
2016-03-15 0:18 GMT+03:00 Slávek Banko <slavek.banko@...>:
> Hi all,
>
> I noticed one problem regarding the cmake build of libraries with versioning
> and tdelfeditor. Tdelfeditor is used not only on file with the appropriate
> version, but also on base 'so' file without a version number. However, this
> is a symlink to the file with the appropriate version. Use tdelfeditor causes
> that instead of this symlink is created a regular file. Results are then two
> full 'so' files, which is incorrect. For example, in tdebase (current stable
> R14.0.3 Wheezy@amd64):
>
>   libkonq.so - size 809232 (package libkonq4-trinity-dev)
>   libkonq.so.4.2.0 - size 809240 (package libkonq4-trinity)
>
> Solutions should be simple: in the common cmake module run tdelfeditor only on
> libraries with the appropriate version and on base files only if the library
> is not versioned. In some cases tdelfeditor is used, although library is not
> shared == tdelfeditor is started without valid arguments. See proposed patch.
>
> I believe that there is no reason against to push the patch. There will be
> only one consequence - the patch causes rebuild almost all packages.
>
> --
> Slávek
>
> Index: b/cmake/modules/TDEMacros.cmake
> ===================================================================
> --- a/cmake/modules/TDEMacros.cmake
> +++ b/cmake/modules/TDEMacros.cmake
> @@ -835,13 +835,7 @@
>    # embed name and metadata
>    set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"x-sharedlib\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" )
>    separate_arguments( ELF_EMBEDDING_METADATA )
> -  if( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor )
> -    add_custom_command(
> -      TARGET ${_target}
> -      POST_BUILD
> -      COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ${ELF_EMBEDDING_METADATA} || true
> -      COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname} || true
> -    )
> +  if( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor AND _soname )
>      if( _version )
>        add_custom_command(
>          TARGET ${_target}
> @@ -849,6 +843,13 @@
>          COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} ${ELF_EMBEDDING_METADATA} || true
>          COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} || true
>        )
> +    else( )
> +      add_custom_command(
> +        TARGET ${_target}
> +        POST_BUILD
> +        COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ${ELF_EMBEDDING_METADATA} || true
> +        COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname} || true
> +      )
>      endif( )
>    endif( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor )
>

Few notes about the patch:
- At least you should use ${BIN_INSTALL_DIR} rather ${CMAKE_INSTALL_PREFIX}/bin.
- It is generally a bad practice to search for a file on an installation path.
- Starting cmake 2.8.4 you may refer a ${_target} in a commands and
cmake should replace it with the appropriate filepath so you may get
rid of the if.

2016-03-15 10:59 GMT+03:00 Michele Calgaro <michele.calgaro@...>:
> On 03/14/2016 10:18 PM, Slávek Banko wrote:
> Hi Slavek,
> no problem if the patch needs to be pushed.
> Anyhow I do not see this problem on my system. See attached screenshot, tdebase rebuilt 3 days ago.
> Maybe something else?
> Cheers
>   Michele
>

Do you have tdelfeditor installed on the building system? Note that It
is getting build only if you build tdelibs WITH_ELFICON