File megasync.spec of Package megasync

Name:		megasync
Version:	4.9.4
Release:	%(cat MEGA_BUILD_ID || echo "1").1
Summary:	Easy automated syncing between your computers and your MEGA cloud drive
License:	Freeware
Group:		Applications/Others
Url:		https://mega.nz
Source0:	megasync_%{version}.tar.gz
Vendor:		MEGA Limited

BuildRequires:	pkgconfig(openssl)
BuildRequires:	pkgconfig(sqlite3)
BuildRequires:	pkgconfig(zlib)
BuildRequires:	autoconf
BuildRequires:	automake
BuildRequires:	libtool
BuildRequires:	gcc-c++
BuildRequires:	pkgconfig(libcares)
BuildRequires:	pkgconfig(cryptopp)
BuildRequires:	hicolor-icon-theme
BuildRequires:	unzip
BuildRequires:	wget
BuildRequires:	terminus-font
BuildRequires:	pkgconfig(Qt5Core)
BuildRequires:	pkgconfig(Qt5Widgets)
BuildRequires:	pkgconfig(Qt5Concurrent)
BuildRequires:	pkgconfig(Qt5Network)
BuildRequires:	pkgconfig(Qt5Svg)
BuildRequires:	pkgconfig(Qt5X11Extras)
BuildRequires:	pkgconfig(libcurl)
BuildRequires:	pkgconfig(libzen)
BuildRequires:	pkgconfig(libmediainfo)
BuildRequires:  pkgconfig(libraw)
BuildRequires:  pkgconfig(libsystemd)
%if 0%{?mageia}
BuildRequires:	qttools5
BuildRequires:	libstdc++-static-devel
BuildRequires:	fontpackages-filesystem
BuildRequires:  libgomp-devel
BuildRequires:  desktop-file-utils
%else
BuildRequires:	libqt5-qttools
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  libqt5-linguist
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  update-desktop-files
BuildRequires:  procps
%endif

Requires:	qtbase5-common >= 5.6

# allowing for rpaths (taken as invalid, as if they were not absolute paths when they are)
%if 0%{?mageia} > 8
%define __brp_check_rpaths QA_RPATHS=0x0002 /usr/lib/rpm/check-rpaths
%endif

%description
Secure:
Your data is encrypted end to end. Nobody can intercept it while in storage or in transit.

Flexible:
Sync any folder from your PC to any folder in the cloud. Sync any number of folders in parallel.

Fast:
Take advantage of MEGA's high-powered infrastructure and multi-connection transfers.

Generous:
Store up to 50 GB for free!

%prep
%setup -q

mega_build_id=`echo %{release} | sed "s/\.[^.]*$//" | sed "s/[^.]*\.//" | sed "s/[^0-9]//g"`
sed -i -E "s/USER_AGENT([^\/]*)\/(([0-9][0-9]*\.){3})(.*)\";/USER_AGENT\1\/\2${mega_build_id}\";/g" MEGASync/control/Preferences.cpp;
sed -i -E "s/BUILD_ID = ([0-9]*)/BUILD_ID = ${mega_build_id}/g" MEGASync/control/Preferences.cpp;

%build

export DESKTOP_DESTDIR=$RPM_BUILD_ROOT/usr

%define flag_disablemediainfo -i

./configure %{flag_disablemediainfo}

# Link dynamically with freeimage
ln -sfr $PWD/MEGASync/mega/bindings/qt/3rdparty/libs/libfreeimage*.so $PWD/MEGASync/mega/bindings/qt/3rdparty/libs/libfreeimage.so.3
ln -sfn libfreeimage.so.3 $PWD/MEGASync/mega/bindings/qt/3rdparty/libs/libfreeimage.so

%if 0%{?mageia}
%qmake_qt5 DESTDIR=%{buildroot}%{_bindir} THE_RPM_BUILD_ROOT=%{buildroot} QMAKE_RPATHDIR="/opt/mega/lib"
lrelease  MEGASync/MEGASync.pro
%else
qmake-qt5 DESTDIR=%{buildroot}%{_bindir} THE_RPM_BUILD_ROOT=%{buildroot} QMAKE_RPATHDIR="/opt/mega/lib"
lrelease-qt5  MEGASync/MEGASync.pro
%endif

make %{?_smp_mflags}

%install
%makeinstall DESTDIR=%{buildroot}%{_bindir}

%if 0%{?mageia}
desktop-file-install \
    --add-category="Network" \
    --dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/%{name}.desktop
