@@ -2,83 +2,137 @@ 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 \
1716 share/include
1817
19- # Install xpat
18+ # Install expat
2019#
21- RUN yum install -y expat-devel
20+ RUN curl https://codeload.github.com/libexpat/libexpat/zip/R_2_2_9 > libexpat-R_2_2_9.zip && \
21+ unzip libexpat-R_2_2_9.zip && \
22+ cd ./libexpat-R_2_2_9/expat && \
23+ ./buildconf.sh && \
24+ ./configure --prefix=/opt && \
25+ make install
2226
23- # Install libimagequant. Details: https://github.com/libvips/libvips/pull/1009
27+ RUN cp -a /opt/lib/libexpat.so* /build/share/lib
28+
29+ # Install libpng
30+ #
31+ RUN curl -L https://downloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz > libpng-1.6.37.tar.xz && \
32+ tar -xf libpng-1.6.37.tar.xz && \
33+ cd libpng-1.6.37 && \
34+ ./configure --prefix=/opt --disable-static && \
35+ make && \
36+ make install
37+
38+ RUN cp -a /opt/lib/libpng.so* /build/share/lib && \
39+ cp -a /opt/lib/libpng16.so* /build/share/lib
40+
41+ # Install giflib
2442#
25- RUN git clone git://github.com/ImageOptim/libimagequant.git && \
43+ RUN curl -L https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz > giflib-5.2.1.tar.gz && \
44+ tar -xf giflib-5.2.1.tar.gz && \
45+ cd giflib-5.2.1 && \
46+ make && \
47+ make PREFIX=/opt install
48+
49+ RUN cp -a /opt/lib/libgif.so* /build/share/lib
50+
51+ # Install libjpeg-turbo
52+ #
53+ RUN curl -L https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-2.0.4.tar.gz > libjpeg-turbo-2.0.4.tar.gz && \
54+ tar -xf libjpeg-turbo-2.0.4.tar.gz && \
55+ cd libjpeg-turbo-2.0.4 && \
56+ cmake -DCMAKE_INSTALL_PREFIX=/opt && \
57+ make && \
58+ make install
59+
60+ RUN cp -a /opt/lib64/libjpeg.so* /build/share/lib && \
61+ cp -a /opt/lib64/libturbojpeg.so* /build/share/lib
62+
63+ # Install libimagequant
64+ #
65+ RUN git clone https://github.com/ImageOptim/libimagequant.git && \
2666 cd ./libimagequant && \
27- git checkout "${IMAGEQUANT_VERSION}" && \
28- CC=clang CXX=clang++ ./configure --prefix=/opt && \
67+ git checkout 2.12.6 && \
68+ ./configure --prefix=/opt && \
2969 make libimagequant.so && \
3070 make install && \
3171 echo /opt/lib > /etc/ld.so.conf.d/libimagequant.conf && \
3272 ldconfig
33- RUN cp -a $INSTALLDIR/lib/libimagequant.so* $WORKDIR/share/lib/ && \
34- cp -a $INSTALLDIR/include/libimagequant.h $WORKDIR/share/include/
3573
74+ RUN cp -a /opt/lib/libimagequant.so* /build/share/lib/ && \
75+ cp -a /opt/include/libimagequant.h /build/share/include/
3676
37- # Install deps for libvips. Details: https://libvips.github.io/libvips/install.html
77+ # Install libvips. Primary deps https://libvips.github.io/libvips/install.html
3878#
3979RUN yum install -y \
40- gtk-doc \
41- gobject-introspection \
42- gobject-introspection-devel
80+ gtk-doc \
81+ ninja-build
82+
83+ RUN pip3 install meson && \
84+ pip3 install ninja
4385
44- # Clone repo and checkout version tag.
86+ 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 && \
87+ tar -xf glib-2.64.2.tar.xz && \
88+ cd glib-2.64.2 && \
89+ mkdir ./_build && \
90+ cd ./_build && \
91+ meson --prefix=/opt .. && \
92+ ninja && \
93+ ninja install
94+
95+ RUN cp -a /opt/lib64/libffi.so* /build/share/lib && \
96+ cp -a /opt/lib64/libglib-2.0.so* /build/share/lib && \
97+ cp -a /opt/lib64/libgmodule-2.0.so* /build/share/lib && \
98+ cp -a /opt/lib64/libgobject-2.0.so* /build/share/lib && \
99+ cp -a /opt/lib64/libgthread-2.0.so* /build/share/lib
100+
101+ 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 && \
102+ tar -xf gobject-introspection-1.64.1.tar.xz && \
103+ cd gobject-introspection-1.64.1 && \
104+ mkdir ./_build && \
105+ cd ./_build && \
106+ meson --prefix=/opt .. && \
107+ ninja && \
108+ ninja install
109+
110+ # Install libvips.
45111#
46- RUN git clone git://github.com/libvips/libvips.git && \
47- cd libvips && \
48- git checkout "v${VIPS_VERSION}"
112+ RUN curl -L https://github.com/libvips/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.gz > vips-${VIPS_VERSION}.tar.gz && \
113+ tar -xf vips-${VIPS_VERSION}.tar.gz && \
114+ cd vips-${VIPS_VERSION} && \
115+ ./configure \
116+ --prefix=/opt \
117+ --disable-gtk-doc \
118+ --without-magick \
119+ --with-expat=/opt && \
120+ make && \
121+ make install && \
122+ echo /opt/lib > /etc/ld.so.conf.d/libvips.conf && \
123+ ldconfig
124+
125+ RUN cp -a /opt/lib/libvips.so* /build/share/lib
49126
50- # Compile from source .
127+ # Store the VIPS_VERSION variable in a file, accessible to the deploy script .
51128#
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.
129+ RUN echo $VIPS_VERSION > "./share/VIPS_VERSION"
130+
131+ # Create an /build/share/opt/lib64 symlink for shared objects.
64132#
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
133+ RUN cd ./share && ln -s lib lib64
76134
77135# Zip up contents so final `lib` can be placed in /opt layer.
78136#
79137RUN cd ./share && \
80- zip --symlinks -r libvips.zip .
81-
82- # Store the VIPS_VERSION variable in a file, accessible to the deploy script.
83- #
84- RUN echo $VIPS_VERSION >> $WORKDIR/share/.VIPS_VERSION
138+ zip --symlinks -r libvips.zip .
0 commit comments