File tomahawk-0.7.0-build-portfwd-statically-and-rename-libtomahawklib-to-libtomahawk.diff of Package tomahawk

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95d0e6f..0672c18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -320,7 +320,7 @@ endif()
 # Add all targets to the build-tree export set
 set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Tomahawk" CACHE PATH  "Installation directory for CMake files")
 set(CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}")
-export(TARGETS tomahawklib tomahawk_portfwd
+export(TARGETS tomahawklib
   FILE "${PROJECT_BINARY_DIR}/TomahawkLibraryDepends.cmake")
 
 # Export the package for use from the build-tree
diff --git a/CMakeModules/NSIS.template.in b/CMakeModules/NSIS.template.in
index 0390d4f..934d7c3 100644
--- a/CMakeModules/NSIS.template.in
+++ b/CMakeModules/NSIS.template.in
@@ -276,8 +276,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
         File "${INSTALL_PATH}\bin\tomahawk_crash_reporter.exe"
         File "${INSTALL_PATH}\bin\libtomahawk_breakpad.dll"
 
-        File "${INSTALL_PATH}\bin\libtomahawk_portfwd.dll"
-        File "${INSTALL_PATH}\bin\libtomahawklib.dll"
+        File "${INSTALL_PATH}\bin\libtomahawk.dll"
         ; plugins
         File "${INSTALL_PATH}\lib\libtomahawk_*_*.dll"
    !endif
@@ -288,8 +287,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
         File "${BUILD_PATH}\tomahawk_crash_reporter.exe"
         File "${BUILD_PATH}\libtomahawk_breakpad.dll"
 
-        File "${BUILD_PATH}\libtomahawklib.dll"
-        File "${BUILD_PATH}\libtomahawk_portfwd.dll"
+        File "${BUILD_PATH}\libtomahawk.dll"
         ; plugins
         File "${BUILD_PATH}\libtomahawk_*_*.dll"
    !endif
diff --git a/src/AclRegistryImpl.h b/src/AclRegistryImpl.h
index 85b617b..96b8082 100644
--- a/src/AclRegistryImpl.h
+++ b/src/AclRegistryImpl.h
@@ -22,7 +22,6 @@
 
 #include "AclRegistry.h"
 #include "HeadlessCheck.h"
-#include "DllMacro.h"
 
 #include <QObject>
 #include <QString>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6ca16f8..5ae0c86 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -167,18 +167,15 @@ qt_add_resources( RC_SRCS "../resources.qrc" )
 
 SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMoc} ${tomahawkSources} ${RC_SRCS} )
 
-IF( UNIX AND NOT APPLE )
-    ADD_EXECUTABLE( tomahawk ${final_src} )
-ENDIF( UNIX AND NOT APPLE )
-IF( APPLE )
-    ADD_EXECUTABLE( tomahawk MACOSX_BUNDLE ${final_src} )
-    SET_TARGET_PROPERTIES(tomahawk PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/Info.plist")
-ENDIF( APPLE )
-IF( WIN32 )
-    ADD_EXECUTABLE( tomahawk WIN32 ${final_src} )
-ENDIF( WIN32 )
 
-SET_TARGET_PROPERTIES(tomahawk PROPERTIES AUTOMOC TRUE)
+ADD_EXECUTABLE( tomahawk WIN32 MACOSX_BUNDLE ${final_src} )
+SET_TARGET_PROPERTIES(tomahawk
+    PROPERTIES
+        AUTOMOC TRUE
+        MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/Info.plist"
+)
+
+
 qt5_use_modules(tomahawk Core Widgets Network Sql WebKitWidgets)
 
 MESSAGE( STATUS "OS_SPECIFIC_LINK_LIBRARIES: ${OS_SPECIFIC_LINK_LIBRARIES}" )
diff --git a/src/ConfigDelegateBase.h b/src/ConfigDelegateBase.h
index 1a2587e..f530656 100644
--- a/src/ConfigDelegateBase.h
+++ b/src/ConfigDelegateBase.h
@@ -19,14 +19,12 @@
 #ifndef CONFIGDELEGATEBASE_H
 #define CONFIGDELEGATEBASE_H
 
-#include "DllMacro.h"
-
 #include <QStyledItemDelegate>
 
 #define PADDING 4
 
 class QPainter;
-class Q_DECL_EXPORT ConfigDelegateBase : public QStyledItemDelegate
+class ConfigDelegateBase : public QStyledItemDelegate
 {
     Q_OBJECT
 public:
diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt
index 28a2798..c162d90 100644
--- a/src/libtomahawk/CMakeLists.txt
+++ b/src/libtomahawk/CMakeLists.txt
@@ -6,6 +6,7 @@ add_definitions( ${QT_DEFINITIONS} )
 add_definitions( -DQT_SHARED )
 add_definitions( -DDLLEXPORT_PRO )
 add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS )
+add_definitions( -DPORTFWDDLLEXPORT_STATIC )
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Config.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -459,6 +460,7 @@ set_target_properties(
             AUTOMOC TRUE
             VERSION ${TOMAHAWK_VERSION_SHORT}
             SOVERSION ${TOMAHAWK_VERSION_SHORT}
+            OUTPUT_NAME "tomahawk"
 )
 
 
@@ -473,9 +475,11 @@ IF( UNIX AND NOT APPLE )
 ENDIF( UNIX AND NOT APPLE )
 
 TARGET_LINK_LIBRARIES( tomahawklib
+    LINK_PRIVATE
     # Thirdparty shipped with tomahawk
     ${LIBPORTFWD_LIBRARIES}
 
+    LINK_PUBLIC
     # External deps
     ${QJSON_LIBRARIES}
     ${PHONON_LIBS}
diff --git a/thirdparty/libportfwd/CMakeLists.txt b/thirdparty/libportfwd/CMakeLists.txt
index 1025241..909b1da 100644
--- a/thirdparty/libportfwd/CMakeLists.txt
+++ b/thirdparty/libportfwd/CMakeLists.txt
@@ -8,19 +8,19 @@ SET(NATPMP_DIR      "third-party/libnatpmp-20100808")
 
 ADD_DEFINITIONS(-Wall -O2 -DNDEBUG)
 IF(WIN32)
-	ADD_DEFINITIONS(-DWIN32 -DMINIUPNP_EXPORTS )
+	ADD_DEFINITIONS(-DWIN32 )
 ELSE()
 	ADD_DEFINITIONS(-fPIC)
 ENDIF()
 INCLUDE_DIRECTORIES( ${MINIUPNP_DIR} include ${QT_INCLUDES} )
 SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} )
 
