Kaffeine/telegram-qt

Incorrect paths in generated cmake config

jtojnar opened this issue · 4 comments

I am trying to package telegram-qt but the cmake config file contains wrong paths:

$ cat $(nix-build -A libsForQt5.telegram)/lib/cmake/TelegramQt5/TelegramQt5Config.cmake 
# TelegramQt5Config.cmake is generated by CMake from telegram-qt/TelegramQtConfig.cmake.in.
# Any changed value in this file will be overwritten by CMake.

# set the version number
set(TELEGRAM_QT5_VERSION_MAJOR 0)
set(TELEGRAM_QT5_VERSION_MINOR 1)
set(TELEGRAM_QT5_VERSION_PATCH 0)
set(TELEGRAM_QT5_VERSION 0.1.0)

# set the directories
if(NOT TELEGRAM_QT5_INSTALL_DIR)
   set(TELEGRAM_QT5_INSTALL_DIR "/nix/store/fd2vy5svxj51f2g67sqs1wcm6223r48b-telegram-qt-0.1.0")
endif(NOT TELEGRAM_QT5_INSTALL_DIR)

set(TELEGRAM_QT5_INCLUDE_DIR              "${TELEGRAM_QT5_INSTALL_DIR}//nix/store/fd2vy5svxj51f2g67sqs1wcm6223r48b-telegram-qt-0.1.0/include/telegram-qt5")
set(TELEGRAM_QT5_LIB_DIR                  "${TELEGRAM_QT5_INSTALL_DIR}//nix/store/fd2vy5svxj51f2g67sqs1wcm6223r48b-telegram-qt-0.1.0/lib")

set(TELEGRAM_QT5_LIBRARIES -L${TELEGRAM_QT5_LIB_DIR} -ltelegram-qt5)

For example, TELEGRAM_QT5_LIB_DIR resolves to /nix/store/90m1a9961hcag9pspws53qk246gkg5hj-telegram-qt-0.1.0//nix/store/90m1a9961hcag9pspws53qk246gkg5hj-telegram-qt-0.1.0/lib.

I use the following cmake flags:

-DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/90m1a9961hcag9pspws53qk246gkg5hj-telegram-qt-0.1.0/include -DCMAKE_INSTALL_LIBDIR=/nix/store/90m1a9961hcag9pspws53qk246gkg5hj-telegram-qt-0.1.0/lib -DCMAKE_INSTALL_NAME_DIR=/nix/store/90m1a9961hcag9pspws53qk246gkg5hj-telegram-qt-0.1.0/lib -DCMAKE_INSTALL_PREFIX=/nix/store/90m1a9961hcag9pspws53qk246gkg5hj-telegram-qt-0.1.0  

Comparing the TelegramQtConfig.cmake.in file

set(TELEGRAM_QT@QT_VERSION_MAJOR@_INCLUDE_DIR "${TELEGRAM_QT@QT_VERSION_MAJOR@_INSTALL_DIR}/@TELEGRAM_QT_INCLUDE_DIR@")
set(TELEGRAM_QT@QT_VERSION_MAJOR@_LIB_DIR "${TELEGRAM_QT@QT_VERSION_MAJOR@_INSTALL_DIR}/@TELEGRAM_QT_LIB_DIR@")

with a similar one from telepathy-qt

https://github.com/TelepathyIM/telepathy-qt/blob/f81ae2d33ff36baa7938b4f89fa51372c9ff1fcc/TelepathyQt/TelepathyQtServiceConfig.cmake.in#L18-L19

tells me, the issue is probably here.

I think I fixed it in 71c722f.
Thank you!

The generated file looks fine and telepathy-morse builds with this, thanks.

I have to say that it seems that you build a very old version and because of the changes on the (Telegram) server side, I would not expect it to work correctly.

I'm going to release 0.2.0 this year, but I can not promise.
I can make a tag like 0.2.0-alpha1 if it makes any sense for you (the master branches are stable and should work much better, than 0.1.0).

I upgraded to master after locally patching this bug because it was not working. Packaging git HEAD is fine with us, we would probably had to continue doing so even if a “stable” version were released.

I am packaging it here: NixOS/nixpkgs#32622