summaryrefslogtreecommitdiff
path: root/freefilesync/freefilesync.spec
blob: 2136e86ff24a6010033e73a8bdd21ac8a922fdb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Summary for CentOS 7 compilation of freefilesync:
# 1. city-fan repo (http://www.city-fan.org/ftp/contrib/yum-repo/) for newer libssh2
# 2. sclo for gcc 7.3.1
# 3. all sorts of custom patches to code in freefilesync.spec and some standalone patch files.
# 4. custom openssl 1.1.0-devel and -libs packages.
%global  pkgname FreeFileSync
%global  prog2name RealTimeSync
%global  dummy_package   0
%define scl_env %{nil}
%define scl_buildreq coreutils
%if 0%{?el6}%{?el7}
   %define scl_env devtoolset-7
   %define scl_buildreq devtoolset-7-toolchain
%endif
Name:       freefilesync
Version:    10.9
Release:    1%{?dist}
Summary:    A file synchronization utility

Group:      Applications/File
License:    GPLv3
URL:        http://www.freefilesync.org/
# upstream does not provide easy automatic downloads of the source, so use the mirror
#Source0:    http://www.freefilesync.org/download/%%{pkgname}_%%{version}_Source.zip
Source0:    https://gitlab.com/opensource-tracking/%{pkgname}/-/archive/%{version}/%{pkgname}-%{version}.tar.gz
Source1:    %{pkgname}.desktop
Source2:    %{prog2name}.desktop
Patch0:     ffs_makefile.patch
Patch1:     ffs_no_check_updates.patch
Patch2:     ffs_no_wx311.patch
Patch3:     ffs_fedora.patch
Patch4:     ffs_allow_parallel_ops.patch
Patch5:     ffs_old_libcurl.patch
Patch6:     ffs_sftp.patch
Patch7:     ffs_abi.patch

Packager:   B Stack <bgstack15@gmail.com>
# WARNING: the build will FAIL if you have wxGTK3-devel installed. Only wxGTK2-devel should be on the build system.
BuildRequires: boost-devel
BuildRequires: compat-wxGTK3-gtk2-devel
BuildRequires: desktop-file-utils
BuildRequires: gcc-c++
BuildRequires: ImageMagick
BuildRequires: libcurl-devel
BuildRequires: libssh2-devel
BuildRequires: openssl-devel
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(zlib)
%if 0%{?el6}%{?el7}
BuildRequires: wxGTK-devel
%endif
%if "%{?scl_env}" != ""
BuildRequires: %{scl_buildreq}
%endif
Requires:      hicolor-icon-theme

%description
FreeFileSync is a free Open Source software that helps you synchronize
files and synchronize folders for Windows, Linux and macOS. It is
designed to save your time setting up and running backup jobs while
having nice visual feedback along the way.

%prep
%setup -n %{pkgname}-%{version}

# fix text file line endings and permissions to unix
find . ! -type d \( -name '*.c' -o -name '*.cpp' -o -name '*.h' \) \
   -exec %{__sed} -i -r -e 's/\r$//' {} +

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%if "%{?scl_env}" != ""
      # everything minus the -fPIC got farther but failed asking for -fPIC
      # another option is to use the output of "wx-config --libs std, aui --debug=no" from fc28 and find the 3.0 libs and use those here.
   %{__sed} \
      -e 's|-O3 -DNDEBUG|& -I/usr/include/wx-3.0-gtk2 -I/usr/lib64/wx/include/gtk2-unicode-3.0-gtk2 -fPIC|;' \
      -e '/LINKFLAGS/s|-no-pie|& -I/usr/include/wx-3.0-gtk2 -I/usr/lib64/wx/include/gtk2-unicode-3.0-gtk2 -pthread   -lwx_gtk2u_aui-3.0-gtk2 -lwx_gtk2u_xrc-3.0-gtk2 -lwx_gtk2u_html-3.0-gtk2 -lwx_gtk2u_qa-3.0-gtk2 -lwx_gtk2u_adv-3.0-gtk2 -lwx_gtk2u_core-3.0-gtk2 -lwx_baseu_xml-3.0-gtk2 -lwx_baseu_net-3.0-gtk2 -lwx_baseu-3.0-gtk2|;' \
      -e 's|-O3 -DNDEBUG|-DNDEBUG -D"warn_static(arg)= " -DZEN_LINUX %{optflags}|g' \
      -e '/LINKFLAGS/s|-s|-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld %{__global_ldflags}|g' \
      -e '/LINKFLAGS/s|LINKLAGS\s*=\s*|&--static |;' \
      -i %{pkgname}/Source/Makefile %{pkgname}/Source/%{prog2name}/Makefile

   # old libcurl problems again, perhaps solved with http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
   #sed -r -e '/CURLE_WEIRD_SERVER_REPLY|CURLE_HTTP2|CURLE_NO_CONNECTION_AVAILABLE|CURLE_SSL_PINNEDPUBKEYNOTMATCH|CURLE_SSL_INVALIDCERTSTATUS|CURLE_RECURSIVE_API_CALL|CURLINFO_ACTIVESOCKET/s|^|//|;' \
   #   -i %{pkgname}/Source/fs/libcurl/curl_wrap.h

   # https://stackoverflow.com/questions/52567517/freefilesync-c-error-byte-is-not-a-member-of-std
   sed -i '1s/^/#include <cstddef>\n/' zen/serialize.h zen/ring_buffer.h

   # trying to use some openssl-devel from 1.1.0 to satisfy it, from city-fan?
   ## use openssl 1.0.2 on centos7
   #sed -r -e '/OPENSSL_VERSION_NUMBER/s|0x[0-9]+L|0x100020beL|;' \
   #   -i FreeFileSync/Source/fs/libssh2/*.cpp

