diff --git a/app-text/coolreader3/additional-files/coolreader.rdef.in b/app-text/coolreader3/additional-files/coolreader.rdef.in new file mode 100644 index 000000000..0d115bd7c --- /dev/null +++ b/app-text/coolreader3/additional-files/coolreader.rdef.in @@ -0,0 +1,49 @@ +resource app_signature "application/x-vnd.qt5-coolreader"; + +resource app_flags B_MULTIPLE_LAUNCH; + +resource app_version { + major = @MAJOR@, + middle = @MIDDLE@, + minor = @MINOR@, + + variety = B_APPV_FINAL, + internal = @INTERNAL@, + + short_info = "CoolReader3", + long_info = "Free e-book reader" +}; + +resource file_types message { + "types" = "application/epub+zip", + "types" = "application/msword", + "types" = "application/x-fictionbook", + "types" = "application/x-fictionbook+xml", + "types" = "application/xhtml+xml", + "types" = "application/zip", + "types" = "text/html", + "types" = "text/plain", + "types" = "text/rtf", + "types" = "text/xml" +}; + +resource vector_icon { + $"6E63696606040179050102000602B48906376C703D2A3E3A580149DC9C45756F" + $"00B17703FFC7AC5B02000605B9DCB83D4EE8BFD6FDBC3DCA4BD5FB4A53B700DA" + $"D09F31FFFDF279DAD09FC5C7AC5BFFB1770302000604B66104385BC73D03703B" + $"0A2346B1734ABA4F00DAD09F4FFFFDF29DDAD09FFFC7AC5B0501080006426046" + $"6042604C5E4A604E5C4E584C5A505655505352574E5F4C5D506148423C5A3C42" + $"3C0613BFF3FFF33C46273F254D29582A54285C2C56345A34563451334E405034" + $"4E40494D444D444A51425E485E405E33553A592C51244E264F204C2746234629" + $"462B472A472B472C422C442C42302D3E2D3E2E38312B2F30312B353228322833" + $"24382235223B220610EFFFBEFF425E405E485E4D444A514D4449404E404E4050" + $"34582A532A542846274D293F2538223B223522322833243228352BB9BFB76CB9" + $"BFB76C2F30B821BEEF2E38B821BEEF3042B7C7C08EB7C7C08E2C442B472B47B6" + $"CDC43D244EB5C64E264F33552C513A5900024F354F3554315A2B502B5A2B0004" + $"405C405C405A465442544252354D3B502F4A28462A462846020628462A462446" + $"244E204C264F33552C513A59425E405E3F5C465442544252354D3B502F4A0802" + $"332F4B3808023235443D0A0A000100000A0101011001178402040A020101000A" + $"0101031001178400040A01001001178400040A030102000A0101041001178422" + $"040A040105000A05020607123FD5C7368D4FB6A8D13FFF1DBCCC394732100117" + $"8200040A05020607100117820004" +}; diff --git a/app-text/coolreader3/additional-files/haikuicons.zip b/app-text/coolreader3/additional-files/haikuicons.zip new file mode 100644 index 000000000..46a1667c3 Binary files /dev/null and b/app-text/coolreader3/additional-files/haikuicons.zip differ diff --git a/app-text/coolreader3/coolreader3-3.1.2.52.recipe b/app-text/coolreader3/coolreader3-3.1.2.52.recipe new file mode 100644 index 000000000..67cc0aa23 --- /dev/null +++ b/app-text/coolreader3/coolreader3-3.1.2.52.recipe @@ -0,0 +1,116 @@ +SUMMARY="Free e-book reader" +DESCRIPTION="CoolReader is fast and small cross-platform XML/CSS based eBook reader for \ +desktops and handheld devices. Supported formats: FB2, TXT, RTF, DOC, TCR, HTML, EPUB, \ +CHM, PDB, MOBI. Platforms: Win32, Linux, Android. Ported on some eInk based devices." +HOMEPAGE="https://sourceforge.net/projects/crengine/" +COPYRIGHT="1998-2009 Vadim Lopatin" +LICENSE="GNU GPL v2" +REVISION="1" + +srcGitRev="d8a3a1bb60b6d03968469c0b866065af787a7373" +SOURCE_URI="https://sourceforge.net/code-snapshots/git/c/cr/crengine/crengine.git/crengine-crengine-$srcGitRev.zip" +CHECKSUM_SHA256="72f472fe0231b214df3cb31861ccabdf588bdb18efc37ba65eacdb6d0542c44c" +SOURCE_DIR="crengine-crengine-$srcGitRev" + +PATCHES="coolreader3-$portVersion.patchset" +ADDITIONAL_FILES=" + coolreader.rdef.in + haikuicons.zip + " + +ARCHITECTURES="!x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + coolreader3$secondaryArchSuffix = $portVersion + app:coolreader3$secondaryArchSuffix = $portVersion + " + +REQUIRES=" + haiku$secondaryArchSuffix + lib:libfreetype$secondaryArchSuffix + lib:libfontconfig$secondaryArchSuffix + lib:libGL$secondaryArchSuffix + lib:libintl$secondaryArchSuffix + lib:libjpeg$secondaryArchSuffix + lib:libpng16$secondaryArchSuffix + lib:libQt5Core$secondaryArchSuffix + lib:libQt5Gui$secondaryArchSuffix + lib:libQt5Network$secondaryArchSuffix + lib:libQt5PrintSupport$secondaryArchSuffix + lib:libQt5Svg$secondaryArchSuffix + lib:libQt5WebKit$secondaryArchSuffix + lib:libQt5WebKitWidgets$secondaryArchSuffix + lib:libQt5Widgets$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libfreetype$secondaryArchSuffix + devel:libfontconfig$secondaryArchSuffix + devel:libGL$secondaryArchSuffix + devel:libjpeg$secondaryArchSuffix + devel:libpng$secondaryArchSuffix + devel:libQt5Core$secondaryArchSuffix + devel:libQt5Gui$secondaryArchSuffix + devel:libQt5Network$secondaryArchSuffix + devel:libQt5PrintSupport$secondaryArchSuffix + devel:libQt5Svg$secondaryArchSuffix + devel:libQt5WebKit$secondaryArchSuffix + devel:libQt5WebKitWidgets$secondaryArchSuffix + devel:libQt5Widgets$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " + +BUILD_PREREQUIRES=" + cmd:cmake + cmd:gcc$secondaryArchSuffix + cmd:git + cmd:g++$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:lrelease$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:which + cmd:unzip + " + +PATCH() +{ + unzip -o $sourceDir/../../additional-files/haikuicons.zip -d $sourceDir/cr3qt/src/icons +} + +BUILD() +{ + mkdir -p build + cd build + cmake .. -DGUI=QT5 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX:PATH=$appsDir/CoolReader3 + + make $jobArgs +} + +INSTALL() +{ + cd build + make install + mv -f $appsDir/CoolReader3/cr3 $appsDir/CoolReader3/CoolReader + + local MAJOR="`echo "$portVersion" | cut -d. -f1`" + local MIDDLE="`echo "$portVersion" | cut -d. -f2`" + local MINOR="`echo "$portVersion" | cut -d. -f3`" + local INTERNAL="`echo "$portVersion" | cut -d. -f4`" + + sed \ + -e "s|@MAJOR@|$MAJOR|" \ + -e "s|@MIDDLE@|$MIDDLE|" \ + -e "s|@MINOR@|$MINOR|" \ + -e "s|@INTERNAL@|$INTERNAL|" \ + $portDir/additional-files/coolreader.rdef.in > coolreader.rdef + + addResourcesToBinaries coolreader.rdef $appsDir/CoolReader3/CoolReader + mimeset -f $appsDir/CoolReader3/CoolReader + addAppDeskbarSymlink $appsDir/CoolReader3/CoolReader +} diff --git a/app-text/coolreader3/patches/coolreader3-3.1.2.52.patchset b/app-text/coolreader3/patches/coolreader3-3.1.2.52.patchset new file mode 100644 index 000000000..14097489a --- /dev/null +++ b/app-text/coolreader3/patches/coolreader3-3.1.2.52.patchset @@ -0,0 +1,227 @@ +From a64c2561240cef51dea4c15a52b3f8a663ee0dce Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Sat, 2 Sep 2017 20:33:12 +1000 +Subject: Fix build for Haiku + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0749577..c8299d3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 2.6) + + #INCLUDE(CPack) + ++set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD_REQUIRED ON) ++ + if( ${CMAKE_SYSTEM} MATCHES "Darwin" ) + message("MAC OSX build") + SET(MAC 1) +diff --git a/cr3qt/CMakeLists.txt b/cr3qt/CMakeLists.txt +index 4eda8f3..1a63cbd 100644 +--- a/cr3qt/CMakeLists.txt ++++ b/cr3qt/CMakeLists.txt +@@ -48,6 +48,10 @@ if(MAC) + -DUSE_FONTCONFIG=0 + ${CARBON_CFLAGS} + ) ++ELSEIF (HAIKU) ++ ADD_DEFINITIONS(-DCR3_DATA_DIR="${CMAKE_INSTALL_PREFIX}/data/" ++ -DUSE_FONTCONFIG=1 ++ ) + ELSEIF (UNIX) + ADD_DEFINITIONS(-DCR3_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/cr3/" + -DUSE_FONTCONFIG=1 +@@ -171,7 +175,9 @@ IF(MAC) + # SET(FRAMEWORKS "-framework ApplicationServices -framework Carbon -framework AppKit") + #/Developer/Qt/lib/libQtCore.a /Developer/Qt/lib/libQtGui.a ${FRAMEWORKS} + SET (EXTRA_LIBS ${QT_LIBRARIES} ${STD_LIBS} ) +-#${QT_LIBRARIES} ++#${QT_LIBRARIES} ++ELSEIF (HAIKU) ++ SET (EXTRA_LIBS ${QT_LIBRARIES} ${STD_LIBS} ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} fontconfig intl) + ELSEIF (UNIX) + SET (EXTRA_LIBS ${QT_LIBRARIES} fontconfig ${STD_LIBS} ) + ELSE() +@@ -200,6 +206,20 @@ INSTALL( FILES src/desktop/PkgInfo DESTINATION Contents ) + #INSTALL( FILES src/desktop/cr3.png DESTINATION share/pixmaps ) + #INSTALL( FILES src/desktop/cr3.xpm DESTINATION share/pixmaps ) + ++ELSEIF (HAIKU) ++ ++INSTALL( TARGETS cr3 RUNTIME DESTINATION . ) ++INSTALL( DIRECTORY data/ DESTINATION data ++ FILES_MATCHING PATTERN "*.css" PATTERN "skins" EXCLUDE PATTERN "docs" EXCLUDE) ++INSTALL( DIRECTORY data/hyph DESTINATION data ++ FILES_MATCHING PATTERN "*.pdb" ) ++INSTALL( DIRECTORY data/hyph DESTINATION data ++ FILES_MATCHING PATTERN "*.pattern" ) ++INSTALL( DIRECTORY data/textures DESTINATION data ) ++INSTALL( DIRECTORY data/backgrounds DESTINATION data ) ++INSTALL( FILES ${CR3_CHANGELOG} DESTINATION data ) ++INSTALL( FILES ${QM_FILES} DESTINATION i18n ) ++ + ELSEIF (UNIX) + + +-- +2.13.1 + + +From e21d817cebdd528ceca0dfb077f80da0036df91d Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Sat, 2 Sep 2017 20:49:13 +1000 +Subject: =?UTF-8?q?Fix=20settings=20for=20Haiku=0A*=20fix=20paths=0A*=20fi?= + =?UTF-8?q?x=20default=20params=0A*=20add=20Noto=20Sans=20support?= + + +diff --git a/cr3qt/src/cr3widget.cpp b/cr3qt/src/cr3widget.cpp +index 2e1c784..a328172 100644 +--- a/cr3qt/src/cr3widget.cpp ++++ b/cr3qt/src/cr3widget.cpp +@@ -347,7 +347,7 @@ void CR3View::updateDefProps() + _data->_props->setStringDef( PROP_WINDOW_SHOW_MENU, "1" ); + _data->_props->setStringDef( PROP_WINDOW_SHOW_SCROLLBAR, "1" ); + _data->_props->setStringDef( PROP_WINDOW_TOOLBAR_SIZE, "1" ); +- _data->_props->setStringDef( PROP_WINDOW_SHOW_STATUSBAR, "0" ); ++ _data->_props->setStringDef( PROP_WINDOW_SHOW_STATUSBAR, "1" ); + _data->_props->setStringDef( PROP_APP_START_ACTION, "0" ); + + +diff --git a/cr3qt/src/main.cpp b/cr3qt/src/main.cpp +index ed56449..008db81 100644 +--- a/cr3qt/src/main.cpp ++++ b/cr3qt/src/main.cpp +@@ -123,7 +123,11 @@ int main(int argc, char *argv[]) + lString16 home = Utf8ToUnicode(lString8(( getenv("HOME") ) )); + lString16 homecr3 = home; + LVAppendPathDelimiter(homecr3); ++#ifdef __HAIKU__ ++ homecr3 << "config/settings/cr3"; ++#else + homecr3 << ".cr3"; ++#endif + LVAppendPathDelimiter(homecr3); + //~/.cr3/ + lString16 homefonts = homecr3; +@@ -166,7 +170,7 @@ int main(int argc, char *argv[]) + QString exeDir = QDir::toNativeSeparators(qApp->applicationDirPath() + "/Contents/Resources/"); //QDir::separator(); + QString translations = exeDir + "i18n"; + #else +-#if defined(_WIN32) ++#if defined(_WIN32) || defined(__HAIKU__) + QString exeDir = QDir::toNativeSeparators(qApp->applicationDirPath() + "/"); //QDir::separator(); + QString translations = exeDir + "i18n"; + #else +diff --git a/cr3qt/src/mainwindow.cpp b/cr3qt/src/mainwindow.cpp +index 7899171..f7a7c85 100644 +--- a/cr3qt/src/mainwindow.cpp ++++ b/cr3qt/src/mainwindow.cpp +@@ -74,6 +74,10 @@ MainWindow::MainWindow(QWidget *parent) + addAction(ui->actionNextSentence); + addAction(ui->actionPrevSentence); + ++#ifdef __HAIKU__ ++ QString homeDir = QDir::toNativeSeparators(QDir::homePath() + "/config/settings/cr3/"); ++ QString exeDir = QString(CR3_DATA_DIR); ++#else + #ifdef _LINUX + QString homeDir = QDir::toNativeSeparators(QDir::homePath() + "/.cr3/"); + #else +@@ -84,6 +88,8 @@ MainWindow::MainWindow(QWidget *parent) + #else + QString exeDir = QDir::toNativeSeparators(qApp->applicationDirPath() + "/"); //QDir::separator(); + #endif ++#endif ++#ifndef __HAIKU__ + QString cacheDir = homeDir + "cache"; + QString bookmarksDir = homeDir + "bookmarks"; + QString histFile = exeDir + "cr3hist.bmk"; +@@ -92,6 +98,16 @@ MainWindow::MainWindow(QWidget *parent) + QString iniFile = homeDir + "cr3.ini"; + QString cssFile = homeDir + "fb2.css"; + QString cssFile2 = exeDir + "fb2.css"; ++#else ++ QString cacheDir = homeDir + "cache"; ++ QString bookmarksDir = homeDir + "bookmarks"; ++ QString histFile = homeDir + "cr3hist.bmk"; ++ QString histFile2 = histFile; ++ QString iniFile = homeDir + "cr3.ini"; ++ QString iniFile2 = iniFile; ++ QString cssFile = exeDir + "fb2.css"; ++ QString cssFile2 = homeDir + "fb2.css"; ++#endif + //QString translations = exeDir + "i18n"; + //CRLog::info("Translations directory: %s", LCSTR(qt2cr(translations)) ); + QString hyphDir = exeDir + "hyph" + QDir::separator(); +diff --git a/cr3qt/src/settings.cpp b/cr3qt/src/settings.cpp +index 11b53bc..e2ecf48 100644 +--- a/cr3qt/src/settings.cpp ++++ b/cr3qt/src/settings.cpp +@@ -84,6 +84,10 @@ SettingsDlg::SettingsDlg(QWidget *parent, CR3View * docView ) : + + m_oldHyph = cr2qt(HyphMan::getSelectedDictionary()->getId()); + ++#ifdef __HAIKU__ ++ QString homeDir = QDir::toNativeSeparators(QDir::homePath() + "/config/settings/cr3/"); ++ QString exeDir = QString(CR3_DATA_DIR); ++#else + #ifdef _LINUX + QString homeDir = QDir::toNativeSeparators(QDir::homePath() + "/.cr3/"); + #else +@@ -96,6 +100,7 @@ SettingsDlg::SettingsDlg(QWidget *parent, CR3View * docView ) : + #else + QString exeDir = QDir::toNativeSeparators(qApp->applicationDirPath() + "/"); //QDir::separator(); + #endif ++#endif + + lString16Collection baseDirs; + baseDirs.add(qt2cr(homeDir)); +@@ -176,7 +181,7 @@ SettingsDlg::SettingsDlg(QWidget *parent, CR3View * docView ) : + m_ui->cbBookmarkHighlightMode->setCurrentIndex(highlight); + + +- int n = m_props->getIntDef( PROP_PAGE_MARGIN_LEFT, 8 ); ++ int n = m_props->getIntDef( PROP_PAGE_MARGIN_LEFT, 30 ); + int mi = 0; + for (int i=0; i < (int)MAX_MARGIN_INDEX; i++) { + if (n <= def_margins[i]) { +@@ -212,6 +217,9 @@ SettingsDlg::SettingsDlg(QWidget *parent, CR3View * docView ) : + + const char * defFontFace = "DejaVu Sans"; + static const char * goodFonts[] = { ++#ifdef __HAIKU__ ++ "Noto Sans", ++#endif + "DejaVu Sans", + "FreeSans", + "Liberation Sans", +diff --git a/crengine/src/lvdocview.cpp b/crengine/src/lvdocview.cpp +index c84883a..c480b2c 100644 +--- a/crengine/src/lvdocview.cpp ++++ b/crengine/src/lvdocview.cpp +@@ -87,9 +87,9 @@ const char + "body[name=\"notes\"] section[id] empty-line { display: inline }\n" + "code, pre { display: block; white-space: pre; font-family: \"Courier New\", monospace }\n"; + +-static const char * DEFAULT_FONT_NAME = "Arial, DejaVu Sans"; //Times New Roman"; ++static const char * DEFAULT_FONT_NAME = "Arial, Noto Sans, DejaVu Sans"; //Times New Roman"; + static const char * DEFAULT_STATUS_FONT_NAME = +- "Arial Narrow, Arial, DejaVu Sans"; //Times New Roman"; ++ "Arial Narrow, Arial, Noto Sans, DejaVu Sans"; //Times New Roman"; + static css_font_family_t DEFAULT_FONT_FAMILY = css_ff_sans_serif; + // css_ff_serif, + // css_ff_sans_serif, +@@ -5625,7 +5625,7 @@ void LVDocView::propsUpdateDefaults(CRPropRef props) { + props->setIntDef(PROP_DISPLAY_TURBO_UPDATE_MODE, 0); + + lString8 defFontFace; +- static const char * goodFonts[] = { "DejaVu Sans", "FreeSans", ++ static const char * goodFonts[] = { "Noto Sans", "DejaVu Sans", "FreeSans", + "Liberation Sans", "Arial", "Verdana", NULL }; + for (int i = 0; goodFonts[i]; i++) { + if (list.contains(lString16(goodFonts[i]))) { +-- +2.13.1 +