Skip to content

Instantly share code, notes, and snippets.

@voodoonofx
Last active February 1, 2019 23:36
Show Gist options
  • Save voodoonofx/84bba511777e148a5999c8deff968292 to your computer and use it in GitHub Desktop.
Save voodoonofx/84bba511777e148a5999c8deff968292 to your computer and use it in GitHub Desktop.
# Build OIIO for Centos 7.4.1708 with:
# OpenEXR >= 2.0
# libTIFF >= 3.9
RUN yum -y install https://centos7.iuscommunity.org/ius-release.rpm && \
yum -y install gcc gcc-c++ make boost-devel cmake3 autoconf automake libtool SDL-devel && \
yum -y install unzip bzip2 git vim-enhanced tmux wget less tree && \
yum -y install python36u python36u-devel python36u-pip
# yum -y install libtiff-devel nasm && \
# System setups and pathing
RUN echo "/opt/co3/lib" > /etc/ld.so.conf.d/co3.conf && \
export PKG_CONFIG_PATH=/opt/co3/lib/pkgconfig && \
export C_INCLUDE_PATH=/opt/co3/include:/usr/include/opus \
export CXXFLAGS=-fPIC && \
export CFLAGS=-fPIC && ldconfig
### Build ilmbase, OpenEXR 2.2 and pyilmbase
# Build ilmbase into /opt/co3 (instead of /usr/local/lib)
RUN mkdir -p /tmp/openexr/ilmbase && cd /tmp/openexr/ilmbase && \
wget -O /tmp/openexr/ilmbase/ilmbase-2.2.0.tar.gz http://download.savannah.nongnu.org/releases/openexr/ilmbase-2.2.0.tar.gz && \
tar zxvf ilmbase-2.2.0.tar.gz && \
cd ilmbase-2.2.0 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 && make && make install && ldconfig
# Build OpenEXR 2.2 (2.3 requires updated cmake, boost. Gross.)
RUN yum -y install zlib-devel && \
mkdir -p /tmp/openexr/openexr && cd /tmp/openexr/openexr && \
wget -O /tmp/openexr/openexr/openexr-2.2.0.tar.gz http://download.savannah.nongnu.org/releases/openexr/openexr-2.2.0.tar.gz && \
tar zxvf openexr-2.2.0.tar.gz && \
cd openexr-2.2.0 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 && make && make install && ldconfig
### Build FFMPEG and all it's crazy dependencies
# Build libraw
RUN mkdir -p /tmp/ffmpeg/libraw &&cd /tmp/ffmpeg/libraw/ && \
wget -O /tmp/ffmpeg/libraw/libraw-0.19.2.tar.gz https://github.com/LibRaw/LibRaw/archive/0.19.2.tar.gz && \
tar zxvf libraw-0.19.2.tar.gz && \
cd LibRaw-0.19.2 && \
autoreconf --install && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 && make clean && make && make install && ldconfig
# Build libx264
RUN mkdir -p /tmp/ffmpeg/libx264 && cd /tmp/ffmpeg/libx264 && \
git clone https://git.videolan.org/git/x264.git && \
cd x264 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 --disable-asm --enable-static && make && make install && ldconfig
# Build libx265
RUN mkdir -p /tmp/ffmpeg/libx265 && cd /tmp/ffmpeg/libx265 && \
wget -O /tmp/ffmpeg/libx265/libx265-3.0.tar.gz https://github.com/videolan/x265/archive/3.0.tar.gz && \
tar zxvf libx265-3.0.tar.gz && cd x265-3.0/source && \
mkdir -p build && cd build && \
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=/opt/co3 .. && make && make install && ldconfig
#Build frei0r
RUN mkdir -p /tmp/ffmpeg/frei0r && cd /tmp/ffmpeg/frei0r && \
wget -O /tmp/ffmpeg/frei0r/frei0r-plugins-1.6.1.tar.gz https://files.dyne.org/frei0r/frei0r-plugins-1.6.1.tar.gz && \
tar zxvf frei0r-plugins-1.6.1.tar.gz && cd frei0r-plugins-1.6.1 && \
mkdir -p build && cd build && \
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=/opt/co3 .. && make && make install && ldconfig
#Build vis.stab (Stabilization)
RUN mkdir -p /tmp/ffmpeg/vid.stab && cd /tmp/ffmpeg/vid.stab && \
wget -O /tmp/ffmpeg/vid.stab/vid.stab.v1.1.0.tar.gz https://github.com/georgmartius/vid.stab/archive/v1.1.0.tar.gz && \
tar zxvf vid.stab.v1.1.0.tar.gz && cd vid.stab-1.1.0 && \
mkdir -p build && cd build && \
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=/opt/co3 .. && make && make install && ldconfig
# Build libOpus (CentOS 7 provides 1.0.2, requires at least 1.0.3)
RUN mkdir -p /tmp/ffmpeg/libopus && cd /tmp/ffmpeg/libopus && \
wget -O /tmp/ffmpeg/libopus/opus-1.3.tar.gz https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz && \
tar zxvf opus-1.3.tar.gz && cd opus-1.3 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 && make && make install && ldconfig
# Build libvpx (CentOS 7 provides 1.3.0, requires at least 1.4.0)
RUN yum -y install yasm-devel && \
mkdir -p /tmp/ffmpeg/libvpx && cd /tmp/ffmpeg/libvpx && \
wget -O /tmp/ffmpeg/libvpx/libvpx-v1.7.0.tar.gz https://github.com/webmproject/libvpx/archive/v1.7.0.tar.gz && \
tar zxvf libvpx-v1.7.0.tar.gz && cd libvpx-1.7.0 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 --enable-vp8 --enable-vp9 --enable-pic --enable-shared --enable-static \
--enable-realtime-only --enable-runtime-cpu-detect && make -j8 && make install && ldconfig
# Install giflib
RUN mkdir -p /tmp/OpenImageIO/giflib && cd /tmp/OpenImageIO/giflib && \
wget -O /tmp/OpenImageIO/giflib/giflib-5.1.4.tar.bz2 https://astuteinternet.dl.sourceforge.net/project/giflib/giflib-5.1.4.tar.bz2 && \
tar xvfj giflib-5.1.4.tar.bz2 && \
cd giflib-5.1.4 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 && make -j8 && make install && ldconfig
# Install WebP
RUN mkdir -p /tmp/OpenImageIO/webp && cd /tmp/OpenImageIO/webp && \
git clone https://chromium.googlesource.com/webm/libwebp && \
cd libwebp && \
mkdir -p build && cd build && \
cmake3 -DCMAKE_INSTALL_PREFIX:PATH=/opt/co3 .. && make -j8 && make install && ldconfig
# Build FFMpeg itself
RUN yum -y install freetype-devel cairo-devel gavl-devel libbluray-devel libbs2b-devel \
libcaca-devel opencv-devel tesseract-devel libvorbis-devel libxml2-devel openssl-devel
RUN mkdir -p /tmp/ffmpeg/ffmpeg && cd /tmp/ffmpeg/ffmpeg && \
wget -O /tmp/ffmpeg/ffmpeg/ffmpeg-4.1.tar.bz2 https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2 && \
tar xvjf ffmpeg-4.1.tar.bz2 && \
cd ffmpeg-4.1 && \
mkdir -p build && cd build && \
../configure --prefix=/opt/co3 \
--enable-gpl --enable-version3 --enable-nonfree \
--enable-frei0r --enable-libvidstab --enable-libbluray --enable-libfreetype \
--enable-libbs2b --enable-libcaca --enable-libopus --enable-libopencv --enable-libtesseract \
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxml2 \
--enable-openssl --enable-shared \
--enable-lto --enable-pic --enable-linux-perf && make -j8 && make install && ldconfig
### Build OpenImageIO/OpenColorIO
# First, build OpenColorIO
RUN yum -y install glew-devel python-devel
RUN mkdir -p /tmp/OpenImageIO/ocio && cd /tmp/OpenImageIO/ocio && \
wget -O /tmp/OpenImageIO/ocio/ocio-1.1.0.tar.gz https://github.com/imageworks/OpenColorIO/archive/v1.1.0.tar.gz && \
tar zxvf ocio-1.1.0.tar.gz && \
cd OpenColorIO-1.1.0 && \
mkdir -p build && cd build && \
# now, build it once for python2.7, then again for 3.6
cmake3 -DPYTHON=/usr/bin/python2.7 -DCMAKE_INSTALL_PREFIX:PATH=/opt/co3 .. && make -j8 && make install && \
cmake3 -DPYTHON=/usr/bin/python3.6 -DCMAKE_INSTALL_PREFIX:PATH=/opt/co3 .. && make -j8 && make install && \
ldconfig
# Now, build OpenImageIO
RUN yum -y install clang-devel bzip2-devel tbb-devel libtiff-devel libpng-devel libjpeg-devel jasper-devel qt5-qtbase-devel openjpeg-devel
RUN mkdir -p /tmp/OpenImageIO/oiio && cd /tmp/OpenImageIO/oiio && \
wget -O /tmp/OpenImageIO/oiio/oiio-Release-2.0.4.tar.gz https://github.com/OpenImageIO/oiio/archive/Release-2.0.4.tar.gz && \
tar zxvf oiio-Release-2.0.4.tar.gz && \
cd oiio-Release-2.0.4 && \
mkdir -p build && cd build && \
# now, build it once for python2.7, then again for 3.6
cmake3 -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \
-DPYTHON_LIBRARY=/usr/lib64/libpython2.7.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
-DUSE_fPIC=1 \
-DCMAKE_INSTALL_PREFIX:PATH=/opt/co3_py27 \
.. && \
make -j8 BUILDSTATIC=1 LINKSTATIC=1 VERBOSE=1 && make install && \
cmake3 -DPYTHON_EXECUTABLE=/usr/bin/python3.6 \
-DPYTHON_LIBRARY=/usr/lib64/libpython3.6m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \
-DUSE_fPIC=1 \
-DCMAKE_INSTALL_PREFIX:PATH=/opt/co3_py36 \
.. && \
make -j8 BUILDSTATIC=1 LINKSTATIC=1 VERBOSE=1 && make install && \
ldconfig
# Build pyilmbase 2.2.0 - Broken. Needed boost-python built for our python3.6 (yikes)
RUN cd /tmp/OpenImageIO/openexr && \
wget -O /tmp/OpenImageIO/openexr/pyilmbase-2.2.0.tar.gz http://download.savannah.gnu.org/releases/openexr/pyilmbase-2.2.0.tar.gz && \
tar zxvf pyilmbase-2.2.0.tar.gz && \
cd pyilmbase-2.2.0 && \
./configure --prefix=/opt/co3 && make && make install
-----------------------
yum install yum-plugin-downloadonly
yum install --downloadonly --downloaddir=<directory> <package>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment