Compile latest GnuCash 3 source with latest AqBanking on CentOS 7 (PSD2 support)

Documentation date: 2019-09-18.

Again, this document is aimed at CentOS 7.

Purpose of these instructions is to set up a system that runs on the latest available source code. This will not be a stable release but a development build. Ideally, this will allow you to test the latest features. The intention is to install everything temporarily.

This setup will allow you to connect to your bank again using the latest FinTS/HBCI thanks to PSD2.

Let me know, if this article has helped you and/or saved you tons of time. I am also happy to hear any improvement suggestions (ws1909@bluhm-de.com)

Features: MySQL, Python Bindings

Activities:

- Install newer cmake
- Install later boost version
- Install lastest master Gwenhywfar for AqBanking
- Install latest master AqBanking for GnuCash
- Install latest maintenance GnuCash (master is not the latest one)

### Let's get going:

yum -y update
CPU_CORES=$((`nproc` - 1 | bc)) # This will use all but 1 CPU core in conjunction with make -j

# let's start with building cmake
cd /tmp
sudo yum -y install gcc-c++
CMAKE_VERSION=3.15.3
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz
tar xf cmake-${CMAKE_VERSION}.tar.gz
cd cmake-${CMAKE_VERSION}
./bootstrap && make && sudo make install

# Install boost 1.71
cd /tmp
sudo yum -y install gcc-c++ python-devel
wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2
tar xfj boost_*.tar.bz2
cd boost_*
./bootstrap.sh
./b2
sudo ./b2 install
export BOOST_ROOT=/tmp/boost_1_71_0


sudo yum -y install gnutls-devel libgcrypt-devel qt4-devel gtk2-devel qt5-qtbase-devel gcc gcc-c++ libtool automake autoconf

sudo yum remove gwenh*
cd /tmp
GWEN_VERSION=master
wget --content-disposition https://codeload.github.com/aqbanking/gwenhywfar/zip/${GWEN_VERSION}
unzip gwenhywfar-${GWEN_VERSION}
cd gwenhywfar-${GWEN_VERSION}
autoreconf -i
./configure --with-qt4-libs=/usr/lib64 --with-guis="qt4 gtk2 gtk3" #qt5
make -j${CPU_CORES}
sudo make install # installs gwenhywfar to /usr/lib/cmake/${GWEN_VERSION}
sudo ln -s /usr/include/gwenhywfar5/gwenhywfar /usr/include/gwenhywfar


AqBanking has several direct dependencies:
sudo yum install -y xmlsec1-gnutls-devel libtool-ltdl-devel xmlsec1-gnutls libtool-ltdl

cd /tmp
AQ_VERSION=master

wget --content-disposition https://codeload.github.com/aqbanking/aqbanking/zip/${AQ_VERSION}
unzip aqbanking-${AQ_VERSION}.zip
cd aqbanking-${AQ_VERSION}
export LD_LIBRARY_PATH=/usr/lib
autoreconf -i
./configure
make -j${CPU_CORES}
sudo make install

export PKG_CONFIG_PATH=/tmp/gwenhywfar-${GWEN_VERSION}:/tmp/aqbanking-${AQ_VERSION}

# Google Mock. You might not need it depending on GnuCash build:
GMOCK_VERSION=master
cd /tmp
wget --content-disposition https://codeload.github.com/google/googletest/zip/${GMOCK_VERSION}
unzip googletest-${GMOCK_VERSION}
export GTEST_ROOT=/tmp/googletest-${GMOCK_VERSION}

# now off to compile gnucash

cd /tmp
export GNUCASH_VERSION=maint
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # install EPEL
sudo yum -y install glib2-devel libxml2-devel libxslt-devel webkitgtk4-devel guile-devel gwenhywfar-devel aqbanking-devel ktoblzcheck-devel libofx-devel libsecret-devel libdbi-devel libdbi-dbd-mysql gtest-devel gmock-devel  iso-codes-devel python36-devel
# You have to use the git repo or CMake will fail. The repository information is required to add version information.
git clone https://github.com/Gnucash/gnucash.git
git checkout ${GNUCASH_VERSION}
mkdir build-gnucash-${GNUCASH_VERSION}
cd build-gnucash-${GNUCASH_VERSION}
/usr/local/bin/cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3.6 -DWITH_PYTHON=ON ../gnucash
make -j${CPU_CORES}
sudo make install/strip # strip removes all debug info on installing

sudo ln -s /usr/local/lib64/python3.6/site-packages/gnucash /usr/lib64/python3.6/site-packages/gnucash # Optional: do this if you want to use the python libraries in your custom code

# To start gnucash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
gnucash