From 1ec6bd4d3be95753cbc6225ed6025a35095296da Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Fri, 18 Jul 2025 14:51:04 +0800
Subject: [PATCH 10/10] Fix build files

---
 fm/fm.pro       | 30 ++++++++++++++++--------------
 libfm/libfm.pro | 20 +++++++++++---------
 share/qtfm.pri  |  9 +++++----
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git fm/fm.pro fm/fm.pro
index 73ddd75..3293860 100644
--- fm/fm.pro
+++ fm/fm.pro
@@ -1,13 +1,15 @@
-include($${top_srcdir}/share/qtfm.pri)
+include(../share/qtfm.pri)
 
-QT+= widgets concurrent
+greaterThan(QT_MAJOR_VERSION, 4) {
+    QT += widgets concurrent
+}
 
-TARGET = $${QTFM_TARGET}
-TARGET_NAME = $${QTFM_TARGET_NAME}
+TARGET = qtfm
+TARGET_NAME = "QtFM"
 VERSION = $${QTFM_MAJOR}.$${QTFM_MINOR}.$${QTFM_PATCH}
 TEMPLATE = app
 
-INCLUDEPATH += src $${top_srcdir}/libfm
+INCLUDEPATH += src ../libfm
 
 DEFINES += APP=\"\\\"$${TARGET}\\\"\"
 DEFINES += APP_NAME=\"\\\"$${TARGET_NAME}\\\"\"
@@ -27,22 +29,22 @@ SOURCES += \
     src/actiondefs.cpp \
     src/actiontriggers.cpp
 
-RESOURCES += $${top_srcdir}/share/$${TARGET}.qrc
+RESOURCES += ../share/$${TARGET}.qrc
 
 macx {
-    LIBS += -L$${top_builddir}/libfm -lQtFM
+    LIBS += -L../libfm -lQtFM -F$${PREFIX}/libexec/qt4/Library/Frameworks
     DEFINES += NO_DBUS NO_UDISKS
     RESOURCES += bundle/adwaita.qrc
-    ICON = $${top_srcdir}/share/images/QtFM.icns
-    QMAKE_INFO_PLIST = $${top_srcdir}/share/Info.plist
+    ICON = ../share/images/QtFM.icns
+    QMAKE_INFO_PLIST = ../share/Info.plist
 }
 
 unix:!macx {
-    DESTDIR = $${top_builddir}/bin
+    DESTDIR = ../bin
     OBJECTS_DIR = $${DESTDIR}/.obj_fm
     MOC_DIR = $${DESTDIR}/.moc_fm
     RCC_DIR = $${DESTDIR}/.qrc_fm
-    LIBS += -L$${top_builddir}/lib$${LIBSUFFIX} -lQtFM
+    LIBS += -L../lib$${LIBSUFFIX} -lQtFM
 
     target.path = $${PREFIX}/bin
     desktop.files += $${TARGET}.desktop
@@ -51,7 +53,7 @@ unix:!macx {
     man.path += $${MANDIR}/man1
     INSTALLS += target desktop man
 
-    hicolor.files = $${top_srcdir}/share/hicolor
+    hicolor.files = ../share/hicolor
     hicolor.path = $${PREFIX}/share/icons
     INSTALLS += hicolor
 
@@ -63,5 +65,5 @@ unix:!macx {
     !CONFIG(staticlib): QMAKE_RPATHDIR += $ORIGIN/../lib$${LIBSUFFIX}
 }
 
-CONFIG(with_magick): include($${top_srcdir}/share/imagemagick.pri)
-CONFIG(with_ffmpeg): include($${top_srcdir}/share/ffmpeg.pri)
+CONFIG(with_magick): include(../share/imagemagick.pri)
+CONFIG(with_ffmpeg): include(../share/ffmpeg.pri)
diff --git libfm/libfm.pro libfm/libfm.pro
index a819239..2b17aaa 100644
--- libfm/libfm.pro
+++ libfm/libfm.pro
@@ -1,6 +1,8 @@
-include($${top_srcdir}/share/qtfm.pri)
+include(../share/qtfm.pri)
 
-QT += widgets concurrent
+greaterThan(QT_MAJOR_VERSION, 4) {
+    QT += widgets concurrent
+}
 
 TARGET = QtFM
 VERSION = $${QTFM_MAJOR}.$${QTFM_MINOR}.$${QTFM_PATCH}
@@ -59,7 +61,7 @@ HEADERS += \
 #           qtcopydialog/qtotherdialog.ui
 
 unix:!macx {
-    DESTDIR = $${top_builddir}/lib$${LIBSUFFIX}
+    DESTDIR = ../lib$${LIBSUFFIX}
     OBJECTS_DIR = $${DESTDIR}/.obj_libfm
     MOC_DIR = $${DESTDIR}/.moc_libfm
     RCC_DIR = $${DESTDIR}/.qrc_libfm
@@ -79,10 +81,10 @@ unix:!macx {
     target.path = $${LIBDIR}
     docs.path = $${DOCDIR}/$${QTFM_TARGET}-$${VERSION}
     docs.files += \
-                $${top_srcdir}/LICENSE \
-                $${top_srcdir}/README.md \
-                $${top_srcdir}/AUTHORS \
-                $${top_srcdir}/ChangeLog
+                ../LICENSE \
+                ../README.md \
+                ../AUTHORS \
+                ../ChangeLog
 
     CONFIG(with_includes) {
         target_inc.path = $${PREFIX}/include/lib$${TARGET}
@@ -99,5 +101,5 @@ unix:!macx {
     CONFIG(with_includes): INSTALLS += target_inc
 }
 
-CONFIG(with_magick): include($${top_srcdir}/share/imagemagick.pri)
-CONFIG(with_ffmpeg): include($${top_srcdir}/share/ffmpeg.pri)
+CONFIG(with_magick): include(../share/imagemagick.pri)
+CONFIG(with_ffmpeg): include(../share/ffmpeg.pri)
diff --git share/qtfm.pri share/qtfm.pri
index cd01f65..538b20c 100644
--- share/qtfm.pri
+++ share/qtfm.pri
@@ -20,7 +20,11 @@ unix:!macx {
     isEmpty(XDGDIR): XDGDIR = /etc/xdg
 }
 
-QT += widgets
+CONFIG += qt gui
+
+greaterThan(QT_MAJOR_VERSION, 4) {
+    QT += widgets
+}
 
 CONFIG += link_pkgconfig
 
@@ -29,7 +33,6 @@ macx {
     LIBS += -framework CoreFoundation -framework CoreServices
     QT_CONFIG -= no-pkg-config
     PKGCONFIG += libinotify
-    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
     CONFIG += staticlib
 }
 
@@ -44,5 +47,3 @@ netbsd-g++: PKGCONFIG += libinotify
 
 #DEFINES += QT_DEPRECATED_WARNINGS
 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
-
-lessThan(QT_MAJOR_VERSION, 5): error("Qt4 is not supported anymore.")
-- 
2.49.0

