Projects
home:gcomes.pmbs:dsnote
speechnote
speechnote.spec
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File speechnote.spec of Package speechnote (Revision 5)
Currently displaying revision
5
,
Show latest
# # spec file for package speechnote # # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %define aname dsnote %define __provides_exclude ^(libRHVoice.*\\.so.*|libaprilasr\\.so.*|libbergamot_api.*\\.so.*|libclblast\\.so.*|libespeak-ng\\.so.*|libkenlm\\.so.*|libonnxruntime\\.so.*|libstt\\.so.*|libtensorflowlite\\.so.*|libtflitedelegates\\.so.*|libvosk\\.so.*|libwhisper-.*\\.so.*)$ %define __requires_exclude ^(libRHVoice.*\\.so.*|libaprilasr\\.so.*|libbergamot_api.*\\.so.*|libclblast\\.so.*|libespeak-ng\\.so.*|libkenlm\\.so.*|libonnxruntime\\.so.*|libstt\\.so.*|libtensorflowlite\\.so.*|libtflitedelegates\\.so.*|libvosk\\.so.*|libwhisper-.*\\.so.*)$ %if 0%{?suse_version} < 1600 %define pythons python311 %define isLeap15 %nil %else %define pythons python3 %undefine isLeap15 %endif Name: speechnote Version: 4.6.1 Release: 0 Summary: App for note taking, reading and translating URL: https://github.com/mkiol/dsnote License: MPL-2.0 Group: Productivity/Office/Other Source: %aname-%version.tar.gz Source1: sourcetar.tar.gz #Source2: opencl-v2024.05.08-20240921.tar.xz Source3: clblast-1.2.0_rc1-20240921.tar.xz Source4: rhvoice-1.14.0-20240923.tar.zst Source5: bergamot-v0.3.1-20240923.tar.zst Source6: pythonmodules.tar.gz Source9: openfst.patch Source10: %name.rpmlintrc BuildRequires: cmake BuildRequires: gcc-c++ #BuildRequires: cmake(Qt5) BuildRequires: cmake(Qt5LinguistTools) #BuildRequires: cmake(Qt5Network) BuildRequires: cmake(Qt5Multimedia) BuildRequires: cmake(Qt5Xml) BuildRequires: cmake(Qt5Sql) #BuildRequires: cmake(Qt5DBus) BuildRequires: cmake(Qt5QuickControls2) BuildRequires: cmake(Qt5X11Extras) BuildRequires: extra-cmake-modules BuildRequires: pkgconfig(xkbcommon-x11) >= 1.6 BuildRequires: cmake(KF5DBusAddons) BuildRequires: git-core BuildRequires: %{python_module devel} BuildRequires: AppStream BuildRequires: libopenblas_pthreads-devel BuildRequires: libarchive-devel BuildRequires: fmt-devel BuildRequires: xz-devel BuildRequires: %{python_module pybind11-devel} BuildRequires: librubberband-devel BuildRequires: libvorbis-devel BuildRequires: ffmpeg-6-libavutil-devel BuildRequires: ffmpeg-6-libavcodec-devel BuildRequires: ffmpeg-6-libavformat-devel BuildRequires: ffmpeg-6-libavdevice-devel BuildRequires: libtag-devel BuildRequires: libnumbertext-devel BuildRequires: libmp3lame-devel #rnnoise openfst(vosk) espeak libnumbertext BuildRequires: libtool #whispercpp BuildRequires: ocl-icd-devel BuildRequires: openvino-devel #rhvoice %if %{defined isLeap15} BuildRequires: libboost_headers1_75_0-devel %else BuildRequires: libboost_headers-devel %endif BuildRequires: chrpath BuildRequires: dos2unix BuildRequires: fdupes #rubberband build #BuildRequires: meson BuildRequires: %{python_module pip} BuildRequires: %{python_module Cython0} BuildRequires: %{python_module wheel} BuildRequires: %{python_module six} BuildRequires: %{python_module Markdown} %if ! %{defined isLeap15} BuildRequires: %{python_module setuptools} BuildRequires: zstd %endif Recommends: %{name}-python-modules = %{version} %description Speech Note let you take, read and translate notes in multiple languages. It uses Speech to Text, Text to Speech and Machine Translation to do so. Text and voice processing take place entirely offline, locally on your computer, without using a network connection. https://lwn.net/Articles/987315/ %package python-modules Summary: Extra python modules Requires: %{name} = %{version} AutoReqProv: no %description python-modules Python modules for %name %prep %setup -q -n %{aname}-%{version} #do not download libsst sed -i '/DOWNLOAD/d' cmake/libstt.cmake #fst not found sed -i '/set(kaldi_flags/s@$@\n& set(vosk_flags "-O3 -I${external_include_dir}")@' cmake/vosk.cmake sed -i 's@=-O3@=${vosk_flags}@' cmake/vosk.cmake mkdir build external external/pythonsrc tar fx %SOURCE1 -C build #tar fx %%SOURCE2 -C external #( cd external/opencl ; ./restore-src.sh ; git checkout 4fdcfb0ae675f2f63a9add9552e0af62c2b4ed30 ) tar fx %SOURCE3 -C external ( cd external/clblast ; ./restore-src.sh ; git checkout e3ce21bb937f07b8282dccf4823e2acbdf286d17 ) sed -i '/GIT_REPOSITORY/d;/GIT_TAG/d;/GIT_SHALLOW/d' cmake/whispercpp.cmake #disable opencl sed -i '/Add(opencl/,/^[[:blank:]]*)/d;/configure opencl/d' cmake/whispercpp.cmake tar fx %SOURCE4 -C external ( cd external/rhvoice ; if [[ -f restore-src.sh ]]; then ./restore-src.sh ; git checkout 71a1a830d2d860688ffcbb0d27d4de260136d161 ; fi ) sed -i '/GIT_REPOSITORY/d;/GIT_TAG/d;/GIT_SHALLOW/d' cmake/rhvoice.cmake tar fx %SOURCE5 -C external ( cd external/bergamot ; if [[ -f restore-src.sh ]]; then ./restore-src.sh ; git checkout ada8c3922490cc6a507bcf81fa4882b435595323 ; fi ) mv external/bergamot external/bergamotfallback tar fx %SOURCE5 -C external ( cd external/bergamot ; if [[ -f restore-src.sh ]]; then ./restore-src.sh ; git checkout ada8c3922490cc6a507bcf81fa4882b435595323 ; fi ) sed -i '/GIT_REPOSITORY/d;/GIT_TAG/d;/GIT_SHALLOW/d' cmake/bergamot.cmake tar fx %SOURCE6 -C external/pythonsrc #neded for tumbleweed cp %SOURCE9 patches sed -i '/URL_MD5 .*openfst_checksum/s@$@\n PATCH_COMMAND patch --batch --unified -p1 --directory=<SOURCE_DIR>\n -i ${patches_dir}/openfst.patch ||\n echo "patch cmd failed, likely already patched"@' cmake/vosk.cmake sed -i 's@ffmpeg_avcoodec_LIBRARIES@ffmpeg_avcodec_LIBRARIES@' CMakeLists.txt #rpath /usr/share/dsnote/lib sed -i '/-rpath/s@/lib@/share/%{aname}&@' CMakeLists.txt #keep executable permission for libs sed -i '/install(.*lib.*\.so/s@install(FILES@install(PROGRAMS@' cmake/install_desktop.cmake %build YAMLSRC=$PWD/flatpak/python3-modules-x86-64.yaml [[ -f $YAMLSRC ]] FLATPAK_DEST=$PWD/build/external/python-modules MODSRCDIR=$PWD/external/pythonsrc export PKG_CONFIG_PATH=%{python_sitelib}/pybind11/share/pkgconfig %cmake \ -DCMAKE_BUILD_TYPE=Release \ -DWITH_DESKTOP=ON \ -DBUILD_WHISPERCPP_CUBLAS=OFF \ -DBUILD_WHISPERCPP_HIPBLAS=OFF \ -DBUILD_WHISPERCPP_OPENVINO=ON \ \ -DBUILD_OPENBLAS=OFF \ -DBUILD_LIBARCHIVE=OFF \ -DBUILD_XZ=OFF \ -DBUILD_FMT=OFF \ -DBUILD_RUBBERBAND=OFF \ -DBUILD_LIBNUMBERTEXT=OFF \ -DBUILD_PYBIND11=OFF \ -DBUILD_FFMPEG=OFF \ -DBUILD_TAGLIB=OFF \ -DBUILD_ESPEAK=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -Wno-dev %cmake_build modules=$(grep -Fe '- name:' $YAMLSRC | awk '{print $3}' | tr '\012' ' ') export PYTHONPATH=$FLATPAK_DEST/extensions/cpu/%{_lib}/python%{python_version}/site-packages:$FLATPAK_DEST/lib/python%{python_version}/site-packages:$FLATPAK_DEST/%{_lib}/python%{python_version}/site-packages for m in $modules ; do DSBUILDFLAGS= BUILDMOD=$PWD/python-modules mkdir $BUILDMOD pushd $MODSRCDIR >/dev/null modsrc=$(sed -n "/^ - name: $m\$/,/^ -/p" $YAMLSRC | sed -n "/^ sources:/,/^ [[:alpha:]]/p" | awk '$1=="url:"{print $2}' | sed 's@.*/@@;s@%2B@+@g' | tr '\012' ' ') ln $modsrc $BUILDMOD ref=$(sed -n "/^ - name: $m\$/,/^ -/p" $YAMLSRC | sed -n "/^ sources:/,/^ [[:alpha:]]/p" | grep "^ - \*" | sed 's@.*\*@@' | tr '\012' ' ') for n in $ref ; do ln $(sed -n "/\&$n/,/url:/p" $YAMLSRC | awk '$1=="url:"{print $2}' | sed 's@.*/@@;s@%2B@+@g') $BUILDMOD done popd >/dev/null pushd $BUILDMOD >/dev/null #build %if ! %{defined isLeap15} [[ $m = python3-mycroft_mimic3_tts ]] && DSBUILDFLAGS="CFLAGS=-Wno-error=incompatible-pointer-types" %endif eval $(sed -n "/^ - name: $m\$/,/^ -/p" $YAMLSRC | sed -n "/^ build-commands:/,/^ [[:alpha:]]/p" | grep -v '^ [[:alpha:]]' | grep -A4 'pip3 ' | tr -d '\012' | sed "s@- pip3 @$DSBUILDFLAGS pip3 @") #cleanup eval "$(sed -n "/^ - name: $m\$/,/^ -/p" $YAMLSRC | sed -n "/^ cleanup:/,/^ [[:alpha:]]/p" | grep -v '^ [[:alpha:]]' | sed 's@^[[:blank:]]*- @rm -rf $FLATPAK_DEST@')" popd >/dev/null rm -r $BUILDMOD done %install %cmake_install FLATPAK_DEST=$PWD/build/external/python-modules rm -r $FLATPAK_DEST/lib{,64}/python%{python_version}/site-packages/__pycache__ rm -r $FLATPAK_DEST/lib/python%{python_version}/site-packages/pypinyin/__pycache__ rm -r $FLATPAK_DEST/%{_lib}/python%{python_version}/site-packages/pandas/tests rm -r $FLATPAK_DEST/extensions/cpu/%{_lib}/python%{python_version}/site-packages/torch/{test,include} rm $FLATPAK_DEST/%{_lib}/python%{python_version}/site-packages/numpy/*/lib/lib*.a mkdir %buildroot%_datadir/%{aname}/python cp -r $FLATPAK_DEST/{extensions,lib{,64},share} %buildroot%_datadir/%{aname}/python find %buildroot%_datadir/%{aname}/python -name "*.so" -exec strip --strip-unneeded {} \; find %buildroot%_datadir/%{aname}/python -name "*.so.*" -exec strip --strip-unneeded {} \; find %buildroot%_datadir/%{aname}/python/extensions/cpu/%{_lib}/python%{python_version}/site-packages/torch -type f -perm -a+x -a ! -name "*.so.*" -exec strip --strip-unneeded {} \; chmod a-x %buildroot%_datadir/%{aname}/python/lib/python%{python_version}/site-packages/tensorboard/webfiles.zip rm %buildroot%_datadir/%{aname}/python/%{_lib}/python%{python_version}/site-packages/.gitignore %fdupes %buildroot%_datadir/%{aname}/python mv %buildroot%{_bindir}/%{aname} %buildroot%{_bindir}/%{aname}.exe echo -e '#!/bin/bash\n\nexport PYTORCH_TENSOREXPR=0\nexport QT_QUICK_CONTROLS_HOVER_ENABLED=1\nexport PYTHONPATH=${PYTHONPATH:+$PYTHONPATH:}%_datadir/%{aname}/python/extensions/cpu/%{_lib}/python%{python_version}/site-packages:%_datadir/%{aname}/python/lib/python%{python_version}/site-packages:%_datadir/%{aname}/python/%{_lib}/python%{python_version}/site-packages\nexec %{aname}.exe "$@"' >%buildroot%{_bindir}/%{aname} chmod a+x %buildroot%{_bindir}/%{aname} ln -s %aname %buildroot%{_bindir}/%{name} chrpath -r %_datadir/%{aname}/lib %buildroot%_datadir/%aname/bin/espeak-ng chrpath -r %_datadir/%{aname}/lib %buildroot%_datadir/%aname/lib/libstt.so dos2unix %buildroot%_datadir/%aname/share/uroman/bin/* chmod u+x %buildroot%_datadir/%aname/share/uroman/bin/*.pl export NO_BRP_CHECK_RPATH=true %files %{_bindir}/%{name} %{_bindir}/%{aname} %{_bindir}/%{aname}.exe %{_datadir}/applications/%{aname}.desktop %{_datadir}/dbus-1/services/%{aname}.service %{_datadir}/icons/hicolor/* %{_datadir}/metainfo/%{aname}.metainfo.xml %{_datadir}/%{aname} %exclude %{_datadir}/%{aname}/python %files python-modules %{_datadir}/%{aname}/python %changelog
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.