Skip to content

Commit 3126712

Browse files
native-apiskvark
authored andcommitted
Don't build unused Qt features; use all cores (opencv#236)
* Don't build unused Qt features; use all cores * cmake does bootstrapping, too; comment unclear steps * Use Docker comment syntax * tab to space
1 parent 9f1a442 commit 3126712

File tree

2 files changed

+146
-130
lines changed

2 files changed

+146
-130
lines changed

docker/Dockerfile_i686

+74-66
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
FROM quay.io/pypa/manylinux1_i686:latest
22

33
RUN curl -O -L https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz && \
4-
tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \
5-
cd qt-everywhere* && \
6-
./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license && \
7-
gmake -j5 && \
8-
gmake install && \
9-
cd .. && \
10-
rm -rf qt-everywhere-opensource-src-4.8.7 && \
11-
rm qt-everywhere-opensource-src-4.8.7.tar.gz
4+
tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \
5+
cd qt-everywhere* && \
6+
#configure does a bootstrap make under the hood
7+
#manylinux1 is too old to have `nproc`
8+
export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \
9+
#OpenCV only links against QtCore, QtGui, QtTest
10+
./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license \
11+
-no-sql-sqlite -no-qt3support -no-xmlpatterns -no-multimedia \
12+
-no-webkit -no-script -no-declarative -no-dbus -make libs && \
13+
make && \
14+
make install && \
15+
cd .. && \
16+
rm -rf qt-everywhere-opensource-src-4.8.7 && \
17+
rm qt-everywhere-opensource-src-4.8.7.tar.gz
1218

1319
ENV QTDIR /opt/Qt4.8.7
1420
ENV PATH "$QTDIR/bin:$PATH"
1521

1622
RUN curl -O -L https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \
17-
tar -xf cmake-3.9.0.tar.gz && \
18-
cd cmake-3.9.0 && \
19-
true '#manylinux1 provides curl-devel equivalent and libcurl statically linked \
20-
against the same newer OpenSSL as other source-built tools \
21-
(1.0.2s as of this writing)' && \
22-
yum -y install zlib-devel && \
23-
./configure --system-curl && \
24-
make -j4 && \
25-
make install && \
26-
cd .. && \
27-
rm -rf cmake-3.9.0*
23+
tar -xf cmake-3.9.0.tar.gz && \
24+
cd cmake-3.9.0 && \
25+
#manylinux1 provides curl-devel equivalent and libcurl statically linked
26+
# against the same newer OpenSSL as other source-built tools
27+
# (1.0.2s as of this writing)
28+
yum -y install zlib-devel && \
29+
#configure does a bootstrap make under the hood
30+
export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \
31+
./configure --system-curl && \
32+
make && \
33+
make install && \
34+
cd .. && \
35+
rm -rf cmake-3.9.0*
2836

2937
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos#GettheDependencies
3038
# manylinux provides the toolchain and git; we provide cmake
@@ -33,69 +41,69 @@ RUN yum install freetype-devel bzip2-devel zlib-devel -y && \
3341

3442
# Newer openssl configure requires newer perl
3543
RUN curl -O -L https://www.cpan.org/src/5.0/perl-5.20.1.tar.gz && \
36-
tar -xf perl-5.20.1.tar.gz && \
37-
cd perl-5.20.1 && \
38-
./Configure -des -Dprefix="$HOME/openssl_build" && \
39-
true '#perl build scripts do much redundant work \
40-
if running "make install" separately' && \
41-
make install -j4 && \
42-
cd .. && \
43-
rm -rf perl-5.20.1*
44+
tar -xf perl-5.20.1.tar.gz && \
45+
cd perl-5.20.1 && \
46+
./Configure -des -Dprefix="$HOME/openssl_build" && \
47+
#perl build scripts do much redundant work
48+
# if running "make install" separately
49+
make install -j$(getconf _NPROCESSORS_ONLN) && \
50+
cd .. && \
51+
rm -rf perl-5.20.1*
4452

4553
RUN cd ~/ffmpeg_sources && \
46-
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
47-
tar -xf OpenSSL_1_1_1c.tar.gz && \
48-
cd openssl-OpenSSL_1_1_1c && \
49-
true '#in i686, ./config detects x64 in i686 without linux32 \
50-
when run from "docker build"' && \
51-
PERL="$HOME/openssl_build/bin/perl" linux32 ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
52-
make -j4 && \
53-
true '#skip installing documentation' && \
54-
make install_sw && \
54+
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
55+
tar -xf OpenSSL_1_1_1c.tar.gz && \
56+
cd openssl-OpenSSL_1_1_1c && \
57+
#in i686, ./config detects x64 in i686 container without linux32
58+
# when run from "docker build"
59+
PERL="$HOME/openssl_build/bin/perl" linux32 ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
60+
make -j$(getconf _NPROCESSORS_ONLN) && \
61+
#skip installing documentation
62+
make install_sw && \
5563
rm -rf ~/openssl_build
5664

