%global date 20191012 %global commit 5317c21678e71687aaab56862339354e1ea07306 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %define pkgver %{commit} ################################################################################ %define srcver 2.0.0-beta %define pkgver %{srcver} ################################################################################ %define unbundle_mathjax %{nil} # mathjax 2.7.4: Fedora >= 28 %if 0%{?fedora} >= 28 # temporary disabled # js: Uncaught Error: Script error for "libs/MathJax/MathJax" # http://requirejs.org/docs/errors.html#scripterror #%%define unbundle_mathjax 1 %endif %define unbundle_nodejs %{nil} # nodejs-shelljs 0.5.1: Fedora >= 26 # nodejs-archiver 0.14.4: Fedora >= 21 || EL >= 6 %if 0%{?fedora} >= 26 # temporary disabled #%%define unbundle_nodejs 1 %endif ################################################################################ %define devtoolset %{nil} %if 0%{?rhel} && 0%{?rhel} <= 7 %define devtoolset 8 %endif %define desktop_old %{nil} %if 0%{?rhel} && 0%{?rhel} <= 6 %define desktop_old 1 %endif ################################################################################ %define dir_appdata metainfo %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} <= 7 %define dir_appdata appdata %endif %endif %endif %if 0%{!?_metainfodir:1} %define _metainfodir %{_datadir}/%{dir_appdata} %endif %define dir_metainfo %( echo "%{_metainfodir}" | xargs -I{} basename '{}' ) %{!?_licensedir:%global license %%doc} %{!?__git:%define __git %{_bindir}/git} Name: notepadqq Version: 2.0.0~beta Release: 1%{?dist} #Release: 1.%{date}git%{shortcommit}%{?dist} Group: Applications/Editors # Notepadqq is licensed under GPLv3 # CodeMirror is licensed under MIT # RequireJS is licensed under MIT # jQuery is licensed under MIT License: GPLv3 and MIT URL: https://notepadqq.com Summary: A simple, general-purpose editor for Linux #Summary: An advanced text editor for developers Source0: https://github.com/notepadqq/notepadqq/archive/v%{pkgver}.tar.gz#/%{name}-%{pkgver}.tar.gz #Source0: https://github.com/notepadqq/notepadqq/archive/%{commit}/%{name}-%{shortcommit}.tar.gz %global PATCH1_desc Auto-fill paths for node & npm Patch1: notepadqq-1.9.99-paths.patch %global PATCH2_desc Disable editing nodejs options in Preferences Patch2: notepadqq-1.4.8-preferences.patch %global PATCH4_desc Improve icon handling # https://github.com/notepadqq/notepadqq/pull/908 Patch4: notepadqq-1.9.99-icons-xdg.patch %global PATCH100_desc Fix build on old GCC Patch100: notepadqq-1.9.99-cpp14-auto-lambda.patch BuildRequires: coreutils BuildRequires: bash BuildRequires: sed BuildRequires: git BuildRequires: cmake BuildRequires: desktop-file-utils %if ! (0%{?rhel} && 0%{?rhel} <= 6) BuildRequires: libappstream-glib %endif BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Gui) BuildRequires: pkgconfig(Qt5Widgets) #BuildRequires: pkgconfig(Qt5WebKit) #BuildRequires: pkgconfig(Qt5WebKitWidgets) BuildRequires: pkgconfig(Qt5Svg) BuildRequires: pkgconfig(Qt5Test) BuildRequires: qt5-qtwebengine-devel BuildRequires: qt5-qtwebsockets-devel BuildRequires: qt5-qtwebchannel-devel #BuildRequires: qt-creator %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: qt5-linguist %else BuildRequires: cmake(Qt5LinguistTools) %endif BuildRequires: qt5-qttools %if ! (0%{?rhel} && 0%{?rhel} <= 7) BuildRequires: qtchooser %endif BuildRequires: uchardet-devel %if 0%{?devtoolset} BuildRequires: devtoolset-%{devtoolset}-gcc-c++ BuildRequires: devtoolset-%{devtoolset}-gcc BuildRequires: devtoolset-%{devtoolset}-binutils BuildRequires: devtoolset-%{devtoolset}-libatomic-devel %else BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: binutils %endif # https://fedoraproject.org/wiki/Packaging:Scriptlets # https://fedoraproject.org/wiki/PackagingDrafts/ScriptletSnippets Requires(post): coreutils Requires(postun): coreutils Requires(posttrans): coreutils # gtk-update-icon-cache #Requires(post): gtk-update-icon-cache Requires(postun): gtk-update-icon-cache Requires(posttrans): gtk-update-icon-cache # update-mime-database #Requires(post): shared-mime-info #Requires(postun): shared-mime-info #Requires(posttrans): shared-mime-info # update-desktop-database Requires(post): desktop-file-utils Requires(postun): desktop-file-utils #Requires(posttrans): desktop-file-utils # glib-compile-schemas #Requires(post): glib2 #Requires(postun): glib2 #Requires(posttrans): glib2 # ldconfig #Requires(post): glibc /sbin/ldconfig #Requires(postun): glibc /sbin/ldconfig #Requires(posttrans): glibc /sbin/ldconfig %if 0%{?unbundle_mathjax} Requires: mathjax >= 2.7.4 %else Provides: bundled(mathjax) = 2.7.4 %endif %if 0%{?unbundle_nodejs} Requires: nodejs Requires: nodejs-shelljs >= 0.5.1 Requires: nodejs-archiver >= 0.14.4 %else Provides: bundled(nodejs-shelljs) = 0.5.1 Provides: bundled(nodejs-archiver) = 0.14.4 %endif Provides: bundled(nodejs-codemirror) = 5.48.4 Provides: bundled(nodejs-adm-zip) = 0.4.7 Provides: bundled(jQuery) = 2.1.1 Provides: bundled(requireJS) = 2.3.5 %description Notepadqq is a text editor designed by developers, for developers. %prep #%%{autosetup} %setup -q -n "%{name}-%{pkgver}" %{__git} init %{__git} config user.email "notepadqq-owner@fedoraproject.org" %{__git} config user.name "Notepadqq owners" %{__git} add . %{__git} commit -m "base" -q #%%patch1 -p1 #%%{__git} commit -m "%%PATCH1_desc" -a #%%patch2 -p1 -b #%%{__git} commit -m "%%PATCH2_desc" -a %{__cat} %PATCH4 | %{__git} am #%%patch100 -p1 #%%{__git} commit -m "%PATCH100_desc" -a %{__mkdir} -p 'src/editor/libs/codemirror/mode/m4' %{__sed} -i -r "s!lib(/|[[:blank:]]|$)!%{_lib}\1!g" 'src/ui/ui.pro' if [[ "%{dir_metainfo}" != "metainfo" ]]; then %{__sed} -i -r "s!/metainfo/!/%{dir_metainfo}/!g" 'src/ui/ui.pro' fi %build %if 0%{?unbundle_mathjax} # Remove bundled MathJax %{__rm} -rf "%{_builddir}/%{name}-%{pkgver}/src/editor/libs/MathJax" %{__sed} -i -e '/cp -r libs\/MathJax/d' "%{_builddir}/%{name}-%{pkgver}/src/editor/Makefile" %endif %if 0%{?unbundle_nodejs} # Remove bundled archiver %{__rm} -rf "%{_builddir}/%{name}-%{pkgver}/src/extension_tools/node_modules/archiver" # Remove bundled shelljs %{__rm} -rf "%{_builddir}/%{name}-%{pkgver}/src/extension_tools/node_modules/shelljs" %{__rm} -f "%{_builddir}/%{name}-%{pkgver}/src/extension_tools/node_modules/.bin/shjs" %{__ln_s} "%{_bindir}/shjs" "%{_builddir}/%{name}-%{pkgver}/src/extension_tools/node_modules/.bin/shjs" %endif %if 0%{?devtoolset} # We need to disable exit on error temporarily for the following scripts: set +e source scl_source enable devtoolset-%{devtoolset} set -e %endif %{qmake_qt5} PREFIX="%{_prefix}" QMAKE_STRIP= DEFINES+=USE_DBUS LRELEASE=lrelease-qt5 *.pro %{make_build} %install %if 0%{?devtoolset} # We need to disable exit on error temporarily for the following scripts: set +e source scl_source enable devtoolset-%{devtoolset} set -e %endif %{make_install} INSTALL_ROOT="%{buildroot}" if [[ -d "%{buildroot}%{_libdir}/%{name}" && ! -d "%{buildroot}%{_libexecdir}/%{name}" ]]; then %{__install} -d "%{buildroot}%{_libexecdir}/" %{__mv} "%{buildroot}%{_libdir}/%{name}" "%{buildroot}%{_libexecdir}/" rmdir "%{buildroot}%{_libdir}" ||: fi %{__install} -d "%{buildroot}%{_mandir}/man1/" %{__install} -Dpm 0644 "support_files/manpage/%{name}.1"* -t "%{buildroot}%{_mandir}/man1/" %{__rm} -f "%{buildroot}%{_datadir}/icons/hicolor/icon-theme.cache" ||: %if 0%{?desktop_old} %{__sed} -i -r 's/^(Version=).*$/\11.0/' "%{buildroot}/%{_datadir}/applications/%{name}.desktop" %endif %check %{_bindir}/desktop-file-validate "%{buildroot}/%{_datadir}/applications/%{name}.desktop" %if ! (0%{?rhel} && 0%{?rhel} <= 6) %{_bindir}/appstream-util validate-relax --nonet "%{buildroot}%{_metainfodir}/%{name}.appdata.xml" %endif %post /bin/touch --no-create "%{_datadir}/icons/hicolor" &> /dev/null || : #/usr/bin/update-mime-database -n "%{_datadir}/mime" &> /dev/null || : /usr/bin/update-desktop-database &> /dev/null || : #/sbin/ldconfig %postun #if [[ "${1}" -eq "0" ]] ; then # /usr/bin/glib-compile-schemas "%{_datadir}/glib-2.0/schemas" &> /dev/null || : #fi /usr/bin/update-desktop-database &> /dev/null || : if [[ "${1}" -eq "0" ]] ; then /bin/touch --no-create "%{_datadir}/icons/hicolor" &> /dev/null || : /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &> /dev/null || : #/usr/bin/update-mime-database -n "%{_datadir}/mime" &> /dev/null || : fi #/sbin/ldconfig %posttrans #/usr/bin/glib-compile-schemas "%{_datadir}/glib-2.0/schemas" &> /dev/null || : /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &> /dev/null || : #update-mime-database -n %{_datadir}/mime &> /dev/null || : %files %doc *.md %license COPYING %{_bindir}/%{name} %{_libexecdir}/%{name}/%{name}-bin %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/*/apps/%{name}.*g %{_datadir}/%{name} %{_mandir}/man1/%{name}.1* %{_metainfodir}/%{name}.appdata.xml %changelog * Tue Oct 15 2019 Tomasz Tomasik - 2.0.0~beta-1 - Update to 2.0.0~beta - Fix XDG files - Add new icon theme - Improve icon handling - Enforce single instance using D-Bus - Rebuild for EL7 * Thu Sep 26 2019 Tomasz Tomasik - 1.9.99-1.20190921gitfdb59ad - Update to 1.9.99+git - Rebuild for EL7 * Thu Jun 28 2018 Tomasz Tomasik - 1.4.8-2.20180625gitf0042828 - Update to 1.4.8+git - Rebuild for EL7 * Thu Jun 28 2018 Tomasz Tomasik - 1.4.8-1 - Update to 1.4.8 - Rebuild for EL7 * Thu May 10 2018 Tomasz Tomasik - 1.4.4-7 - Fix typo in description - Rebuild for EL7 * Wed May 09 2018 Tomasz Tomasik - 1.4.4-6 - Fix build on EL7 - Rebuild for EL7 * Wed May 09 2018 Tomasz Tomasik - 1.4.4-5 - SPEC file cleanups - Use license macro - Update requirements - Update summary and description - Rebuild for EL7 * Tue May 08 2018 Huaren Zhong 1.4.4-4.1 - Rebuild for Fedora