Ticket #46575: charm-1.8.0.patch

File charm-1.8.0.patch, 11.9 KB (added by RJVB (René Bertin), 10 years ago)
Line 
1Index: Portfile
2===================================================================
3diff --git a/trunk/dports/aqua/charm/Portfile b/trunk/dports/aqua/charm/Portfile
4new file mode 10644
5--- /dev/null   (revision 0)
6+++ b/trunk/dports/aqua/charm/Portfile  (working copy)
7@@ -0,0 +1,56 @@
8+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
9+# $Id$
10+
11+PortSystem          1.0
12+PortGroup           github 1.0
13+
14+fetch.type          git
15+github.setup        KDAB Charm ad76bf18
16+
17+name                charm
18+version             1.8.0
19+categories          qt
20+maintainers         gmail.com:rjvbertin
21+license             GPL-2+ LGPL-2.1+
22+description         Charm - the Cross-Platform Time Tracker
23+long_description    Charm is a program for OS X, Linux and Windows that helps to keep track of time. It is built around two major ideas - tasks and events. Tasks are the things time is spend on, repeatedly. For example, ironing laundry is a task. The laundry done for two hours on last Tuesday is an event in that task. When doing laundry multiple times, the events will be accumulated, and can later be printed in activity reports or weekly time sheets. So in case laundry would be done for three hours on Wednesday again, the activity report for the "Ironing Laundry" task would list the event on tuesday, the event on wednesday and a total of five hours.
24+platforms           darwin
25+homepage            https://github.com/KDAB/Charm
26+
27+subport qt5-${name} {
28+    PortGroup       qt5 1.0
29+    PortGroup       cmake 1.0
30+    conflicts       ${name}
31+    configure.args-append   -DCharm_VERSION=1.8.0 -DWITH_QT4:BOOL=OFF
32+}
33+
34+if {${subport} ne "qt5-${name}"} {
35+    PortGroup       qt4 1.0
36+    PortGroup       cmake 1.0
37+    conflicts       "qt5-${name}"
38+    depends_build-append  port:automoc
39+    configure.args-append   -DCharm_VERSION=1.8.0 -DWITH_QT4:BOOL=ON -DBIN_INSTALL_DIR:PATH=${qt_apps_dir}
40+}
41+configure.args-append   -DBIN_INSTALL_DIR:PATH=${qt_apps_dir}
42+
43+patchfiles          patch-CMakeFiles.patch \
44+                    adapt-to-osx-macports.patch
45+
46+post-extract            { file mkdir ${workpath}/build }
47+# standard post-arg, where to find the primary CMakeLists.txt file.
48+default configure.post_args {../${worksrcdir}}
49+default configure.dir       {${workpath}/build}
50+default build.dir           {${workpath}/build}
51+
52+post-destroot {
53+    xinstall -m 775 -d ${destroot}${prefix}/bin
54+    ln -s ${qt_apps_dir}/Charm.app/Contents/MacOS/Charm ${destroot}${prefix}/bin/charmtimetracker
55+}
56+
57
58Property changes on: trunk/dports/aqua/charm/Portfile
59___________________________________________________________________
60Added: svn:eol-style
61## -0,0 +1 ##
62+native
63\ No newline at end of property
64Added: svn:keywords
65## -0,0 +1 ##
66+Id
67\ No newline at end of property
68Index: files/adapt-to-osx-macports.patch
69===================================================================
70diff --git a/trunk/dports/aqua/charm/files/adapt-to-osx-macports.patch b/trunk/dports/aqua/charm/files/adapt-to-osx-macports.patch
71new file mode 10644
72--- /dev/null   (revision 0)
73+++ b/trunk/dports/aqua/charm/files/adapt-to-osx-macports.patch (working copy)
74@@ -0,0 +1,124 @@
75+diff --git Charm/ApplicationCore.cpp Charm/ApplicationCore.cpp
76+index 17cd0fe..964d098 100644
77+--- Charm/ApplicationCore.cpp
78++++ Charm/ApplicationCore.cpp
79+@@ -158,10 +158,12 @@ ApplicationCore::ApplicationCore( QObject* parent )
80+              SLOT( slotQuitApplication() ) );
81+
82+     m_actionAboutDialog.setText( tr( "About Charm" ) );
83++    m_actionAboutDialog.setMenuRole(QAction::AboutRole);
84+     connect( &m_actionAboutDialog, SIGNAL( triggered() ),
85+              &mainView(),  SLOT( slotAboutDialog() ) );
86+
87+     m_actionPreferences.setText( tr( "Preferences" ) );
88++    m_actionPreferences.setMenuRole(QAction::PreferencesRole);
89+     m_actionPreferences.setIcon( Data::configureIcon() );
90+     connect( &m_actionPreferences, SIGNAL( triggered( bool ) ),
91+              &mainView(),  SLOT( slotEditPreferences( bool ) ) );
92+@@ -260,7 +262,7 @@ void ApplicationCore::createWindowMenu( QMenuBar *menuBar )
93+     menu->addAction( &m_actionActivityReport );
94+     menu->addAction( &m_actionWeeklyTimesheetReport );
95+     menu->addAction( &m_actionMonthlyTimesheetReport );
96+-#ifndef Q_OS_OSX
97++#if !defined(Q_OS_OSX) && !defined(Q_OS_MAC)
98+     menu->addSeparator();
99+ #endif
100+     menu->addAction( &m_actionPreferences );
101+@@ -277,7 +279,7 @@ void ApplicationCore::createFileMenu( QMenuBar *menuBar )
102+     menu->addAction( &m_actionSyncTasks );
103+     menu->addAction( &m_actionImportTasks );
104+     menu->addAction( &m_actionExportTasks );
105+-#ifndef Q_OS_OSX
106++#if !defined(Q_OS_OSX) && !defined(Q_OS_MAC)
107+     menu->addSeparator();
108+ #endif
109+     menu->addAction( &m_actionQuit );
110+diff --git Charm/Charm.cpp Charm/Charm.cpp
111+index 4872e3a..951ba5a 100644
112+--- Charm/Charm.cpp
113++++ Charm/Charm.cpp
114+@@ -13,9 +13,10 @@
115+
116+ static ApplicationCore* createApplicationCore()
117+ {
118+-#ifdef Q_OS_OSX
119+-    return new MacApplicationCore;
120+-#endif
121++// #if defined(Q_OS_OSX) || defined(Q_OS_MAC)
122++//     // this seems to disable (menu) shortcuts...
123++//     return new MacApplicationCore;
124++// #endif
125+     return new ApplicationCore;
126+ }
127+
128+@@ -46,6 +47,9 @@ int main ( int argc, char** argv )
129+
130+     try {
131+         QApplication app( argc, argv );
132++#if defined(Q_OS_MAC) || defined(Q_OS_OSX)
133++        app.setAttribute(Qt::AA_DontShowIconsInMenus);
134++#endif
135+         QScopedPointer<ApplicationCore> core( createApplicationCore() );
136+         QObject::connect( &app, SIGNAL(commitDataRequest(QSessionManager&)), core.data(), SLOT(commitData(QSessionManager&)) );
137+         QObject::connect( &app, SIGNAL(saveStateRequest(QSessionManager&)), core.data(), SLOT(saveState(QSessionManager&)) );
138+diff --git Charm/Data.cpp Charm/Data.cpp
139+index ad8abfa..a7778b1 100644
140+--- Charm/Data.cpp
141++++ Charm/Data.cpp
142+@@ -18,7 +18,7 @@ const QIcon& Data::charmTrayIcon()
143+     // On X11: pure-Qt apps get 22x22 from QSystemTrayIcon.
144+     // KDE apps seem to get 24x24 in KSystemTrayIcon via KIconLoader, which is actually better.
145+
146+-#ifdef Q_OS_OSX
147++#if !defined(Q_OS_OSX) && !defined(Q_OS_MAC)
148+     static const QString iconPath = QLatin1String(":/Charm/charmtray_mac.png");
149+ #else
150+     static const QString iconPath = QLatin1String(":/Charm/charmtray22.png");
151+@@ -37,7 +37,7 @@ const QIcon& Data::charmTrayActiveIcon()
152+     // On X11: pure-Qt apps get 22x22 from QSystemTrayIcon.
153+     // KDE apps seem to get 24x24 in KSystemTrayIcon via KIconLoader, which is actually better.
154+
155+-#ifdef Q_OS_OSX
156++#if !defined(Q_OS_OSX) && !defined(Q_OS_MAC)
157+     static const QString iconPath = QLatin1String(":/Charm/charmtrayactive_mac.png");
158+ #else
159+     static const QString iconPath = QLatin1String(":/Charm/charmtrayactive22.png");
160+diff --git Charm/Idle/IdleDetector.cpp Charm/Idle/IdleDetector.cpp
161+index 131e76e..47c575c 100644
162+--- Charm/Idle/IdleDetector.cpp
163++++ Charm/Idle/IdleDetector.cpp
164+@@ -20,7 +20,7 @@ IdleDetector::IdleDetector( QObject* parent )
165+ IdleDetector* IdleDetector::createIdleDetector( QObject* parent )
166+ {
167+ #ifdef CHARM_IDLE_DETECTION
168+-#ifdef Q_OS_OSX
169++#if defined(Q_OS_OSX) || defined(Q_OS_MAC)
170+     return new MacIdleDetector( parent );
171+ #endif
172+
173+diff --git Charm/Widgets/CharmWindow.cpp Charm/Widgets/CharmWindow.cpp
174+index 375aedc..8bd7657 100644
175+--- Charm/Widgets/CharmWindow.cpp
176++++ Charm/Widgets/CharmWindow.cpp
177+@@ -85,7 +85,7 @@ void CharmWindow::setWindowNumber( int number )
178+     delete m_shortcut;
179+     m_shortcut = new QShortcut( this );
180+     QKeySequence sequence( tr( "Ctrl+%1" ).arg( number ) );
181+-#ifdef Q_OS_OSX
182++#if !defined(Q_OS_OSX) && !defined(Q_OS_MAC)
183+     m_shortcut->setKey( sequence );
184+ #endif
185+     m_shortcut->setContext( Qt::ApplicationShortcut );
186+diff --git Charm/Widgets/EventView.cpp Charm/Widgets/EventView.cpp
187+index 2fb9ef4..2eae8aa 100644
188+--- Charm/Widgets/EventView.cpp
189++++ Charm/Widgets/EventView.cpp
190+@@ -96,7 +96,7 @@ EventView::EventView( QToolBar* toolBar, QWidget* parent )
191+     m_actionDeleteEvent.setText( tr( "Delete Event..." ) );
192+     QList<QKeySequence> deleteShortcuts;
193+     deleteShortcuts << QKeySequence::Delete;
194+-#ifdef Q_OS_OSX
195++#if !defined(Q_OS_OSX) && !defined(Q_OS_MAC)
196+     deleteShortcuts << Qt::Key_Backspace;
197+ #endif
198+     m_actionDeleteEvent.setShortcuts(deleteShortcuts);
199Index: files/patch-CMakeFiles.patch
200===================================================================
201diff --git a/trunk/dports/aqua/charm/files/patch-CMakeFiles.patch b/trunk/dports/aqua/charm/files/patch-CMakeFiles.patch
202new file mode 10644
203--- /dev/null   (revision 0)
204+++ b/trunk/dports/aqua/charm/files/patch-CMakeFiles.patch      (working copy)
205@@ -0,0 +1,100 @@
206+diff --git CMakeLists.txt CMakeLists.txt
207+index 4e735a1..55f78bc 100644
208+--- CMakeLists.txt
209++++ CMakeLists.txt
210+@@ -38,8 +38,10 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.6.0 )
211+ SET( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" )
212+ SET( CMAKE_AUTOMOC ON )
213+
214+-# try Qt5 first, and prefer that if found
215+-find_package(Qt5Core QUIET)
216++if(NOT WITH_QT4)
217++    # try Qt5 first, and prefer that if found
218++    find_package(Qt5Core QUIET)
219++endif()
220+ IF (Qt5Core_FOUND)
221+     find_package(Qt5Widgets REQUIRED)
222+     find_package(Qt5Xml REQUIRED)
223+@@ -61,11 +63,11 @@ IF (Qt5Core_FOUND)
224+         SET(QT_PLATFORM_SPECIFIC_LIBRARIES)
225+     ENDIF()
226+
227+-    IF(APPLE)
228++#     IF(APPLE)
229+         find_package(Qt5MacExtras REQUIRED)
230+         include_directories(${Qt5MacExtras_INCLUDE_DIRS})
231+         set(QT_PLATFORM_SPECIFIC_LIBRARIES ${Qt5MacExtras_LIBRARIES})
232+-    ENDIF()
233++#     ENDIF()
234+
235+     IF(NOT APPLE)
236+         find_package(Qt5DBus)
237+@@ -124,7 +126,7 @@ ELSE()
238+
239+     SET(CHARM_MAC_HIGHRES_SUPPORT_ENABLED OFF)
240+
241+-    IF(UNIX AND NOT APPLE)
242++    IF(UNIX) # AND NOT APPLE)
243+         find_package(Qt4 COMPONENTS QtDBus)
244+         IF (QT_QTDBUS_FOUND)
245+             set(HAVE_DBUS ON)
246+@@ -197,8 +199,10 @@ IF( UNIX AND NOT APPLE )
247+     SET( DOC_INSTALL_DIR share/doc/${Charm_EXECUTABLE} )
248+ ELSE()
249+     set( Charm_EXECUTABLE Charm )
250+-    SET( BIN_INSTALL_DIR . )
251+-    SET( DOC_INSTALL_DIR . )
252++    if(NOT BIN_INSTALL_DIR)
253++        SET( BIN_INSTALL_DIR . )
254++    endif()
255++    SET( DOC_INSTALL_DIR share/doc/${Charm_EXECUTABLE} )
256+ ENDIF()
257+ SET( ICONS_DIR "${CMAKE_SOURCE_DIR}/Charm/Icons" )
258+
259+@@ -223,9 +227,9 @@ CONFIGURE_FILE( CharmCMake.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/CharmCMake.h )
260+
261+ SET( LICENSE_FILE "License.txt" )
262+ SET( README_FILE "ReadMe.txt" )
263+-IF( NOT APPLE )
264++#IF( NOT APPLE )
265+     INSTALL( FILES "${LICENSE_FILE}" "${README_FILE}" DESTINATION ${DOC_INSTALL_DIR} )
266+-ENDIF()
267++#ENDIF()
268+
269+     # Only support CPack packaging on newer versions of CMake.
270+ IF( NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.4" )
271+@@ -252,7 +256,7 @@ IF( NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.4" )
272+             "${README_FILE}" "Readme"
273+         )
274+         SET( CPACK_NSIS_MUI_FINISHPAGE_RUN "${CPACK_NSIS_INSTALLED_ICON_NAME}" )
275+-    ELSEIF( APPLE )
276++    ELSEIF( APPLENATIVE )
277+         SET( CPACK_GENERATOR "DragNDrop" )
278+         SET( CPACK_DMG_FORMAT "UDBZ" )
279+         SET( CPACK_DMG_VOLUME_NAME "Charm" )
280+diff --git Charm/CMakeLists.txt Charm/CMakeLists.txt
281+index e11bae3..a9faff9 100644
282+--- Charm/CMakeLists.txt
283++++ Charm/CMakeLists.txt
284+@@ -180,7 +180,7 @@ IF( WIN32 )
285+ ENDIF()
286+ MESSAGE( STATUS "Charm will be installed to ${CMAKE_INSTALL_PREFIX}" )
287+
288+-IF( UNIX AND NOT APPLE )
289++IF( UNIX) # AND NOT APPLE )
290+     SET( XDG_APPS_INSTALL_DIR share/applications )
291+     INSTALL( FILES charmtimetracker.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
292+     INSTALL( FILES Icons/Charm-128x128.png DESTINATION share/icons/hicolor/128x128/apps )
293+@@ -217,8 +217,8 @@ IF( NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.4" )
294+                  DESTINATION ${BIN_INSTALL_DIR} )
295+     ENDIF()
296+
297+-    IF( APPLE OR WIN32 )
298+-        INCLUDE( DeployQt4 )
299+-        INSTALL_QT4_EXECUTABLE( "${EXECUTABLE}" "qsqlite" )
300+-    ENDIF()
301++#     IF( APPLE OR WIN32 )
302++#         INCLUDE( DeployQt4 )
303++#         INSTALL_QT4_EXECUTABLE( "${EXECUTABLE}" "qsqlite" )
304++#     ENDIF()
305+ ENDIF()