5765
RUN cd ~/ffmpeg_sources && \
58-
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \
59-
tar -xf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
60-
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
61-
make -j4 && \
62-
make install
66+
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \
67+
tar -xf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
68+
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
69+
make -j$(getconf _NPROCESSORS_ONLN) && \
70+
make install
6371

6472
RUN cd ~/ffmpeg_sources && \
65-
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
66-
tar -xf yasm-1.3.0.tar.gz && \
67-
cd yasm-1.3.0 && \
68-
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
69-
make -j4 && \
70-
make install
73+
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
74+
tar -xf yasm-1.3.0.tar.gz && \
75+
cd yasm-1.3.0 && \
76+
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
77+
make -j$(getconf _NPROCESSORS_ONLN) && \
78+
make install
7179

7280
RUN cd ~/ffmpeg_sources && \
73-
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
74-
cd libvpx && \
75-
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
76-
make -j4 && \
77-
make install
81+
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
82+
cd libvpx && \
83+
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
84+
make -j$(getconf _NPROCESSORS_ONLN) && \
85+
make install
7886

7987
RUN cd ~/ffmpeg_sources && \
80-
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
81-
tar -xf ffmpeg-snapshot.tar.bz2 && \
82-
cd ffmpeg && \
83-
PATH=~/bin:$PATH && \
84-
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
85-
make -j4 && \
86-
make install && \
87-
echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
88-
ldconfig && \
89-
rm -rf ~/ffmpeg_sources
88+
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
89+
tar -xf ffmpeg-snapshot.tar.bz2 && \
90+
cd ffmpeg && \
91+
PATH=~/bin:$PATH && \
92+
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
93+
make -j$(getconf _NPROCESSORS_ONLN) && \
94+
make install && \
95+
echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
96+
ldconfig && \
97+
rm -rf ~/ffmpeg_sources
9098

9199
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig
92100
ENV LDFLAGS -L/root/ffmpeg_build/lib
93101

94102
RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \
95-
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
96-
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
97-
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
98-
mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
103+
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
104+
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
105+
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
106+
mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
99107

100108
#in i686, yum metadata ends up with slightly wrong timestamps
101109
#which inhibits its update

docker/Dockerfile_x86_64

+72-64
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
FROM quay.io/pypa/manylinux1_x86_64:latest
22

33
RUN curl -O -L https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz && \
4-
tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \
5-
cd qt-everywhere* && \
6-
./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license && \
7-
gmake -j5 && \
8-
gmake install && \
9-
cd .. && \
10-
rm -rf qt-everywhere-opensource-src-4.8.7 && \
11-
rm qt-everywhere-opensource-src-4.8.7.tar.gz
4+
tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \
5+
cd qt-everywhere* && \
6+
#configure does a bootstrap make under the hood
7+
#manylinux1 is too old to have `nproc`
8+
export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \
9+
#OpenCV only links against QtCore, QtGui, QtTest
10+
./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license \
11+
-no-sql-sqlite -no-qt3support -no-xmlpatterns -no-multimedia \
12+
-no-webkit -no-script -no-declarative -no-dbus -make libs && \
13+
make && \
14+
make install && \
15+
cd .. && \
16+
rm -rf qt-everywhere-opensource-src-4.8.7 && \
17+
rm qt-everywhere-opensource-src-4.8.7.tar.gz
1218

1319
ENV QTDIR /opt/Qt4.8.7
1420
ENV PATH "$QTDIR/bin:$PATH"
1521

1622
RUN curl -O -L https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \
17-
tar -xf cmake-3.9.0.tar.gz && \
18-
cd cmake-3.9.0 && \
19-
true '#manylinux1 provides curl-devel equivalent and libcurl statically linked \
20-
against the same newer OpenSSL as other source-built tools \
21-
(1.0.2s as of this writing)' && \
22-
yum -y install zlib-devel && \
23-
./configure --system-curl && \
24-
make -j4 && \
25-
make install && \
26-
cd .. && \
27-
rm -rf cmake-3.9.0*
23+
tar -xf cmake-3.9.0.tar.gz && \
24+
cd cmake-3.9.0 && \
25+
#manylinux1 provides curl-devel equivalent and libcurl statically linked
26+
# against the same newer OpenSSL as other source-built tools
27+
# (1.0.2s as of this writing)
28+
yum -y install zlib-devel && \
29+
#configure does a bootstrap make under the hood
30+
export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \
31+
./configure --system-curl && \
32+
make && \
33+
make install && \
34+
cd .. && \
35+
rm -rf cmake-3.9.0*
2836