%else
%suse_update_desktop_file -n -i %{name} Network System
%endif

mkdir -p  %{buildroot}/opt/mega/lib
install -D MEGASync/mega/bindings/qt/3rdparty/libs/libfreeimage.so.* %{buildroot}/opt/mega/lib

mkdir -p  %{buildroot}/etc/sysctl.d/
echo "fs.inotify.max_user_watches = 524288" > %{buildroot}/etc/sysctl.d/99-megasync-inotify-limit.conf

mkdir -p  %{buildroot}/etc/udev/rules.d/
echo "SUBSYSTEM==\"block\", ATTRS{idDevtype}==\"partition\"" > %{buildroot}/etc/udev/rules.d/99-megasync-udev.rules

%post
%if 0%{?mageia}
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%else
%desktop_database_post
%icon_theme_cache_post
%endif
sysctl -p /etc/sysctl.d/99-megasync-inotify-limit.conf

%postun
%if 0%{?mageia}
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/* &>/dev/null || :
fi
%else
%desktop_database_postun
%icon_theme_cache_postun
%endif
# kill running MEGAsync instance
killall megasync 2> /dev/null || true

%if 0%{?mageia}
%posttrans
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/* &>/dev/null || :
%endif

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%files
%defattr(-,root,root)
%doc MEGASync/mega/LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/megasync.desktop
%{_datadir}/icons/*
%{_datadir}/doc/megasync/*
/opt/*
%config %{_sysconfdir}/sysctl.d/99-megasync-inotify-limit.conf
%config %{_sysconfdir}/udev/rules.d/99-megasync-udev.rules
%exclude %{_datadir}/icons/ubuntu-mono-dark
%exclude %{_datadir}/icons/ubuntu-mono-dark/*

%changelog
* Fri Sep  6 2019 linux@mega.co.nz
- Update to version 4.2.5:
  * Fix sync issues on macOS 10.15
  * Fix transfer resumption issues for webclient and public links downloads
  * Fix a crash during processing of some PDF files
  * Resume pending transfers after a crash on next startup
  * Include option to add synchronizations from the main dialog
  * Other minor bug fixes and improvements
* Mon Aug 19 2019 linux@mega.co.nz
- Update to version 4.2.3:
  * Fix a crash during processing of some PDF files
  * Resume pending transfers after a crash on next startup
  * Include option to add synchronizations from the main dialog
  * Other minor bug fixes and improvements
* Thu May 16 2019 linux@mega.co.nz
- Update to version 4.1.1:
  * Improved look&feel for high resolution displays on Windows and Linux
  * Improved GUI performance during addition of many downloads
  * Restyling of initial information wizard, new icons and interface improvements
  * Support for business accounts
  * Other minor bug fixes and improvements"));
  * Enable thumbnail support for PDF
* Mon Feb  4 2019 linux@mega.co.nz
- Update to version 4.0.2:
  * Fix bug with selection of transfer manager items
  * Fix bug of context menu not shown over transfer manager items
  * New design for the main dialog
  * Improved setup assistant
  * Support to show Public Service Announcements
  * Modern notifications
  * Updated third-party libraries
  * Other minor bug fixes and improvements
* Wed Sep 12 2018 linux@mega.co.nz
- Update to version 3.7.1:
  * Support for multi-factor authentication
  * Security improvements for the registration of new accounts
  * Better performance for the upload of images
  * Creation of thumbnails and previews for RAW images
  * Improvements in the management of network connections
  * New logic to get external changes in the MEGA account
  * Other minor bug fixes and improvements
* Mon Aug 13 2018 linux@mega.co.nz
- Update to version 3.6.7:
  * Fixed communications with the webclient
* Wed May 23 2018 linux@mega.co.nz
- Update to version 3.6.6:
  * General Data Protection Regulation (GDPR) compliance
  * Updated translations
  * Bug fixes and other minor adjustments
* Wed May  2 2018 linux@mega.co.nz
- Update to version 3.6.5:
  * Allow to change the password
  * Improvements for the sync engine
  * Updated third-party libraries
  * Bug fixes and other minor adjustments
* Thu Jan 18 2018 linux@mega.co.nz
- Update to version 3.6.0:
  * New options related to file versioning
  * Local backup cleaning scheduler
  * Support for video thumbnails and metadata
  * Bug fixes and other minor improvements
* Mon Dec 11 2017 linux@mega.co.nz
- Update to version 3.5.3:
  * Integration with Finder (macOS 10.10+)
  * Faster scanning of files
  * Improved the management of deleted files
  * Bug fixes and other minor improvements
* Mon Nov 13 2017 linux@mega.co.nz
- Update to version 3.5:
  * New UI style
  * Support to generate file versions in MEGA
  * Integration with Finder (macOS 10.10+)
  * Allow to exclude specific files/folders
  * Bug fixes and other minor improvements
* Fri Jun 23 2017 linux@mega.co.nz
- Update to version 3.1.4:
  * Support for Apple File System (macOS High Sierra)
  * Allow to disable left pane icons in settings (Windows 10)
  * Updated translations
  * Bug fixes
* Fri May 12 2017 linux@mega.co.nz
- Update to version 3.1.2:
  * Better integration with Windows 10
  * Updated SSL certificate for communications with the web
  * Deprecated OS X versions prior to Mavericks
  * Bug fixes
* Mon Feb  6 2017 linux@mega.co.nz
- Update to version 3.0.1:
  * Transfer manager
  * Transfer speed control
  * Configurable number of connections per transfer
  * Improved the transfer speed
  * Reduced CPU usage during synchronization
  * Bug fixes
* Fri Nov 11 2016 linux@mega.co.nz
- Update to version 2.9.10:
  * Support to download/import folder links
  * Automatic HTTP/HTTPS proxy detection on OS X
  * Better compatibility with antivirus software
  * HDPI support for Linux distros having QT >= 5.6
  * Other bug fixes and minor improvements
* Mon Oct 17 2016 linux@mega.co.nz
- Update to version 2.9.9:
  * Fixed compatibility with some web browsers
  * Fixed the creation of thumbnails for JPG images (Windows)
  * Fixed incompatibilities with some WiFi drivers (Windows)
  * Fixed problems downloading files with incorrect metadata
  * Other bug fixes
* Wed Jul 20 2016 linux@mega.co.nz
- Update to version 2.9.8:
  * More efficient upload completion
  * Creation of new cryptographic keys
  * Upgrade to QT5 and VS2015 (Windows)
  * Bug fixes
* Tue May 31 2016 linux@mega.co.nz
- Update to version 2.9.5:
  * Save the state and resume transfers
  * Better management of errors during transfers
  * Compatibility with HDPI displays
  * Bug fixes
* Mon Apr 11 2016 linux@mega.co.nz
- Update to version 2.9.0:
  * Management of bandwidth quota for PRO users
  * New information dialog
  * ARM support (Raspberry Pi)
  * Bug fixes
* Wed Apr  6 2016 linux@mega.co.nz
- Update to version 2.8.0:
  * Check if public links have been already downloaded
  * Better management of communications with the webclient
  * Management of bandwidth quotas
  * Bug fixes
* Tue Mar  1 2016 linux@mega.co.nz
- Update to version 2.7.2:
  * Fixed the compilation. The previous version failed with some CPUs
* Sun Feb 21 2016 linux@mega.co.nz
- Update to version 2.7.1:
  * Allow to select hidden files and folders
  * Management of permissions (OS X, Linux)
  * Better management of HTTPS errors
  * Allow to use HTTPS connections only
  * Bug fixes
* Tue Jan 19 2016 linux@mega.co.nz
- Update to version 2.6.1:
  * Streaming from MEGA with a builtin HTTP proxy server
  * Fixed the automatic detection of the proxy (Win32)
  * More and better translations
  * Bug fixes
* Mon Jan  4 2016 linux@mega.co.nz
- Update to version 2.5.3:
  * Allow the usage of MEGAsync without being logged in
  * New network layer using cURL and c-ares (Win32)
  * Accessibility and SOCKS5 proxy support (Win32)
  * Bug fixes and improvements for the synchronization engine
* Thu Oct  8 2015 linux@mega.co.nz
- Update to version 2.3.1:
  * Inform about MITM attacks
  * Compatibility with OS X 10.11 El Capita
  * Improvements for the synchronization engine
  * Bug fixes
* Mon Aug 10 2015 linux@mega.co.nz
- Update to version 2.1.1:
  * Built with a custom version of QT that will allow us to debug crashes in QT libraries
  * List of allowed origins for webclient communications
  * Disable the crash handler when MEGAsync is being closed (to ignore crashes closing QT when the app exits)
  * Report events for new installations
openSUSE Build Service is sponsored by