diff --git a/sigil-0.8.0-system-dicts.patch b/sigil-0.8.0-system-dicts.patch new file mode 100644 index 0000000..06d0ec4 --- /dev/null +++ b/sigil-0.8.0-system-dicts.patch @@ -0,0 +1,11 @@ +diff -up sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install~ sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install +--- sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install~ 2016-01-24 17:32:06.000000000 +0100 ++++ sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install 2016-02-24 17:10:47.396203369 +0100 +@@ -1,5 +1,7 @@ + #!/bin/sh + ++export SIGIL_DICTIONARIES=/usr/share/myspell ++ + # Entry point for Sigil on Unix systems. + # Adds linked Qt's lib directory to the LD_LIBRARY_PATH + diff --git a/sigil-0.9.13-minizip2.patch b/sigil-0.9.13-minizip2.patch new file mode 100644 index 0000000..23496ab --- /dev/null +++ b/sigil-0.9.13-minizip2.patch @@ -0,0 +1,44 @@ +diff -up Sigil-0.9.13/src/Exporters/ExportEPUB.cpp.mz Sigil-0.9.13/src/Exporters/ExportEPUB.cpp +--- Sigil-0.9.13/src/Exporters/ExportEPUB.cpp.mz 2019-03-20 01:01:44.000000000 +0100 ++++ Sigil-0.9.13/src/Exporters/ExportEPUB.cpp 2019-06-04 16:00:33.288040415 +0200 +@@ -25,7 +25,9 @@ + + #include + #include ++#include + #include ++#include + #ifdef _WIN32 + #include + #endif +@@ -143,7 +145,7 @@ void ExportEPUB::SaveFolderAsEpubToLocat + fileInfo.tmz_date.tm_year = timeNow.date().year(); + + // Write the mimetype. This must be uncompressed and the first entry in the archive. +- if (zipOpenNewFileInZip64(zfile, "mimetype", &fileInfo, NULL, 0, NULL, 0, NULL, Z_NO_COMPRESSION, 0, 0) != ZIP_OK) { ++ if (zipOpenNewFileInZip4_64(zfile, "mimetype", &fileInfo, NULL, 0, NULL, 0, NULL, Z_NO_COMPRESSION, 8, 0, 15, 8, Z_DEFAULT_STRATEGY, NULL, 0, 0x0b00, 1<<11, 0) != ZIP_OK) { + zipClose(zfile, NULL); + QFile::remove(tempFile); + throw(CannotStoreFile("mimetype")); +diff -up Sigil-0.9.13/src/Importers/ImportEPUB.cpp.mz Sigil-0.9.13/src/Importers/ImportEPUB.cpp +--- Sigil-0.9.13/src/Importers/ImportEPUB.cpp.mz 2019-03-20 01:01:44.000000000 +0100 ++++ Sigil-0.9.13/src/Importers/ImportEPUB.cpp 2019-06-04 16:01:06.433908894 +0200 +@@ -25,6 +25,7 @@ + #define NOMINMAX + #endif + ++#include + #include "unzip.h" + #ifdef _WIN32 + #include "iowin32.h" +diff -up Sigil-0.9.13/src/Misc/Utility.cpp.mz Sigil-0.9.13/src/Misc/Utility.cpp +--- Sigil-0.9.13/src/Misc/Utility.cpp.mz 2019-03-20 01:01:44.000000000 +0100 ++++ Sigil-0.9.13/src/Misc/Utility.cpp 2019-06-04 16:01:22.951850121 +0200 +@@ -23,6 +23,7 @@ + #define NOMINMAX + #endif + ++#include + #include "unzip.h" + #ifdef _WIN32 + #include "iowin32.h" diff --git a/sigil-0.9.14-python311.patch b/sigil-0.9.14-python311.patch new file mode 100644 index 0000000..f34bc29 --- /dev/null +++ b/sigil-0.9.14-python311.patch @@ -0,0 +1,12 @@ +diff -up Sigil-0.9.14/src/Misc/EmbeddedPython.cpp.orig Sigil-0.9.14/src/Misc/EmbeddedPython.cpp +--- Sigil-0.9.14/src/Misc/EmbeddedPython.cpp.orig 2022-09-14 15:01:07.478992538 +0000 ++++ Sigil-0.9.14/src/Misc/EmbeddedPython.cpp 2022-09-14 14:58:31.927044230 +0000 +@@ -456,7 +456,7 @@ QVariant EmbeddedPython::PyObjectToQVari + + if (kind == PyUnicode_1BYTE_KIND) { + // latin 1 according to PEP 393 +- res = QVariant(QString::fromLatin1(reinterpret_castPyUnicode_1BYTE_DATA(po), -1)); ++ res = QVariant(QString::fromLatin1(reinterpret_cast(PyUnicode_1BYTE_DATA(po)), -1)); + + } else if (kind == PyUnicode_2BYTE_KIND) { + res = QVariant(QString::fromUtf16(PyUnicode_2BYTE_DATA(po), -1)); diff --git a/sigil-0.9.14.tar.gz b/sigil-0.9.14.tar.gz new file mode 100644 index 0000000..4397856 Binary files /dev/null and b/sigil-0.9.14.tar.gz differ diff --git a/sigil-0.9.3-global-plugin-support.patch b/sigil-0.9.3-global-plugin-support.patch new file mode 100644 index 0000000..765c08f --- /dev/null +++ b/sigil-0.9.3-global-plugin-support.patch @@ -0,0 +1,19 @@ +diff -up sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install~ sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install +--- sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install~ 2016-02-24 17:59:35.000000000 +0100 ++++ sigil-0.9.3/src/Resource_Files/bash/sigil-sh_install 2016-02-25 19:26:17.202297521 +0100 +@@ -2,6 +2,15 @@ + + export SIGIL_DICTIONARIES=/usr/share/myspell + ++mkdir -p $HOME/.local/share/sigil-ebook/sigil/plugins ++pushd /usr/share/sigil/plugins > /dev/null ++for i in *; do ++ if [ -d "$i" ]; then ++ cp -pr "$i" $HOME/.local/share/sigil-ebook/sigil/plugins/ ++ fi ++done ++popd > /dev/null ++ + # Entry point for Sigil on Unix systems. + # Adds linked Qt's lib directory to the LD_LIBRARY_PATH + diff --git a/sigil.appdata.xml b/sigil.appdata.xml new file mode 100644 index 0000000..6ba858e --- /dev/null +++ b/sigil.appdata.xml @@ -0,0 +1,34 @@ + + + sigil.desktop + CC0-1.0 + GPL-3.0+ + Sigil + Sigil EPUB ebook Editor + +

