Menu

BuildOnWindows

Zane U. Ji

1. Prerequisites

MSYS2 makes building XML Copy Editor much easier:
1. Visit the home page of MSYS2, then follow the steps to install MSYS2.
2. Install the required packages listed below in MSYS2 shell.

pacman -S zlib aspell expat libiconv libxml2 libxslt pcre ${MINGW_PACKAGE_PREFIX}-wxWidgets ${MINGW_PACKAGE_PREFIX}-xerces-c ${MINGW_PACKAGE_PREFIX}-boost openssl curl

MSYS2 documents how to install a package here.
3. Then continue to Step 14.

Edit etc/fstab file of MSYS. Make sure "/mingw" points to the right directory where MinGW is installed. So I strongly recommend keeping two copies of MSYS for MinGW32 and MinGW64 if both 32-bit and 64-bit build are needed.

If MSYS is installed in D:\msys and MinGW is installed in D:\mingw32, append "D:\msys\bin,D:\mingw32\bin,D:\mingw32\i686-w64-mingw32\bin" to the PATH environment variable.

Then the MinGW console can be started with

D:\msys\bin\sh.exe --login

Drangon have created binary releases for some libraries listed below.

"--disable-nls" can be added to the configure command line if the localized messages are confusing.

2. zlib

Only needed if D:\mingw32\i686-w64-mingw32\lib\libz.dll.a doesn't exist.

INCLUDE_PATH=/mingw/i686-w64-mingw32/include LIBRARY_PATH=/mingw/i686-w64-mingw32/lib BINARY_PATH=/mingw/i686-w64-mingw32/bin make install -fwin32/Makefile.gcc SHARED_MODE=1

3. Aspell

./configure --prefix=/mingw/i686-w64-mingw32 && make install

4. expat

./configure --prefix=/mingw/i686-w64-mingw32 && make install

5. libiconv

./configure --prefix=/mingw/i686-w64-mingw32 && make install

6. libxml2

Please make sure that D:\mingw32\i686-w64-mingw32\lib\libz.dll.a exists before compiling libxml2. Otherwise, install zlib to avoid wired problems.

./configure --prefix=/mingw/i686-w64-mingw32 && make install
ln -s -t /mingw/i686-w64-mingw32/include libxml2/libxml

7. libxslt

./configure --prefix=/mingw/i686-w64-mingw32 && make install

8. pcre

./configure --prefix=/mingw/i686-w64-mingw32 --enable-unicode-properties --enable-newline-is-any
make install

9. wxWidgets

Apply patches.

cd wxWidgets-2.8.12/build/msw
mingw32-make -f makefile.gcc UNICODE=1 USE_GUI=1 USE_XRC=1 CPPFLAGS="-Wno-unused-local-typedefs -Wno-unused-value" CFG=32 VENDOR=xmci686 SHARED=0 BUILD=release

If SHARED=1, add "wxWidgets-2.8.12\lib\gcc_dll32" to the PATH environment variable.

Change CFG and VENDOR if it is a x64 build.

10. openssl (to support HTTPS - optional)

./configure shared --prefix=/mingw/i686-w64-mingw32 mingw && make install

11. cURL (to support HTTPS - optional)

./configure --prefix=/mingw/i686-w64-mingw32 --with-ca-bundle=curl-ca-bundle.crt
make install

Download cacert.pem and rename it to curl-ca-bundle.crt, which is the default file name used by curl.exe on Windows. curl.exe searches for that file in directories listed in PATH environment variable. But XML Copy Editor, libcurl actually, just search it in the current directory, which is specified at build time. So keep a copy of that file in XML Copy Editor directory. Or HTTPS won't work.

12. Xerces-C++

Apply patches. cURL is required to support HTTPS.

./configure --prefix=/mingw/i686-w64-mingw32 --disable-sse2
make install

13. Boost C++ Libraries

Download and unpack it. It doesn't need to be compiled.

14. Eclipse IDE for C/C++ Developers

Change the default encoding of text files to UTF-8. Click Window menu -> Preferences to open the Preferences dialog of Eclipse. Select General -> Workspace on the left, then click the radio button labeled "Others" on the right panel. Choose UTF-8 from the combo box, which is next to the radio button.

The project folder is src. Import the project into Eclipse. Then select the project and click Project menu -> Properties. In the pop up dialog, select C/C++ Build -> Build Variables on the left. Make sure the variables listed on the right are correct. Change them if they are not. Then select Environment, which is just below "Build Variables", on the left. Check the variables on the right as well.

Compile the project.

15. Inno Setup

The script file is src\xmlcopyeditor.iss. After it has been compiled, xmlcopyeditor-x.x.x.x-install.exe will be created.


Related

Wiki: Home