summaryrefslogtreecommitdiffstats
path: root/freebsd/dependencies/akode/files
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/dependencies/akode/files')
-rw-r--r--freebsd/dependencies/akode/files/patch-amd64_libflac8_fix.diff11
-rw-r--r--freebsd/dependencies/akode/files/patch-clang.diff61
-rw-r--r--freebsd/dependencies/akode/files/patch-cmake.diff3226
3 files changed, 3298 insertions, 0 deletions
diff --git a/freebsd/dependencies/akode/files/patch-amd64_libflac8_fix.diff b/freebsd/dependencies/akode/files/patch-amd64_libflac8_fix.diff
new file mode 100644
index 000000000..d0334a3a4
--- /dev/null
+++ b/freebsd/dependencies/akode/files/patch-amd64_libflac8_fix.diff
@@ -0,0 +1,11 @@
+--- a/akode/plugins/xiph_decoder/flac113_decoder.cpp
++++ b/akode/plugins/xiph_decoder/flac113_decoder.cpp
+@@ -108,7 +108,7 @@
+ static FLAC__StreamDecoderReadStatus flac_read_callback(
+ const FLAC__StreamDecoder *,
+ FLAC__byte buffer[],
+- unsigned *bytes,
++ size_t *bytes,
+ void *client_data)
+ {
+ FLACDecoder::private_data *data = (FLACDecoder::private_data*)client_data;
diff --git a/freebsd/dependencies/akode/files/patch-clang.diff b/freebsd/dependencies/akode/files/patch-clang.diff
new file mode 100644
index 000000000..309665bab
--- /dev/null
+++ b/freebsd/dependencies/akode/files/patch-clang.diff
@@ -0,0 +1,61 @@
+Index: b/akode/lib/converter.cpp
+===================================================================
+--- a/akode/lib/converter.cpp
++++ b/akode/lib/converter.cpp
+@@ -26,7 +26,7 @@
+
+ Converter::Converter(int sample_width) : m_sample_width(sample_width) {}
+
+-template<typename T, typename S, template<typename T> class ArithmT, template<typename S> class ArithmS>
++template<typename T, typename S, template<typename T_Type> class ArithmT, template<typename S_Type> class ArithmS>
+ static bool __doFrameFP(AudioFrame* in, AudioFrame* out, int sample_width)
+ {
+ AudioConfiguration config = *in;
+Index: b/akode/lib/crossfader.cpp
+===================================================================
+--- a/akode/lib/crossfader.cpp
++++ b/akode/lib/crossfader.cpp
+@@ -27,7 +27,7 @@
+ CrossFader::CrossFader(unsigned int time) : time(time),pos(0) {}
+
+ // T is the input/output type, S is the fast arithmetics type, Div is a division method
+-template<typename T, typename S, template<typename S> class Arithm>
++template<typename T, typename S, template<typename S_Type> class Arithm>
+ static bool _doFrame(AudioFrame* in, int& pos, AudioFrame* frame)
+ {
+ T** indata1 = (T**)in->data;
+@@ -66,7 +66,7 @@
+ }
+
+ // T is the input/output type, S is the fast arithmetics type, Arithm defines devisions
+-template<typename T, typename S, template<typename S> class Arithm>
++template<typename T, typename S, template<typename S_Type> class Arithm>
+ static bool _readFrame(AudioFrame* in, int& pos, AudioFrame* frame)
+ {
+ T** indata = (T**)frame->data;
+Index: b/akode/lib/fast_resampler.cpp
+===================================================================
+--- a/akode/lib/fast_resampler.cpp
++++ b/akode/lib/fast_resampler.cpp
+@@ -37,7 +37,7 @@
+ // A fast resampling by linear interpolation
+ // I assume you know binary arithmetics and convertions if you're reading this
+ // T is the input/output type, Arithm defines the used arithmetic
+-template<typename T, typename S, template<typename S> class Arithm>
++template<typename T, typename S, template<typename S_Type> class Arithm>
+ static bool _doBuffer(AudioFrame* in, AudioFrame* out, float speed, unsigned sample_rate)
+ {
+ unsigned long vt_pos_start = 0; // virtual positions of new sample
+Index: b/akode/lib/volumefilter.cpp
+===================================================================
+--- a/akode/lib/volumefilter.cpp
++++ b/akode/lib/volumefilter.cpp
+@@ -29,7 +29,7 @@
+ VolumeFilter::VolumeFilter() : m_volume(0) {}
+
+ // T is the input/output type, S is the fast arithmetics type, Arithm is a division definition
+-template<typename T, typename S, template<typename S> class Arithm>
++template<typename T, typename S, template<typename S_Type> class Arithm>
+ static bool _doFrame(AudioFrame* in, AudioFrame* out, int volume)
+ {
+ T** indata = (T**)in->data;
diff --git a/freebsd/dependencies/akode/files/patch-cmake.diff b/freebsd/dependencies/akode/files/patch-cmake.diff
new file mode 100644
index 000000000..accd12478
--- /dev/null
+++ b/freebsd/dependencies/akode/files/patch-cmake.diff
@@ -0,0 +1,3226 @@
+Index: b/akode/akodeplay/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/akodeplay/CMakeLists.txt
+@@ -0,0 +1,30 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++)
++
++
++##### akodeplay #################################
++
++set( target akodeplay )
++
++tde_add_executable(
++ ${target}
++ SOURCES ${target}.cpp
++ LINK akode-shared
++ DESTINATION ${BIN_INSTALL_DIR}
++)
++
+Index: b/akode/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/CMakeLists.txt
+@@ -0,0 +1,31 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++
++#### pkg-config #################################
++
++set( prefix ${CMAKE_INSTALL_PREFIX} )
++string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}"
++ exec_prefix ${EXEC_INSTALL_PREFIX} )
++string( REGEX REPLACE "^${EXEC_INSTALL_PREFIX}" "\${exec_prefix}"
++ libdir ${LIB_INSTALL_DIR} )
++string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}"
++ includedir ${INCLUDE_INSTALL_DIR} )
++
++configure_file( akode-config.in akode-config @ONLY )
++install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/akode-config
++ DESTINATION ${BIN_INSTALL_DIR} )
++
++
++##### build #####################################
++
++tde_auto_add_subdirectories()
++
+Index: b/akode/lib/akode_export.h.cmake
+===================================================================
+--- /dev/null
++++ b/akode/lib/akode_export.h.cmake
+@@ -0,0 +1,53 @@
++/* This file is part of the KDE libraries
++ Copyright (c) 2002-2003 KDE Team
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Library General Public
++ License as published by the Free Software Foundation; either
++ version 2 of the License, or (at your option) any later version.
++
++ This library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public License
++ along with this library; see the file COPYING.LIB. If not, write to
++ the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
++ Boston, MA 02110-1301, USA.
++*/
++
++#ifndef AKODE_EXPORT_H
++#define AKODE_EXPORT_H
++
++#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1
++
++/**
++ * The ARTS_NO_EXPORT macro marks the symbol of the given variable
++ * to be hidden. A hidden symbol is stripped during the linking step,
++ * so it can't be used from outside the resulting library, which is similar
++ * to static. However, static limits the visibility to the current
++ * compilation unit. hidden symbols can still be used in multiple compilation
++ * units.
++ *
++ * \code
++ * int AKODE_NO_EXPORT foo;
++ * int AKODE_EXPORT bar;
++ * \end
++ */
++
++#if defined(__KDE_HAVE_GCC_VISIBILITY)
++/* Visibility is available for GCC newer than 3.4.
++ * See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9283
++ */
++#define AKODE_NO_EXPORT __attribute__ ((visibility("hidden")))
++#define AKODE_EXPORT __attribute__ ((visibility("default")))
++#elif defined(_WIN32)
++#define AKODE_NO_EXPORT
++#define AKODE_EXPORT __declspec(dllexport)
++#else
++#define AKODE_NO_EXPORT
++#define AKODE_EXPORT
++#endif
++
++#endif /* AKODE_EXPORTS */
+Index: b/akode/lib/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/lib/CMakeLists.txt
+@@ -0,0 +1,100 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++if( UNIX )
++ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden" )
++ set( __KDE_HAVE_GCC_VISIBILITY 1 )
++endif( UNIX )
++configure_file( akode_export.h.cmake akode_export.h @ONLY )
++
++
++##### library ###################################
++
++set( target akode )
++
++set( ${target}_SRCS
++ bytebuffer.cpp
++ audiobuffer.cpp
++ pluginhandler.cpp
++ decoderpluginhandler.cpp
++ resamplerpluginhandler.cpp
++ sinkpluginhandler.cpp
++ encoderpluginhandler.cpp
++ fast_resampler.cpp
++ crossfader.cpp
++ volumefilter.cpp
++ localfile.cpp
++ mmapfile.cpp
++ wav_decoder.cpp
++ auto_sink.cpp
++ void_sink.cpp
++ converter.cpp
++ buffered_decoder.cpp
++ player.cpp
++ magic.cpp
++)
++
++tde_add_library(
++ ${target} SHARED
++ VERSION 2.0.0
++ SOURCES ${${target}_SRCS}
++ LINK ${CMAKE_THREAD_LIBS_INIT} ${AKODE_LIBDL} ${SEM_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
++set_property(
++ TARGET ${target}-shared
++ APPEND PROPERTY COMPILE_DEFINITIONS
++ AKODE_SEARCHDIR="${LIB_INSTALL_DIR}"
++)
++
++
++##### headers ###################################
++
++set( ${target}_INCLUDES
++ ${CMAKE_CURRENT_BINARY_DIR}/akode_export.h
++ akodelib.h
++ decoder.h
++ sink.h
++ encoder.h
++ audioconfiguration.h
++ audioframe.h
++ audiobuffer.h
++ bytebuffer.h
++ file.h
++ localfile.h
++ mmapfile.h
++ pluginhandler.h
++ crossfader.h
++ volumefilter.h
++ resampler.h
++ fast_resampler.h
++ buffered_decoder.h
++ wav_decoder.h
++ auto_sink.h
++ void_sink.h
++ player.h
++ magic.h
++ converter.h
++ framedecoder.h
++)
++
++install(
++ FILES ${${target}_INCLUDES}
++ DESTINATION ${INCLUDE_INSTALL_DIR}/akode
++)
++
+Index: b/akode/plugins/alsa_sink/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/alsa_sink/CMakeLists.txt
+@@ -0,0 +1,31 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++
++##### library ###################################
++
++set( target libakode_alsa_sink )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES alsa_sink.cpp
++ LINK akode-shared ${ALSA_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/CMakeLists.txt
+@@ -0,0 +1,26 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++
++##### build #####################################
++
++tde_conditional_add_subdirectory( WITH_ALSA_SINK alsa_sink )
++tde_conditional_add_subdirectory( WITH_JACK_SINK jack_sink )
++tde_conditional_add_subdirectory( WITH_OSS_SINK oss_sink )
++tde_conditional_add_subdirectory( WITH_POLYP_SINK polyp_sink )
++tde_conditional_add_subdirectory( WITH_SUN_SINK sun_sink )
++
++tde_conditional_add_subdirectory( WITH_FFMPEG_DECODER ffmpeg_decoder )
++tde_conditional_add_subdirectory( WITH_MPC_DECODER mpc_decoder )
++tde_conditional_add_subdirectory( WITH_MPEG_DECODER mpeg_decoder )
++tde_conditional_add_subdirectory( WITH_SRC_RESAMPLER src_resampler )
++tde_conditional_add_subdirectory( WITH_XIPH_DECODER xiph_decoder )
++
+Index: b/akode/plugins/ffmpeg_decoder/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/ffmpeg_decoder/CMakeLists.txt
+@@ -0,0 +1,33 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${AVFORMAT_INCLUDE_DIRS}
++ ${AVCODEC_INCLUDE_DIRS}
++)
++
++
++##### library ###################################
++
++set( target libakode_ffmpeg_decoder )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES ffmpeg_decoder.cpp
++ LINK akode-shared ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/jack_sink/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/jack_sink/CMakeLists.txt
+@@ -0,0 +1,32 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${JACK_INCLUDE_DIRS}
++)
++
++
++##### library ###################################
++
++set( target libakode_jack_sink )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES jack_sink.cpp
++ LINK akode-shared ${JACK_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/mpc_decoder/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/mpc_decoder/CMakeLists.txt
+@@ -0,0 +1,36 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}/mppdec
++)
++
++
++##### mppdec ####################################
++add_subdirectory( mppdec )
++
++
++##### library ###################################
++
++set( target libakode_mpc_decoder )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES mpc_decoder.cpp
++ LINK akode-shared akode_mppdec-static
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/mpc_decoder/mppdec/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/mpc_decoder/mppdec/CMakeLists.txt
+@@ -0,0 +1,40 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++
++##### library ###################################
++
++set( target akode_mppdec )
++
++set( ${target}_SRCS
++ bitstream.cpp
++ huffsv46.cpp
++ huffsv7.cpp
++ idtag.cpp
++ mpc_dec.cpp
++ requant.cpp
++ streaminfo.cpp
++ synth_filter.cpp
++)
++
++tde_add_library(
++ ${target} STATIC_PIC
++ SOURCES ${${target}_SRCS}
++)
++
+Index: b/akode/plugins/mpeg_decoder/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/mpeg_decoder/CMakeLists.txt
+@@ -0,0 +1,31 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++
++##### library ###################################
++
++set( target libakode_mpeg_decoder )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES mpeg_decoder.cpp
++ LINK akode-shared ${MAD_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/oss_sink/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/oss_sink/CMakeLists.txt
+@@ -0,0 +1,31 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++
++##### library ###################################
++
++set( target libakode_oss_sink )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES oss_sink.cpp
++ LINK akode-shared ${OSSAUDIO_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/polyp_sink/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/polyp_sink/CMakeLists.txt
+@@ -0,0 +1,32 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${POLYP_INCLUDE_DIRS}
++)
++
++
++##### library ###################################
++
++set( target libakode_polyp_sink )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES polyp_sink.cpp
++ LINK akode-shared ${POLYP_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/src_resampler/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/src_resampler/CMakeLists.txt
+@@ -0,0 +1,31 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++
++##### library ###################################
++
++set( target libakode_src_resampler )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES src_resampler.cpp
++ LINK akode-shared ${SAMPLERATE_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/sun_sink/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/sun_sink/CMakeLists.txt
+@@ -0,0 +1,31 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++
++##### library ###################################
++
++set( target libakode_sun_sink )
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES sun_sink.cpp
++ LINK akode-shared
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/akode/plugins/xiph_decoder/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/akode/plugins/xiph_decoder/CMakeLists.txt
+@@ -0,0 +1,44 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include_directories(
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_BINARY_DIR}/akode/lib
++ ${CMAKE_SOURCE_DIR}/akode/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${SPEEX_INCLUDE_DIRS}
++)
++
++
++##### library ###################################
++
++set( target libakode_xiph_decoder )
++
++set( ${target}_SRCS
++ flac_decoder.cpp
++ flac113_decoder.cpp
++ speex_decoder.cpp
++ vorbis_decoder.cpp
++ xiph_decoder.cpp
++)
++
++tde_add_library(
++ ${target} MODULE
++ SOURCES ${${target}_SRCS}
++ LINK
++ akode-shared
++ ${FLAC_LIBRARIES} ${OGGFLAC_LIBRARIES}
++ ${VORBIS_LIBRARIES} ${VORBISFILE_LIBRARIES}
++ ${SPEEX_LIBRARIES}
++ DESTINATION ${LIB_INSTALL_DIR}
++)
++
+Index: b/cmake/generate_apidox
+===================================================================
+--- /dev/null
++++ b/cmake/generate_apidox
+@@ -0,0 +1,17 @@
++#!/bin/bash
++
++top_srcdir=${1}
++top_builddir=${2}
++kde_libs_htmldir=${3}
++export QTDOCDIR=${4}
++
++if [[ ! -d "${top_srcdir}/doc/common/" ]]; then
++ export DOXDATA=${kde_libs_htmldir}/en/common
++fi
++
++abs_top_srcdir=$(cd ${top_srcdir} && pwd)
++
++rm -rf ${top_builddir}/${kde_libs_htmldir}/en
++mkdir -p ${top_builddir}/${kde_libs_htmldir}/en
++cd ${top_builddir}/${kde_libs_htmldir}/en
++${abs_top_srcdir}/admin/doxygen.sh --modulename --installdir=${top_builddir}/${kde_libs_htmldir}/en ${abs_top_srcdir}
+Index: b/cmake/install_apidox
+===================================================================
+--- /dev/null
++++ b/cmake/install_apidox
+@@ -0,0 +1,12 @@
++#!/bin/bash
++
++top_srcdir=${1}
++top_builddir=${2}
++kde_libs_htmldir=${3}
++installdir=${DESTDIR}
++
++abs_top_srcdir=$(cd ${top_srcdir} && pwd)
++
++cd ${top_builddir}
++mkdir -p ${installdir}/${kde_libs_htmldir}/en
++cp -Rp ${top_builddir}/${kde_libs_htmldir}/en ${installdir}/${kde_libs_htmldir}/
+Index: b/cmake/modules/FindTDE.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/FindTDE.cmake
+@@ -0,0 +1,101 @@
++#################################################
++#
++# (C) 2010-2011 Serghei Amelian
++# serghei (DOT) amelian (AT) gmail.com
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++if( NOT TDE_FOUND )
++
++ message( STATUS "checking for 'TDE'")
++
++ pkg_search_module( TDE tqt )
++
++ if( NOT TDE_FOUND )
++ tde_message_fatal( "Unable to find tdelibs!\n Try adding the directory in which the tdelibs.pc file is located\nto the PKG_CONFIG_PATH variable." )
++ endif( )
++
++ # if the path is not already defined by user,
++ # find tde-config executable
++ if( NOT DEFINED KDECONFIG_EXECUTABLE )
++ find_program( KDECONFIG_EXECUTABLE
++ NAMES tde-config
++ HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} )
++ if( NOT KDECONFIG_EXECUTABLE )
++ tde_message_fatal( "tde-config are NOT found." )
++ endif( NOT KDECONFIG_EXECUTABLE )
++ endif( NOT DEFINED KDECONFIG_EXECUTABLE )
++
++ set( ENV{LD_LIBRARY_PATH} "${TDE_LIBDIR}:$ENV{LD_LIBRARY_PATH}" )
++ # check for installed trinity version
++ tde_execute_process(
++ COMMAND ${KDECONFIG_EXECUTABLE} --version
++ OUTPUT_VARIABLE _version
++ RESULT_VARIABLE _result
++ OUTPUT_STRIP_TRAILING_WHITESPACE
++ MESSAGE "Unable to run tde-config!\n TDELIBS are correctly installed?\n Path to tde-config are corect?" )
++
++ # parse tde-config output, to extract TDE version
++ string( REGEX MATCH "TDE: R([0-9\\.]+).*" __dummy "${_version}" )
++ set( TDE_VERSION "${CMAKE_MATCH_1}" )
++
++ # ask tde-config for few paths
++ macro( __internal_get_path __type __var )
++ tde_execute_process(
++ COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type}
++ OUTPUT_VARIABLE ${__var}
++ CACHE INTERNAL "TDE ${__type} path" FORCE
++ OUTPUT_STRIP_TRAILING_WHITESPACE )
++ endmacro( __internal_get_path )
++
++ __internal_get_path( include TDE_INCLUDE_DIR )
++ __internal_get_path( lib TDE_LIB_DIR )
++ __internal_get_path( exe TDE_BIN_DIR )
++ __internal_get_path( data TDE_DATA_DIR )
++ __internal_get_path( config TDE_CONFIG_DIR )
++ __internal_get_path( html TDE_HTML_DIR )
++ __internal_get_path( cmake TDE_CMAKE_DIR )
++ __internal_get_path( qtplugins TDE_QTPLUGINS_DIR )
++
++ # find kde tools
++ macro( __internal_find_program __prog __var )
++ find_program( ${__var}
++ NAMES ${__prog}
++ HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR}
++ OUTPUT_STRIP_TRAILING_WHITESPACE )
++ if( NOT ${__var} )
++ tde_message_fatal( "${__prog} are NOT found.\n TDELIBS are correctly installed?" )
++ endif( NOT ${__var} )
++ set( ${__var} ${${__var}} CACHE INTERNAL "${__prog} executable" FORCE )
++ endmacro( __internal_find_program )
++
++ __internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE )
++ __internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE )
++ __internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE )
++ __internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE )
++ __internal_find_program( tdeconfig_compiler KDE3_KCFGC_EXECUTABLE )
++ __internal_find_program( maketdewidgets KDE3_MAKETDEWIDGETS_EXECUTABLE )
++
++ # dcopidlng is a bash script which using tde-config;
++ # if PATH to tde-config is not set, dcopidlng will fail;
++ # for this reason we set KDECONFIG environment variable before running dcopidlng
++ set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE}
++ CACHE INTERNAL "dcopidlng executable" FORCE )
++
++ # look for SCM data if present
++ if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" )
++ file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmmodule" TDE_SCM_MODULE_NAME )
++ endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" )
++ if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" )
++ file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmrevision" TDE_SCM_MODULE_REVISION )
++ endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" )
++
++ message( STATUS " found 'TDE', version ${TDE_VERSION}" )
++
++endif( NOT TDE_FOUND )
++
++include( "${TDE_CMAKE_DIR}/tdelibs.cmake" )
+Index: b/cmake/modules/FindTQt.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/FindTQt.cmake
+@@ -0,0 +1,95 @@
++#################################################
++#
++# (C) 2010-2011 Serghei Amelian
++# serghei (DOT) amelian (AT) gmail.com
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++macro( tqt_message )
++ message( STATUS "${ARGN}" )
++endmacro( )
++
++pkg_search_module( TQT tqt )
++
++if( NOT TQT_FOUND )
++ tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
++endif( )
++
++# tmoc_executable
++tde_execute_process(
++ COMMAND pkg-config tqt --variable=tmoc_executable
++ OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
++
++if( NOT EXISTS ${TMOC_EXECUTABLE} )
++ tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" )
++endif( )
++
++tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
++
++
++# moc_executable
++tde_execute_process(
++ COMMAND pkg-config tqt --variable=moc_executable
++ OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
++
++if( NOT EXISTS ${MOC_EXECUTABLE} )
++ tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
++endif( )
++
++tqt_message( " moc path: ${MOC_EXECUTABLE}" )
++
++
++# uic_executable
++tde_execute_process(
++ COMMAND pkg-config tqt --variable=uic_executable
++ OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
++
++if( NOT EXISTS ${UIC_EXECUTABLE} )
++ tde_message_fatal( "uic not found!\n tqt is correctly installed?" )
++endif( )
++
++tqt_message( " uic path: ${UIC_EXECUTABLE}" )
++
++
++# tqt-replace script
++set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace" )
++
++if( NOT EXISTS ${TQT_REPLACE_SCRIPT} )
++ tde_message_fatal( "tqt-replace not found!\n Check tqt installation." )
++endif( )
++
++tqt_message( " tqt-replace path: ${TQT_REPLACE_SCRIPT}" )
++
++
++# check if tqt is usable
++tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
++set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
++foreach( _dirs ${TQT_LIBRARY_DIRS} )
++ list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
++endforeach()
++list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
++
++check_cxx_source_compiles("
++ #include <tqapplication.h>
++ int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
++ HAVE_USABLE_TQT )
++
++if( NOT HAVE_USABLE_TQT )
++ tde_message_fatal( "Unable to build a simple tqt test." )
++endif( )
++
++tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
++
++
++# TQT_CXX_FLAGS
++foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} )
++ set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
++endforeach()
++
++# Set compiler flags according to build type
++set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG" )
++set( CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG" )
+Index: b/cmake/modules/FindTQtQUI.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/FindTQtQUI.cmake
+@@ -0,0 +1,45 @@
++#################################################
++#
++# (C) 2010-2011 Serghei Amelian
++# serghei (DOT) amelian (AT) gmail.com
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++macro( tqtqui_message )
++ message( STATUS "${ARGN}" )
++endmacro( )
++
++pkg_search_module( TQTQUI tqtqui )
++
++if( NOT TQTQUI_FOUND )
++ tde_message_fatal( "Unable to find tqtqui!\n Try adding the directory in which the tqtqui.pc file is located\nto the PKG_CONFIG_PATH variable." )
++endif( )
++
++# check if tqtqui is usable
++tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
++set( CMAKE_REQUIRED_INCLUDES ${TQTQUI_INCLUDE_DIRS} )
++foreach( _dirs ${TQTQUI_LIBRARY_DIRS} )
++ list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
++endforeach()
++list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQTQUI_LIBRARIES} )
++
++check_cxx_source_compiles("
++ #include <tqapplication.h>
++ int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
++ HAVE_USABLE_TQTQUI )
++
++if( NOT HAVE_USABLE_TQTQUI )
++ tde_message_fatal( "Unable to build a simple tqtqui test." )
++endif( )
++
++tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
++
++
++# TQTQUI_CXX_FLAGS
++foreach( _flag ${TQTQUI_CFLAGS_OTHER} )
++ set( TQTQUI_CXX_FLAGS "${TQTQUI_CXX_FLAGS} ${_flag}" )
++endforeach()
+Index: b/cmake/modules/TDEMacros.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/TDEMacros.cmake
+@@ -0,0 +1,1568 @@
++#################################################
++#
++# (C) 2010-2012 Serghei Amelian
++# serghei (DOT) amelian (AT) gmail.com
++#
++# (C) 2011-2012 Timothy Pearson
++# kb9vqf (AT) pearsoncomputing.net
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++include( KDE3Macros ) # we will need this module for a while
++include( CheckCXXCompilerFlag )
++
++
++#################################################
++#####
++##### tde_message_fatal
++
++macro( tde_message_fatal )
++ message( FATAL_ERROR
++ "#################################################\n"
++ " ${ARGV}\n"
++ "#################################################" )
++endmacro( tde_message_fatal )
++
++
++#################################################
++#####
++##### tde_get_arg( <ARG_NAME> <COUNT> <RETURN> <REST> <ARGS...> )
++##### ARG_NAME(string): name of an argument to find in ARGS
++##### COUNT(number): argument dimension, a number of items returned in RETURN
++##### RETURN(list ref): items returned for argument as they found in ARGS
++##### REST(list ref): rest of items except argument name and items returned in RETURN
++##### ARGS(list): source list of arguments
++
++macro( tde_get_arg ARG_NAME COUNT RETURN REST )
++ unset( ${RETURN} )
++ unset( ${REST} )
++ list( APPEND ${REST} ${ARGN} )
++ list( FIND ${REST} ${ARG_NAME} _arg_idx)
++ if( NOT ${_arg_idx} EQUAL -1 )
++ list( REMOVE_AT ${REST} ${_arg_idx} )
++ set( _i 0 )
++ while( ${_i} LESS ${COUNT} )
++ list( GET ${REST} ${_arg_idx} _arg )
++ list( REMOVE_AT ${REST} ${_arg_idx} )
++ list( APPEND ${RETURN} ${_arg} )
++ math( EXPR _i "${_i} + 1" )
++ endwhile()
++ endif()
++endmacro( tde_get_arg )
++
++
++################################################
++#####
++##### tde_execute_process( <ARGS...> [MESSAGE <MSG>] )
++##### MSG: fatal error message (standard message will be written if not supplied)
++##### ARGS: execute_process arguments
++
++macro( tde_execute_process )
++ tde_get_arg( MESSAGE 1 _message _rest_args ${ARGV} )
++ tde_get_arg( RESULT_VARIABLE 1 _result_variable _tmp ${_rest_args} )
++ tde_get_arg( COMMAND 1 _command _tmp ${_rest_args} )
++ tde_get_arg( OUTPUT_VARIABLE 1 _output_variable _tmp ${_rest_args} )
++ tde_get_arg( CACHE 3 _cache _rest_args2 ${_rest_args} )
++
++ # handle optional FORCE parameter
++ if( DEFINED _cache )
++ list( GET _cache 2 _tmp )
++ if( _tmp STREQUAL FORCE )
++ set( _rest_args ${_rest_args2} )
++ else()
++ tde_get_arg( CACHE 2 _cache _rest_args ${_rest_args} )
++ endif()
++ endif()
++
++ if( NOT DEFINED _result_variable )
++ list( APPEND _rest_args RESULT_VARIABLE _exec_result )
++ set( _result_variable _exec_result )
++ endif()
++
++ execute_process( ${_rest_args} )
++
++ if( DEFINED _output_variable AND DEFINED _cache )
++ set( ${_output_variable} ${${_output_variable}} CACHE ${_cache} )
++ endif()
++
++ if( ${_result_variable} )
++ if( DEFINED _message )
++ tde_message_fatal( ${_message} )
++ else()
++ if( ${${_result_variable}} MATCHES "^[0-9]+$" )
++ set( ${_result_variable} "status ${${_result_variable}} returned!" )
++ endif()
++ tde_message_fatal( "Error executing '${_command}': ${${_result_variable}}" )
++ endif()
++ endif()
++endmacro( tde_execute_process )
++
++
++if( DEFINED MASTER_SOURCE_DIR )
++ return( )
++endif( )
++########### slave part ends here ###############
++
++
++################################################
++#####
++##### CMP0026 states we should not read the LOCATION property of a target,
++##### and should be using generators instead. We can't do that here however
++##### because we need the value of the property at configure time.
++
++if( POLICY CMP0026 )
++ cmake_policy( PUSH )
++ cmake_policy( SET CMP0026 OLD )
++endif( POLICY CMP0026 )
++
++
++################################################
++#####
++##### tde_install_icons( <icons...> THEME <svgicons> DESTINATION <destdir> )
++##### default theme: hicolor
++##### default destination: ${SHARE_INSTALL_DIR}/icons
++
++macro( tde_install_icons )
++ tde_get_arg( DESTINATION 1 _dest _args ${ARGV} )
++ tde_get_arg( THEME 1 _req_theme _icons ${_args} )
++
++ #defaults
++ if( NOT _icons )
++ set( _icons "*" )
++ endif( NOT _icons )
++ if( NOT _dest )
++ set( _dest "${ICON_INSTALL_DIR}" )
++ endif( NOT _dest )
++
++ foreach( _icon ${_icons} )
++ unset( _theme ) # clearing
++
++ file(GLOB _icon_files *-${_icon}.png *-${_icon}.mng _icon_files *-${_icon}.svg* )
++ foreach( _icon_file ${_icon_files} )
++ # FIXME need a review
++ string( REGEX MATCH "^.*/([a-zA-Z][a-zA-Z])([0-9a-zA-Z]+)\\-([a-z]+)\\-([^/]+)$" _dummy "${_icon_file}" )
++ set( _type "${CMAKE_MATCH_1}" )
++ set( _size "${CMAKE_MATCH_2}" )
++ set( _group "${CMAKE_MATCH_3}" )
++ set( _name "${CMAKE_MATCH_4}" )
++
++ # we must ignore invalid icon names
++ if( _type AND _size AND _group AND _name )
++
++ # autodetect theme
++ if( NOT _req_theme )
++ unset( _theme )
++ if( "${_type}" STREQUAL "cr" )
++ set( _theme crystalsvg )
++ elseif( "${_type}" STREQUAL "lo" )
++ set( _theme locolor )
++ endif( "${_type}" STREQUAL "cr" )
++ # defaulting
++ if( NOT _theme )
++ set( _theme hicolor )
++ endif( NOT _theme )
++ else( NOT _req_theme )
++ set( _theme ${_req_theme} )
++ endif( NOT _req_theme )
++
++ # fix "group" name
++ if( "${_group}" STREQUAL "mime" )
++ set( _group "mimetypes" )
++ endif( "${_group}" STREQUAL "mime" )
++ if( "${_group}" STREQUAL "filesys" )
++ set( _group "places" )
++ endif( "${_group}" STREQUAL "filesys" )
++ if( "${_group}" STREQUAL "category" )
++ set( _group "categories" )
++ endif( "${_group}" STREQUAL "category" )
++ if( "${_group}" STREQUAL "device" )
++ set( _group "devices" )
++ endif( "${_group}" STREQUAL "device" )
++ if( "${_group}" STREQUAL "app" )
++ set( _group "apps" )
++ endif( "${_group}" STREQUAL "app" )
++ if( "${_group}" STREQUAL "action" )
++ set( _group "actions" )
++ endif( "${_group}" STREQUAL "action" )
++
++ if( "${_size}" STREQUAL "sc" )
++ install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/scalable/${_group}/ RENAME ${_name} )
++ else( "${_size}" STREQUAL "sc" )
++ install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/${_size}x${_size}/${_group}/ RENAME ${_name} )
++ endif( "${_size}" STREQUAL "sc" )
++
++ endif( _type AND _size AND _group AND _name )
++
++ endforeach( _icon_file )
++ endforeach( _icon )
++
++endmacro( tde_install_icons )
++
++
++#################################################
++#####
++##### tde_add_lut( <source> <result> [depends] )
++##### default depends: source
++
++macro( tde_add_lut _src _lut _dep )
++ set( create_hash_table ${CMAKE_SOURCE_DIR}/kjs/create_hash_table )
++ if( NOT _dep )
++ set( _dep ${_src} )
++ endif( NOT _dep )
++ add_custom_command( OUTPUT ${_lut}
++ COMMAND perl ARGS ${create_hash_table} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} -i > ${_lut}
++ DEPENDS ${_src} )
++ set_source_files_properties( ${_dep} PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_lut} )
++ unset( _dep )
++endmacro( tde_add_lut )
++
++
++#################################################
++#####
++##### tde_add_luts( <sources...> )
++
++macro( tde_add_luts )
++ foreach( _src ${ARGV} )
++ get_filename_component( _lut ${_src} NAME_WE )
++ set( _lut "${_lut}.lut.h" )
++ tde_add_lut( ${_src} ${_lut} ${_src} )
++ endforeach( _src )
++endmacro( tde_add_luts )
++
++
++#################################################
++#####
++##### tde_file_to_cpp( <source> <destination> <variable> )
++
++macro( tde_file_to_cpp _src _dst _var )
++ if( IS_ABSOLUTE ${_dst} )
++ set( dst ${_dst} )
++ else( )
++ set( dst "${CMAKE_CURRENT_BINARY_DIR}/${_dst}" )
++ endif( )
++ file( READ ${_src} text )
++ string( REGEX REPLACE "\n" "\\\\n\"\n\"" text "${text}" )
++ set( text "/* Generated by CMake */\n\nconst char *${_var} = \n\n\"${text}\";\n" )
++ string( REGEX REPLACE "\n\"\";\n$" ";\n" text "${text}" )
++ file( WRITE ${dst} "${text}" )
++endmacro( )
++
++
++#################################################
++#####
++##### tde_install_la_file( <target> <destination> )
++
++macro( tde_install_la_file _target _destination )
++
++ get_target_property( _target_location ${_target} LOCATION )
++ get_filename_component( _laname ${_target_location} NAME_WE )
++ get_filename_component( _soname ${_target_location} NAME )
++ set( _laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la )
++
++ file( WRITE ${_laname}
++"# ${_laname} - a libtool library file, generated by cmake
++# The name that we can dlopen(3).
++dlname='${_soname}'
++# Names of this library
++library_names='${_soname} ${_soname} ${_soname}'
++# The name of the static archive
++old_library=''
++# Libraries that this one depends upon.
++dependency_libs=''
++# Version information.\ncurrent=0\nage=0\nrevision=0
++# Is this an already installed library?\ninstalled=yes
++# Should we warn about portability when linking against -modules?\nshouldnotlink=yes
++# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''
++# Directory that this library needs to be installed in:
++libdir='${_destination}'
++" )
++
++ install( FILES ${_laname} DESTINATION ${_destination} )
++
++endmacro( tde_install_la_file )
++
++
++#################################################
++#####
++##### tde_add_ui_files
++
++macro( tde_add_ui_files _sources )
++ foreach( _ui_file ${ARGN} )
++
++ get_filename_component( _ui_basename ${_ui_file} NAME_WE )
++ get_filename_component( _ui_absolute_path ${_ui_file} ABSOLUTE )
++
++ list( APPEND ${_sources} ${_ui_basename}.cpp )
++
++ add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp
++ COMMAND ${CMAKE_COMMAND}
++ -DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE}
++ -DTQT_REPLACE_SCRIPT:FILEPATH=${TQT_REPLACE_SCRIPT}
++ -DTDE_QTPLUGINS_DIR:FILEPATH=${TDE_QTPLUGINS_DIR}
++ -DUI_FILE:FILEPATH=${_ui_absolute_path}
++ -DMASTER_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR}
++ -DMASTER_BINARY_DIR:FILEPATH=${CMAKE_BINARY_DIR}
++ -P ${CMAKE_MODULE_PATH}/tde_uic.cmake
++ COMMAND ${MOC_EXECUTABLE} ${_ui_basename}.h >> ${_ui_basename}.cpp
++ DEPENDS ${_ui_absolute_path} )
++
++ endforeach( _ui_file )
++endmacro( tde_add_ui_files )
++
++
++#################################################
++#####
++##### tde_moc
++
++macro( tde_moc _sources )
++ foreach( _input_file ${ARGN} )
++
++ get_filename_component( _input_file "${_input_file}" ABSOLUTE )
++ get_filename_component( _basename ${_input_file} NAME_WE )
++ set( _output_file "${_basename}.moc.cpp" )
++ add_custom_command( OUTPUT ${_output_file}
++ COMMAND
++ ${TMOC_EXECUTABLE} ${_input_file} -o ${_output_file}
++ DEPENDS
++ ${_input_file} )
++ list( APPEND ${_sources} ${_output_file} )
++
++ endforeach( )
++endmacro( )
++
++
++#################################################
++#####
++##### tde_automoc
++
++macro( tde_automoc )
++ foreach( _src_file ${ARGN} )
++
++ get_filename_component( _src_file "${_src_file}" ABSOLUTE )
++
++ if( EXISTS "${_src_file}" )
++
++ # read source file and check if have moc include
++ file( READ "${_src_file}" _src_content )
++ string( REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _moc_includes "${_src_content}" )
++
++ # found included moc(s)?
++ if( _moc_includes )
++ foreach( _moc_file ${_moc_includes} )
++
++ # extracting moc filename
++ string( REGEX MATCH "[^ <\"]+\\.moc" _moc_file "${_moc_file}" )
++ set( _moc_file "${CMAKE_CURRENT_BINARY_DIR}/${_moc_file}" )
++
++ # create header filename
++ get_filename_component( _src_path "${_src_file}" ABSOLUTE )
++ get_filename_component( _src_path "${_src_path}" PATH )
++ get_filename_component( _src_header "${_moc_file}" NAME_WE )
++ set( _header_file "${_src_path}/${_src_header}.h" )
++
++ # if header doesn't exists, check in META_INCLUDES
++ if( NOT EXISTS "${_header_file}" )
++ unset( _found )
++ foreach( _src_path ${_meta_includes} )
++ set( _header_file "${_src_path}/${_src_header}.h" )
++ if( EXISTS "${_header_file}" )
++ set( _found 1 )
++ break( )
++ endif( )
++ endforeach( )
++ if( NOT _found )
++ get_filename_component( _moc_file "${_moc_file}" NAME )
++ tde_message_fatal( "AUTOMOC error: '${_moc_file}' cannot be generated.\n Reason: '${_src_file}.h' not found." )
++ endif( )
++ endif( )
++
++ # moc-ing header
++ add_custom_command( OUTPUT ${_moc_file}
++ COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file}
++ DEPENDS ${_header_file} )
++
++ # create dependency between source file and moc file
++ set_property( SOURCE ${_src_file} APPEND PROPERTY OBJECT_DEPENDS ${_moc_file} )
++
++ endforeach( _moc_file )
++
++ endif( _moc_includes )
++
++ endif( EXISTS "${_src_file}" )
++
++ endforeach( _src_file )
++endmacro( tde_automoc )
++
++
++#################################################
++#####
++##### __tde_internal_process_sources
++
++macro( __tde_internal_process_sources _sources )
++
++ unset( ${_sources} )
++
++ foreach( _arg ${ARGN} )
++ get_filename_component( _ext ${_arg} EXT )
++ get_filename_component( _name ${_arg} NAME_WE )
++ get_filename_component( _path ${_arg} PATH )
++
++ # if not path, set it to "."
++ if( NOT _path )
++ set( _path "./" )
++ endif( NOT _path )
++
++ # handle .ui files
++ if( ${_ext} STREQUAL ".ui" )
++ tde_add_ui_files( ${_sources} ${_arg} )
++
++ # handle .skel files
++ elseif( ${_ext} STREQUAL ".skel" )
++ kde3_add_dcop_skels( ${_sources} ${_path}/${_name}.h )
++
++ # handle .stub files
++ elseif( ${_ext} STREQUAL ".stub" )
++ kde3_add_dcop_stubs( ${_sources} ${_path}/${_name}.h )
++
++ # handle .kcfgc files
++ elseif( ${_ext} STREQUAL ".kcfgc" )
++ kde3_add_kcfg_files( ${_sources} ${_arg} )
++
++ # handle any other files
++ else( ${_ext} STREQUAL ".ui" )
++ list(APPEND ${_sources} ${_arg} )
++ endif( ${_ext} STREQUAL ".ui" )
++ endforeach( _arg )
++
++endmacro( __tde_internal_process_sources )
++
++
++#################################################
++#####
++##### tde_install_libtool_file
++
++macro( tde_install_libtool_file _target _destination )
++
++ get_target_property( _target_location ${_target} LOCATION )
++
++ # get name of target
++ get_filename_component( _name ${_target_location} NAME_WE )
++
++ # get .la name
++ set( _laname ${_name}.la )
++
++ # get .so name
++ get_filename_component( _soname ${_target_location} NAME )
++
++ # get version of target
++ get_target_property( _target_version ${_target} VERSION )
++ get_target_property( _target_soversion ${_target} SOVERSION )
++
++ # we have so version
++ if( _target_version )
++ set( _library_name_1 "${_soname}.${_target_version}" )
++ set( _library_name_2 "${_soname}.${_target_soversion}" )
++ set( _library_name_3 "${_soname}" )
++
++ string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_target_version}" )
++ set( _version_current "${CMAKE_MATCH_1}" )
++ set( _version_age "${CMAKE_MATCH_2}" )
++ set( _version_revision "${CMAKE_MATCH_3}" )
++
++ # we have no so version (module?)
++ else( _target_version )
++ set( _library_name_1 "${_soname}" )
++ set( _library_name_2 "${_soname}" )
++ set( _library_name_3 "${_soname}" )
++ set( _version_current "0" )
++ set( _version_age "0" )
++ set( _version_revision "0" )
++ endif( _target_version )
++
++ if( IS_ABSOLUTE ${_destination} )
++ set( _libdir "${_destination}" )
++ else( IS_ABSOLUTE ${_destination} )
++ set( _libdir "${CMAKE_INSTALL_PREFIX}/${_destination}" )
++ endif( IS_ABSOLUTE ${_destination} )
++
++ configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_libtool_file.cmake "${_laname}" @ONLY )
++
++ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_laname}" DESTINATION ${_destination} )
++
++endmacro( tde_install_libtool_file )
++
++
++#################################################
++#####
++##### tde_install_export / tde_import
++
++function( tde_install_export )
++ file( GLOB export_files ${CMAKE_CURRENT_BINARY_DIR}/export-*.cmake )
++
++ set( mode "WRITE" )
++ foreach( filename ${export_files} )
++ file( READ ${filename} content )
++ file( ${mode} "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" "${content}" )
++ set( mode "APPEND" )
++ endforeach( )
++
++ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" DESTINATION ${CMAKE_INSTALL_DIR} )
++endfunction( )
++
++
++macro( tde_import _library )
++ message( STATUS "checking for '${_library}'" )
++ string( TOUPPER "BUILD_${_library}" _build )
++ if( ${_build} )
++ message( STATUS " ok, activated for build" )
++ else()
++ if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" )
++ include( "${TDE_CMAKE_DIR}/${_library}.cmake" )
++ message( STATUS " ok, found import file" )
++ else()
++ tde_message_fatal( "'${_library}' are required,\n but is not installed nor selected for build" )
++ endif()
++ endif()
++endmacro()
++
++
++#################################################
++#####
++##### tde_add_library
++
++macro( tde_add_library _arg_target )
++
++ unset( _target )
++ unset( _type )
++ unset( _static_pic )
++ unset( _automoc )
++ unset( _meta_includes )
++ unset( _no_libtool_file )
++ unset( _no_export )
++ unset( _version )
++ unset( _sources )
++ unset( _destination )
++ unset( _embed )
++ unset( _link )
++ unset( _dependencies )
++ unset( _storage )
++
++ set( _shouldnotlink no )
++
++ # metadata
++ unset( _description )
++ unset( _license )
++ unset( _copyright )
++ unset( _authors )
++ unset( _product )
++ unset( _organization )
++ unset( _version )
++ unset( _datetime )
++ unset( _notes )
++
++ # default metadata
++ set( _product "Trinity Desktop Environment" )
++ tde_curdatetime( _datetime )
++
++ foreach( _arg ${ARGV} )
++
++ # this variable help us to skip
++ # storing unapropriate values (i.e. directives)
++ unset( _skip_store )
++
++ # found one of directives: "SHARED", "STATIC", "MODULE"
++ if( "+${_arg}" STREQUAL "+SHARED" OR "+${_arg}" STREQUAL "+STATIC" OR "+${_arg}" STREQUAL "+MODULE" )
++ set( _skip_store 1 )
++ set( _type "${_arg}" )
++ endif( "+${_arg}" STREQUAL "+SHARED" OR "+${_arg}" STREQUAL "+STATIC" OR "+${_arg}" STREQUAL "+MODULE" )
++
++ # found directive "STATIC_PIC"
++ if( "+${_arg}" STREQUAL "+STATIC_PIC" )
++ set( _skip_store 1 )
++ set( _type "STATIC" )
++ set( _static_pic 1 )
++ endif( "+${_arg}" STREQUAL "+STATIC_PIC" )
++
++ # found directive "AUTOMOC"
++ if( "+${_arg}" STREQUAL "+AUTOMOC" )
++ set( _skip_store 1 )
++ set( _automoc 1 )
++ endif( "+${_arg}" STREQUAL "+AUTOMOC" )
++
++ # found directive "META_INCLUDES"
++ if( "+${_arg}" STREQUAL "+META_INCLUDES" )
++ set( _skip_store 1 )
++ set( _storage "_meta_includes" )
++ endif( )
++
++ # found directive "NO_LIBTOOL_FILE"
++ if( "+${_arg}" STREQUAL "+NO_LIBTOOL_FILE" )
++ set( _skip_store 1 )
++ set( _no_libtool_file 1 )
++ endif( "+${_arg}" STREQUAL "+NO_LIBTOOL_FILE" )
++
++ # found directive "NO_EXPORT"
++ if( "+${_arg}" STREQUAL "+NO_EXPORT" )
++ set( _skip_store 1 )
++ set( _no_export 1 )
++ endif( "+${_arg}" STREQUAL "+NO_EXPORT" )
++
++ # found directive "VERSION"
++ if( "+${_arg}" STREQUAL "+VERSION" )
++ set( _skip_store 1 )
++ set( _storage "_version" )
++ endif( "+${_arg}" STREQUAL "+VERSION" )
++
++ # found directive "SOURCES"
++ if( "+${_arg}" STREQUAL "+SOURCES" )
++ set( _skip_store 1 )
++ set( _storage "_sources" )
++ endif( "+${_arg}" STREQUAL "+SOURCES" )
++
++ # found directive "EMBED"
++ if( "+${_arg}" STREQUAL "+EMBED" )
++ set( _skip_store 1 )
++ set( _storage "_embed" )
++ endif( "+${_arg}" STREQUAL "+EMBED" )
++
++ # found directive "LINK"
++ if( "+${_arg}" STREQUAL "+LINK" )
++ set( _skip_store 1 )
++ set( _storage "_link" )
++ endif( "+${_arg}" STREQUAL "+LINK" )
++
++ # found directive "DEPENDENCIES"
++ if( "+${_arg}" STREQUAL "+DEPENDENCIES" )
++ set( _skip_store 1 )
++ set( _storage "_dependencies" )
++ endif( "+${_arg}" STREQUAL "+DEPENDENCIES" )
++
++ # found directive "DESTINATION"
++ if( "+${_arg}" STREQUAL "+DESTINATION" )
++ set( _skip_store 1 )
++ set( _storage "_destination" )
++ unset( ${_storage} )
++ endif( "+${_arg}" STREQUAL "+DESTINATION" )
++
++ # metadata
++ if( "+${_arg}" STREQUAL "+DESCRIPTION" )
++ set( _skip_store 1 )
++ set( _storage "_description" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+LICENSE" )
++ set( _skip_store 1 )
++ set( _storage "_license" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+COPYRIGHT" )
++ set( _skip_store 1 )
++ set( _storage "_copyright" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+AUTHORS" )
++ set( _skip_store 1 )
++ set( _storage "_authors" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+PRODUCT" )
++ set( _skip_store 1 )
++ set( _storage "_product" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+ORGANIZATION" )
++ set( _skip_store 1 )
++ set( _storage "_organization" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+VERSION" )
++ set( _skip_store 1 )
++ set( _storage "_version" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+DATETIME" )
++ set( _skip_store 1 )
++ set( _storage "_datetime" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+NOTES" )
++ set( _skip_store 1 )
++ set( _storage "_notes" )
++ endif( )
++
++ # storing value
++ if( _storage AND NOT _skip_store )
++ list( APPEND ${_storage} ${_arg} )
++ list( REMOVE_DUPLICATES ${_storage} )
++ endif( _storage AND NOT _skip_store )
++
++ endforeach( _arg )
++
++ # if no type is set, we choose one
++ # based on BUILD_SHARED_LIBS
++ if( NOT _type )
++ if( BUILD_SHARED_LIBS )
++ set( _type "SHARED" )
++ else( BUILD_SHARED_LIBS )
++ set( _type "STATIC" )
++ endif( BUILD_SHARED_LIBS )
++ endif( NOT _type )
++
++ # change target name, based on type
++ string( TOLOWER "${_type}" _type_lower )
++ set( _target "${_arg_target}-${_type_lower}" )
++
++ # create variables like "LIB_xxx" for convenience
++ if( ${_type} STREQUAL "SHARED" )
++ string( TOUPPER "${_arg_target}" _tmp )
++ set( LIB_${_tmp} ${_target} CACHE INTERNAL LIB_${tmp} FORCE )
++ endif( ${_type} STREQUAL "SHARED" )
++
++ # disallow target without sources
++ if( NOT _sources )
++ message( FATAL_ERROR "\nTarget [$_target] have no sources." )
++ endif( NOT _sources )
++
++ # processing different types of sources
++ __tde_internal_process_sources( _sources ${_sources} )
++
++ # set automoc
++ if( _automoc )
++ tde_automoc( ${_sources} )
++ endif( _automoc )
++
++ # add target
++ add_library( ${_target} ${_type} ${_sources} )
++
++ # we assume that modules have no prefix and no version
++ # also, should not link
++ if( ${_type} STREQUAL "MODULE" )
++ set_target_properties( ${_target} PROPERTIES PREFIX "" )
++ unset( _version )
++ set( _shouldnotlink yes )
++ endif( ${_type} STREQUAL "MODULE" )
++
++ # set real name of target
++ set_target_properties( ${_target} PROPERTIES OUTPUT_NAME ${_arg_target} )
++
++ # set -fPIC flag for static libraries
++ if( _static_pic )
++ set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC )
++ endif( _static_pic )
++
++ # set version
++ if( _version )
++ if( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
++ # OpenBSD: _soversion and _version both contains only major and minor
++ string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_version}" )
++ set( _version "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
++ set( _soversion "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
++ else( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
++ # General (Linux) case: _soversion contains only the major number of version
++ string( REGEX MATCH "^[0-9]+" _soversion ${_version} )
++ endif( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
++ set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} )
++ endif( _version )
++
++ # set interface libraries (only for shared)
++ unset( _shared_libs )
++ if( NOT ${_type} STREQUAL "STATIC" )
++ foreach( _lib ${_link} )
++ #get_target_property( _lib_type ${_lib} TYPE )
++ #if( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" )
++ if( NOT ${_lib} MATCHES ".+-static" )
++ list( APPEND _shared_libs ${_lib} )
++ endif( NOT ${_lib} MATCHES ".+-static" )
++ #endif( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" )
++ endforeach( _lib )
++ endif( NOT ${_type} STREQUAL "STATIC" )
++
++ # set embedded archives
++ if( _embed )
++ list( INSERT _link 0 -Wl,-whole-archive ${_embed} -Wl,-no-whole-archive )
++ endif( _embed )
++
++ # set link libraries
++ if( _link )
++ if( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
++ # hack for broken CMake 2.8.12.0
++ set_target_properties( ${_target} PROPERTIES LINK_LIBRARIES "${_link}" )
++ else( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
++ target_link_libraries( ${_target} ${_link} )
++ endif( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
++ endif( )
++ if( _shared_libs )
++ set_target_properties( ${_target} PROPERTIES
++ LINK_INTERFACE_LIBRARIES "${_shared_libs}"
++ INTERFACE_LINK_LIBRARIES "${_shared_libs}" )
++ endif( _shared_libs )
++
++ # set dependencies
++ if( _dependencies )
++ add_dependencies( ${_target} ${_dependencies} )
++ endif( _dependencies )
++
++ # if destination directory is set
++ if( _destination )
++
++ # we export only shared libs (no static, no modules);
++ # also, do not export targets marked as "NO_EXPORT" (usually for tdeinit)
++ if( "SHARED" STREQUAL ${_type} AND NOT _no_export )
++
++ # get target properties: output name, version, soversion
++ get_target_property( _output ${_target} LOCATION )
++ get_filename_component( _output ${_output} NAME )
++ get_target_property( _version ${_target} VERSION )
++ get_target_property( _soversion ${_target} SOVERSION )
++
++ if( _version )
++ set( _location "${_destination}/${_output}.${_version}" )
++ set( _soname "${_output}.${_soversion}" )
++ else( )
++ set( _location "${_destination}/${_output}" )
++ set( _soname "${_output}" )
++ endif( )
++
++ configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY )
++ endif( )
++
++ # install target
++ install( TARGETS ${_target} DESTINATION ${_destination} )
++
++ # install .la files for dynamic libraries
++ if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file )
++ tde_install_libtool_file( ${_target} ${_destination} )
++ endif( )
++
++ endif( _destination )
++
++ # embed name and metadata
++ set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"x-sharedlib\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" )
++ separate_arguments( ELF_EMBEDDING_METADATA )
++ if( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor )
++ add_custom_command(
++ TARGET ${_target}
++ POST_BUILD
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ${ELF_EMBEDDING_METADATA} || true
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname} || true
++ )
++ if( _version )
++ add_custom_command(
++ TARGET ${_target}
++ POST_BUILD
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} ${ELF_EMBEDDING_METADATA} || true
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} || true
++ )
++ endif( )
++ endif( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor )
++
++endmacro( tde_add_library )
++
++
++#################################################
++#####
++##### tde_add_kpart
++
++macro( tde_add_kpart _target )
++ tde_add_library( ${_target} ${ARGN} MODULE )
++endmacro( tde_add_kpart )
++
++
++#################################################
++#####
++##### tde_curdatetime
++macro( tde_curdatetime result )
++ tde_execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
++ string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} )
++endmacro( tde_curdatetime )
++
++
++#################################################
++#####
++##### tde_add_executable
++
++macro( tde_add_executable _arg_target )
++
++ unset( _target )
++ unset( _automoc )
++ unset( _meta_includes )
++ unset( _setuid )
++ unset( _sources )
++ unset( _destination )
++ unset( _link )
++ unset( _dependencies )
++ unset( _storage )
++
++ # metadata
++ unset( _description )
++ unset( _license )
++ unset( _copyright )
++ unset( _authors )
++ unset( _product )
++ unset( _organization )
++ unset( _version )
++ unset( _datetime )
++ unset( _notes )
++
++ # default metadata
++ set( _product "Trinity Desktop Environment" )
++ set( _version "${TDE_VERSION}" )
++ tde_curdatetime( _datetime )
++
++ foreach( _arg ${ARGV} )
++
++ # this variable help us to skip
++ # storing unapropriate values (i.e. directives)
++ unset( _skip_store )
++
++ # found directive "AUTOMOC"
++ if( "+${_arg}" STREQUAL "+AUTOMOC" )
++ set( _skip_store 1 )
++ set( _automoc 1 )
++ endif( "+${_arg}" STREQUAL "+AUTOMOC" )
++
++ # found directive "META_INCLUDES"
++ if( "+${_arg}" STREQUAL "+META_INCLUDES" )
++ set( _skip_store 1 )
++ set( _storage "_meta_includes" )
++ endif( )
++
++ # found directive "SETUID"
++ if( "+${_arg}" STREQUAL "+SETUID" )
++ set( _skip_store 1 )
++ set( _setuid 1 )
++ endif( "+${_arg}" STREQUAL "+SETUID" )
++
++ # found directive "SOURCES"
++ if( "+${_arg}" STREQUAL "+SOURCES" )
++ set( _skip_store 1 )
++ set( _storage "_sources" )
++ endif( "+${_arg}" STREQUAL "+SOURCES" )
++
++ # found directive "LINK"
++ if( "+${_arg}" STREQUAL "+LINK" )
++ set( _skip_store 1 )
++ set( _storage "_link" )
++ endif( "+${_arg}" STREQUAL "+LINK" )
++
++ # found directive "DEPENDENCIES"
++ if( "+${_arg}" STREQUAL "+DEPENDENCIES" )
++ set( _skip_store 1 )
++ set( _storage "_dependencies" )
++ endif( "+${_arg}" STREQUAL "+DEPENDENCIES" )
++
++ # found directive "DESTINATION"
++ if( "+${_arg}" STREQUAL "+DESTINATION" )
++ set( _skip_store 1 )
++ set( _storage "_destination" )
++ unset( ${_storage} )
++ endif( "+${_arg}" STREQUAL "+DESTINATION" )
++
++ # metadata
++ if( "+${_arg}" STREQUAL "+DESCRIPTION" )
++ set( _skip_store 1 )
++ set( _storage "_description" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+LICENSE" )
++ set( _skip_store 1 )
++ set( _storage "_license" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+COPYRIGHT" )
++ set( _skip_store 1 )
++ set( _storage "_copyright" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+AUTHORS" )
++ set( _skip_store 1 )
++ set( _storage "_authors" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+PRODUCT" )
++ set( _skip_store 1 )
++ set( _storage "_product" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+ORGANIZATION" )
++ set( _skip_store 1 )
++ set( _storage "_organization" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+VERSION" )
++ set( _skip_store 1 )
++ set( _storage "_version" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+DATETIME" )
++ set( _skip_store 1 )
++ set( _storage "_datetime" )
++ endif( )
++ if( "+${_arg}" STREQUAL "+NOTES" )
++ set( _skip_store 1 )
++ set( _storage "_notes" )
++ endif( )
++
++ # storing value
++ if( _storage AND NOT _skip_store )
++ #set( ${_storage} "${${_storage}} ${_arg}" )
++ list( APPEND ${_storage} ${_arg} )
++ endif( _storage AND NOT _skip_store )
++
++ endforeach( _arg )
++
++ set( _target "${_arg_target}" )
++
++ # disallow target without sources
++ if( NOT _sources )
++ message( FATAL_ERROR "\nTarget [$_target] have no sources." )
++ endif( NOT _sources )
++
++ # processing different types of sources
++ __tde_internal_process_sources( _sources ${_sources} )
++
++ # set automoc
++ if( _automoc )
++ tde_automoc( ${_sources} )
++ endif( _automoc )
++
++ # add target
++ add_executable( ${_target} ${_sources} )
++
++ # set link libraries
++ if( _link )
++ target_link_libraries( ${_target} ${_link} )
++ endif( _link )
++
++ # set dependencies
++ if( _dependencies )
++ add_dependencies( ${_target} ${_dependencies} )
++ endif( _dependencies )
++
++ # set PIE flags for setuid binaries
++ if( _setuid )
++ set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS "${TDE_PIE_CFLAGS}" )
++ set_target_properties( ${_target} PROPERTIES LINK_FLAGS "${TDE_PIE_LDFLAGS}" )
++ endif( _setuid )
++
++ # set destination directory
++ if( _destination )
++ if( _setuid )
++ install( TARGETS ${_target} DESTINATION ${_destination} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE SETUID )
++ else( _setuid )
++ install( TARGETS ${_target} DESTINATION ${_destination} )
++ endif( _setuid )
++ endif( _destination )
++
++ # embed icon, name, and metadata
++ set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"${_target}\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" )
++ separate_arguments( ELF_EMBEDDING_METADATA )
++ if( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor )
++ add_custom_command(
++ TARGET ${_target}
++ POST_BUILD
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true
++ COMMAND ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true
++ )
++ endif( EXISTS ${CMAKE_INSTALL_PREFIX}/bin/tdelfeditor )
++
++endmacro( tde_add_executable )
++
++
++#################################################
++#####
++##### tde_add_tdeinit_executable
++
++macro( tde_add_tdeinit_executable _target )
++
++ configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_tdeinit_executable.cmake ${_target}_tdeinit_executable.cpp COPYONLY )
++ configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_tdeinit_module.cmake ${_target}_tdeinit_module.cpp COPYONLY )
++
++ unset( _sources )
++ unset( _runtime_destination )
++ unset( _library_destination )
++ unset( _plugin_destination )
++
++ # default storage is _sources
++ set( _storage _sources )
++
++ # set default export to NO_EXPORT
++ set( _export "NO_EXPORT" )
++
++ foreach( _arg ${ARGN} )
++
++ # this variable help us to skip
++ # storing unapropriate values (i.e. directives)
++ unset( _skip_store )
++
++ # found directive "EXPORT"
++ if( "+${_arg}" STREQUAL "+EXPORT" )
++ set( _skip_store 1 )
++ unset( _export )
++ endif( "+${_arg}" STREQUAL "+EXPORT" )
++
++ # found directive "RUNTIME_DESTINATION"
++ if( "+${_arg}" STREQUAL "+RUNTIME_DESTINATION" )
++ set( _skip_store 1 )
++ set( _storage "_runtime_destination" )
++ unset( ${_storage} )
++ endif( "+${_arg}" STREQUAL "+RUNTIME_DESTINATION" )
++
++ # found directive "LIBRARY_DESTINATION"
++ if( "+${_arg}" STREQUAL "+LIBRARY_DESTINATION" )
++ set( _skip_store 1 )
++ set( _storage "_library_destination" )
++ unset( ${_storage} )
++ endif( "+${_arg}" STREQUAL "+LIBRARY_DESTINATION" )
++
++ # found directive "PLUGIN_DESTINATION"
++ if( "+${_arg}" STREQUAL "+PLUGIN_DESTINATION" )
++ set( _skip_store 1 )
++ set( _storage "_plugin_destination" )
++ unset( ${_storage} )
++ endif( "+${_arg}" STREQUAL "+PLUGIN_DESTINATION" )
++
++ # storing value
++ if( _storage AND NOT _skip_store )
++ list( APPEND ${_storage} ${_arg} )
++ set( _storage "_sources" )
++ endif( _storage AND NOT _skip_store )
++
++ endforeach( _arg )
++
++ # if destinations are not set, we using some defaults
++ # we assume that tdeinit executable MUST be installed
++ # (otherwise why we build it?)
++ if( NOT _runtime_destination )
++ set( _runtime_destination ${BIN_INSTALL_DIR} )
++ endif( NOT _runtime_destination )
++ if( NOT _library_destination )
++ set( _library_destination ${LIB_INSTALL_DIR} )
++ endif( NOT _library_destination )
++ if( NOT _plugin_destination )
++ set( _plugin_destination ${PLUGIN_INSTALL_DIR} )
++ endif( NOT _plugin_destination )
++
++ # create the library
++ tde_add_library( tdeinit_${_target} ${_sources} SHARED ${_export}
++ DESTINATION ${_library_destination}
++ )
++
++ # create the executable
++ tde_add_executable( ${_target}
++ SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_tdeinit_executable.cpp
++ LINK tdeinit_${_target}-shared
++ DESTINATION ${_runtime_destination}
++ )
++
++ # create the plugin
++ tde_add_kpart( ${_target}
++ SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_tdeinit_module.cpp
++ LINK tdeinit_${_target}-shared
++ DESTINATION ${_plugin_destination}
++ )
++
++endmacro( tde_add_tdeinit_executable )
++
++
++#################################################
++#####
++##### tde_create_translation
++
++macro( tde_create_translation )
++
++ unset( _srcs )
++ unset( _lang )
++ unset( _dest )
++ unset( _out_name )
++ unset( _directive )
++ unset( _var )
++
++ foreach( _arg ${ARGN} )
++
++ # found directive "FILES"
++ if( "+${_arg}" STREQUAL "+FILES" )
++ unset( _srcs )
++ set( _var _srcs )
++ set( _directive 1 )
++ endif( )
++
++ # found directive "LANG"
++ if( "+${_arg}" STREQUAL "+LANG" )
++ unset( _lang )
++ set( _var _lang )
++ set( _directive 1 )
++ endif( )
++
++ # found directive "DESTINATION"
++ if( "+${_arg}" STREQUAL "+DESTINATION" )
++ unset( _dest )
++ set( _var _dest )
++ set( _directive 1 )
++ endif( )
++
++ # found directive "DESTINATION"
++ if( "+${_arg}" STREQUAL "+OUTPUT_NAME" )
++ unset( _proj )
++ set( _var _out_name )
++ set( _directive 1 )
++ endif( )
++
++ # collect data
++ if( _directive )
++ unset( _directive )
++ elseif( _var )
++ list( APPEND ${_var} ${_arg} )
++ endif()
++
++ endforeach( )
++
++ if( NOT MSGFMT_EXECUTABLE )
++ tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" )
++ elseif( NOT _lang )
++ tde_message_fatal( "missing LANG directive" )
++ endif( )
++
++ # if no file specified, include all *.po files
++ if( NOT _srcs )
++ file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po )
++ endif( )
++ if( NOT _srcs )
++ tde_message_fatal( "no source files" )
++ endif( )
++
++ if( NOT _lang STREQUAL "auto")
++ set( _real_lang ${_lang} )
++
++ if( NOT _dest )
++ set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" )
++ endif( )
++
++ # OUTPUT_NAME can only be used if we have only one file
++ list( LENGTH _srcs _srcs_num)
++ if( _out_name AND _srcs_num GREATER 1 )
++ tde_message_fatal( "OUTPUT_NAME can be supplied only with single file or LANG=auto" )
++ endif( )
++
++ elseif( NOT _out_name )
++ tde_message_fatal( "LANG=auto reqires OUTPUT_NAME directive to be set" )
++ elseif( _dest )
++ tde_message_fatal( "DESTINATION cannot be used with LANG=auto" )
++ endif( )
++
++ # generate *.mo files
++ foreach( _src ${_srcs} )
++
++ get_filename_component( _src ${_src} ABSOLUTE )
++
++ if( _out_name )
++ set( _out ${_out_name} )
++ if( _lang STREQUAL "auto" )
++ get_filename_component( _real_lang ${_src} NAME_WE )
++ set( _dest "${LOCALE_INSTALL_DIR}/${_real_lang}/LC_MESSAGES" )
++ endif( )
++ else( )
++ get_filename_component( _out ${_src} NAME_WE )
++ endif( )
++
++ string( REPLACE "@" "_" _target ${_real_lang} )
++ set( _out_filename "${_out}-${_real_lang}.mo" )
++ set( _install_filename "${_out}.mo" )
++
++ add_custom_command(
++ OUTPUT ${_out_filename}
++ COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_filename}
++ DEPENDS ${_src} )
++ add_custom_target( "${_out}-${_target}-translation" ALL DEPENDS ${_out_filename} )
++ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_filename} RENAME ${_install_filename} DESTINATION ${_dest} )
++
++ endforeach( )
++
++endmacro( )
++
++
++#################################################
++#####
++##### tde_create_handbook
++
++macro( tde_create_handbook )
++
++ unset( _target )
++ unset( _dest )
++ unset( _noindex )
++ unset( _srcs )
++ unset( _extra )
++ unset( _srcdir )
++
++ set( _lang en )
++ set( _first_arg 1 )
++ set( _var _target )
++
++ foreach( _arg ${ARGN} )
++
++ # found directive "NOINDEX"
++ if( "+${_arg}" STREQUAL "+NOINDEX" )
++ set( _noindex 1 )
++ set( _directive 1 )
++ endif()
++
++ # found directive "FILES"
++ if( "+${_arg}" STREQUAL "+FILES" )
++ unset( _srcs )
++ set( _var _srcs )
++ set( _directive 1 )
++ endif()
++
++ # found directive "EXTRA"
++ if( "+${_arg}" STREQUAL "+EXTRA" )
++ unset( _extra )
++ set( _var _extra )
++ set( _directive 1 )
++ endif()
++
++ # found directive "SRCDIR"
++ if( "+${_arg}" STREQUAL "+SRCDIR" )
++ unset( _srcdir )
++ set( _var _srcdir )
++ set( _directive 1 )
++ endif()
++
++ # found directive DESTINATION
++ if( "+${_arg}" STREQUAL "+DESTINATION" )
++ unset( _dest )
++ set( _var _dest )
++ set( _directive 1 )
++ endif()
++
++ # found directive "LANG"
++ if( "+${_arg}" STREQUAL "+LANG" )
++ unset( _lang )
++ set( _var _lang )
++ set( _directive 1 )
++ endif()
++
++ # collect data
++ if( _directive )
++ unset( _directive )
++ elseif( _var )
++ if( _first_arg )
++ set( _target "${_arg}" )
++ else()
++ list( APPEND ${_var} ${_arg} )
++ endif()
++ endif()
++
++ unset( _first_arg )
++
++ endforeach()
++
++ # if no target specified, try to guess it from DESTINATION
++ if( NOT _target )
++ if( NOT _dest )
++ tde_message_fatal( "target name cannot be determined because DESTINATION is not set" )
++ endif()
++ string( REPLACE "/" "-" _target "${_dest}" )
++ endif()
++
++ set( _target "${_target}-${_lang}-handbook" )
++
++ # if no file specified, include all docbooks, stylesheets and images
++ if( NOT _srcs )
++ file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.docbook *.css *.png )
++ endif()
++
++ # if no destination specified, defaulting to HTML_INSTALL_DIR
++ if( NOT _dest )
++ set( _dest "${HTML_INSTALL_DIR}/${_lang}" )
++ # if destination is NOT absolute path,
++ # we assume that is relative to HTML_INSTALL_DIR
++ elseif( NOT IS_ABSOLUTE ${_dest} )
++ set( _dest "${HTML_INSTALL_DIR}/${_lang}/${_dest}" )
++ endif()
++
++ if( NOT _srcs )
++ tde_message_fatal( "no source files" )
++ endif()
++
++ if( NOT _noindex )
++
++ # check for index.docbook
++ list( FIND _srcs "index.docbook" _find_index )
++ if( -1 EQUAL _find_index )
++ tde_message_fatal( "missing index.docbook file" )
++ endif()
++
++ # check for srcdir
++ if( _srcdir )
++ set( _srcdir "--srcdir=${_srcdir}" )
++ endif()
++
++ add_custom_command(
++ OUTPUT index.cache.bz2
++ COMMAND ${KDE3_MEINPROC_EXECUTABLE} ${_srcdir} --check --cache index.cache.bz2 ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook
++ DEPENDS ${_srcs} )
++
++ add_custom_target( ${_target} ALL DEPENDS index.cache.bz2 )
++
++ list( APPEND _srcs ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 )
++
++ if( NOT TDE_HTML_DIR )
++ set( TDE_HTML_DIR ${HTML_INSTALL_DIR} )
++ endif( )
++
++ tde_install_empty_directory( ${_dest} )
++ tde_install_symlink( ${TDE_HTML_DIR}/${_lang}/common ${_dest} )
++
++ endif()
++
++ install( FILES ${_srcs} ${_extra} DESTINATION ${_dest} )
++
++endmacro( )
++
++
++#################################################
++#####
++##### tde_include_tqt
++
++macro( tde_include_tqt )
++ foreach( _cpp ${ARGN} )
++ set_source_files_properties( ${_cpp} PROPERTIES COMPILE_FLAGS "-include tqt.h" )
++ endforeach()
++endmacro( )
++
++
++#################################################
++#####
++##### tde_install_symlink
++
++macro( tde_install_symlink _target _link )
++
++ # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX
++ if( IS_ABSOLUTE "${_link}" )
++ set( _destination "${_link}" )
++ else( IS_ABSOLUTE "${_link}" )
++ set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" )
++ endif( IS_ABSOLUTE "${_link}" )
++
++ get_filename_component( _path "${_destination}" PATH )
++ if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
++ install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_path}\" )" )
++ endif( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
++
++ install( CODE "execute_process( COMMAND ln -s ${_target} \$ENV{DESTDIR}${_destination} )" )
++
++endmacro( tde_install_symlink )
++
++
++#################################################
++#####
++##### tde_install_empty_directory
++
++macro( tde_install_empty_directory _path )
++
++ # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX
++ if( IS_ABSOLUTE "${_path}" )
++ set( _destination "${_path}" )
++ else( IS_ABSOLUTE "${_path}" )
++ set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" )
++ endif( IS_ABSOLUTE "${_path}" )
++
++ install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" )
++
++endmacro( tde_install_empty_directory )
++
++
++#################################################
++#####
++##### tde_conditional_add_subdirectory
++
++macro( tde_conditional_add_subdirectory _cond _path )
++
++ if( ${_cond} )
++ add_subdirectory( "${_path}" )
++ endif( ${_cond} )
++
++endmacro( tde_conditional_add_subdirectory )
++
++
++#################################################
++#####
++##### tde_auto_add_subdirectories
++
++macro( tde_auto_add_subdirectories )
++ file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * )
++ foreach( _dir ${_dirs} )
++ if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} )
++ if( NOT ${_dir} STREQUAL ".svn" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt )
++ add_subdirectory( ${_dir} )
++ endif()
++ endif()
++ endforeach()
++endmacro()
++
++
++#################################################
++#####
++##### tde_save / tde_restore
++
++macro( tde_save )
++ foreach( _var ${ARGN} )
++ set( __bak_${_var} ${${_var}} )
++ endforeach()
++endmacro()
++
++macro( tde_save_and_set _var )
++ set( __bak_${_var} ${${_var}} )
++ set( ${_var} ${ARGN} )
++endmacro( )
++
++macro( tde_restore )
++ foreach( _var ${ARGN} )
++ set( ${_var} ${__bak_${_var}} )
++ unset( __bak_${_var} )
++ endforeach()
++endmacro()
++
++
++#################################################
++#####
++##### tde_setup_install_path
++
++macro( tde_setup_install_path _path _default )
++ if( DEFINED ${_path} )
++ set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE )
++ else( )
++ set( ${_path} "${_default}" )
++ endif( )
++endmacro( )
++
++
++##################################################
++
++if( ${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR} )
++ tde_message_fatal( "Please use out-of-source building, like this:
++ \n rm ${CMAKE_SOURCE_DIR}/CMakeCache.txt
++ mkdir /tmp/${PROJECT_NAME}.build
++ cd /tmp/${PROJECT_NAME}.build
++ cmake ${CMAKE_SOURCE_DIR} [arguments...]" )
++endif( )
++
++#################################################
++#####
++##### tde_setup_architecture_flags
++
++macro( tde_setup_architecture_flags )
++ message( STATUS "Detected ${CMAKE_SYSTEM_PROCESSOR} CPU architecture" )
++ ## Immediate symbol binding is available only for gcc but not on ARM architectures
++ if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm* AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
++ set( LINKER_IMMEDIATE_BINDING_FLAGS "-z\ now" CACHE INTERNAL "" FORCE )
++ else( )
++ set( LINKER_IMMEDIATE_BINDING_FLAGS "" CACHE INTERNAL "" FORCE )
++ endif( )
++
++ check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT )
++ if( HAVE_PIE_SUPPORT )
++ set( TDE_PIE_CFLAGS -fPIE )
++ set( TDE_PIE_LDFLAGS -pie )
++ endif( HAVE_PIE_SUPPORT )
++endmacro( )
++
++
++################################################
++#####
++##### Restore CMP0026 policy
++
++if( POLICY CMP0026 )
++ cmake_policy( POP )
++endif( POLICY CMP0026 )
++
+Index: b/cmake/modules/TDESetupPaths.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/TDESetupPaths.cmake
+@@ -0,0 +1,68 @@
++#################################################
++#
++# (C) 2010-2011 Serghei Amelian
++# serghei (DOT) amelian (AT) gmail.com
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++#################################################
++#####
++##### tde_internal_setup_path
++
++macro( _tde_internal_setup_path _path _default _comment )
++ if( DEFINED ${_path} )
++ set( ${_path} "${${_path}}" CACHE PATH "${_comment}" )
++ else( DEFINED ${_path} )
++ set( ${_path} "${_default}" )
++ endif( DEFINED ${_path} )
++endmacro( _tde_internal_setup_path )
++
++
++#################################################
++#####
++##### tde_setup_paths
++
++macro( tde_setup_paths )
++
++ # install paths
++ _tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" )
++ _tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" )
++ _tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" )
++ _tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" )
++ _tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" )
++ _tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/trinity/libexec)" )
++ _tde_internal_setup_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" "The install dir for pkg-config metadata files" )
++ _tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" )
++
++ _tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" )
++ _tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/trinity)" )
++ _tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" )
++ _tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" )
++ _tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/tde/HTML" "The HTML install dir for documentation" )
++ _tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" )
++ _tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for tdeconfig files" )
++ _tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" )
++ _tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" )
++ _tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" )
++ _tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" )
++ _tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" )
++ _tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" )
++ _tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" )
++ _tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" )
++ _tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/tdeconf_update" "The tdeconf_update install dir" )
++ _tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" )
++
++ _tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" )
++ _tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" )
++ _tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" )
++
++ _tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" )
++ _tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/tde" "The XDG apps dir" )
++ _tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" )
++ _tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" )
++
++endmacro( tde_setup_paths )
+Index: b/cmake/modules/tde_uic.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/tde_uic.cmake
+@@ -0,0 +1,61 @@
++#################################################
++#
++# (C) 2010-2011 Serghei Amelian
++# serghei (DOT) amelian (AT) gmail.com
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++set( CMAKE_MODULE_PATH "${MASTER_SOURCE_DIR}/cmake/modules" )
++include( TDEMacros )
++
++get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
++
++# FIXME this will working only on out-of-source mode
++set( local_ui_file ${_ui_basename}.ui )
++configure_file( ${UI_FILE} ${local_ui_file} COPYONLY )
++tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file} )
++
++# ui.h extension file, if exists
++if( EXISTS "${UI_FILE}.h" )
++ configure_file( ${UI_FILE}.h ${local_ui_file}.h COPYONLY )
++ tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file}.h )
++endif( )
++
++if( TDE_QTPLUGINS_DIR )
++ set( L -L ${TDE_QTPLUGINS_DIR} )
++endif( )
++
++tde_execute_process( COMMAND ${UIC_EXECUTABLE}
++ -nounload -tr tr2i18n
++ ${L}
++ ${local_ui_file}
++ OUTPUT_VARIABLE _ui_h_content )
++
++if( _ui_h_content )
++ string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
++ string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
++ string( REGEX REPLACE "public TQWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
++ string( REGEX REPLACE "public QWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
++ string( REGEX REPLACE "#include <ntqwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
++ string( REGEX REPLACE "#include <qwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
++ file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
++endif( )
++
++tde_execute_process( COMMAND ${UIC_EXECUTABLE}
++ -nounload -tr tr2i18n
++ ${L}
++ -impl ${_ui_basename}.h
++ ${local_ui_file}
++ OUTPUT_VARIABLE _ui_cpp_content )
++
++if( _ui_cpp_content )
++ string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
++ string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
++ string( REGEX REPLACE ": TQWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
++ string( REGEX REPLACE ": QWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
++ file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <tdelocale.h>\n\n${_ui_cpp_content}" )
++endif( )
+Index: b/cmake/modules/template_dummy_cpp.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/template_dummy_cpp.cmake
+@@ -0,0 +1,5 @@
++#ifdef _AIX
++ namespace {
++ void *not_empty_file;
++ }
++#endif
+Index: b/cmake/modules/template_export_library.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/template_export_library.cmake
+@@ -0,0 +1,7 @@
++add_library( @_target@ @_type@ IMPORTED )
++
++set_target_properties( @_target@ PROPERTIES
++ IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@"
++ IMPORTED_LOCATION "@_location@"
++ IMPORTED_SONAME "@_soname@" )
++
+Index: b/cmake/modules/template_libtool_file.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/template_libtool_file.cmake
+@@ -0,0 +1,35 @@
++# @_laname@ - a libtool library file
++# Generated by CMake - GNU libtool
++#
++# Please DO NOT delete this file!
++# It is necessary for linking the library.
++
++# The name that we can dlopen(3).
++dlname='@_library_name_2@'
++
++# Names of this library.
++library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@'
++
++# The name of the static archive.
++old_library=''
++
++# Libraries that this one depends upon.
++dependency_libs=''
++
++# Version information for @_name@.
++current=@_version_current@
++age=@_version_age@
++revision=@_version_revision@
++
++# Is this an already installed library?
++installed=yes
++
++# Should we warn about portability when linking against -modules?
++shouldnotlink=@_shouldnotlink@
++
++# Files to dlopen/dlpreopen
++dlopen=''
++dlpreopen=''
++
++# Directory that this library needs to be installed in:
++libdir='@_libdir@'
+Index: b/cmake/modules/template_tdeinit_executable.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/template_tdeinit_executable.cmake
+@@ -0,0 +1,2 @@
++extern "C" int kdemain(int argc, char* argv[]);
++int main(int argc, char* argv[]) { return kdemain(argc,argv); }
+Index: b/cmake/modules/template_tdeinit_module.cmake
+===================================================================
+--- /dev/null
++++ b/cmake/modules/template_tdeinit_module.cmake
+@@ -0,0 +1,3 @@
++#include <kdemacros.h>
++extern "C" int kdemain(int argc, char* argv[]);
++extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
+Index: b/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,73 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++cmake_minimum_required( VERSION 2.6 )
++
++
++##### general package setup #####################
++
++project( akode )
++set( PACKAGE akode )
++set( VERSION 2.0.2 )
++
++
++##### include essential cmake modules ###########
++
++include( FindPkgConfig )
++include( CheckCXXSourceCompiles )
++include( CheckFunctionExists )
++include( CheckIncludeFile )
++include( CheckLibraryExists )
++
++
++##### include our cmake modules #################
++
++set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
++include( TDEMacros )
++tde_setup_architecture_flags( )
++
++
++##### setup install paths #######################
++
++include( TDESetupPaths )
++tde_setup_paths( )
++
++
++##### optional stuff ############################
++
++option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
++
++OPTION( WITH_LIBLTDL "Build with libltdl" ${WITH_ALL_OPTIONS} )
++
++OPTION( WITH_ALSA_SINK "Build with alsa sink" ${WITH_ALL_OPTIONS} )
++OPTION( WITH_JACK_SINK "Build with jack sink" ${WITH_ALL_OPTIONS} )
++OPTION( WITH_POLYP_SINK "Build with polyp sink" OFF )
++OPTION( WITH_OSS_SINK "Build with oss sink" ${WITH_ALL_OPTIONS} )
++OPTION( WITH_SUN_SINK "Build with sun sink" OFF )
++
++OPTION( WITH_FFMPEG_DECODER "Build with ffmeeg decoder" OFF )
++option( WITH_MPC_DECODER "Build with mpc decoder" ON )
++option( WITH_MPEG_DECODER "Build with mpeg decoder" ${WITH_ALL_OPTIONS} )
++OPTION( WITH_SRC_RESAMPLER "Build with src resampler" ${WITH_ALL_OPTIONS} )
++option( WITH_XIPH_DECODER "Build with xiph decoder" ${WITH_ALL_OPTIONS} )
++
++
++##### configure checks ##########################
++
++include( ConfigureChecks.cmake )
++add_definitions( -DHAVE_CONFIG_H )
++configure_file( config.h.cmake config.h @ONLY )
++
++
++##### build #####################################
++
++tde_auto_add_subdirectories()
++
+Index: b/config.h.cmake
+===================================================================
+--- /dev/null
++++ b/config.h.cmake
+@@ -0,0 +1,62 @@
++
++/* defined if you have libltdl library and header */
++#cmakedefine HAVE_LIBLTDL
++
++/* Define if your platform has posix_madvise */
++#cmakedefine HAVE_POSIX_MADVISE
++
++/* Define if your platform has posix_fadvise */
++#cmakedefine HAVE_POSIX_FADVISE
++
++/* Define if your platform has fadvise */
++#cmakedefine HAVE_FADVISE
++
++/* Define if your platform has madvise */
++#cmakedefine HAVE_MADVISE
++
++/* Define if madvise has no usefull prototype */
++#cmakedefine NEED_MADVISE_PROTOTYPE
++
++/* Define if your platform has getopt_long from glibc */
++#cmakedefine HAVE_GNU_GETOPT
++
++/* Define to 1 if you have the <stdint.h> header file. */
++#cmakedefine HAVE_STDINT_H
++
++/* Define to 1 if you have the <inttypes.h> header file. */
++#cmakedefine HAVE_INTTYPES_H
++
++/* Define to 1 if you have the <sys/types.h> header file. */
++#cmakedefine HAVE_SYS_TYPES_H
++
++/* Define to 1 if you have the <soundcard.h> header file. */
++#cmakedefine HAVE_SOUNDCARD_H
++
++/* Define to 1 if you have the <sys/soundcard.h> header file. */
++#cmakedefine HAVE_SYS_SOUNDCARD_H
++
++/* Define if you have libavcodec and libavformat from FFMPEG (required for WMA
++ and RealAudio decoding) */
++#cmakedefine HAVE_FFMPEG
++
++/* Define if you have libFLAC 1.1.3 or newer */
++#cmakedefine HAVE_LIBFLAC113
++
++/* Define if you have libFLAC 1.1.1 or 1.1.2 */
++#cmakedefine HAVE_LIBFLAC
++
++/* Define if you have libOggFLAC (required for loading OggFLAC files) */
++#cmakedefine HAVE_LIBOGGFLAC
++
++/* Define if you have speex installed */
++#cmakedefine HAVE_SPEEX
++
++/* Define if you have libspeex 1.1.x installed */
++#cmakedefine HAVE_SPEEX11
++
++/* Define if you have one of the broken libspeex 1.1.x < 1.1.5 */
++#cmakedefine BROKEN_SPEEX11
++
++/* Define if you have ogg/vorbis installed */
++#cmakedefine HAVE_OGG_VORBIS
++
+Index: b/ConfigureChecks.cmake
+===================================================================
+--- /dev/null
++++ b/ConfigureChecks.cmake
+@@ -0,0 +1,300 @@
++#################################################
++#
++# (C) 2015 Slávek Banko
++# slavek (DOT) banko (AT) axis.cz
++#
++# Improvements and feedback are welcome
++#
++# This file is released under GPL >= 2
++#
++#################################################
++
++
++##### check for system libraries ################
++
++if( WITH_LIBLTDL )
++ # check libltdl
++ check_include_file( "ltdl.h" HAVE_LTDL_H )
++ if( HAVE_LTDL_H )
++ set( AKODE_LIBDL ltdl )
++ check_library_exists( ${AKODE_LIBDL} lt_dlopen "" HAVE_LIBLTDL )
++ endif( HAVE_LTDL_H)
++ if( NOT HAVE_LIBLTDL )
++ tde_message_fatal( "libltdl are required, but not found on your system" )
++ endif( NOT HAVE_LIBLTDL )
++
++else( WITH_LIBLTDL )
++ # check libdl
++ set( AKODE_LIBDL dl )
++ check_library_exists( ${AKODE_LIBDL} dlopen /lib HAVE_LIBDL )
++ if( NOT HAVE_LIBDL )
++ unset( AKODE_LIBDL )
++ check_function_exists( dlopen HAVE_DLOPEN )
++ if( NOT HAVE_DLOPEN )
++ tde_message_fatal( "libdl are required, but not found on your system" )
++ endif( NOT HAVE_DLOPEN )
++ endif( NOT HAVE_LIBDL )
++endif( WITH_LIBLTDL )
++
++
++find_package( Threads )
++
++
++check_include_file( "semaphore.h" HAVE_SEM )
++check_library_exists( rt sem_init "" HAVE_LIBRT )
++if( HAVE_LIBRT )
++ set( SEM_LIBRARIES rt )
++endif( HAVE_LIBRT )
++
++
++check_library_exists( c posix_madvise "" HAVE_POSIX_MADVISE )
++check_library_exists( c posix_fadvise "" HAVE_POSIX_FADVISE )
++check_library_exists( c madvise "" HAVE_MADVISE )
++check_library_exists( c fadvise "" HAVE_FADVISE )
++check_cxx_source_compiles( "
++ #include <sys/types.h>
++ #include <sys/mman.h>
++ int main() { ::madvise((char*)0,0, MADV_SEQUENTIAL); return 0; }"
++ HAVE_MADVISE_PROTOTYPE )
++if( NOT HAVE_MADVISE_PROTOTYPE )
++ set( NEED_MADVISE_PROTOTYPE 1 )
++endif( NOT HAVE_MADVISE_PROTOTYPE )
++
++
++check_include_file( "getopt.h" HAVE_GETOPT_H )
++check_library_exists( c getopt_long "" HAVE_GNU_GETOPT )
++check_include_file( "stdint.h" HAVE_STDINT_H )
++if( NOT HAVE_STDINT_H )
++ check_include_file( "inttypes.h" HAVE_INTTYPES_H )
++endif( NOT HAVE_STDINT_H )
++check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )
++
++
++##### check alsa support ########################
++
++if( WITH_ALSA_SINK )
++
++ pkg_search_module( ALSA alsa>=0.90 )
++
++ if( NOT ALSA_FOUND )
++ tde_message_fatal( "alsa >= 0.90 are required, but not found on your system" )
++ endif( NOT ALSA_FOUND )
++
++endif( WITH_ALSA_SINK )
++
++
++##### check jack support ########################
++
++if( WITH_JACK_SINK )
++
++ pkg_search_module( JACK jack>=0.90 )
++
++ if( NOT JACK_FOUND )
++ tde_message_fatal( "jack >= 0.90 are required, but not found on your system" )
++ endif( NOT JACK_FOUND )
++
++endif( WITH_JACK_SINK )
++
++
++##### check oss support #########################
++
++if( WITH_OSS_SINK )
++
++ check_include_file( "soundcard.h" HAVE_SOUNDCARD_H )
++ if( NOT HAVE_SOUNDCARD_H )
++ check_include_file( "sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
++ if( NOT HAVE_SYS_SOUNDCARD_H )
++ tde_message_fatal( "soundcard.h are required, but not found on your system" )
++ endif( NOT HAVE_SYS_SOUNDCARD_H )
++ endif( NOT HAVE_SOUNDCARD_H )
++
++ check_library_exists( ossaudio _oss_ioctl "" HAVE_OSSAUDIO )
++ if( HAVE_OSSAUDIO )
++ set( OSSAUDIO_LIBRARIES "-lossaudio" )
++ endif( HAVE_OSSAUDIO )
++
++endif( WITH_OSS_SINK )
++
++
++##### check polyp support #######################
++
++if( WITH_POLYP_SINK )
++
++ pkg_search_module( POLYP polyplib-simple>=0.70 )
++
++ if( NOT POLYP_FOUND )
++ tde_message_fatal( "polyplib-simple >= 0.70 are required, but not found on your system" )
++ endif( NOT POLYP_FOUND )
++
++endif( WITH_POLYP_SINK )
++
++
++##### check sun support #########################
++
++if( WITH_SUN_SINK )
++
++ check_include_file( "sys/audioio.h" HAVE_AUDIOIO_H )
++ if( NOT HAVE_AUDIOIO_H )
++ tde_message_fatal( "sun audioio are required, but not found on your system" )
++ endif( NOT HAVE_AUDIOIO_H )
++
++endif( WITH_SUN_SINK )
++
++
++##### check ffmpeg support ######################
++
++if( WITH_FFMPEG_DECODER )
++
++ pkg_search_module( AVFORMAT libavformat>=50 )
++ if( NOT AVFORMAT_FOUND )
++ tde_message_fatal( "libavformat >= 50 are required, but not found on your system" )
++ endif( NOT AVFORMAT_FOUND )
++
++ pkg_search_module( AVCODEC libavcodec>=50 )
++ if( NOT AVCODEC_FOUND )
++ tde_message_fatal( "libavcodec >= 50 are required, but not found on your system" )
++ endif( NOT AVCODEC_FOUND )
++
++ set( HAVE_FFMPEG 1 )
++
++endif( WITH_FFMPEG_DECODER )
++
++
++##### check mad support #########################
++
++if( WITH_MPEG_DECODER )
++
++ pkg_search_module( MAD mad )
++
++ if( NOT MAD_FOUND )
++ find_library( MAD_LIBRARIES NAMES mad )
++ find_path( MAD_INCLUDE_DIRS mad.h )
++ if( NOT MAD_LIBRARIES )
++ tde_message_fatal( "mad are required, but not found on your system" )
++ endif( NOT MAD_LIBRARIES )
++ endif( NOT MAD_FOUND )
++
++endif( WITH_MPEG_DECODER )
++
++
++##### check FLAC support ########################
++
++if( WITH_XIPH_DECODER )
++
++ # check for FLAC module
++ pkg_search_module( FLAC flac>=1.1.3 )
++ if( FLAC_FOUND )
++ set( HAVE_LIBFLAC113 1 )
++ else( FLAC_FOUND )
++ # check for FLAC 1.1.3
++ check_include_file( "FLAC/metadata.h" HAVE_FLAC113_H )
++ if( HAVE_FLAC113_H )
++ tde_save_and_set( CMAKE_REQUIRED_LIBRARIES ogg )
++ check_library_exists( FLAC FLAC__stream_decoder_seek_absolute "" HAVE_LIBFLAC113 )
++ tde_restore( CMAKE_REQUIRED_LIBRARIES )
++ if( HAVE_LIBFLAC113 )
++ set( FLAC_LIBRARIES "-lFLAC -logg" )
++ endif( HAVE_LIBFLAC113 )
++ endif( HAVE_FLAC113_H )
++
++ # check for FLAC 1.1.1 or 1.1.2
++ if( NOT HAVE_LIBFLAC113 )
++ check_include_file( "FLAC/seekable_stream_decoder.h" HAVE_FLAC_H )
++ if( HAVE_FLAC_H )
++ check_library_exists( FLAC FLAC__seekable_stream_decoder_process_single "" HAVE_LIBFLAC )
++ if( HAVE_LIBFLAC )
++ set( FLAC_LIBRARIES "-lFLAC" )
++ endif( HAVE_LIBFLAC )
++ endif( HAVE_FLAC_H )
++
++ check_include_file( "OggFLAC/seekable_stream_decoder.h" HAVE_OGGFLAC_H )
++ if( HAVE_OGGFLAC_H )
++ tde_save_and_set( CMAKE_REQUIRED_LIBRARIES m OggFLAC FLAC )
++ check_library_exits( OggFLAC OggFLAC__seekable_stream_decoder_process_single "" HAVE_LIBOGGFLAC )
++ tde_restore( CMAKE_REQUIRED_LIBRARIES )
++ if( HAVE_LIBOGGFLAC )
++ set( OGGFLAC_LIBRARIES "-lOggFLAC" )
++ endif( HAVE_LIBFLAC )
++ endif( HAVE_OGGFLAC_H )
++ endif( NOT HAVE_LIBFLAC113 )
++ endif( FLAC_FOUND )
++
++ if( NOT FLAC_LIBRARIES )
++ tde_message_fatal( "FLAC >= 1.1.1 are required, but not found on your system" )
++ endif( NOT FLAC_LIBRARIES )
++
++endif( WITH_XIPH_DECODER )
++
++
++##### check speex support #######################
++
++if( WITH_XIPH_DECODER )
++
++ # check for speex module
++ pkg_search_module( SPEEX speex>=1.2 )
++ if( NOT SPEEX_FOUND )
++ # check for speex >= 1.1
++ pkg_search_module( SPEEX speex>=1.1 )
++ if( SPEEX_FOUND )
++ set( HAVE_SPEEX11 1 )
++ check_library_exits( speex speex_decode_int "" HAVE_SPEEX_DECODE_INT )
++ if( NOT HAVE_SPEEX_DECODE_INT )
++ set( BROKEN_SPEEX11 1 )
++ endif( )
++ else( )
++ pkg_search_module( SPEEX speex )
++ endif( )
++
++ endif( )
++
++ if( SPEEX_FOUND )
++ set( HAVE_SPEEX 1 )
++ if( NOT EXISTS ${SPEEX_INCLUDEDIR}/speex.h )
++ find_path( SPEEX_EXTRA_INCLUDEDIR "speex.h" ${SPEEX_INCLUDEDIR}/speex )
++ if( NOT SPEEX_EXTRA_INCLUDEDIR )
++ tde_message_fatal( "speex are required, but header not found on your system" )
++ endif( NOT SPEEX_EXTRA_INCLUDEDIR )
++ list( APPEND SPEEX_INCLUDE_DIRS "${SPEEX_EXTRA_INCLUDEDIR}" )
++ endif( NOT EXISTS ${SPEEX_INCLUDEDIR}/speex.h )
++ else( SPEEX_FOUND )
++ tde_message_fatal( "speex are required, but not found on your system" )
++ endif( SPEEX_FOUND )
++
++endif( WITH_XIPH_DECODER )
++
++
++##### check ogg/vorbis support ##################
++
++if( WITH_XIPH_DECODER )
++
++ pkg_search_module( VORBIS vorbis )
++ if( NOT VORBIS_FOUND )
++ tde_message_fatal( "ogg/vorbis are required, but not found on your system" )
++ endif( NOT VORBIS_FOUND )
++
++ pkg_search_module( VORBISFILE vorbisfile )
++ if( NOT VORBISFILE_FOUND )
++ tde_message_fatal( "ogg/vorbisfile are required, but not found on your system" )
++ endif( NOT VORBISFILE_FOUND )
++
++ set( HAVE_OGG_VORBIS 1 )
++
++endif( WITH_XIPH_DECODER )
++
++
++##### check samplerate support ##################
++
++if( WITH_SRC_RESAMPLER )
++
++ pkg_search_module( SAMPLERATE samplerate )
++
++ if( NOT SAMPLERATE_FOUND )
++ find_library( SAMPLERATE_LIBRARIES NAMES samplerate )
++ find_path( SAMPLERATE_INCLUDE_DIRS samplerate.h )
++ if( NOT SAMPLERATE_LIBRARIES )
++ tde_message_fatal( "samplerate are required, but not found on your system" )
++ endif( NOT SAMPLERATE_LIBRARIES )
++ endif( NOT SAMPLERATE_FOUND )
++
++endif( WITH_SRC_RESAMPLER )
++