+ Sigil is a multi-platform EPUB ebook editor (think Word or LibreOffice + but specific for EPUB ebooks) with the following features: +

+
    +
  • Full UTF-16 support
  • +
  • EPUB 2 spec support with limited EPUB 3 support
  • +
  • Multiple Views: Book View, Code View and Preview View
  • +
  • WYSIWYG editing in Book View
  • +
  • Complete control over directly editing EPUB syntax in Code View
  • +
  • Table of Contents generator with multi-level heading support
  • +
  • Metadata editor
  • +
+
+ https://sigil-ebook.com/ + + + http://ubuntuhandbook.org/wp-content/uploads/2016/02/sigil-epub-editor.jpg + Sigil about window + + + jwrdegoede_at_fedoraproject.org + https://github.com/Sigil-Ebook/Sigil/issues + https://sigil-ebook.com/donate/ + https://sigil-ebook.com/documentation/ +
diff --git a/sigil.spec b/sigil.spec new file mode 100644 index 0000000..1b9595f --- /dev/null +++ b/sigil.spec @@ -0,0 +1,169 @@ +%global __cmake_in_source_build 1 + +Name: sigil +Version: 0.9.14 +Release: 1 +Summary: WYSIWYG ebook editor +License: GPLv3+ +URL: https://sigil-ebook.com/ +Source0: https://github.com/Sigil-Ebook/Sigil/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: %{name}.appdata.xml +Patch1: %{name}-0.8.0-system-dicts.patch +Patch2: %{name}-0.9.3-global-plugin-support.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1632199 +# port to minizip 2.x for F-30+ +Patch3: %{name}-0.9.13-minizip2.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2083977 +Patch4: %{name}-0.9.14-python311.patch +BuildRequires: make +BuildRequires: cmake +BuildRequires: qt5-qtbase-devel +BuildRequires: qt5-qtwebkit-devel +BuildRequires: qt5-qtsvg-devel +BuildRequires: qt5-qttools-devel +BuildRequires: qt5-qtxmlpatterns-devel +BuildRequires: zlib-devel +BuildRequires: hunspell-devel +BuildRequires: pcre-devel >= 8.31 +BuildRequires: minizip-devel +BuildRequires: pkgconfig +BuildRequires: python3-devel +BuildRequires: desktop-file-utils libappstream-glib +# For the plugins +Requires: python3-pillow python3-cssselect python3-cssutils +Requires: python3-html5lib python3-lxml python3-qt5 +Requires: python3-regex python3-chardet python3-six +Requires: hicolor-icon-theme +Recommends: FlightCrew-sigil-plugin +# See internal/about.md for rationale for this +Provides: bundled(gumbo) + +%description +Sigil is a multi-platform WYSIWYG ebook editor. It is designed to edit books +in ePub format. + +Now what does it have to offer... + + * Full Unicode support: everything you see in Sigil is in UTF-16 + * Full EPUB spec support + * WYSIWYG editing + * Multiple Views: Book View, Code View and Split View + * Metadata editor with full support for all possible metadata entries with + full descriptions for each + * Table Of Contents editor + * Multi-level TOC support + * Book View fully supports the display of any XHTML document possible under + the OPS spec + * SVG support + * Basic XPGT support + * Advanced automatic conversion of all imported documents to Unicode + * Currently imports TXT, HTML and EPUB files; more will be added with time + * Embedded HTML Tidy; all imported documents are thoroughly cleaned; + changing views cleans the document so no matter how much you screw up + your code, it will fix it (usually) + + +%package doc +License: CC-BY-SA +Summary: Documentation for Sigil ebook editor +BuildArch: noarch + +%description doc +%{summary}. + + +%prep +%setup -q -n Sigil-%{version} +%patch1 -p1 +%patch2 -p1 +%if 0%{?fedora} >= 30 +%patch3 -p1 -b .mz +%endif +%patch4 -p1 +sed -i 's|/lib/sigil|/%{_lib}/sigil|' \ + CMakeLists.txt src/CMakeLists.txt \ + src/Resource_Files/bash/sigil-sh_install +# Cleanup sources a bit +fixtimestamp() { + touch -r $1.orig $1 + rm -f $1.orig +} +chmod a-x src/Dialogs/AddSemantics.{cpp,h} \ + src/Form_Files/{AddSemantics,PKeyboardShortcutsWidget}.ui \ + src/Misc/PyObjectPtr.h \ + src/Resource_Files/dictionaries/*.{aff,dic} \ + src/Resource_Files/main/*.png \ + src/Resource_Files/polyfills/MathJax_README.md \ + src/ResourceObjects/NavProcessor.{cpp,h} +for fil in src/Misc/PyObjectPtr.h \ + src/Resource_Files/python3lib/metadata_utils.py \ + src/Resource_Files/python3lib/metaproc2.py \ + src/Resource_Files/python3lib/metaproc3.py \ + src/Resource_Files/python3lib/opf_newparser.py +do + sed -i.orig 's/\r//' $fil + fixtimestamp $fil +done +for fil in $(grep -Frl %{_bindir}/env .); do + sed -ri.orig 's,%{_bindir}/env python3?,%{_bindir}/python3,' $fil + fixtimestamp $fil +done + +# Fix hunspell library lookup from python +hver=$(ls -1 %{_libdir}/libhunspell*.so | sed 's/.*hunspell\(-.*\)\.so/\1/') +hver=$(echo hver) +sed -i.orig "s/find_library('hunspell')/find_library('hunspell$hver')/" \ + src/Resource_Files/plugin_launchers/python/pluginhunspell.py +fixtimestamp src/Resource_Files/plugin_launchers/python/pluginhunspell.py + + +%build +mkdir build +pushd build +%{cmake} -DUSE_SYSTEM_LIBS=1 -DSYSTEM_LIBS_REQUIRED=1 \ + -DINSTALL_BUNDLED_DICTS=0 -DSHARE_INSTALL_PREFIX:PATH=%{_prefix} .. +make %{?_smp_mflags} +popd + + +%install +pushd build +%make_install +popd +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins +# Make rpmlint happy +chmod +x $RPM_BUILD_ROOT%{_datadir}/%{name}/python3lib/*.py +chmod +x $RPM_BUILD_ROOT%{_datadir}/%{name}/plugin_launchers/python/*.py +chmod -x $RPM_BUILD_ROOT%{_datadir}/%{name}/plugin_launchers/python/sigil_gumbo_bs4_adapter.py +# desktop-file, icons and appdata +desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop +rm $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png +for i in 16 32 48 128 256 512; do + mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/apps + install -p -m 644 src/Resource_Files/icon/app_icon_$i.png \ + $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png +done +mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata +install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/appdata +appstream-util validate-relax --nonet \ + $RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml + + +%files +%doc ChangeLog.txt README.md +%license COPYING.txt +%{_bindir}/%{name} +%{_libdir}/%{name} +%{_datadir}/%{name} +%{_datadir}/appdata/%{name}.appdata.xml +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}.png + +%files doc +%doc docs/*.epub + + +%changelog +* Fri May 26 2023 wangtaozhi - 0.9.14-1 +- Package init + diff --git a/sigil.yaml b/sigil.yaml new file mode 100644 index 0000000..ab0f165 --- /dev/null +++ b/sigil.yaml @@ -0,0 +1,7 @@ +version_control: github +src_repo: https://github.com/Sigil-Ebook/Sigil +tag_prefix: "v" +separator: "." + + +