2937
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos#GettheDependencies
3038
# manylinux provides the toolchain and git; we provide cmake
@@ -33,66 +41,66 @@ RUN yum install freetype-devel bzip2-devel zlib-devel -y && \
3341

3442
# Newer openssl configure requires newer perl
3543
RUN curl -O -L https://www.cpan.org/src/5.0/perl-5.20.1.tar.gz && \
36-
tar -xf perl-5.20.1.tar.gz && \
37-
cd perl-5.20.1 && \
38-
./Configure -des -Dprefix="$HOME/openssl_build" && \
39-
true '#perl build scripts do much redundant work \
40-
if running "make install" separately' && \
41-
make install -j4 && \
42-
cd .. && \
43-
rm -rf perl-5.20.1*
44+
tar -xf perl-5.20.1.tar.gz && \
45+
cd perl-5.20.1 && \
46+
./Configure -des -Dprefix="$HOME/openssl_build" && \
47+
#perl build scripts do much redundant work
48+
# if running "make install" separately
49+
make install -j$(getconf _NPROCESSORS_ONLN) && \
50+
cd .. && \
51+
rm -rf perl-5.20.1*
4452

4553
RUN cd ~/ffmpeg_sources && \
46-
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
47-
tar -xf OpenSSL_1_1_1c.tar.gz && \
48-
cd openssl-OpenSSL_1_1_1c && \
49-
PERL="$HOME/openssl_build/bin/perl" ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
50-
make -j4 && \
51-
true '#skip installing documentation' && \
52-
make install_sw && \
54+
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
55+
tar -xf OpenSSL_1_1_1c.tar.gz && \
56+
cd openssl-OpenSSL_1_1_1c && \
57+
PERL="$HOME/openssl_build/bin/perl" ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
58+
make -j$(getconf _NPROCESSORS_ONLN) && \
59+
#skip installing documentation
60+
make install_sw && \
5361
rm -rf ~/openssl_build
5462

5563
RUN cd ~/ffmpeg_sources && \
56-
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \
57-
tar -xf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
58-
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
59-
make -j4 && \
60-
make install
64+
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \
65+
tar -xf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
66+
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
67+
make -j$(getconf _NPROCESSORS_ONLN) && \
68+
make install
6169

6270
RUN cd ~/ffmpeg_sources && \
63-
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
64-
tar -xf yasm-1.3.0.tar.gz && \
65-
cd yasm-1.3.0 && \
66-
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
67-
make -j4 && \
68-
make install
71+
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
72+
tar -xf yasm-1.3.0.tar.gz && \
73+
cd yasm-1.3.0 && \
74+
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
75+
make -j$(getconf _NPROCESSORS_ONLN) && \
76+
make install
6977

7078
RUN cd ~/ffmpeg_sources && \
71-
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
72-
cd libvpx && \
73-
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
74-
make -j4 && \
75-
make install
79+
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
80+
cd libvpx && \
81+
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
82+
make -j$(getconf _NPROCESSORS_ONLN) && \
83+
make install
7684

7785
RUN cd ~/ffmpeg_sources && \
78-
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
79-
tar -xf ffmpeg-snapshot.tar.bz2 && \
80-
cd ffmpeg && \
81-
PATH=~/bin:$PATH && \
82-
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
83-
make -j4 && \
84-
make install && \
85-
echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
86-
ldconfig && \
87-
rm -rf ~/ffmpeg_sources
86+
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
87+
tar -xf ffmpeg-snapshot.tar.bz2 && \
88+
cd ffmpeg && \
89+
PATH=~/bin:$PATH && \
90+
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
91+
make -j$(getconf _NPROCESSORS_ONLN) && \
92+
make install && \
93+
echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
94+
ldconfig && \
95+
rm -rf ~/ffmpeg_sources
8896

8997
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig
9098
ENV LDFLAGS -L/root/ffmpeg_build/lib
9199

92100
RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \
93-
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
94-
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
95-
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
96-
mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
101+
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
102+
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
103+
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
104+
mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
97105

98106
ENV PATH "$HOME/bin:$PATH"

0 commit comments

Comments
 (0)