Skip to content

Packaging of vFinance dependencies as rpm files

Notifications You must be signed in to change notification settings

v-finance/rpm-packages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites
=============

Packages for building RPMs (rpm-build, rpm-devel, rpmlint and rpmdevtools)
should already be installed on your workstation by ansible.


Building Packages
=================

A list of the available packages can be obtained using:

$ invoke list-packages

When building a package for the first time, it is necessary to install the build
dependencies:

$ invoke install-build-deps <package>

Next, the package can be build:

$ invoke build-package <package>
$ invoke build-package <package> --bundle-name=<bundle_name>

For example:

$ invoke build-package vortex-python3 --bundle-name=stable
$ invoke build-package vortex-qt5 --bundle-name=test


To build and install all packages, the following command can be used:

$ invoke build-all-packages	# requires sudo

To build all packages without sudo, mock can be used:

$ invoke mock-build-packages


Naming Conventions
==================

- Packages always have a bundle name (e.g. stable) associated with them.
- Package names start with the prefix "vortex-<bundle_name>-" (e.g. vortex-stable-).
  This helps to distinguish them from other packages provided by CentOS and
  vortex packages from other bundles.
- Packages are installed to the "/vortex/<target_triplet>/<bundle_name>" directory.
- See https://wiki.osdev.org/Target_Triplet for more information about the target
  triplet. Currently, the output of "gcc -dumpmachine" is used.


LD_LIBRARY_PATH
===============

Since packages are not installed to default locations, it is necessary to set the
LD_LIBRARY_PATH environment variable to make sure the correct libraries are used.
The dynamic libraries are always located in the
"/vortex/<target_triplet>/<bundle_name>/lib" directory.

Example:

$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/vortex/x86_64-redhat-linux/stable/lib"
$ ...


Dependencies Between Packages
=============================

PACKAGE			DEPENDS ON
vortex-openssl		-
vortex-qt5		-
vortex-python3		vortex-openssl
vortex-sip		vortex-openssl, vortex-python3, vortex-qt5
vortex-pyqt5		vortex-openssl, vortex-python3, vortex-qt5, vortex-sip


Setting the Bundle Name
=======================

If no bundle name is specified, a default name is used (currently stable).

To set the bundle name, the VORTEX_BUNDLE environment variable should be set when
building a package.

For example:

$ VORTEX_BUNDLE=feature-freeze invoke build-package vortex-python3


Updating the RPM Repository repodata
====================================

The packages are distributed using RPM repositories. The actual RPM binary files
are hosted on github as files associated with a specific release. To update a
package in the RPM repository, a new release for the rpm-packages github
repository should be made. The RPM files can be attached to this release as
downloadable assets.

Next, the RPM repository metadata should be updated. 

$ cd rpm-repository/vortex

Here, we assume that the rpm packages uploaded to github are placed in the
current (rpm-repository/vortex) directory. When running the createrepo command,
a baseurl pointing to the github release should be used:

$ createrepo --baseurl https://github.com/v-finance/rpm-packages/releases/download/<github_release>/ .

Replace <github_release> with the name used for the release on github and commit
the changes overwritting the previous repodata. You will now be able to install
the new version using yum/dnf.


MinGW Packages for Cross-Compilation
====================================

In order to build recent versions of Qt, a recent version of MinGW is required.
The version provided by CentOS 8 is too old. The version provided by Fedora 32
can be used but the packages need to be rebuild for CentOS 8.

Step 1: Download Fedora Source Packages
---------------------------------------

The source packages can be downloaded from:
https://download.fedoraproject.org/pub/fedora/linux/releases/32/Everything/source/tree/Packages/m/

The following fedora packages are needed to bootstrap GCC:

- mingw-filesystem
- mingw-binutils
- mingw-headers
- mingw-gcc
- mingw-crt
- mingw-winpthreads
- cloog

Next, additional packages provide the libraries:

- mingw-win-iconv
- mingw-termcap
- mingw-gettext
- mingw-pkg-config
- mingw-zlib
- mingw-openssl

The commands below assume all the source packages are in the present working
directory.

Step 2: Bootstrap GCC
---------------------

Most packages can be rebuild for CentOS using one command:

$ rpmbuild --rebuild <fedora_source_rpm>

However, due to a cyclic dependency between gcc, headers and winpthreads,
bootstrapping gcc is a bit more complicated. The steps below give an overview of
this process.

- build & install   filesystem
- build & install   binutils
- build & install   headers       with "%global bundle_dummy_pthread_headers 1"
- build & install   cloog         (build dependency of gcc)
- build & install   gcc           with "%global bootstrap 1" and "%global libgomp 0"
- build & install   crt
- build             winpthreads
- uninstall         gcc
- uninstall         headers
- install           winpthreads
- build & install   headers
- build & install   gcc


