enable Solid udisks2 backend, backport FindKipi.cmake

* Sat Sep 22 2012 Kevin Kofler <Kevin@tigcc.ticalc.org> - 6:4.9.1-4
- actually enable Solid udisks2 backend (restore patch hunks lost in 4.9.1-2)
- backport FindKipi.cmake from Digikam SC 3.0.0-beta1 for libkipi 2 (kde#307213)
This commit is contained in:
Kevin Kofler 2012-09-22 18:42:15 +02:00
parent e5e0930922
commit ae5f4b1749
3 changed files with 348 additions and 1 deletions

View File

@ -0,0 +1,223 @@
diff -ur kdelibs-4.9.1/cmake/modules/FindKipi.cmake kdelibs-4.9.1-FindKipi-libkipi2/cmake/modules/FindKipi.cmake
--- kdelibs-4.9.1/cmake/modules/FindKipi.cmake 2012-08-13 10:39:41.000000000 +0200
+++ kdelibs-4.9.1-FindKipi-libkipi2/cmake/modules/FindKipi.cmake 2012-09-22 18:37:47.000000000 +0200
@@ -1,116 +1,118 @@
-# - Try to find the Kipi library
+# Module that tries to find the Kipi library
#
# If you have put a local version of libkipi into your source tree,
# set KIPI_LOCAL_DIR to the relative path to the local directory.
#
# Once done this will define
#
-# KIPI_FOUND - system has libkipi
-# KIPI_INCLUDE_DIR - the libkipi include directory
-# KIPI_LIBRARIES - Link these to use libkipi
+# KIPI_FOUND - System has libkipi
+# KIPI_INCLUDE_DIR - The libkipi include directory
+# KIPI_LIBRARIES - Link these to use libkipi
# KIPI_DEFINITIONS - Compiler switches required for using libkipi
+# KIPI_VERSION - The release version of the Kipi library
+# KIPI_SO_VERSION - The binary SO version of the Kipi library
#
-# Copyright (c) 2008, Gilles Caulier, <caulier.gilles@gmail.com>
+# Copyright (c) 2012, Victor Dodon <dodonvictor at gmail dot com>
+# Copyright (c) 2012, Gilles Caulier <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-if (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS)
+IF(KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS AND KIPI_VERSION AND KIPI_SO_VERSION)
- message(STATUS "Found Kipi library in cache: ${KIPI_LIBRARIES}")
+ IF(NOT Kipi_FIND_QUIETLY)
+ MESSAGE(STATUS "Found kipi library in cache ${KIPI_LIBRARIES}")
+ ENDIF(NOT Kipi_FIND_QUIETLY)
+ # Already in cache
+ SET(KIPI_FOUND TRUE)
+
+ELSE(KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS AND KIPI_VERSION AND KIPI_SO_VERSION)
+
+ IF(NOT Kipi_FIND_QUIETLY)
+ MESSAGE(STATUS "Check Kipi library in local sub-folder...")
+ ENDIF(NOT Kipi_FIND_QUIETLY)
+
+ IF(KIPI_LOCAL_DIR)
+ FIND_FILE(KIPI_LOCAL_FOUND libkipi/version.h.cmake ${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR} NO_DEFAULT_PATH)
+ IF(NOT KIPI_LOCAL_FOUND)
+ MESSAGE(WARNING "KIPI_LOCAL_DIR specified as \"${KIPI_LOCAL_DIR}\" but libkipi could not be found there.")
+ ENDIF(NOT KIPI_LOCAL_FOUND)
+ ELSE(KIPI_LOCAL_DIR)
+ FIND_FILE(KIPI_LOCAL_FOUND libkipi/version.h.cmake ${CMAKE_SOURCE_DIR}/libkipi NO_DEFAULT_PATH)
+ IF(KIPI_LOCAL_FOUND)
+ SET(KIPI_LOCAL_DIR libkipi)
+ ENDIF(KIPI_LOCAL_FOUND)
+
+ FIND_FILE(KIPI_LOCAL_FOUND libkipi/version.h.cmake ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH)
+ IF(KIPI_LOCAL_FOUND)
+ SET(KIPI_LOCAL_DIR libs/libkipi)
+ ENDIF(KIPI_LOCAL_FOUND)
+ ENDIF(KIPI_LOCAL_DIR)
+
+ IF(KIPI_LOCAL_FOUND)
+
+ SET(KIPI_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}" "${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR}")
+ SET(KIPI_DEFINITIONS "-I${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}" "-I${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR}")
+ SET(KIPI_LIBRARIES kipi)
+ IF(NOT Kipi_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Kipi library in local sub-folder: ${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}")
+ ENDIF(NOT Kipi_FIND_QUIETLY)
+ SET(KIPI_FOUND TRUE)
+ SET(KIPI_VERSION_H_FILENAME "${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR}/libkipi/version.h")
+
+ ELSE(KIPI_LOCAL_FOUND)
+
+ IF(NOT WIN32)
+ IF(NOT Kipi_FIND_QUIETLY)
+ MESSAGE(STATUS "Check Kipi library using pkg-config...")
+ ENDIF(NOT Kipi_FIND_QUIETLY)
+
+ INCLUDE(FindPkgConfig)
+ PKG_CHECK_MODULES(KIPI libkipi>=1.2.0)
+ ENDIF(NOT WIN32)
+
+ FIND_LIBRARY(KIPI_LIBRARIES NAMES libkipi PATHS ${KIPI_LIBRARY_DIRS} ${LIB_INSTALL_DIR} ${KDE4_LIB_DIR})
+ FIND_PATH(KIPI_INCLUDE_DIR NAMES libkipi/version.h PATHS ${KIPI_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR} ${KDE4_INCLUDE_DIR})
+ SET(KIPI_VERSION_H_FILENAME "${KIPI_INCLUDE_DIR}/libkipi/version.h")
+ SET(KIPI_DEFINITIONS ${KIPI_CFLAGS})
+
+ INCLUDE(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(KIPI DEFAULT_MSG KIPI_LIBRARIES KIPI_INCLUDE_DIR)
+
+ ENDIF(KIPI_LOCAL_FOUND)
+
+ IF(KIPI_FOUND)
+
+ IF(NOT KIPI_VERSION)
+ FILE(READ "${KIPI_VERSION_H_FILENAME}" KIPI_VERSION_H_CONTENT)
+ STRING(REGEX REPLACE ".*static +const +char +kipi_version\\[\\] += +\"([^\"]+)\".*" "\\1" KIPI_VERSION "${KIPI_VERSION_H_CONTENT}")
+ MESSAGE(STATUS "Kipi library version: ${KIPI_VERSION}")
+ ENDIF(NOT KIPI_VERSION)
+
+ IF(NOT KIPI_SO_VERSION)
+ FILE(READ "${KIPI_VERSION_H_FILENAME}" KIPI_VERSION_H_CONTENT)
+ STRING(REGEX REPLACE
+ ".*static +const +int +kipi_binary_version += ([^ ;]+).*"
+ "\\1"
+ KIPI_SO_VERSION
+ "${KIPI_VERSION_H_CONTENT}"
+ )
+ MESSAGE(STATUS "Kipi library SO binary version: ${KIPI_SO_VERSION}")
+ ENDIF(NOT KIPI_SO_VERSION)
+
+ UNSET(KIPI_VERSION_H_CONTENT)
+ UNSET(KIPI_VERSION_H_FILENAME)
+ ENDIF(KIPI_FOUND)
+
+ IF(KIPI_FOUND)
+ MARK_AS_ADVANCED(KIPI_INCLUDE_DIR KIPI_LIBRARIES KIPI_DEFINITIONS KIPI_VERSION KIPI_SO_VERSION)
+ ELSE(KIPI_FOUND)
+ UNSET(KIPI_INCLUDE_DIR)
+ UNSET(KIPI_LIBRARIES)
+ UNSET(KIPI_DEFINITIONS)
+ UNSET(KIPI_VERSION)
+ UNSET(KIPI_SO_VERSION)
+ ENDIF(KIPI_FOUND)
- # in cache already
- set(KIPI_FOUND TRUE)
-
-else (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS)
-
- message(STATUS "Check Kipi library in local sub-folder...")
-
- # Check if library is not in local sub-folder
-
- if (KIPI_LOCAL_DIR)
- set (KIPI_LOCAL_FOUND TRUE)
- else (KIPI_LOCAL_DIR)
- find_file(KIPI_LOCAL_FOUND libkipi/kipi.h ${CMAKE_SOURCE_DIR}/libkipi ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH)
-
- if (KIPI_LOCAL_FOUND)
- # Was it found in libkdcraw/ or in libs/libkdcraw?
- find_file(KIPI_LOCAL_FOUND_IN_LIBS libkipi/kipi.h ${CMAKE_SOURCE_DIR}/libs/libkipi NO_DEFAULT_PATH)
- if (KIPI_LOCAL_FOUND_IN_LIBS)
- set(KIPI_LOCAL_DIR libs/libkipi)
- else (KIPI_LOCAL_FOUND_IN_LIBS)
- set(KIPI_LOCAL_DIR libkipi)
- endif (KIPI_LOCAL_FOUND_IN_LIBS)
- endif (KIPI_LOCAL_FOUND)
- endif (KIPI_LOCAL_DIR)
-
- if (KIPI_LOCAL_FOUND)
- # we need two include directories: because the version.h file is put into the build directory
- # TODO KIPI_INCLUDE_DIR sounds like it should contain only one directory...
- set(KIPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR} ${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR})
- set(KIPI_DEFINITIONS "-I${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}" "-I${CMAKE_BINARY_DIR}/${KIPI_LOCAL_DIR}")
- set(KIPI_LIBRARIES kipi)
- message(STATUS "Found Kipi library in local sub-folder: ${CMAKE_SOURCE_DIR}/${KIPI_LOCAL_DIR}")
- set(KIPI_FOUND TRUE)
- mark_as_advanced(KIPI_INCLUDE_DIR KIPI_LIBRARIES KIPI_DEFINITIONS)
-
- else (KIPI_LOCAL_FOUND)
-
- if (NOT WIN32)
- message(STATUS "Check Kipi library using pkg-config...")
-
- # use pkg-config to get the directories and then use these values
- # in the FIND_PATH() and FIND_LIBRARY() calls
- include(UsePkgConfig)
-
- PKGCONFIG(libkipi _KIPIIncDir _KIPILinkDir _KIPILinkFlags _KIPICflags)
-
- if (_KIPILinkFlags)
- # query pkg-config asking for a libkipi >= 0.2.0
- exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=0.2.0 libkipi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
- if (_return_VALUE STREQUAL "0")
- message(STATUS "Found libkipi release >= 0.2.0")
- set(KIPI_VERSION_GOOD_FOUND TRUE)
- else (_return_VALUE STREQUAL "0")
- message(STATUS "Found libkipi release < 0.2.0, too old")
- set(KIPI_VERSION_GOOD_FOUND FALSE)
- set(KIPI_FOUND FALSE)
- endif (_return_VALUE STREQUAL "0")
- else (_KIPILinkFlags)
- set(KIPI_VERSION_GOOD_FOUND FALSE)
- set(KIPI_FOUND FALSE)
- endif (_KIPILinkFlags)
- else (NOT WIN32)
- set(KIPI_VERSION_GOOD_FOUND TRUE)
- endif (NOT WIN32)
- if (KIPI_VERSION_GOOD_FOUND)
- set(KIPI_DEFINITIONS ${_KIPICflags})
-
- find_path(KIPI_INCLUDE_DIR NAMES libkipi/version.h PATHS ${KDE4_INCLUDE_DIR} ${_KIPIIncDir})
- find_library(KIPI_LIBRARIES NAMES kipi PATHS ${KDE4_LIB_DIR} ${_KIPILinkDir})
-
- if (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES)
- set(KIPI_FOUND TRUE)
- endif (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES)
- endif (KIPI_VERSION_GOOD_FOUND)
- if (KIPI_FOUND)
- if (NOT Kipi_FIND_QUIETLY)
- message(STATUS "Found libkipi: ${KIPI_LIBRARIES}")
- endif (NOT Kipi_FIND_QUIETLY)
- else (KIPI_FOUND)
- if (Kipi_FIND_REQUIRED)
- if (NOT KIPI_INCLUDE_DIR)
- message(FATAL_ERROR "Could NOT find libkipi header files")
- endif (NOT KIPI_INCLUDE_DIR)
- if (NOT KIPI_LIBRARIES)
- message(FATAL_ERROR "Could NOT find libkipi library")
- endif (NOT KIPI_LIBRARIES)
- endif (Kipi_FIND_REQUIRED)
- endif (KIPI_FOUND)
-
- mark_as_advanced(KIPI_INCLUDE_DIR KIPI_LIBRARIES KIPI_DEFINITIONS)
-
- endif (KIPI_LOCAL_FOUND)
-
-endif (KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS)
+ENDIF(KIPI_INCLUDE_DIR AND KIPI_LIBRARIES AND KIPI_DEFINITIONS AND KIPI_VERSION AND KIPI_SO_VERSION)

View File

@ -0,0 +1,114 @@
diff -ur kdelibs-4.9.1/solid/solid/CMakeLists.txt kdelibs-4.9.1-solid-udisks2-enable/solid/solid/CMakeLists.txt
--- kdelibs-4.9.1/solid/solid/CMakeLists.txt 2012-08-13 10:41:04.000000000 +0200
+++ kdelibs-4.9.1-solid-udisks2-enable/solid/solid/CMakeLists.txt 2012-09-22 18:26:54.000000000 +0200
@@ -39,7 +39,6 @@
file(MAKE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/backends/fakehw
- ${CMAKE_CURRENT_BINARY_DIR}/backends/hal
${CMAKE_CURRENT_BINARY_DIR}/backends/udev
${CMAKE_CURRENT_BINARY_DIR}/backends/wmi
)
@@ -225,33 +224,6 @@
endif( UDEV_FOUND )
- message(STATUS "Building Solid HAL backend." )
- set(solid_LIB_SRCS ${solid_LIB_SRCS}
- backends/hal/halacadapter.cpp
- backends/hal/halaudiointerface.cpp
- backends/hal/halbattery.cpp
- backends/hal/halblock.cpp
- backends/hal/halbutton.cpp
- backends/hal/halcamera.cpp
- backends/hal/halcdrom.cpp
- backends/hal/haldeviceinterface.cpp
- backends/hal/haldvbinterface.cpp
- backends/hal/halfstabhandling.cpp
- backends/hal/halgenericinterface.cpp
- backends/hal/haldevice.cpp
- backends/hal/halmanager.cpp
- backends/hal/halnetworkinterface.cpp
- backends/hal/halserialinterface.cpp
- backends/hal/halopticaldisc.cpp
- backends/hal/halportablemediaplayer.cpp
- backends/hal/halprocessor.cpp
- backends/hal/halstorageaccess.cpp
- backends/hal/halstorage.cpp
- backends/hal/halvideo.cpp
- backends/hal/halvolume.cpp
- backends/hal/halsmartcardreader.cpp
- )
-
message(STATUS "Building Solid UPower backend." )
set(solid_LIB_SRCS ${solid_LIB_SRCS}
backends/upower/upowermanager.cpp
@@ -264,18 +236,19 @@
# FIXME: this should work on more Unix systems
if (CMAKE_SYSTEM_NAME MATCHES Linux)
- message(STATUS "Building Solid UDisks backend." )
+ message(STATUS "Building Solid UDisks2 backend." )
set(solid_LIB_SRCS ${solid_LIB_SRCS}
- backends/udisks/udisksmanager.cpp
- backends/udisks/udisksdevice.cpp
- backends/udisks/udisksblock.cpp
- backends/udisks/udisksstoragevolume.cpp
- backends/udisks/udisksdeviceinterface.cpp
- backends/udisks/udisksopticaldisc.cpp
- backends/udisks/udisksopticaldrive.cpp
- backends/udisks/udisksstoragedrive.cpp
- backends/udisks/udisksstorageaccess.cpp
- backends/udisks/udisksgenericinterface.cpp
+ backends/udisks2/udisksmanager.cpp
+ backends/udisks2/udisksdevice.cpp
+ backends/udisks2/udisksblock.cpp
+ backends/udisks2/udisksstoragevolume.cpp
+ backends/udisks2/udisksdeviceinterface.cpp
+ backends/udisks2/udisksopticaldisc.cpp
+ backends/udisks2/udisksopticaldrive.cpp
+ backends/udisks2/udisksstoragedrive.cpp
+ backends/udisks2/udisksstorageaccess.cpp
+ backends/udisks2/udisksgenericinterface.cpp
+ backends/udisks2/dbus/manager.cpp
)
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
Nur in kdelibs-4.9.1-solid-udisks2-enable/solid/solid: CMakeLists.txt.orig.
diff -ur kdelibs-4.9.1/solid/solid/managerbase.cpp kdelibs-4.9.1-solid-udisks2-enable/solid/solid/managerbase.cpp
--- kdelibs-4.9.1/solid/solid/managerbase.cpp 2012-08-13 10:41:05.000000000 +0200
+++ kdelibs-4.9.1-solid-udisks2-enable/solid/solid/managerbase.cpp 2012-09-22 18:26:54.000000000 +0200
@@ -30,8 +30,7 @@
#if defined (Q_OS_MAC)
#include "backends/iokit/iokitmanager.h"
#elif defined (Q_OS_UNIX)
-#include "backends/hal/halmanager.h"
-#include "backends/udisks/udisksmanager.h"
+#include "backends/udisks2/udisksmanager.h"
#include "backends/upower/upowermanager.h"
#if defined (HUPNP_FOUND)
@@ -71,22 +70,13 @@
# elif defined(Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE)
m_backends << new Solid::Backends::Wmi::WmiManager(0);
-# elif defined(Q_OS_UNIX) && !defined(Q_OS_LINUX)
- m_backends << new Solid::Backends::Hal::HalManager(0);
-
# elif defined(Q_OS_LINUX)
- bool solidHalLegacyEnabled
- = QString::fromLocal8Bit(qgetenv("SOLID_HAL_LEGACY")).toInt()==1;
- if (solidHalLegacyEnabled) {
- m_backends << new Solid::Backends::Hal::HalManager(0);
- } else {
# if defined(UDEV_FOUND)
m_backends << new Solid::Backends::UDev::UDevManager(0);
# endif
- m_backends << new Solid::Backends::UDisks::UDisksManager(0)
+ m_backends << new Solid::Backends::UDisks2::Manager(0)
<< new Solid::Backends::UPower::UPowerManager(0)
<< new Solid::Backends::Fstab::FstabManager(0);
- }
# endif
# if defined (HUPNP_FOUND)

View File

@ -25,7 +25,7 @@
Summary: KDE Libraries
Version: 4.9.1
Release: 3%{?dist}
Release: 4%{?dist}
Name: kdelibs
Epoch: 6
@ -123,6 +123,7 @@ Patch45: kdelibs-4.7.3-halectomy.patch
# udisks2 Solid backend, halectomy
Patch47: kdelibs-udisks2-backend.patch
Patch48: kdelibs-4.9.1-solid-udisks2-enable.patch
## upstreamable
# knewstuff2 variant of:
@ -145,6 +146,9 @@ Patch54: kdelibs-4.8.4-kjs-locale.patch
# Can't safely remove a USB removable hard drive ( http://bugzilla.redhat.com/852196 )
Patch55: kdelibs-4.9.1-udisks_detatch_external_hdd.patch
# backport FindKipi.cmake from Digikam SC 3.0.0-beta1 for libkipi 2 (kde#307213)
Patch56: kdelibs-4.9.1-FindKipi-libkipi2.patch
## upstream
Patch100: kdelibs-4.9.2-optdiscspin.patch
@ -304,6 +308,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%if "%{?udisks}" == "udisks2"
%patch47 -p1 -b .udisks2backend
%patch48 -p1 -b .udisks2-enable
%else
%patch45 -p1 -b .halectomy
%endif
@ -315,6 +320,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%patch53 -p1 -b .kjs-s390
%patch54 -p1 -b .kjs-locale
%patch55 -p1 -b .solid-detach-external-hdd
%patch56 -p1 -b .FindKipi-libkipi2
# upstream patches
%patch100 -p1 -b .optdiscspin
@ -573,6 +579,10 @@ rm -rf %{buildroot}
%changelog
* Sat Sep 22 2012 Kevin Kofler <Kevin@tigcc.ticalc.org> - 6:4.9.1-4
- actually enable Solid udisks2 backend (restore patch hunks lost in 4.9.1-2)
- backport FindKipi.cmake from Digikam SC 3.0.0-beta1 for libkipi 2 (kde#307213)
* Wed Sep 19 2012 Lukas Tinkl <ltinkl@redhat.com> - 6:4.9.1-3
- Resolves #690123 - solid-udisks: Constant spinning of DVD drive when
selecting dolphin