roniemartinez / libqpsd

PSD (Photoshop Document) & PSB (Photoshop Big) Plugin for Qt/C++ (Qt4/Qt5)
GNU Lesser General Public License v2.1
108 stars 25 forks source link

Packaging nightmare #20

Closed dvzrv closed 6 years ago

dvzrv commented 6 years ago

I'd like to package libqpsd for Arch Linux (needed for nomacs - at least most likely in the future). Sadly, using qmake is a nightmare...

Currently, I'm trying something in the vein of:

mkdir build
cd build  
qmake "QT_INSTALL_PLUGINS=/usr/lib/qt/plugins" ..
make
make DESTDIR="${pkgdir}" install

However, the install target just deletes the .so file and then all fails. In the end I end up manually placing the .so file into the package file system... It seems, the .pro file is actually pretty unusable on Linux. There's no documentation on how to use it, what the variables actually do and what the estimated outcome would be. Any help on how to procede would be very much appreciated!

eli-schwartz commented 6 years ago

The .pro file uses DESTDIR to immediately put the plugin in /usr rather than waiting until make install to place it in INSTALL_ROOT.

Instead, target.path = $$[QT_INSTALL_PLUGINS]/imageformats should be used. qmake is supposed to handle this automatically in a cross-platform manner, so I'm confused as to why this sprinkles conditionals everywhere... am I missing something?

roniemartinez commented 6 years ago

Thanks @eli-schwartz

@dvzrv , you can also try to use the CMake build system. I don't have it here in my repo but nomacs implemented it.

eli-schwartz commented 6 years ago

That would be sort of missing the point, as the CMake version does not actually implement installation and would also involve downloading arbitrary thirdparty forks just to obtain a build system...

We know exactly why it doesn't work. It's a pretty easy fix:

From 23f44c1b1b7862d510e0b59534b36b90a1890175 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz93@gmail.com>
Date: Mon, 19 Mar 2018 21:11:32 -0400
Subject: [PATCH] Fix `make install`

Currently this instead tries to install directly to /usr during `make`
---
 QPsdPlugin.pro | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/QPsdPlugin.pro b/QPsdPlugin.pro
index 8c63256..0d6f12d 100644
--- a/QPsdPlugin.pro
+++ b/QPsdPlugin.pro
@@ -18,8 +18,6 @@ CONFIG(release, debug|release) {

 TEMPLATE = lib

-DESTDIR = $$[QT_INSTALL_PLUGINS]/imageformats
-
 SOURCES += qpsdplugin.cpp \
     qpsdhandler.cpp \
     qpsdhandler_p.cpp
@@ -32,11 +30,5 @@ OTHER_FILES += \
     README.md \
     CHANGELOG.md

-unix:!symbian {
-    maemo5 {
-        target.path = /opt/usr/lib
-    } else {
-        target.path = /usr/lib
-    }
-    INSTALLS += target
-}
+target.path = $$[QT_INSTALL_PLUGINS]/imageformats
+INSTALLS += target
-- 
2.16.2
roniemartinez commented 6 years ago

Thank you @eli-schwartz