@@ -2,83 +2,139 @@ FROM lambci/lambda:build-ruby2.7
22
33WORKDIR /build
44
5- ARG VIPS_VERSION=8.9.1
6- ARG IMAGEQUANT_VERSION=2.12.6
5+ ARG VIPS_VERSION=8.9.2
76
8- ENV WORKDIR="/build"
9- ENV INSTALLDIR="/opt"
107ENV VIPS_VERSION=$VIPS_VERSION
11- ENV IMAGEQUANT_VERSION=$IMAGEQUANT_VERSION
8+ ENV PATH=/opt/bin:$PATH
9+ ENV LD_LIBRARY_PATH=/opt/lib:/opt/lib64:$LD_LIBRARY_PATH
10+ ENV PKG_CONFIG_PATH=/opt/lib/pkgconfig:/opt/lib64/pkgconfig
1211
1312# Setup Some Dirs
1413#
1514RUN mkdir -p \
1615 share/lib \
16+ share/lib64 \
1717 share/include
1818
19- # Install xpat
19+ # Install expat
2020#
21- RUN yum install -y expat-devel
21+ RUN curl https://codeload.github.com/libexpat/libexpat/zip/R_2_2_9 > libexpat-R_2_2_9.zip && \
22+ unzip libexpat-R_2_2_9.zip && \
23+ cd ./libexpat-R_2_2_9/expat && \
24+ ./buildconf.sh && \
25+ ./configure --prefix=/opt && \
26+ make install
2227
23- # Install libimagequant. Details: https://github.com/libvips/libvips/pull/1009
28+ RUN cp -a /opt/lib/libexpat.so* /build/share/lib
29+
30+ # Install libpng
31+ #
32+ RUN curl -L https://downloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz > libpng-1.6.37.tar.xz && \
33+ tar -xf libpng-1.6.37.tar.xz && \
34+ cd libpng-1.6.37 && \
35+ ./configure --prefix=/opt --disable-static && \
36+ make && \
37+ make install
38+
39+ RUN cp -a /opt/lib/libpng.so* /build/share/lib && \
40+ cp -a /opt/lib/libpng16.so* /build/share/lib
41+
42+ # Install giflib
43+ #
44+ RUN curl -L https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz > giflib-5.2.1.tar.gz && \
45+ tar -xf giflib-5.2.1.tar.gz && \
46+ cd giflib-5.2.1 && \
47+ make && \
48+ make PREFIX=/opt install
49+
50+ RUN cp -a /opt/lib/libgif.so* /build/share/lib
51+
52+ # Install libjpeg-turbo
53+ #
54+ RUN curl -L https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-2.0.4.tar.gz > libjpeg-turbo-2.0.4.tar.gz && \
55+ tar -xf libjpeg-turbo-2.0.4.tar.gz && \
56+ cd libjpeg-turbo-2.0.4 && \
57+ cmake -DCMAKE_INSTALL_PREFIX=/opt && \
58+ make && \
59+ make install
60+
61+ RUN cp -a /opt/lib64/libjpeg.so* /build/share/lib && \
62+ cp -a /opt/lib64/libturbojpeg.so* /build/share/lib
63+
64+ # Install libimagequant
2465#
25- RUN git clone git ://github.com/ImageOptim/libimagequant.git && \
66+ RUN git clone https ://github.com/ImageOptim/libimagequant.git && \
2667 cd ./libimagequant && \
27- git checkout "${IMAGEQUANT_VERSION}" && \
28- CC=clang CXX=clang++ ./configure --prefix=/opt && \
68+ git checkout 2.12.6 && \
69+ ./configure --prefix=/opt && \
2970 make libimagequant.so && \
3071 make install && \
3172 echo /opt/lib > /etc/ld.so.conf.d/libimagequant.conf && \
3273 ldconfig
33- RUN cp -a $INSTALLDIR/lib/libimagequant.so* $WORKDIR/share/lib/ && \
34- cp -a $INSTALLDIR/include/libimagequant.h $WORKDIR/share/include/
3574
75+ RUN cp -a /opt/lib/libimagequant.so* /build/share/lib/ && \
76+ cp -a /opt/include/libimagequant.h /build/share/include/
3677
37- # Install deps for libvips. Details: https://libvips.github.io/libvips/install.html
78+ # Install libvips. Primary deps https://libvips.github.io/libvips/install.html
3879#
3980RUN yum install -y \
40- gtk-doc \
41- gobject-introspection \
42- gobject-introspection-devel
81+ gtk-doc \
82+ ninja-build
4383
44- # Clone repo and checkout version tag.
45- #
46- RUN git clone git://github.com/libvips/libvips.git && \
47- cd libvips && \
48- git checkout "v${VIPS_VERSION}"
84+ RUN pip3 install meson && \
85+ pip3 install ninja
86+
87+ RUN curl -L http://ftp.gnome.org/pub/gnome/sources/glib/2.64/glib-2.64.2.tar.xz > glib-2.64.2.tar.xz && \
88+ tar -xf glib-2.64.2.tar.xz && \
89+ cd glib-2.64.2 && \
90+ mkdir ./_build && \
91+ cd ./_build && \
92+ meson --prefix=/opt .. && \
93+ ninja && \
94+ ninja install
4995
50- # Compile from source.
96+ RUN cp -a /opt/lib64/libffi.so* /build/share/lib && \
97+ cp -a /opt/lib64/libglib-2.0.so* /build/share/lib && \
98+ cp -a /opt/lib64/libgmodule-2.0.so* /build/share/lib && \
99+ cp -a /opt/lib64/libgobject-2.0.so* /build/share/lib && \
100+ cp -a /opt/lib64/libgthread-2.0.so* /build/share/lib
101+
102+ RUN curl -L http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/1.64/gobject-introspection-1.64.1.tar.xz > gobject-introspection-1.64.1.tar.xz && \
103+ tar -xf gobject-introspection-1.64.1.tar.xz && \
104+ cd gobject-introspection-1.64.1 && \
105+ mkdir ./_build && \
106+ cd ./_build && \
107+ meson --prefix=/opt .. && \
108+ ninja && \
109+ ninja install
110+
111+ # Install libvips.
51112#
52- RUN cd ./libvips && \
53- CC=clang CXX=clang++ \
54- IMAGEQUANT_CFLAGS="-I/opt/include" \
55- IMAGEQUANT_LIBS="-L/opt/lib -limagequant" \
56- ./autogen.sh \
57- --prefix=${INSTALLDIR} \
58- --disable-static && \
59- make install && \
60- echo /opt/lib > /etc/ld.so.conf.d/libvips.conf && \
61- ldconfig
62-
63- # Copy only needed so files to new share/lib.
113+ RUN curl -L https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.gz > vips-${VIPS_VERSION}.tar.gz && \
114+ tar -xf vips-${VIPS_VERSION}.tar.gz && \
115+ cd vips-${VIPS_VERSION} && \
116+ ./configure \
117+ --prefix=/opt \
118+ --disable-gtk-doc \
119+ --without-magick \
120+ --with-expat=/opt && \
121+ make && \
122+ make install && \
123+ echo /opt/lib > /etc/ld.so.conf.d/libvips.conf && \
124+ ldconfig
125+
126+ RUN cp -a /opt/lib/libvips.so* /build/share/lib
127+
128+ # Store the VIPS_VERSION variable in a file, accessible to the deploy script.
64129#
65- RUN mkdir -p share/lib && \
66- cp -a $INSTALLDIR/lib/libvips.so* $WORKDIR/share/lib/
67-
68- # Copy glib and gobject with their deps over.
69- RUN cd ./share/lib/ && \
70- cp /usr/lib64/libglib-2.0* . && \
71- cp /usr/lib64/libgobject-2.0* . && \
72- cp /usr/lib64/libgthread-2.0* . && \
73- cp /usr/lib64/libgmodule-2.0* . && \
74- cp /usr/lib64/libexpat* . && \
75- ldconfig
130+ RUN echo $VIPS_VERSION > "./share/VIPS_VERSION"
76131
77- # Zip up contents so final `lib` can be placed in /opt layer .
132+ # Create an /opt/lib64 symlink for linked objects .
78133#
79134RUN cd ./share && \
80- zip --symlinks -r libvips.zip .
135+ ln -s /opt/lib /opt/lib64
81136
82- # Store the VIPS_VERSION variable in a file, accessible to the deploy script .
137+ # Zip up contents so final `lib` can be placed in /opt layer .
83138#
84- RUN echo $VIPS_VERSION >> $WORKDIR/share/.VIPS_VERSION
139+ RUN cd ./share && \
140+ zip --symlinks -r libvips.zip .
0 commit comments