Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Compile FreeFileSync 10.1 on Fedora

How to compile FreeFileSync 10.1 on Fedora

Tested on Fedora 28

1. Install build dependencies.

dnf install -y boost-devel compat-wxGTK3-gtk2-devel gcc-c++ gtk+-devel gtk3-devel wxGTK-devel wxGTK3-devel

2. Fetch and extract source

wget --user-agent 'Firefox 60.0 (GNU/Linux) X11' -L https://www.freefilesync.org/download/FreeFileSync_10.1_Source.zip
mkdir 10.1
pushd 10.1; unzip ../FreeFileSync_10.1_Source.zip; popd

3. Prepare patch required to compile on Fedora.

pfile=FreeFileSync-10.1-1.fc28.patch
cat <<'EOF' > "${pfile}"
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/Makefile 10.1-0/FreeFileSync/Source/Makefile
--- 10.1/FreeFileSync/Source/Makefile   2018-06-03 04:27:00.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/Makefile 2018-06-07 22:44:44.919899060 -0400
@@ -5,15 +5,15 @@
 APPSHAREDIR = $(SHAREDIR)/$(APPNAME)
 DOCSHAREDIR = $(SHAREDIR)/doc/$(APPNAME)

-CXXFLAGS  = -std=c++17 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -isystem../../boost -include "zen/i18n.h" -include "zen/warn_static.h" \
+CXXFLAGS  = -std=c++17 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -isystem/usr/include/boost -include "zen/i18n.h" -include "zen/warn_static.h" \
 -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor \
 -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread

-LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -pthread
+LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread

 #Gtk - support recycler/icon loading/no button border/grid scrolling
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`

 #support for SELinux (optional)
 SELINUX_EXISTING=$(shell pkg-config --exists libselinux && echo YES)
@@ -125,5 +125,5 @@
    $(APPSHAREDIR)

    mkdir -p $(DOCSHAREDIR)
-   cp ../Build/Changelog.txt $(DOCSHAREDIR)/changelog
+   cp ../../Changelog.txt $(DOCSHAREDIR)/changelog
    gzip $(DOCSHAREDIR)/changelog
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/RealTimeSync/Makefile 10.1-0/FreeFileSync/Source/RealTimeSync/Makefile
--- 10.1/FreeFileSync/Source/RealTimeSync/Makefile  2018-06-03 04:27:00.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/RealTimeSync/Makefile    2018-06-07 22:20:59.043383931 -0400
@@ -6,11 +6,11 @@
 -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor \
 -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread

-LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -pthread
+LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread

 #Gtk - support "no button border"
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`

 CPP_FILES=
 CPP_FILES+=application.cpp
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/ui/main_dlg.cpp 10.1-0/FreeFileSync/Source/ui/main_dlg.cpp
--- 10.1/FreeFileSync/Source/ui/main_dlg.cpp    2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/ui/main_dlg.cpp  2018-06-07 22:25:32.856972097 -0400
@@ -11,6 +11,7 @@
 #include <zen/thread.h>
 #include <zen/shell_execute.h>
 #include <zen/perf.h>
+/* #include <zen/warn_static.h>  REMOVED FOR TESTING. Add back on any failures. */
 #include <wx/clipbrd.h>
 #include <wx/wupdlock.h>
 #include <wx/sound.h>
@@ -4844,7 +4845,7 @@
         globalCfg_.gui.lastUpdateCheck = 0; //reset to GlobalSettings.xml default value!

     m_menuItemCheckVersionAuto->Check(updateCheckActive(globalCfg_.gui.lastUpdateCheck));
-
+    /*
     if (shouldRunAutomaticUpdateCheck(globalCfg_.gui.lastUpdateCheck))
     {
         flashStatusInformation(_("Searching for program updates..."));
@@ -4852,6 +4853,7 @@
         automaticUpdateCheckEval(this, globalCfg_.gui.lastUpdateCheck, globalCfg_.gui.lastOnlineVersion,
                                  automaticUpdateCheckRunAsync(automaticUpdateCheckPrepare().get()).get());
     }
+    */
 }


@@ -4859,7 +4861,7 @@
 {
     //execute just once per startup!
     Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnRegularUpdateCheck), nullptr, this);
-
+    /*
     if (shouldRunAutomaticUpdateCheck(globalCfg_.gui.lastUpdateCheck))
     {
         flashStatusInformation(_("Searching for program updates..."));
@@ -4873,6 +4875,7 @@
                                      resultAsync.get()); //run on main thread:
         });
     }
+    */
 }


diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/ui/small_dlgs.cpp 10.1-0/FreeFileSync/Source/ui/small_dlgs.cpp
--- 10.1/FreeFileSync/Source/ui/small_dlgs.cpp  2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/ui/small_dlgs.cpp    2018-06-07 22:20:59.050384125 -0400
@@ -970,7 +970,8 @@
     //setMainInstructionFont(*m_staticTextMain);

     m_bitmapActivation->SetBitmap(getResourceImage(L"website"));
-    m_textCtrlOfflineActivationKey->ForceUpper();
+    // Fedora 27 does not have wxWidgets 3.1.1 yet. https://github.com/wxWidgets/wxWidgets/commit/69b66e9e2e2b8e49e3816acdde079686ce9b0da1
+    //m_textCtrlOfflineActivationKey->ForceUpper();

     m_textCtrlLastError           ->ChangeValue(lastErrorMsg);
     m_textCtrlManualActivationUrl ->ChangeValue(manualActivationUrl);
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/ui/version_check_impl.h 10.1-0/FreeFileSync/Source/ui/version_check_impl.h
--- 10.1/FreeFileSync/Source/ui/version_check_impl.h    2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/ui/version_check_impl.h  2018-06-07 22:20:59.051384152 -0400
@@ -14,7 +14,7 @@

 namespace fff
 {
-inline
+
 time_t getVersionCheckInactiveId()
 {
     //use current version to calculate a changing number for the inactive state near UTC begin, in order to always check for updates after installing a new version
@@ -38,7 +38,6 @@
 }


-inline
 time_t getVersionCheckCurrentTime()
 {
     return std::time(nullptr);
diff -x '*.orig' -x '*.rej' -Naur 10.1/wx+/grid.cpp 10.1-0/wx+/grid.cpp
--- 10.1/wx+/grid.cpp   2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/wx+/grid.cpp 2018-06-07 22:30:02.202436428 -0400
@@ -1169,7 +1169,9 @@
             {
                 if (overlapPix != 0)
                 {
-                    const double scrollSpeed = wnd_.ToDIP(overlapPix) * mouseDragSpeedIncScrollU; //unit: [scroll units / sec]
+                    // Fedora 28 does not have wxGTK 3.1.1 yet. This probably breaks HiDPI usage
+                    //const double scrollSpeed = wnd_.ToDIP(overlapPix) * mouseDragSpeedIncScrollU; //unit: [scroll units / sec]
+                    const double scrollSpeed = overlapPix * mouseDragSpeedIncScrollU; //unit: [scroll units / sec]
                     toScroll += scrollSpeed * deltaSecs;
                 }
                 else
EOF

A summary of what this patch does:

  • Ensure using the system boost library. It appears the source looks for a locally-bundled boost lib, which was not included with the 10.1 code.
  • Link to zlib because previous versions use to, and without I could not compile.
  • Compile against gtk+3 instead of gtk+2 because I could not get it to compile against gtk2.
  • Place the changelog text file where the Makefile expects.
  • Disable the check for updates and lines related to activation, particularly a few based on a newer version of wxWidgets which Fedora 28 does not have yet (wxWidgets 3.1.1).
  • Revert to an older version of the scrollSpeed calculation because wxWidgets 3.1.1 is not in Fedora yet.

4. Apply patch

cd 10.1
patch -p1 < ../FreeFileSync-10.1-1.fc28.patch

5. Compile and install

cd FreeFileSync/Source
make && sudo make install

Next steps

Build an rpm for FreeFileSync (gitlab)

References

Weblinks

  1. How-to: Build 10.* from Source (Linux Mint) (FreeFileSync forum)
  2. Compiling FreeFileSync 10.0 on Fedora (this blog)
  3. Compiling FreeFileSync on Fedora (this blog)
  4. AUR (en) - freefilesync

Comments