FROM centos:5
ARG TDE_VERSION = 14 .1.1
ARG ARCH = x86_64
# Add local repositories
COPY packages /packages
RUN rpm -Uvh --force http://repo/repo/archives/centos/5/os/x86_64/CentOS/{ curl-7.15.5-17.el5_9,libidn-0.6.5-1.1} .x86_64.rpm \
&& echo "multilib_policy=best" >>/etc/yum.conf \
&& cd /etc/yum.repos.d \
&& rm -fv *.repo \
&& curl http://repo/repo/{ centos5,epel5,repoforge5} .repo >repos.repo \
&& rpm -e --nodeps --justdb libselinux \
&& yum -y update \
&& yum -y install $( </packages) || :
# Avoid conflict with gnome-screensaver
RUN setarch ${ ARCH } yum -y remove gnome-screensaver \
&& setarch ${ ARCH } yum -y install --disablerepo= "*" --enablerepo= "centos-extras" xscreensaver
# Updated build tools (not provided in centos5)
# Distro-specific patches
RUN rpm -Uvh http://xh61v/trinity/archives/el5/tools/RPMS/{ noarch/autoconf-2.63-5.el5.noarch,noarch/automake-1.11.1-4.el5.noarch,x86_64/m4-1.4.13-5.el5.x86_64} .rpm \
&& rpm -Uvh http://xh61v/trinity/archives/el5/trinity-14.0.4/RPMS/x86_64/trinity-poppler{ ,-devel} -0.12.4-1.el5.x86_64.rpm \
&& chmod a+r /usr/libexec/utempter/utempter \
&& sed -i "/usr/include/jasper/jas_math.h" -e " /#include <stdint.h>/ s| $|\n#ifndef SIZE_MAX\n#define SIZE_MAX ((size_t) -1)\n#endif\n| "
# Add non-root user to build packages
RUN useradd -m -s /bin/bash -u 1000 trinity \
&& echo "trinity ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
# Fix sudo running in docker
RUN sed -i "/etc/sudoers" -e "/requiretty/ s|^|#|"
# Use GCC 4.4 by default
RUN rm -f /usr/bin/gcc && ln -sf /usr/bin/gcc44 /usr/bin/gcc \
&& rm -f /usr/bin/g++ && ln -sf /usr/bin/g++44 /usr/bin/g++ \
&& rm -f /usr/bin/c++ && ln -sf /usr/bin/g++44 /usr/bin/c++
USER trinity
COPY rpmmacros /home/trinity/.rpmmacros
RUN mkdir -p ${ HOME } /rpmbuild/{ BUILD,BUILDROOT,SOURCES,SPECS,RPMS/noarch,RPMS/${ ARCH } ,SRPMS}
# Build development tools
RUN wget -nv -P /tmp http://vault.centos.org/6.10/os/Source/SPackages/cmake-2.8.12.2-4.el6.src.rpm \
&& rpm -ivh --nomd5 /tmp/cmake-2.8.12.2-4.el6.src.rpm \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/cmake.spec --without gui \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/cmake-2*.rpm \
&& rm -fv /tmp/*.src.rpm \
&& sudo sed -i "/usr/share/cmake/Modules/FindGTK2.cmake" -e "/GTK2_GIO/ s|^|#|"
RUN wget -nv -P /tmp http://vault.centos.org/6.10/os/Source/SPackages/binutils-2.20.51.0.2-5.48.el6.src.rpm \
&& rpm -ivh --nomd5 /tmp/binutils-2.20.51.0.2-5.48.el6.src.rpm \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/binutils.spec --nodeps \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/binutils{ ,-devel} -2*.rpm \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://archives.fedoraproject.org/pub/archive/epel/6/SRPMS/Packages/p/pcsc-perl-1.4.14-2.el6.src.rpm \
&& rpm -ivh --nomd5 /tmp/pcsc-perl-1.4.14-2.el6.src.rpm \
&& sed -i ${ HOME } /rpmbuild/SPECS/pcsc-perl.spec -e "s|%license|%doc|" -e " /URL:/ s| $|\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)| " \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/pcsc-perl.spec --define "__isa_bits 64" \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/pcsc-perl-1*.rpm \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://archives.fedoraproject.org/pub/archive/epel/6/SRPMS/Packages/s/sword-1.7.3-2.el6.src.rpm \
&& rpm -ivh --nomd5 /tmp/sword-1.7.3-2.el6.src.rpm \
&& sed -i ${ HOME } /rpmbuild/SPECS/sword.spec -e " /URL:/ s| $|\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)| " \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/sword.spec \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/sword{ ,-devel} -1*.rpm \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://vault.centos.org/6.10/os/Source/SPackages/gnuchess-5.07-14.1.el6.src.rpm \
&& rpm -ivh --nomd5 /tmp/gnuchess-5.07-14.1.el6.src.rpm \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/gnuchess.spec \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/gnuchess-5*.rpm \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://fr2.rpmfind.net/linux/epel/7/SRPMS/Packages/p/perl-PAR-1.015-4.el7.src.rpm \
&& rpm -ivh --nomd5 /tmp/perl-PAR-1.015-4.el7.src.rpm \
&& sed -i ${ HOME } /rpmbuild/SPECS/perl-PAR.spec -e "s|%license|%doc|" -e "/perl(AutoLoader)/ s|^|#|" -e " /URL:/ s| $|\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)| " -e "/^make test/ s|^|#|" \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/perl-PAR.spec \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/perl-PAR-1*.rpm \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://vault.centos.org/7.7.1908/os/Source/SPackages/perl-Module-ScanDeps-1.10-3.el7.src.rpm \
&& rpm -ivh --nomd5 /tmp/perl-Module-ScanDeps-1.10-3.el7.src.rpm \
&& sed -i ${ HOME } /rpmbuild/SPECS/perl-Module-ScanDeps.spec -e " /URL:/ s| $|\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)| " -e "/^make test/ s|^|#|" \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/perl-Module-ScanDeps.spec \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/perl-Module-ScanDeps-*.rpm \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://fr2.rpmfind.net/linux/epel/7/SRPMS/Packages/p/perl-PAR-Packer-1.041-2.el7.src.rpm \
&& rpm -ivh --nomd5 /tmp/perl-PAR-Packer-1.041-2.el7.src.rpm \
&& sed -i ${ HOME } /rpmbuild/SPECS/perl-PAR-Packer.spec -e "s|%license|%doc|" -e "/^make test/ s|^|#|" -e " /^Summary:/ s| $|\nGroup: Development/Languages| " -e " /URL:/ s| $|\nBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)| " -e "s|desktop-file-install|desktop-file-install --vendor=''|" \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/perl-PAR-Packer.spec --define "_unpackaged_files_terminate_build 0" \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/perl-PAR-Packer-1*.rpm --nodeps \
&& rm -fv /tmp/*.src.rpm
RUN wget -nv -P /tmp http://vault.centos.org/6.10/os/Source/SPackages/exempi-2.1.0-5.el6.src.rpm \
&& rpm -ivh --nomd5 /tmp/exempi-2.1.0-5.el6.src.rpm \
&& setarch ${ ARCH } rpmbuild -ba ${ HOME } /rpmbuild/SPECS/exempi.spec \
&& sudo rpm -Uvh ${ HOME } /rpmbuild/RPMS/*/exempi{ ,-devel} -2*.rpm \
&& rm -fv /tmp/*.src.rpm