Step 2.1: mingw-filesystem and mingw-binutils
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ rpmbuild --rebuild mingw-filesystem-<version>.fc32.src.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/noarch/mingw-filesystem-base-<version>.el8.noarch.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/noarch/mingw32-filesystem-base-<version>.el8.noarch.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/noarch/mingw64-filesystem-base-<version>.el8.noarch.rpm

$ rpmbuild --rebuild mingw-binutils-<version>.fc32.src.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/mingw-binutils-generic-<version>.el8.x86_64.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/mingw32-binutils-<version>.el8.x86_64.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/mingw64-binutils-<version>.el8.x86_64.rpm

Step 2.2: Building mingw-headers for the First Time
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ # unpack source rpm
$ mkdir mingw-headers
$ cd mingw-headers
$ rpm2cpio ../mingw-headers-<version>.fc32.src.rpm | cpio -idmv

Edit the mingw-headers.spec file and replace:

	%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
	%global bundle_dummy_pthread_headers 0
	%else
	%global bundle_dummy_pthread_headers 1
	%endif

with:

	%global bundle_dummy_pthread_headers 1

$ cp *.patch ~/rpmbuild/SOURCES
$ cp *.tar.bz2 ~/rpmbuild/SOURCES
$ rpmbuild -bb mingw-headers.spec
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/mingw32-headers-<version>.el8.x86_64.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/mingw64-headers-<version>.el8.x86_64.rpm

Step 2.3: mingw-gcc Build Dependency cloog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ rpmbuild --rebuild cloog-<version>.fc32.src.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/cloog-<version>.el8.x86_64.rpm
$ sudo rpm -i ~/rpmbuild/RPMS/x86_64/cloog-devel-<version>.el8.x86_64.rpm

Step 2.4: Building mingw-gcc for the First Time
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ # unpack source rpm
$ mkdir mingw-gcc
$ cd mingw-gcc
$ rpm2cpio ../mingw-gcc-<version>.fc32.src.rpm | cpio -idmv

Edit the mingw-gcc.spec file and replace:

	%global bootstrap 0

	%global enable_libgomp 1

with:

	%global bootstrap 1

	%global enable_libgomp 0

$ cp *.tar.xz ~/rpmbuild/SOURCES
$ rpmbuild -bb mingw-gcc.spec
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw32-cpp-<version>.el8.x86_64.rpm 
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw32-gcc-<version>.el8.x86_64.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw32-gcc-c++-<version>.el8.x86_64.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw64-cpp-<version>.el8.x86_64.rpm 
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw64-gcc-<version>.el8.x86_64.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw64-gcc-c++-<version>.el8.x86_64.rpm

Step 2.5: Building mingw-crt and mingw-winpthreads
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ rpmbuild --rebuild mingw-crt-<version>.fc32.src.rpm
$ sudo rpm -i RPMS/mingw32-crt-<version>.el8.noarch.rpm
$ sudo rpm -i RPMS/mingw64-crt-<version>.el8.noarch.rpm

$ rpmbuild --rebuild mingw-winpthreads-<version>.fc32.src.rpm

Do not install mingw-winpthreads yet, it will conflict with the currently
installed mingw-headers.

Step 2.6: Uninstalling mingw-gcc and mingw-headers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ sudo rpm -e mingw32-gcc-c++ 
$ sudo rpm -e mingw32-gcc
$ sudo rpm -e mingw32-cpp
$ sudo rpm -e mingw64-gcc-c++ 
$ sudo rpm -e mingw64-gcc
$ sudo rpm -e mingw64-cpp
$ sudo rpm -e mingw32-headers 
$ sudo rpm -e mingw64-headers 

Step 2.7: Installing mingw-winpthreads
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ sudo rpm -i RPMS/mingw32-winpthreads-<version>.el8.noarch.rpm 
$ sudo rpm -i RPMS/mingw64-winpthreads-<version>.el8.noarch.rpm 

Step 2.8: Building final mingw-headers and mingw-gcc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ rpmbuild --rebuild mingw-headers-<version>.fc32.src.rpm 
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/noarch/mingw32-headers-<version>.el8.noarch.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/noarch/mingw64-headers-<version>.el8.noarch.rpm

$ rpmbuild --rebuild mingw-gcc-<version>.fc32.src.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw32-cpp-<version>.el8.x86_64.rpm 
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw32-gcc-<version>.el8.x86_64.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw32-gcc-c++-<version>.el8.x86_64.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw64-cpp-<version>.el8.x86_64.rpm 
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw64-gcc-<version>.el8.x86_64.rpm
$ sudo rpm -i /home/timvdm/rpmbuild/RPMS/x86_64/mingw64-gcc-c++-<version>.el8.x86_64.rpm

Step 3: Continue Building Packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Continue building/installing packages in this order: 

- mingw-win-iconv
- mingw-termcap
- mingw-gettext
- mingw-pkg-config
- mingw-zlib
- mingw-openssl