You are not logged in.

#1 2014-10-27 22:08:02

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

[SOLVED]makepkg changes behaviour of make install (gen. with cmake)

For the first time I want to distribute what I am coding in my spare time. Right now I am trying to pack the app with PKGBUILD, but I am facing problems. I use cmake and when I install the app from sources make install runs properly. But when I try to run make install in the package() function the config file will not be installed.

CMakeLists.txt:

#linux
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  set(SRCS ${SRCS} src/globalhotkey_x11.cpp)
  add_executable(albert ${SRCS} ${UIS} ${DATA})
  target_link_libraries(albert Qt5::Widgets Qt5::X11Extras muparser X11)
  install(TARGETS albert RUNTIME DESTINATION /usr/bin)
  install(FILES data/albert.conf DESTINATION /etc/xdg/albert COMPONENT config)
  install(DIRECTORY data/icons DESTINATION /usr/share/albert COMPONENT config)
  install(DIRECTORY data/themes DESTINATION /usr/share/albert COMPONENT config)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

PKGBUILD

build() {

  msg "Connecting to GIT server...."

  if [[ -d "$pkgname" ]]; then
    cd "$pkgname" && git pull
  else
    git clone "$_gitroot" --branch testing "$pkgname"
  fi

  msg "Done."
  msg "Make project..."

  [[ -d "$srcdir/build" ]] || mkdir -p "$srcdir/build"

  cd "$srcdir/build"
  cmake "../$pkgname" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Debug
  make
}

package() {
  cd "$srcdir/build"
  make DESTDIR="$pkgdir/" install
}

Where is the problem?

Last edited by manuelschneid3r (2014-10-28 08:58:24)


Please feel free to correct my english.

Offline

#2 2014-10-27 22:21:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED]makepkg changes behaviour of make install (gen. with cmake)

I don't use cmake, but my guess would be that the Makefile doesn't use DESTDIR.  The excerpt that you posted leads me to suspect that DESTINATION may be used instead.  Can you post (or link to) the Makefile produced by cmake?

Also, please see the VCS guidelines for git packages, you should not check out the code manually - makepkg will do that.

EDIT: I may have misread.  When you use the PKGBUILD is nothing installed, or is only the config file missing?

Last edited by Trilby (2014-10-27 22:23:57)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2014-10-28 07:27:10

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

Re: [SOLVED]makepkg changes behaviour of make install (gen. with cmake)

Just the config files are missing. I found a partial solution. When I use relative paths in the install part, it works if I set CMAKE_INSTALL_PREFIX=/. But this would not be proper, since this is a way to let the user decide where the files should be installed. If it is fine with PKGBUILD it's not with the from-source-way and vice versa. Is there a way to avoid this?


Please feel free to correct my english.

Offline

#4 2014-10-28 08:57:07

manuelschneid3r
Member
From: Germany
Registered: 2013-04-14
Posts: 152

Re: [SOLVED]makepkg changes behaviour of make install (gen. with cmake)

Hmm okay, i dont know what i have done yesterday but right now it is working. :? Build stuff now looks like this:

#linux
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

  # Add platformspecific sources
  set(SRCS ${SRCS} src/globalhotkey_x11.cpp)

  # Define targets and linked libs
  add_executable(albert ${SRCS} ${UIS} ${DATA})
  target_link_libraries(albert Qt5::Widgets Qt5::X11Extras muparser X11)

  # Define make install target
  install(TARGETS albert RUNTIME DESTINATION bin)
  install(DIRECTORY data/icons DESTINATION share/albert COMPONENT config)
  install(DIRECTORY data/themes DESTINATION share/albert COMPONENT config)
  install(FILES data/icon.svg DESTINATION share/albert COMPONENT icon)
  install(FILES data/albert.desktop DESTINATION share/applications COMPONENT desktop)
  install(FILES data/albert.conf DESTINATION /etc/xdg/albert COMPONENT config)

endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
build() {
  msg "Connecting to GIT server...."

  if [[ -d "$pkgname" ]]; then
    cd "$pkgname" && git pull
  else
    git clone "$_gitroot" --branch testing "$pkgname"
  fi

  msg "Done."
  msg "Make project..."

  [[ -d "$srcdir/build" ]] || mkdir -p "$srcdir/build"

  cd "$srcdir/build"
  cmake "../$pkgname" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Debug
  make
}

package() {
  cd "$srcdir/build"
  make DESTDIR="$pkgdir/" install
}

I am totally excited about to publish an alpha here as soon all problems are solved.

Last edited by manuelschneid3r (2014-10-28 08:59:52)


Please feel free to correct my english.

Offline

#5 2014-10-28 13:14:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED]makepkg changes behaviour of make install (gen. with cmake)

You ignored Trilby's suggestion to check out the VCS PKGBUILD guidelines wiki page. Please do so.

Offline

Board footer

Powered by FluxBB