Open 3D1T0R opened 7 years ago
@alex-ter: Would you mind either updating these instructions to reflect the way you currently build Toucan, or explaining (here, or on the PortableApps.com forums) how you compile Toucan, and I can use that information to rewrite the documentation (and hopefully to be able to compile Toucan)? Please.
Sure. Those instructions are completely out of date nowadays and I wanted to update those, so now that someone else is interested, that's probably the time :)
I wanted to help with #16, and actually came fairly close to your solution, but since I couldn't build Toucan, I couldn't test my attempts.
Yeah, it only makes sense to do that. Here's a very raw dump of my notes with minial editing, just to have something quick. If you're up to that, feel free to test them out as I've last touched them a year ago. They were written about four years ago, when I revived Toucan, but then I've refreshed them when reinstalling the environment last year, so you can see sometimes I noted several versions of the software that are "ok". Some of the requisites may not be available in those exact versions I installed then, so while my environment still works, installing a new may bring updates.
PREREQUISITES 1) Install Python (3.3.2 is ok, 3.4.3 is ok), check it's added to the PATH 2) install MinGW and add it to PATH use mingw-get-inst select "download latest repository catalogues" select C, C++ compiler, MSYS and DevKit settings alternatively install mingw from http://mingw-w64.org/doku.php/download/mingw-builds, add it to PATH (5.1.0 is ok) 3) Install CMake (2.8.11.2 is ok), add it to PATH 4) Download and build Google Test (1.6.0 is ok, 1.7.0 is ok) instructions are in the README use cmake or cmake-gui to generate the makefiles select "MinGW Makefiles" as generator, leave "Use default native compilers checked" select Release as the CMAKE_BUILD_TYPE set the gtest_disable_pthreads to ON, otherwise you'll get compilation errors (not necessary with MinGW 5.1.0) then cd to the "build" folder you've specified in cmake and compile with mingw32-make 5) Download SWIG for Windows (2.0.10 is ok, 3.0.5 is ok), it will contain a precompiled .exe file, just add the directory containing it into PATH after unpacking 6) Download and build the latest wxWidgets (only prior to 3.0, most probably, 2.9.5 is ok) first read the BuildSVN.txt in the root + docs/msw/install.txt generally just do the following cd wxwidgets-2.9.5\build\msw mingw32-make -f makefile.gcc
To have it compiled with mingw-w64 (gcc 5.1.0) the following patches are needed:
----------------------------------------------------------------------------
diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp
index 620d74b..cec2c85 100644
--- a/src/msw/dirdlg.cpp
+++ b/src/msw/dirdlg.cpp
@@ -105,11 +105,11 @@ struct IModalWindow : public IUnknown
#define FOS_FORCEFILESYSTEM 0x40
#endif
-struct COMDLG_FILTERSPEC;
+struct _COMDLG_FILTERSPEC;
struct IFileDialog : public IModalWindow
{
- virtual HRESULT wxSTDCALL SetFileTypes(UINT, const COMDLG_FILTERSPEC*) = 0;
+ virtual HRESULT wxSTDCALL SetFileTypes(UINT, const _COMDLG_FILTERSPEC*) = 0;
virtual HRESULT wxSTDCALL SetFileTypeIndex(UINT) = 0;
virtual HRESULT wxSTDCALL GetFileTypeIndex(UINT*) = 0;
virtual HRESULT wxSTDCALL Advise(IFileDialogEvents*, DWORD*) = 0;
----------------------------------------------------------------------------
build\msw\config.gcc
--------
# Standard flags for C++
- CXXFLAGS ?=
+ CXXFLAGS ?= -std=gnu++11
--------
7) Download and build Boost library (1.54 is ok, 1.58 is ok)
Unpack the zip file
Download and unpack the threadpool library (0.2.5 is ok) - http://threadpool.sourceforge.net/
contents of the boost subdir - into boost subdir of Boost
contents of the libs subdir - into libs subdir of Boost
Go to the directory tools\build\v2\ - for 1.54
Go to the directory tools\build\ - for 1.58
Instructions are here: http://www.boost.org/doc/libs/1_58_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary
Run "bootstrap.bat mingw"
Run .\b2 --prefix="E:\dev\tools\boost_1_54_0\boost.build" install
Add cd E:\dev\tools\boost_1_54_0
b2 --build-dir="E:\dev\tools\boost_1_54_0-build" toolset=gcc --build-type=complete stage
Compilation takes several hours, generally overnight
Remove path to boost.build from PATH
9) Download and build Lua (5.2.2 is ok, 5.3.0 is ok in prebuilt form)
unpack
for 5.3.0 apply the below to src\Makefile
- doesn't work, compiles fine, but cannot use afterwards, just use prebuilt
-------
- CC= gcc -std=gnu99
+ CC= g++ -std=gnu99
-------
in the root directory run "mingw32-make mingw" add the path to src subdir to PATH - not needed with prebuilt
10) Install Git client, e.g. from git-scm.com
11) Install Sphinx for docs generation
Download https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py somewhere (this is setuptools installer)
python ez_setup.py
Download https://raw.github.com/pypa/pip/master/contrib/get-pip.py (pip installer)
python get-pip.py
Make sure Scripts directory under your Python installation root is also in the PATH, after that you're done
pip install sphinx
BUILDING TOUCAN 1) Get the sources from https://github.com/PortableApps/Toucan 2) Run cmake on the directory, correct the variables as required 3) Set the BOOST_ROOT variable to the path to your Boost installation 4) Apply the below patch to threadpool library
--- dependencies/threadpool/include/threadpool/task_adaptors.hpp
+++ dependencies/threadpool/include/threadpool/task_adaptors.hpp
@@ -135,7 +135,11 @@
if(m_break_s > 0 || m_break_ns > 0)
{ // Sleep some time before first execution
xtime xt;
+#if BOOST_VERSION >= 105000
+ xtime_get(&xt, TIME_UTC_);
+#else
xtime_get(&xt, TIME_UTC);
+#endif
xt.nsec += m_break_ns;
xt.sec += m_break_s;
thread::sleep(xt);
@@ -146,7 +150,11 @@
if(m_break_s > 0 || m_break_ns > 0)
{
xtime xt;
+#if BOOST_VERSION >= 105000
+ xtime_get(&xt, TIME_UTC_);
+#else
xtime_get(&xt, TIME_UTC);
+#endif
xt.nsec += m_break_ns;
xt.sec += m_break_s;
thread::sleep(xt);
5) Add "-s" switch to the CXX_FLAGS_RELEASE variable (to have the debuginfo stripped during Release builds) 6) Run mingw32-make in the Toucan's build dir configured in CMake, that will build Toucan and put it into TOUCAN_OUTPUT_DIR directory (see CMake) 7) DOCS: cd to help directory and run "make.bat html ./build", that will generate the help files into the help/build/html dir 8) LANGUAGES: install PoEdit
Uh... that's a lot to take in...
Do you use Python for anything other than Sphinx? If not, I can vouch that Python 2.7 & 3.2 work fine.
Yes, there are quite a few prerequisites... Python is only used for Sphinx and yes, I think in this particular case the version is irrelevant.
Also, I was wondering: Have you tried building on Linux? (either building for Linux, or cross-compiling for Windows?)
I have tried cross-compiling, yes. There were some compilation errors, which I couldn't resolve after spending some time on that and after a while I just moved on.
Building for linux won't work as the code is noticeably Windows-oriented.
The previous (and original) maintainer of Toucan (Steve Lamerton) did a lot of work toward making it cross platform, and in particular able to be compiled for Linux. A few of the DevTests he released prior to moving on and leaving Toucan behind included a build for Linux, which could be extracted into an existing Windows installation of the same version, allowing it to be used on either platform. So... I would have to disagree with your last sentence. Even if it's not fully functional when built for Linux, it should be possible if done right (and admittedly, it may require some more fixes to get newer versions to build for Linux).
Ok, I didn't have this information and wasn't around at that time. I saw some mentions of "linux build", however there are no instructions on getting that one built. Code I had in mind is e.g. 7zip invocation in the Backup feature, which is plain Windows-style with backslashes as path separators.
And btw I'm not saying it couldn't be built, just that code changes are definitely required, after all most of the code is wxWidgets-based and that's cross-platorm "for free".
Well, fixing the documentation for compiling on & for Windows is the first step. We can try to get instructions for Linux builds and/or cross-compiling the Windows version from Linux figured out after.
The help section on compiling Toucan from source appears to be a bit out-of-date.
At the very least e6e87bdcfa794da3cf2795c5859508b37de916d7 appears to invalidate this section: https://github.com/PortableApps/Toucan/blob/273496e14f89f68b130b1071d5f270226c2f84dc/help/source/devel/compiling.txt#L32-L35 and this should be changed to point to the git repository on GitHub: https://github.com/PortableApps/Toucan/blob/273496e14f89f68b130b1071d5f270226c2f84dc/help/source/devel/compiling.txt#L8