-ADD_DEFINITIONS( -DPORTFWDDLLEXPORT_PRO )
+ADD_DEFINITIONS( -DPORTFWDDLLEXPORT_STATIC -DSTATICLIB )
 if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
   ADD_DEFINITIONS( -DMACOSX -D_DARWIN_C_SOURCE )
 endif ()
 
-ADD_LIBRARY(tomahawk_portfwd SHARED
+ADD_LIBRARY(tomahawk_portfwd STATIC
         # the needed bits of miniupnpc (no python module, no tests, no cli)
         ${MINIUPNP_DIR}/connecthostport.c
         ${MINIUPNP_DIR}/igd_desc_parse.c
@@ -46,14 +46,6 @@ IF(WIN32)
 	TARGET_LINK_LIBRARIES( tomahawk_portfwd "ws2_32.dll" "iphlpapi.a" )
 ENDIF()
 
-INSTALL( TARGETS tomahawk_portfwd
-    EXPORT TomahawkLibraryDepends
-    RUNTIME DESTINATION bin
-    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-    BUNDLE DESTINATION library
-)
-
 #INSTALL(FILES include/portfwd/portfwddllmacro.h include/portfwd/portfwd.h DESTINATION include/portfwd)
 
 #ADD_EXECUTABLE(portfwd-demo
diff --git a/thirdparty/libportfwd/include/portfwd/portfwddllmacro.h b/thirdparty/libportfwd/include/portfwd/portfwddllmacro.h
index 7faddc3..c74702b 100644
--- a/thirdparty/libportfwd/include/portfwd/portfwddllmacro.h
+++ b/thirdparty/libportfwd/include/portfwd/portfwddllmacro.h
@@ -21,12 +21,16 @@
 
 #include <QtCore/qglobal.h>
 
-#ifndef PORTFWDDLLEXPORT
-# if defined (PORTFWDDLLEXPORT_PRO)
-#  define PORTFWDDLLEXPORT Q_DECL_EXPORT
+# if defined (PORTFWDDLLEXPORT_STATIC)
+#   define PORTFWDDLLEXPORT
 # else
-#  define PORTFWDDLLEXPORT Q_DECL_IMPORT
+#   ifndef PORTFWDDLLEXPORT
+#       if defined (PORTFWDDLLEXPORT_PRO)
+#           define PORTFWDDLLEXPORT Q_DECL_EXPORT
+#       else
+#           define PORTFWDDLLEXPORT Q_DECL_IMPORT
+#       endif
+#   endif
 # endif
-#endif
 
 #endif
\ No newline at end of file