2018-11-10 13:09:13 +01:00
APR_VERSION := 1.6.5
APU_VERSION := 1.6.1
ARABICA_VERSION := 2016-January
2020-04-11 10:56:01 +02:00
BOOST_VERSION := 1.72.0
EXPAT_VERSION := 2.2.9
2020-09-15 18:37:18 +02:00
GETTEXT_VERSION := 0.20.1
2020-04-11 10:56:01 +02:00
ICONV_VERSION := 1.16
2018-11-10 13:09:13 +01:00
LIBCONFIG_VERSION := 1.7.2
LIBXML2_VERSION := 2.9.8
LOG4CXX_VERSION := 0.10.0
QT_VERSION := 4.5.3
QT2_VERSION := 5.6.3
XERCES_VERSION := 3.2.2
2020-04-11 10:56:01 +02:00
HOST := i686-w64-mingw32
2018-11-10 13:09:13 +01:00
BUILD := i386-linux
BASE = $( shell pwd )
PREFIX = $( BASE) /inst
2009-12-05 18:07:49 +01:00
PREFIX_FLAG = $( PREFIX) /.flag
2018-11-10 13:09:13 +01:00
ARCHIVE_DIR = $( BASE) /archives
BUILD_DIR = $( BASE) /build
WGET = wget -c -P $( ARCHIVE_DIR)
TAR = tar -C $( BUILD_DIR)
2008-01-19 20:33:08 +01:00
# XXX: Hardcoded for mingw on linux, at the moment
2020-04-11 10:56:01 +02:00
CC = $( HOST) -gcc
CXX = $( HOST) -g++
2008-01-19 20:33:08 +01:00
CPPFLAGS += -I$( PREFIX) /include
2020-04-11 10:56:01 +02:00
CONFIGURE = CC = " $( CC) " CXX = " $( CXX) " CPPFLAGS = " $( CPPFLAGS) " ./configure --host= $( HOST) --build= $( BUILD) --prefix= $( PREFIX) --enable-static --disable-shared
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
# Dependencies (incomplete list):
# expat <- apr <- apu <- log4cxx
2020-09-15 18:37:18 +02:00
LIBS := iconv gettext boost expat apr apu libconfig log4cxx arabica qt2
2018-11-10 13:09:13 +01:00
TARGETS = $( LIBS:%= .%)
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
.PHONY : help all clean clean -% distclean distclean -%
all : $( TARGETS )
# Remove the extracted directory and the marker flag
clean-% :
rm -rf $( $( shell echo $* | tr a-z A-Z) _DIR) .$*
# Also remove the archive
distclean-% : clean -%
rm -rf $( $( shell echo $* | tr a-z A-Z) _ARCHIVE)
clean : $( LIBS :%=clean -%)
distclean :
rm -rf $( PREFIX)
rm -rf $( ARCHIVE_DIR)
rm -rf $( BUILD_DIR)
2008-01-19 20:33:08 +01:00
2008-09-22 23:21:38 +02:00
help :
@echo "Usage: make all"
2008-01-19 20:33:08 +01:00
2009-12-05 18:07:49 +01:00
$(PREFIX_FLAG) :
2018-11-10 13:09:13 +01:00
mkdir -p $( PREFIX) $( ARCHIVE_DIR) $( BUILD_DIR)
2009-12-05 18:07:49 +01:00
touch $@
2008-01-19 20:33:08 +01:00
2009-09-26 10:15:31 +02:00
2018-11-10 13:09:13 +01:00
### APR (needed by log4cxx) ###
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
APR_DIR = $( BUILD_DIR) /apr-$( APR_VERSION)
APR_DIR_FLAG = $( APR_DIR) /.flag
APR_ARCHIVE = $( ARCHIVE_DIR) /apr-$( APR_VERSION) .tar.bz2
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
$(APR_ARCHIVE) : $( PREFIX_FLAG )
# $(WGET) http://www-eu.apache.org/dist/apr/$(shell basename $@)
$( WGET) http://archive.apache.org/dist/apr/$( shell basename $@ )
2009-09-26 10:15:31 +02:00
2018-11-10 13:09:13 +01:00
$(APR_DIR_FLAG) : $( APR_ARCHIVE )
$( TAR) -xjf $<
2009-12-05 18:07:49 +01:00
touch $@
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
.apr : $( APR_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( APR_DIR) \
&& patch -p0 < $( BASE) /apr-configure-hacks.patch \
&& patch -p0 < $( BASE) /apr-bugzilla-56342.patch \
&& $( CONFIGURE) \
&& make install)
2008-01-19 20:33:08 +01:00
touch $@
2018-11-10 13:09:13 +01:00
### APU (needed by log4cxx) ###
2011-01-16 22:41:38 +01:00
2018-11-10 13:09:13 +01:00
APU_DIR = $( BUILD_DIR) /apr-util-$( APU_VERSION)
APU_DIR_FLAG = $( APU_DIR) /.flag
APU_ARCHIVE = $( ARCHIVE_DIR) /apr-util-$( APU_VERSION) .tar.bz2
2011-01-16 22:41:38 +01:00
2018-11-10 13:09:13 +01:00
$(APU_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) http://www-eu.apache.org/dist/apr/$( shell basename $@ )
2011-01-16 22:41:38 +01:00
2018-11-10 13:09:13 +01:00
$(APU_DIR_FLAG) : $( APU_ARCHIVE )
$( TAR) -xjf $<
2011-01-16 22:41:38 +01:00
touch $@
2018-11-10 13:09:13 +01:00
.apu : $( APU_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( APU_DIR) \
&& $( CONFIGURE) --with-apr= $( PREFIX) \
&& make install)
2011-01-16 22:41:38 +01:00
touch $@
2012-04-28 15:31:21 +02:00
### Arabica ###
2011-01-16 22:41:38 +01:00
2018-11-10 13:09:13 +01:00
ARABICA_DIR = $( BUILD_DIR) /arabica-$( ARABICA_VERSION)
2012-04-28 15:31:21 +02:00
ARABICA_DIR_FLAG = $( ARABICA_DIR) /.flag
2018-11-10 13:09:13 +01:00
ARABICA_ARCHIVE = $( ARCHIVE_DIR) /$( ARABICA_VERSION) .tar.gz
2011-01-16 22:41:38 +01:00
2012-04-28 15:31:21 +02:00
$(ARABICA_ARCHIVE) : $( PREFIX_FLAG )
2018-11-10 13:09:13 +01:00
$( WGET) https://github.com/jezhiggins/arabica/archive/$( shell basename $@ )
2011-01-16 22:41:38 +01:00
2012-04-28 15:31:21 +02:00
$(ARABICA_DIR_FLAG) : $( ARABICA_ARCHIVE )
2018-11-10 13:09:13 +01:00
$( TAR) -xzf $<
2011-01-16 22:41:38 +01:00
touch $@
2012-04-28 15:31:21 +02:00
.arabica : $( ARABICA_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( ARABICA_DIR) \
&& autoreconf -i \
&& $( CONFIGURE) --with-parser= expat --with-expat= $( PREFIX) --with-boost= $( PREFIX) --with-tests= no --with-dom= no \
&& make install)
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
### Boost ###
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
BOOST_UNDERSCORE_VERSION = $( subst .,_,$( BOOST_VERSION) )
BOOST_DIR = $( BUILD_DIR) /boost_$( BOOST_UNDERSCORE_VERSION)
BOOST_DIR_FLAG = $( BOOST_DIR) /.flag
BOOST_ARCHIVE = $( ARCHIVE_DIR) /boost_$( BOOST_UNDERSCORE_VERSION) .tar.bz2
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
$(BOOST_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) https://dl.bintray.com/boostorg/release/$( BOOST_VERSION) /source/$( shell basename $@ )
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
$(BOOST_DIR_FLAG) : $( BOOST_ARCHIVE )
$( TAR) -xjf $<
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
# We don't build any library, because we don't need them (and it is really
# hard to cross-compile with their crappy build system)
.boost : $( BOOST_DIR_FLAG )
#(cd $(BOOST_DIR) && ./configure --prefix=$(PREFIX) && ./tools/jam/src/bin.linuxx86/bjam --toolset=gcc --prefix=$(PREFIX) --without-date_time --without-filesystem --without-graph --without-iostreams --without-program_options --without-python --without-regex --without-serialization --without-signals --without-test --without-thread --without-wave install)
cp -r $( BOOST_DIR) /boost $( PREFIX) /include
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
### Expat ###
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
EXPAT_UNDERSCORE_VERSION = $( subst .,_,$( EXPAT_VERSION) )
EXPAT_DIR = $( BUILD_DIR) /libexpat-R_$( EXPAT_UNDERSCORE_VERSION)
EXPAT_DIR_FLAG = $( EXPAT_DIR) /.flag
EXPAT_ARCHIVE = $( ARCHIVE_DIR) /R_$( EXPAT_UNDERSCORE_VERSION) .tar.gz
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
$(EXPAT_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) https://github.com/libexpat/libexpat/archive/$( shell basename $@ )
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
$(EXPAT_DIR_FLAG) : $( EXPAT_ARCHIVE )
$( TAR) -xzf $<
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
.expat : $( EXPAT_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( EXPAT_DIR) /expat \
&& ./buildconf.sh \
&& $( CONFIGURE) --without-xmlwf \
&& make install)
2012-04-28 15:31:21 +02:00
touch $@
2020-09-15 18:37:18 +02:00
### gettext ###
GETTEXT_DIR = $( BUILD_DIR) /gettext-$( GETTEXT_VERSION)
GETTEXT_DIR_FLAG = $( GETTEXT_DIR) /.flag
GETTEXT_ARCHIVE = $( ARCHIVE_DIR) /gettext-$( GETTEXT_VERSION) .tar.gz
$(GETTEXT_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) https://ftp.gnu.org/pub/gnu/gettext/$( shell basename $@ )
$(GETTEXT_DIR_FLAG) : $( GETTEXT_ARCHIVE )
$( TAR) -xzf $<
touch $@
.gettext : $( GETTEXT_DIR_FLAG )
( cd $( GETTEXT_DIR) \
&& $( CONFIGURE) --disable-java --disable-native-java --disable-relocatable --without-emacs --without-included-libxml \
&& make install)
touch $@
2018-11-10 13:09:13 +01:00
### iconv ###
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
ICONV_DIR = $( BUILD_DIR) /libiconv-$( ICONV_VERSION)
ICONV_DIR_FLAG = $( ICONV_DIR) /.flag
ICONV_ARCHIVE = $( ARCHIVE_DIR) /libiconv-$( ICONV_VERSION) .tar.gz
$(ICONV_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) https://ftp.gnu.org/pub/gnu/libiconv/$( shell basename $@ )
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
$(ICONV_DIR_FLAG) : $( ICONV_ARCHIVE )
$( TAR) -xzf $<
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
.iconv : $( ICONV_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( ICONV_DIR) \
&& $( CONFIGURE) \
&& make install)
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
### libconfig ###
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
LIBCONFIG_DIR = $( BUILD_DIR) /libconfig-$( LIBCONFIG_VERSION)
LIBCONFIG_DIR_FLAG = $( LIBCONFIG_DIR) /.flag
LIBCONFIG_ARCHIVE = $( ARCHIVE_DIR) /v$( LIBCONFIG_VERSION) .tar.gz
2012-04-28 15:31:21 +02:00
2018-11-10 13:09:13 +01:00
$(LIBCONFIG_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) https://github.com/hyperrealm/libconfig/archive/$( shell basename $@ )
$(LIBCONFIG_DIR_FLAG) : $( LIBCONFIG_ARCHIVE )
$( TAR) -xvf $<
touch $@
.libconfig : $( LIBCONFIG_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( LIBCONFIG_DIR) \
&& autoreconf -i \
&& patch -p0 < $( BASE) /libconfig++-ignore-docs.patch \
&& patch -p0 < $( BASE) /libconfig++-static-build.patch \
&& CFLAGS = -DLIBCONFIG_STATIC CXXFLAGS = -DLIBCONFIGXX_STATIC $( CONFIGURE) --disable-examples \
&& make install)
2018-11-10 13:09:13 +01:00
touch $@
### LibXML 2 ###
LIBXML2_DIR = $( BUILD_DIR) /libxml2-$( LIBXML2_VERSION)
LIBXML2_DIR_FLAG = $( LIBXML2_DIR) /.flag
LIBXML2_ARCHIVE = $( ARCHIVE_DIR) /libxml2-$( LIBXML2_VERSION) .tar.gz
$(LIBXML2_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) ftp://xmlsoft.org/libxml2/$( shell basename $@ )
$(LIBXML2_DIR_FLAG) : $( LIBXML 2_ARCHIVE )
$( TAR) -xzf $<
2012-04-28 15:31:21 +02:00
touch $@
2018-11-10 13:09:13 +01:00
# TODO: add more --without-xxx flags (apparently needed for build: pattern, debug)
# --with-legacy and --with-html are needed for arabica
.libxml2 : $( LIBXML 2_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( LIBXML2_DIR) \
&& $( CONFIGURE) --with-legacy --without-schematron --without-zlib --without-http --without-ftp --without-html --without-python --without-docbook --without-regexps \
&& make install)
2011-01-16 22:41:38 +01:00
touch $@
### log4cxx ###
2018-11-10 13:09:13 +01:00
LOG4CXX_DIR = $( BUILD_DIR) /apache-log4cxx-$( LOG4CXX_VERSION)
2011-01-16 22:41:38 +01:00
LOG4CXX_DIR_FLAG = $( LOG4CXX_DIR) /.flag
2018-11-10 13:09:13 +01:00
LOG4CXX_ARCHIVE = $( ARCHIVE_DIR) /apache-log4cxx-$( LOG4CXX_VERSION) .tar.gz
2011-01-16 22:41:38 +01:00
$(LOG4CXX_ARCHIVE) : $( PREFIX_FLAG )
2018-11-10 13:09:13 +01:00
$( WGET) http://www-eu.apache.org/dist/logging/log4cxx/$( LOG4CXX_VERSION) /$( shell basename $@ )
2011-01-16 22:41:38 +01:00
$(LOG4CXX_DIR_FLAG) : $( LOG 4CXX_ARCHIVE )
2018-11-10 13:09:13 +01:00
$( TAR) -xzf $<
2011-01-16 22:41:38 +01:00
touch $@
.log4cxx : $( LOG 4CXX_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( LOG4CXX_DIR) \
&& patch -p0 < $( BASE) /log4cxx-no-example.patch \
&& patch -p0 < $( BASE) /log4cxx-build-fixes.patch \
&& CXXFLAGS = -Wno-narrowing $( CONFIGURE) --with-apr= $( PREFIX) --with-apu= $( PREFIX) --with-apr-util= $( PREFIX) --disable-doxygen --disable-dot \
&& make install)
2011-01-16 22:41:38 +01:00
touch $@
2018-11-10 13:09:13 +01:00
### Qt ###
2008-09-22 23:21:38 +02:00
2018-11-10 13:09:13 +01:00
# FIXME: No automated way to build it at the moment :-(
QT_DIR = $( BUILD_DIR) /qt4-$( QT_VERSION) -win32-bin
QT_DIR_FLAG = $( QT_DIR) /.flag
QT_ARCHIVE = $( ARCHIVE_DIR) /qt4-$( QT_VERSION) -win32-bin.tar.bz2
2008-09-22 23:21:38 +02:00
2018-11-10 13:09:13 +01:00
$(QT_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) http://dl.sv.nongnu.org/releases-noredirect/eliot/other/$( shell basename $@ )
2009-09-26 10:15:31 +02:00
2018-11-10 13:09:13 +01:00
$(QT_DIR_FLAG) : $( QT_ARCHIVE )
$( TAR) -xjf $<
2009-12-05 18:07:49 +01:00
touch $@
2008-09-22 23:21:38 +02:00
2018-11-10 13:09:13 +01:00
.qt : $( QT_DIR_FLAG )
#(cd $<; mkdir -p $(PREFIX)/bin; mkdir -p $(PREFIX)/include; mkdir -p $(PREFIX)/lib/pkgconfig; rm -f $(PREFIX)/lib/pkgconfig/Qt*; sed 's,@@PREFIX@@,$(PREFIX),' lib/pkgconfig/QtCore.pc.in > $(PREFIX)/lib/pkgconfig/QtCore.pc; sed 's,@@PREFIX@@,$(PREFIX),' lib/pkgconfig/QtGui.pc.in > $(PREFIX)/lib/pkgconfig/QtGui.pc; cp -r include/* $(PREFIX)/include; cp lib/*a $(PREFIX)/lib; mkdir -p $(PREFIX)/share/qt4/translations; cp -r share/translations/* $(PREFIX)/share/qt4/translations)
( cd $( QT_DIR) ; cp -r bin include lib share $( PREFIX) ; sed 's,@@PREFIX@@,$(PREFIX),' $( PREFIX) /lib/pkgconfig/QtCore.pc.in > $( PREFIX) /lib/pkgconfig/QtCore.pc; sed 's,@@PREFIX@@,$(PREFIX),' lib/pkgconfig/QtGui.pc.in > $( PREFIX) /lib/pkgconfig/QtGui.pc; rm $( PREFIX) /lib/pkgconfig/*.in)
2008-09-22 23:21:38 +02:00
touch $@
2018-11-10 13:09:13 +01:00
QT2_DIR = $( BUILD_DIR) /qtbase-opensource-src-$( QT2_VERSION)
QT2_DIR_FLAG = $( QT2_DIR) /.flag
QT2_ARCHIVE = $( ARCHIVE_DIR) /qtbase-opensource-src-$( QT2_VERSION) .tar.xz
2008-09-22 23:21:38 +02:00
2018-11-10 13:09:13 +01:00
$(QT2_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) https://download.qt.io/official_releases/qt/5.6/$( QT2_VERSION) /submodules/$( shell basename $@ )
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
$(QT2_DIR_FLAG) : $( QT 2_ARCHIVE )
$( TAR) -xJf $<
2009-12-05 18:07:49 +01:00
touch $@
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
.qt2 : $( QT 2_DIR_FLAG )
( cd $( QT2_DIR) && CPPFLAGS = " $( PREFIX) /include " ./configure -xplatform win32-g++ -device-option CROSS_COMPILE = $( HOST) - --prefix= $( PREFIX) -static -opensource -confirm-license -release -no-pkg-config -no-gif -qt-libjpeg -no-openssl -no-opengl -no-dbus -no-qml-debug -no-audio-backend -no-sql-sqlite -no-sql-odbc -no-pch -no-compile-examples -nomake examples)
# Build
( cd $( QT2_DIR) && make)
# Fix .pc files to remove debug version (d)
( cd $( QT2_DIR) /lib/pkgconfig && for i in *.pc; do sed -i -e 's/d\.a/.a/g' -e 's/d $$/ /' $$ i; done )
# Fix Qt5Core.pc file to include qwindows (QWindowsIntegrationPlugin) and Qt5Platform Support
( cd $( QT2_DIR) /lib/pkgconfig; sed -i -e 's/ -lQt5Core/ -lqwindows -lQt5PlatformSupport -lQt5Core/g' Qt5Core.pc)
# Install
( cd $( QT2_DIR) && make install)
# Keep only the qwindows plugin
mv $( PREFIX) /plugins/platforms/libqwindows.a $( PREFIX) /lib/ && rm -rf $( PREFIX) /plugins
2008-01-19 20:33:08 +01:00
touch $@
2018-11-10 13:09:13 +01:00
### Xerces ###
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
XERCES_DIR = $( BUILD_DIR) /xerces-c-$( XERCES_VERSION)
XERCES_DIR_FLAG = $( XERCES_DIR) /.flag
XERCES_ARCHIVE = $( ARCHIVE_DIR) /xerces-c-$( XERCES_VERSION) .tar.gz
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
$(XERCES_ARCHIVE) : $( PREFIX_FLAG )
$( WGET) http://www-eu.apache.org/dist/xerces/c/3/sources/$( shell basename $@ )
2009-09-26 10:15:31 +02:00
2018-11-10 13:09:13 +01:00
$(XERCES_DIR_FLAG) : $( XERCES_ARCHIVE )
$( TAR) -xzf $<
2009-12-05 18:07:49 +01:00
touch $@
2008-01-19 20:33:08 +01:00
2018-11-10 13:09:13 +01:00
.xerces : $( XERCES_DIR_FLAG )
2020-04-11 10:56:01 +02:00
( cd $( XERCES_DIR) \
&& $( CONFIGURE) --disable-network \
&& make install)
2008-01-19 20:33:08 +01:00
touch $@