Gentoo Archives: gentoo-commits

From: Andrey Grozin <grozin@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/coolreader/files/, app-text/coolreader/
Date: Wed, 30 Aug 2017 16:24:54
Message-Id: 1504110248.8a74b3274e79e045e12caccfe75b300f51bf0b7c.grozin@gentoo
1 commit: 8a74b3274e79e045e12caccfe75b300f51bf0b7c
2 Author: Andrey Grozin <grozin <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 30 16:24:08 2017 +0000
4 Commit: Andrey Grozin <grozin <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 30 16:24:08 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a74b327
7
8 app-text/coolreader: initial import
9 ebuild by Sergey Torokhov <torokhov_s_a <AT> mail.ru>
10 Bug: 269110
11 Package-Manager: Portage-2.3.6, Repoman-2.3.3
12
13 app-text/coolreader/Manifest | 1 +
14 app-text/coolreader/coolreader-3.1.2.71.ebuild | 87 +++++++++++++++++++
15 .../coolreader/files/cr3.1.2.71-r1_qt5_wx.diff | 94 ++++++++++++++++++++
16 app-text/coolreader/files/cr3.1.2.71_wxGTK3.diff | 99 ++++++++++++++++++++++
17 app-text/coolreader/files/cr3ini.diff | 35 ++++++++
18 app-text/coolreader/metadata.xml | 14 +++
19 6 files changed, 330 insertions(+)
20
21 diff --git a/app-text/coolreader/Manifest b/app-text/coolreader/Manifest
22 new file mode 100644
23 index 00000000000..fd45bc5155f
24 --- /dev/null
25 +++ b/app-text/coolreader/Manifest
26 @@ -0,0 +1 @@
27 +DIST coolreader-3.1.2.71.tar.bz2 10141514 SHA256 746345984be549284713a450686f0c8b04f1485f9a28bedc457940ea1b52f7d1 SHA512 2859eabfc8ba603d1cb09b07358887135b6968268a5f2fa7f874a1e8613d1b5ebe69d9b133f16e84321d1a460eae5088a7947433c6fb340a47bde9ceee415735 WHIRLPOOL b8a8bb58c811592577dc4e1b9b1ae0ed0a3dd92e277b1501962d2c7683c0969b49f71fa147c445f7985cf82bea6431a818915bdf2387f48831fab70defdf42c7
28
29 diff --git a/app-text/coolreader/coolreader-3.1.2.71.ebuild b/app-text/coolreader/coolreader-3.1.2.71.ebuild
30 new file mode 100644
31 index 00000000000..6f89f96cfcc
32 --- /dev/null
33 +++ b/app-text/coolreader/coolreader-3.1.2.71.ebuild
34 @@ -0,0 +1,87 @@
35 +# Copyright 1999-2017 Gentoo Foundation
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=6
39 +
40 +inherit cmake-utils
41 +
42 +if [ "${PV}" == 9999 ]
43 +then
44 + inherit git
45 + EGIT_REPO_URI="git://crengine.git.sourceforge.net/gitroot/crengine/crengine"
46 + SRC_URI=""
47 +else
48 + # git tag cr3.1.2-71
49 + SRC_URI="https://dev.gentoo.org/~grozin/${P}.tar.bz2"
50 +fi
51 +
52 +DESCRIPTION="CoolReader - reader of eBook files (fb2,epub,htm,rtf,txt)"
53 +HOMEPAGE="https://sourceforge.net/projects/crengine/"
54 +
55 +LICENSE="GPL-2"
56 +SLOT="0"
57 +KEYWORDS="~amd64 ~x86"
58 +IUSE="qt4 qt5 wxwidgets"
59 +REQUIRED_USE="^^ ( qt4 qt5 wxwidgets )"
60 +
61 +DEPEND="sys-libs/zlib
62 + media-libs/libpng
63 + virtual/jpeg
64 + media-libs/freetype
65 + wxwidgets? (
66 + >=x11-libs/wxGTK-2.8 )
67 + qt4? ( dev-qt/qtcore:4
68 + dev-qt/qtgui:4 )
69 + qt5? ( dev-qt/qtcore:5
70 + dev-qt/qtgui:5
71 + dev-qt/qtwidgets:5 )
72 + "
73 +RDEPEND="${DEPEND}
74 + media-fonts/corefonts"
75 +
76 +src_prepare() {
77 + # setting patch to save cr3.ini to ~homedir
78 + epatch "${FILESDIR}/cr3ini.diff"
79 + # patch to build QT5 and WX GUI version of coolreader3
80 + # and setting correct vesrion number and years of cr3qt/cr3wx
81 + epatch "${FILESDIR}/cr3.1.2.71-r1_qt5_wx.diff"
82 + if [ $(eselect wxwidgets list | grep '*' | cut -d ' ' -f 6) == "gtk2-unicode-3.0" ]; then
83 + # patch if wxGTK3.0 (not wxGTK2.8) is active eselect profile
84 + epatch "${FILESDIR}/cr3.1.2.71_wxGTK3.diff"
85 + fi
86 + eapply_user
87 +}
88 +
89 +src_configure() {
90 + CMAKE_USE_DIR="${S}"
91 + CMAKE_BUILD_TYPE="Release"
92 + if use qt4; then
93 + local mycmakeargs=(-D GUI=QT)
94 + elif use qt5; then
95 + local mycmakeargs=(-D GUI=QT5)
96 + elif use wxwidgets; then
97 + . "${ROOT}/var/lib/wxwidgets/current"
98 + if [[ "${WXCONFIG}" -eq "none" ]]; then
99 + die "The wxGTK profile should be selected!"
100 + fi
101 + local mycmakeargs=(-D GUI=WX)
102 + fi
103 + cmake-utils_src_configure
104 +}
105 +
106 +src_install() {
107 + cmake-utils_src_install
108 + dosym ../fonts/corefonts /usr/share/crengine/fonts
109 + elog
110 +}
111 +
112 +pkg_postinst() {
113 +if use wxwidgets; then
114 + elog ""
115 + elog "KNOWN ISSUE TO FIX:"
116 + elog "With wxwidgets gui you can see a warning message \"iCCP: known incorrect sRGB profile\""
117 + elog "that appears if \"Toolbar size\" is setting to \"Medium buttons\" in Options."
118 + elog "To avoid appearing of this warning popup window you can change \"Toolbar size\" or set it to \"Hide Toolbar\"."
119 + elog ""
120 +fi
121 +}
122
123 diff --git a/app-text/coolreader/files/cr3.1.2.71-r1_qt5_wx.diff b/app-text/coolreader/files/cr3.1.2.71-r1_qt5_wx.diff
124 new file mode 100644
125 index 00000000000..2acbd4512e0
126 --- /dev/null
127 +++ b/app-text/coolreader/files/cr3.1.2.71-r1_qt5_wx.diff
128 @@ -0,0 +1,94 @@
129 +# Patch that allows to build Coolreader3 with Qt5 or wxWindgets GUI.
130 +# Qt5 build related bug : https://sourceforge.net/p/crengine/bugs/370
131 +# => absence of "-std=c++11 -fPIC" options in ../cr3qt/CMakeLIsts.txt
132 +# and absence of Qt5 libraries in linking library list of ../cr3qt/CMakeLIsts.txt;
133 +# wxWidgets build related bug : https://sourceforge.net/p/crengine/bugs/371
134 +# => absence of "fonconfig" in linking library list of ../cr3wx/CMakeLIsts.txt
135 +# Add chages to years of cr3wx about dialog and merge with cr3qt about dialog patch.
136 +
137 +diff -Naur old/CMakeLists.txt new/CMakeLists.txt
138 +--- old/CMakeLists.txt 2015-07-13 11:23:37.000000000 +0300
139 ++++ new/CMakeLists.txt 2017-08-28 00:34:39.000000000 +0300
140 +@@ -29,7 +29,7 @@
141 + endif()
142 + elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
143 + # Update if necessary
144 +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
145 ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -std=c++11 -fPIC")
146 + endif()
147 +
148 + if (NOT DEFINED GUI)
149 +@@ -323,7 +323,7 @@
150 + message("Will make CR3/WX")
151 + ADD_DEFINITIONS( ${DESKTOP_DEFS} -DCR_WX_SUPPORT=1 )
152 + SET(wxWidgets_USE_LIBS base core )
153 +- FIND_PACKAGE(wxWidgets)
154 ++ FIND_PACKAGE(wxWidgets 2.8)
155 + IF (wxWidgets_FOUND)
156 + INCLUDE(${wxWidgets_USE_FILE})
157 + include_directories( ${wxWidgets_INCLUDE_DIRS} )
158 +diff -Naur old/cr3qt/CMakeLists.txt new/cr3qt/CMakeLists.txt
159 +--- old/cr3qt/CMakeLists.txt 2015-07-13 11:23:37.000000000 +0300
160 ++++ new/cr3qt/CMakeLists.txt 2017-08-26 03:25:55.000000000 +0300
161 +@@ -173,7 +173,11 @@
162 + SET (EXTRA_LIBS ${QT_LIBRARIES} ${STD_LIBS} )
163 + #${QT_LIBRARIES}
164 + ELSEIF (UNIX)
165 +- SET (EXTRA_LIBS ${QT_LIBRARIES} fontconfig ${STD_LIBS} )
166 ++ IF( ${GUI} STREQUAL QT )
167 ++ SET (EXTRA_LIBS ${QT_LIBRARIES} fontconfig ${STD_LIBS} )
168 ++ ELSE()
169 ++ SET (EXTRA_LIBS fontconfig ${STD_LIBS} ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES})
170 ++ ENDIF()
171 + ELSE()
172 + SET (EXTRA_LIBS ${STD_LIBS} ${QT_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} )
173 + ENDIF(MAC)
174 +diff -Naur old/cr3wx/CMakeLists.txt new/cr3wx/CMakeLists.txt
175 +--- old/cr3wx/CMakeLists.txt 2015-07-13 11:23:37.000000000 +0300
176 ++++ new/cr3wx/CMakeLists.txt 2017-08-26 01:22:53.000000000 +0300
177 +@@ -10,7 +10,7 @@
178 + )
179 + LINK_DIRECTORIES(${wxWidgets_LIBRARY_DIRS})
180 + ADD_EXECUTABLE(cr3 ${CR3_SOURCES})
181 +-SET (EXTRA_LIBS ${wxWidgets_LIBRARIES} ${STD_LIBS})
182 ++SET (EXTRA_LIBS ${wxWidgets_LIBRARIES} fontconfig ${STD_LIBS})
183 + TARGET_LINK_LIBRARIES(cr3 crengine tinydict ${EXTRA_LIBS})
184 +
185 + IF (UNIX)
186 +@@ -22,6 +22,9 @@
187 + INSTALL( DIRECTORY ../cr3qt/data/hyph DESTINATION share/cr3
188 + FILES_MATCHING PATTERN "*.pattern" )
189 + INSTALL( DIRECTORY ../cr3qt/data/skins DESTINATION share/cr3/skins )
190 ++ INSTALL( FILES ../cr3qt/src/desktop/cr3.desktop DESTINATION share/applications )
191 ++ INSTALL( FILES ../cr3qt/src/desktop/cr3.png DESTINATION share/pixmaps )
192 ++ INSTALL( FILES ../cr3qt/src/desktop/cr3.xpm DESTINATION share/pixmaps )
193 + ELSE()
194 + INSTALL( TARGETS cr3 RUNTIME DESTINATION . )
195 + INSTALL( DIRECTORY ../cr3qt/data/ DESTINATION .
196 +
197 +# Change the dates in About program dialogs:
198 +--- a/crengine/include/cr3version.h 2015-07-13 11:23:37.000000000 +0300
199 ++++ b/crengine/include/cr3version.h 2017-07-12 11:09:49.000000000 +0300
200 +@@ -1,2 +1,2 @@
201 +-#define CR_ENGINE_VERSION "3.1.2-52"
202 +-#define CR_ENGINE_BUILD_DATE "2014-11-19"
203 ++#define CR_ENGINE_VERSION "3.1.2-71"
204 ++#define CR_ENGINE_BUILD_DATE "2015-07-02"
205 +
206 +--- a/cr3qt/src/aboutdlg.ui
207 ++++ b/cr3qt/src/aboutdlg.ui
208 +@@ -59 +59 @@
209 +- <string notr="true">(c) 1998-2010 Vadim Lopatin</string>
210 ++ <string notr="true">(c) 1998-2015 Vadim Lopatin</string>
211 +
212 +--- old/cr3wx/src/cr3.cpp 2015-07-13 11:23:37.000000000 +0300
213 ++++ new/cr3wx/src/cr3.cpp 2017-08-28 02:29:32.000000000 +0300
214 +@@ -1479,7 +1479,7 @@
215 + void
216 + cr3Frame::OnAbout( wxCommandEvent& WXUNUSED( event ) )
217 + {
218 +- wxMessageBox( wxT( "Cool Reader " wxT(CR3_VERSION) wxT("\n(c) 1998-2007 Vadim Lopatin\nwxWidgets version\n") )
219 ++ wxMessageBox( wxT( "Cool Reader " wxT(CR3_VERSION) wxT("\n(c) 1998-2015 Vadim Lopatin\nwxWidgets version\n") )
220 + wxT("\nBased on CREngine library " wxT(CR_ENGINE_VERSION) )
221 + wxT("\nThird party libraries used:")
222 + wxT("\nzlib, libpng, libjpeg, freetype2,")
223
224 diff --git a/app-text/coolreader/files/cr3.1.2.71_wxGTK3.diff b/app-text/coolreader/files/cr3.1.2.71_wxGTK3.diff
225 new file mode 100644
226 index 00000000000..1a0f1659592
227 --- /dev/null
228 +++ b/app-text/coolreader/files/cr3.1.2.71_wxGTK3.diff
229 @@ -0,0 +1,99 @@
230 +# Patch to build CoolReader3 with active wxGTK-3.0 profile
231 +# (eselect wxwidgets is set to "gtk2-unicode-3.0" instead of "gtk2-inicode-release-2.8")
232 +diff -Naur old/cr3wx/src/cr3.cpp new/cr3wx/src/cr3.cpp
233 +--- old/cr3wx/src/cr3.cpp 2015-07-13 11:23:37.000000000 +0300
234 ++++ new/cr3wx/src/cr3.cpp 2017-08-28 12:54:13.000000000 +0300
235 +@@ -395,7 +395,7 @@
236 +
237 + lString16 GetConfigFileName()
238 + {
239 +- lString16 cfgdir( wxStandardPaths::Get().GetUserDataDir().c_str() );
240 ++ lString16 cfgdir( wxStandardPaths::Get().GetUserDataDir().wx_str() );
241 + if ( !wxDirExists( cfgdir.c_str() ) )
242 + ::wxMkdir( wxString( cfgdir.c_str() ) );
243 + lChar16 slash = detectSlash( cfgdir );
244 +@@ -622,7 +622,7 @@
245 + wxImage::AddHandler(new wxPNGHandler);
246 + resources = new ResourceContainer();
247 +
248 +- lString16 appname( argv[0] );
249 ++ lString16 appname( argv[0].wx_str() );
250 + int lastSlash=-1;
251 + lChar16 slashChar = '/';
252 + for ( int p=0; p<(int)appname.length(); p++ ) {
253 +@@ -777,7 +777,7 @@
254 + int argc = wxGetApp().argc;
255 + lString16 fnameToOpen;
256 + for ( int i=1; i<argc; i++ ) {
257 +- lString16 param = lString16( wxGetApp().argv[1] );
258 ++ lString16 param = lString16( wxGetApp().argv[1].wx_str() );
259 + if ( param[0]!='-' )
260 + fnameToOpen = param;
261 + }
262 +@@ -1193,7 +1193,7 @@
263 + lString16 outFile;
264 + bool convert = false;
265 + for ( int i=1; i<argc; i++ ) {
266 +- lString16 param = lString16( wxGetApp().argv[i] );
267 ++ lString16 param = lString16( wxGetApp().argv[i].wx_str() );
268 + if ( param[0]!='-' )
269 + fnameToOpen = param;
270 + else if (param.startsWith("--convert"))
271 +@@ -1470,7 +1470,7 @@
272 + wxCursor hg( wxCURSOR_WAIT );
273 + this->SetCursor( hg );
274 + wxSetCursor( hg );
275 +- _view->getDocView()->exportWolFile( dlg.GetPath(), opts.getMode()==0, opts.getLevels() );
276 ++ _view->getDocView()->exportWolFile( dlg.GetPath().wx_str(), opts.getMode()==0, opts.getLevels() );
277 + wxSetCursor( wxNullCursor );
278 + this->SetCursor( wxNullCursor );
279 + }
280 +diff -Naur old/cr3wx/src/optdlg.cpp new/cr3wx/src/optdlg.cpp
281 +--- old/cr3wx/src/optdlg.cpp 2015-07-13 11:23:37.000000000 +0300
282 ++++ new/cr3wx/src/optdlg.cpp 2017-08-28 11:38:06.000000000 +0300
283 +@@ -41,7 +41,7 @@
284 + if ( v==_choices[i] )
285 + tb = i;
286 + if ( _storeStringValues ) {
287 +- props->setString( _option, lString16(_choices[tb]) );
288 ++ props->setString( _option, lString16(_choices[tb].wx_str()) );
289 + } else {
290 + props->setInt( _option, tb );
291 + }
292 +@@ -50,7 +50,7 @@
293 + {
294 + unsigned tb = _defvalue;
295 + if ( _storeStringValues ) {
296 +- lString8 s8 = UnicodeToUtf8( lString16(_choices[_defvalue]) );
297 ++ lString8 s8 = UnicodeToUtf8( lString16(_choices[_defvalue].wx_str()) );
298 + lString16 s16 = props->getStringDef( _option, s8.c_str() );
299 + wxString v = s16.c_str();
300 + for ( unsigned i=0; i<_choices.GetCount(); i++ )
301 +diff -Naur old/cr3wx/src/view.cpp new/cr3wx/src/view.cpp
302 +--- old/cr3wx/src/view.cpp 2015-07-13 11:23:37.000000000 +0300
303 ++++ new/cr3wx/src/view.cpp 2017-08-28 12:57:55.000000000 +0300
304 +@@ -353,7 +353,7 @@
305 +
306 + lString16 cr3view::GetHistoryFileName()
307 + {
308 +- lString16 cfgdir( wxStandardPaths::Get().GetUserDataDir().c_str() );
309 ++ lString16 cfgdir( wxStandardPaths::Get().GetUserDataDir().wx_str() );
310 + if ( !wxDirExists( cfgdir.c_str() ) )
311 + ::wxMkdir( wxString( cfgdir.c_str() ) );
312 + lChar16 slash = detectSlash( cfgdir );
313 +@@ -667,13 +667,13 @@
314 + //===========================================
315 + GetParent()->Update();
316 + //printf(" loading... ");
317 +- bool res = getDocView()->LoadDocument( fname.c_str() );
318 ++ bool res = getDocView()->LoadDocument( fname.wx_str() );
319 + //printf(" done. \n");
320 + //DEBUG
321 + //_docview->exportWolFile( "test.wol", true );
322 + //_docview->SetPos(0);
323 + if ( !res )
324 +- getDocView()->createDefaultDocument(lString16("File open error"), lString16("Cannot open file ") + fname.c_str() );
325 ++ getDocView()->createDefaultDocument(lString16("File open error"), lString16("Cannot open file ") + fname.wx_str() );
326 + lString16 title = getDocView()->getAuthors();
327 + if ( !title.empty() && !getDocView()->getTitle().empty() )
328 + title << L". ";
329
330 diff --git a/app-text/coolreader/files/cr3ini.diff b/app-text/coolreader/files/cr3ini.diff
331 new file mode 100644
332 index 00000000000..66562aa836a
333 --- /dev/null
334 +++ b/app-text/coolreader/files/cr3ini.diff
335 @@ -0,0 +1,35 @@
336 +# Patch to allow creating cr3.ini file in the home directory of user
337 +# instead to trying save it in /usr/share/cr3/cr3.ini
338 +# Bug: https://sourceforge.net/p/crengine/bugs/179/
339 +# Patch was proposed by "Olexandr" (see bug report)
340 +diff --git a/cr3qt/src/mainwindow.cpp b/cr3qt/src/mainwindow.cpp
341 +index 142242a..0401f71 100644
342 +--- a/cr3qt/src/mainwindow.cpp
343 ++++ b/cr3qt/src/mainwindow.cpp
344 +@@ -77,8 +77,8 @@ MainWindow::MainWindow(QWidget *parent)
345 + #endif
346 + QString cacheDir = homeDir + "cache";
347 + QString bookmarksDir = homeDir + "bookmarks";
348 +- QString histFile = exeDir + "cr3hist.bmk";
349 +- QString histFile2 = homeDir + "cr3hist.bmk";
350 ++ QString histFile2 = exeDir + "cr3hist.bmk";
351 ++ QString histFile = homeDir + "cr3hist.bmk";
352 + QString iniFile2 = exeDir + "cr3.ini";
353 + QString iniFile = homeDir + "cr3.ini";
354 + QString cssFile = homeDir + "fb2.css";
355 +@@ -92,9 +92,13 @@ MainWindow::MainWindow(QWidget *parent)
356 + ldomDocCache::init( qt2cr( cacheDir ), DOC_CACHE_SIZE );
357 + ui->view->setPropsChangeCallback( this );
358 + if ( !ui->view->loadSettings( iniFile ) )
359 +- ui->view->loadSettings( iniFile2 );
360 ++ if ( !ui->view->loadSettings( iniFile2 ) )
361 ++ ui->view->saveSettings( iniFile );
362 ++
363 + if ( !ui->view->loadHistory( histFile ) )
364 +- ui->view->loadHistory( histFile2 );
365 ++ if ( !ui->view->loadHistory( histFile2 ) )
366 ++ ui->view->saveHistory( histFile );
367 ++
368 + if ( !ui->view->loadCSS( cssFile ) )
369 + ui->view->loadCSS( cssFile2 );
370 + #if ENABLE_BOOKMARKS_DIR==1
371
372 diff --git a/app-text/coolreader/metadata.xml b/app-text/coolreader/metadata.xml
373 new file mode 100644
374 index 00000000000..afd1b4bc9da
375 --- /dev/null
376 +++ b/app-text/coolreader/metadata.xml
377 @@ -0,0 +1,14 @@
378 +<?xml version="1.0" encoding="UTF-8"?>
379 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
380 +<pkgmetadata>
381 + <maintainer type="person">
382 + <email>grozin@g.o</email>
383 + </maintainer>
384 + <longdescription lang="en">
385 + A fast and small cross-platform XML/CSS based eBook reader for desktops and handheld devices.
386 + Supported formats: FB2, TXT, RTF, DOC, TCR, HTML, EPUB, CHM, PDB, MOBI.
387 + </longdescription>
388 + <upstream>
389 + <remote-id type="sourceforge">crengine</remote-id>
390 + </upstream>
391 +</pkgmetadata>