From 27f9e8d062a3ba2517b1b2f1ee9ec202f379f322 Mon Sep 17 00:00:00 2001
From: Andreas Romeyke <andreas.romeyke@slub-dresden.de>
Date: Wed, 31 Jul 2019 11:07:51 +0200
Subject: [PATCH] - added more comments - removed outdated code

---
 deploy_mediaconch/Dockerfile | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/deploy_mediaconch/Dockerfile b/deploy_mediaconch/Dockerfile
index 70402d8..5b98452 100644
--- a/deploy_mediaconch/Dockerfile
+++ b/deploy_mediaconch/Dockerfile
@@ -45,12 +45,14 @@ RUN useradd builder -u 1000 -m -G users,wheel && \
 USER builder
 RUN scl enable devtoolset-2 bash
 ENV FLAVOR=rpmbuild OS=centos DIST=el6 CC=/opt/rh/devtoolset-2/root/usr/bin/gcc CXX=/opt/rh/devtoolset-2/root/usr/bin/g++
+ENV CXXFLAGS="-O3"
 CMD /srv/pkg
 WORKDIR /home/builder/
 ENV DISTDIR=/home/builder/distribution/usr/local
 RUN mkdir -p $DISTDIR
 
 # get and compile libxml2, because RHEL uses outdated and errorneous version
+# we disabled python support and building static variants only
 RUN wget -np https://gitlab.gnome.org/GNOME/libxml2/-/archive/master/libxml2-master.tar.gz
 RUN tar xfz libxml2-master.tar.gz
 RUN cd libxml2-master && ./autogen.sh
@@ -65,6 +67,8 @@ RUN echo $PATH
 
 
 # get and compile libxslt, because RHEL uses outdated and errorneous version
+# the configure-script must be patched, because empty else branch somewhere
+# also we disabled python support and crypto  and building static variants only
 RUN wget -np https://gitlab.gnome.org/GNOME/libxslt/-/archive/master/libxslt-master.tar.gz
 RUN tar xfz libxslt-master.tar.gz
 RUN cd libxslt-master && ./autogen.sh
@@ -87,6 +91,7 @@ RUN cd libxslt-master && \
 
 # get and compile libzen
 RUN git clone https://github.com/MediaArea/ZenLib.git
+
 # next lines only usefull if mediaconch build with cmake
 #RUN cd ZenLib && \
 #    mkdir build &&\
@@ -94,6 +99,9 @@ RUN git clone https://github.com/MediaArea/ZenLib.git
 #    cmake ../Project/CMake -DCMAKE_INSTALL_PREFIX=$DISTDIR &&\
 #    make -j &&\
 #    make install
+
+# we patched autogen.sh and configure.ac because precedence of user settings is broken
+# also we building static variants only
 RUN cd ZenLib &&\
     cd Project/GNU/Library && \
     sed -e "s/-O2/-O3/g" -i autogen.sh && \
@@ -103,12 +111,12 @@ RUN cd ZenLib/Project/GNU/Library &&\
    ./configure --prefix=$DISTDIR  --disable-shared --enable-static &&\
     make -j &&\
     make install
-
 ENV ZenLibDir $DISTDIR
 
 
 # get and compile libmediainfo
 RUN git clone https://github.com/MediaArea/MediaInfoLib.git
+
 # next lines only usefull if mediaconch build with cmake
 #RUN cd MediaInfoLib &&\
 #    mkdir build &&\
@@ -116,6 +124,9 @@ RUN git clone https://github.com/MediaArea/MediaInfoLib.git
 #    cmake ../Project/CMake -DCMAKE_INSTALL_PREFIX=$DISTDIR &&\
 #    make -j &&\
 #    make install
+
+# we patched autogen.sh and configure.ac because precedence of user settings is broken
+# also we building static variants only
 RUN cd MediaInfoLib &&\
     cd Project/GNU/Library && \
     sed -e "s/-O2/-O3/g" -i autogen.sh && \
@@ -126,14 +137,18 @@ RUN cd MediaInfoLib/Project/GNU/Library/ &&\
     make -j &&\
     make install
 
-#ENV PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$DISTDIR/lib64/pkgconfig:$DISTDIR/lib/pkgconfig
-#run echo $PKG_CONFIG_PATH
+# because Mediaconch configure script expects libml2 and libxslt as hardcoded
+# names, we set symlinks
 RUN ln -s libxml2-master libxml2
 RUN ln -s libxslt-master libxslt
-RUN ls -lha
+
 # get and compile mediaconch
 RUN git clone https://github.com/MediaArea/MediaConch_SourceCode.git
     #cmake ../Project/CMake -DCMAKE_INSTALL_PREFIX=$DISTDIR &&\
+
+# we patched autogen.sh and configure.ac because precedence of user settings is broken
+# also we building static variants only
+# HINT: the -lrt switch is needed for RHEL6, because glibc is outdated
 RUN cd MediaConch_SourceCode &&\
     cd Project/GNU/CLI && \
     sed -e "s/-O2/-O3/g" -i autogen.sh && \
@@ -141,8 +156,6 @@ RUN cd MediaConch_SourceCode &&\
     ./autogen.sh
 RUN cd MediaConch_SourceCode/Project/GNU/CLI/ &&\
    ./configure --help
-RUN cd MediaConch_SourceCode/Project/GNU/CLI/ &&\
-fgrep --color -C 4 libxml2 configure
 RUN cd MediaConch_SourceCode/Project/GNU/CLI/ &&\
    CXXFLAGS="-O3 -I$DISTDIR/include -L/lib -L/lib64 -lrt -L$DISTDIR/lib -L$DISTDIR/lib64" \
    ./configure --prefix=$DISTDIR --without-sqlite --without-jansson\
@@ -155,5 +168,5 @@ RUN cd MediaConch_SourceCode/Project/GNU/CLI/ &&\
 RUN tree $DISTDIR
 RUN cd $DISTDIR/../../ && tar -cz -f /tmp/mediaconch.tgz *
 RUN ls -lha /tmp/
-
+RUN echo "Finished, in /tmp/mediaconch.tgz should be the binary found"
 
-- 
GitLab