%else
# only when not el6/el7
# custom build parameters for packaging application in rpm
   %{__sed} \
     -e 's|-O3 -DNDEBUG|-DNDEBUG -D"warn_static(arg)= " -DZEN_LINUX %{build_cxxflags}|g' \
     -e '/LINKFLAGS/s|-s|%{__global_ldflags}|g' \
     -i %{pkgname}/Source/Makefile %{pkgname}/Source/%{prog2name}/Makefile
%endif

%build
%if !%{dummy_package}
   %if "%{?scl_env}" != ""
      scl enable %{scl_env} /bin/bash << EOF
   %endif
   %make_build -C %{pkgname}/Source
   # turned off while building ffs for centos 7
   #%make_build -C %{pkgname}/Source/%{prog2name}
   %if "%{?scl_env}" != ""
EOF
   %endif
%endif

%install
%if !%{dummy_package}
# removed by upstream!
#%%make_install -C %%{pkgname}/Source
#%%make_install -C %%{pkgname}/Source/%%{prog2name}
pushd %{pkgname}/Build
install -d %{buildroot}%{_bindir} %{buildroot}%{_datadir}/%{name}
# turned off while building ffs for centos 7
#install -Dm 0755 -t %{buildroot}%{_bindir} Bin/%{pkgname} Bin/%{prog2name}
install -Dm 0755 -t %{buildroot}%{_bindir} Bin/%{pkgname}
cp -pr Languages %{buildroot}%{_datadir}/%{name}
install -Dm 0644 ding.wav gong.wav harp.wav Resources.zip styles.gtk_rc %{buildroot}%{_datadir}/%{name}
popd
%endif

# make extra sure the files are not marked with executable
find %{buildroot}%{_datadir}/%{name} -type f -exec chmod -x '{}' \; || :

# desktop files
mkdir -p %{buildroot}%{_datadir}/applications
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE1}
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE2}

# application start script
# none

# man pages
# none

# mimetypes
# none

# icons
unzip %{pkgname}/Build/Resources.zip %{pkgname}.png %{prog2name}.png

for res in 16 22 24 32 48 64 96 128 256 ;do
  dir=%{buildroot}%{_datadir}/icons/hicolor/${res}x${res}/apps
  mkdir -p ${dir}
  for icon in %{pkgname} %{prog2name} ;do
    convert ${icon}.png -filter Lanczos -resize ${res}x${res}  \
      ${dir}/${icon}.png
  done
done

%clean
%{__rm} -rf %{buildroot} || :

%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
update-desktop-database &> /dev/null || :

%preun
# is it a final removal?
#if test "$1" = "0" ;
#then
#fi   

%postun
update-desktop-database &> /dev/null || :
if test "$1" = "0" ;
then
   touch --no-create %{_datadir}/icons/hicolor &>/dev/null
   gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%files
%license %attr(444, -, -) License.txt
%doc %attr(444, -, -) Changelog.txt
%{_bindir}/%{pkgname}
# turned off while building ffs for centos 7
#%{_bindir}/%{prog2name}
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*x*/apps/*.png
%{_datadir}/%{name}
%ghost %config %attr(666, -, -) %{_datadir}/%{name}/GlobalSettings.xml

%changelog
* Tue Feb 12 2019 B Stack <bgstack15@gmail.com> - 10.9-1
- version bump
- add manual install that is now absent from upstream
- move datadir to lowercase name instead of camelcase

* Thu Jan 17 2019 B Stack <bgstack15@gmail.com> - 10.8-1
- version bump

* Tue Dec 18 2018 B Stack <bgstack15@gmail.com> - 10.7-1
- version bump

* Fri Nov 16 2018 B Stack <bgstack15@gmail.com> - 10.6-3
- version bump

* Tue Oct 16 2018 B Stack <bgstack15@gmail.com> - 10.5-1
- version bump

* Mon Sep 10 2018 B Stack <bgstack15@gmail.com> - 10.4-1
- version bump

* Wed Aug 29 2018 B Stack <bgstack15@gmail.com> - 10.3-3
- forked from phantomx release

* Fri Aug 17 2018 Phantom X <megaphantomx at bol dot com dot br> - 10.3-1
- 10.3
bgstack15