@@ -51,134 +51,12 @@ function update_script() {
5151 fi
5252 if [[ -f ~ /.immich_library_revisions ]]; then
5353 libraries=(" libjxl" " libheif" " libraw" " imagemagick" " libvips" )
54- readarray -d ' ' NEW_REVISIONS < <( for library in " ${libraries[@]} " ; do
55- echo " $library : $( curl -fsSL https://raw.githubusercontent.com/immich-app/base-images/refs/heads/main/server/sources/" $library " .json | jq -cr ' .revision' -) "
56- done)
57- UPDATED_REVISIONS=" $( comm -13 <( sort ~ /.immich_library_revisions) <( echo -n " ${NEW_REVISIONS[@]} " | sort) ) "
58- if [[ " $UPDATED_REVISIONS " ]]; then
59- readarray -t NAMES < <( echo " $UPDATED_REVISIONS " | awk -F ' :' ' {print $1}' )
60- rm -rf " $SOURCE_DIR "
61- mkdir -p " $SOURCE_DIR "
62- cd " $BASE_DIR "
63- $STD git pull
64- cd " $STAGING_DIR "
65- for name in " ${NAMES[@]} " ; do
66- if [[ " $name " == " libjxl" ]]; then
67- msg_info " Recompiling libjxl"
68- SOURCE=${SOURCE_DIR} /libjxl
69- JPEGLI_LIBJPEG_LIBRARY_SOVERSION=" 62"
70- JPEGLI_LIBJPEG_LIBRARY_VERSION=" 62.3.0"
71- : " ${LIBJXL_REVISION:= $(jq -cr ' .revision' $BASE_DIR / server/ sources/ libjxl.json)} "
72- $STD git clone https://github.com/libjxl/libjxl.git " $SOURCE "
73- cd " $SOURCE "
74- $STD git reset --hard " $LIBJXL_REVISION "
75- $STD git submodule update --init --recursive --depth 1 --recommend-shallow
76- $STD git apply " $BASE_DIR " /server/sources/libjxl-patches/jpegli-empty-dht-marker.patch
77- $STD git apply " $BASE_DIR " /server/sources/libjxl-patches/jpegli-icc-warning.patch
78- mkdir build
79- cd build
80- $STD cmake \
81- -DCMAKE_BUILD_TYPE=Release \
82- -DBUILD_TESTING=OFF \
83- -DJPEGXL_ENABLE_DOXYGEN=OFF \
84- -DJPEGXL_ENABLE_MANPAGES=OFF \
85- -DJPEGXL_ENABLE_PLUGIN_GIMP210=OFF \
86- -DJPEGXL_ENABLE_BENCHMARK=OFF \
87- -DJPEGXL_ENABLE_EXAMPLES=OFF \
88- -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
89- -DJPEGXL_FORCE_SYSTEM_HWY=ON \
90- -DJPEGXL_ENABLE_JPEGLI=ON \
91- -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=ON \
92- -DJPEGXL_INSTALL_JPEGLI_LIBJPEG=ON \
93- -DJPEGXL_ENABLE_PLUGINS=ON \
94- -DJPEGLI_LIBJPEG_LIBRARY_SOVERSION=" $JPEGLI_LIBJPEG_LIBRARY_SOVERSION " \
95- -DJPEGLI_LIBJPEG_LIBRARY_VERSION=" $JPEGLI_LIBJPEG_LIBRARY_VERSION " \
96- -DLIBJPEG_TURBO_VERSION_NUMBER=2001005 \
97- ..
98- $STD cmake --build . -- -j" $( nproc) "
99- $STD cmake --install .
100- ldconfig /usr/local/lib
101- $STD make clean
102- cd " $STAGING_DIR "
103- rm -rf " $SOURCE " /{build,third_party}
104- msg_ok " Recompiled libjxl"
105- fi
106- if [[ " $name " == " libheif" ]]; then
107- msg_info " Recompiling libheif"
108- SOURCE=${SOURCE_DIR} /libheif
109- : " ${LIBHEIF_REVISION:= $(jq -cr ' .revision' $BASE_DIR / server/ sources/ libheif.json)} "
110- $STD git clone https://github.com/strukturag/libheif.git " $SOURCE "
111- cd " $SOURCE "
112- $STD git reset --hard " $LIBHEIF_REVISION "
113- mkdir build
114- cd build
115- $STD cmake --preset=release-noplugins \
116- -DWITH_DAV1D=ON \
117- -DENABLE_PARALLEL_TILE_DECODING=ON \
118- -DWITH_LIBSHARPYUV=ON \
119- -DWITH_LIBDE265=ON \
120- -DWITH_AOM_DECODER=OFF \
121- -DWITH_AOM_ENCODER=OFF \
122- -DWITH_X265=OFF \
123- -DWITH_EXAMPLES=OFF \
124- ..
125- $STD make install -j " $( nproc) "
126- ldconfig /usr/local/lib
127- $STD make clean
128- cd " $STAGING_DIR "
129- rm -rf " $SOURCE " /build
130- msg_ok " Recompiled libheif"
131- fi
132- if [[ " $name " == " libraw" ]]; then
133- msg_info " Recompiling libraw"
134- SOURCE=${SOURCE_DIR} /libraw
135- : " ${LIBRAW_REVISION:= $(jq -cr ' .revision' $BASE_DIR / server/ sources/ libraw.json)} "
136- $STD git clone https://github.com/libraw/libraw.git " $SOURCE "
137- cd " $SOURCE "
138- $STD git reset --hard " $LIBRAW_REVISION "
139- $STD autoreconf --install
140- $STD ./configure
141- $STD make -j" $( nproc) "
142- $STD make install
143- ldconfig /usr/local/lib
144- $STD make clean
145- cd " $STAGING_DIR "
146- msg_ok " Recompiled libraw"
147- fi
148- if [[ " $name " == " imagemagick" ]]; then
149- msg_info " Recompiling ImageMagick"
150- SOURCE=$SOURCE_DIR /imagemagick
151- : " ${IMAGEMAGICK_REVISION:= $(jq -cr ' .revision' $BASE_DIR / server/ sources/ imagemagick.json)} "
152- $STD git clone https://github.com/ImageMagick/ImageMagick.git " $SOURCE "
153- cd " $SOURCE "
154- $STD git reset --hard " $IMAGEMAGICK_REVISION "
155- $STD ./configure --with-modules
156- $STD make -j" $( nproc) "
157- $STD make install
158- ldconfig /usr/local/lib
159- $STD make clean
160- cd " $STAGING_DIR "
161- msg_ok " Recompiled ImageMagick"
162- fi
163- if [[ " $name " == " libvips" ]]; then
164- msg_info " Recompiling libvips"
165- SOURCE=$SOURCE_DIR /libvips
166- : " ${LIBVIPS_REVISION:= $(jq -cr ' .revision' $BASE_DIR / server/ sources/ libvips.json)} "
167- $STD git clone https://github.com/libvips/libvips.git " $SOURCE "
168- cd " $SOURCE "
169- $STD git reset --hard " $LIBVIPS_REVISION "
170- $STD meson setup build --buildtype=release --libdir=lib -Dintrospection=disabled -Dtiff=disabled
171- cd build
172- $STD ninja install
173- ldconfig /usr/local/lib
174- cd " $STAGING_DIR "
175- rm -rf " $SOURCE " /build
176- msg_ok " Recompiled libvips"
177- fi
178- done
179- echo -n " ${NEW_REVISIONS[@]} " > ~/.immich_library_revisions
180- msg_ok " Image-processing libraries compiled"
181- fi
54+ cd " $BASE_DIR "
55+ $STD git pull
56+ for library in " ${libraries[@]} " ; do
57+ compile_" $library "
58+ done
59+ msg_ok " Image-processing libraries updated"
18260 fi
18361 RELEASE=$( curl -fsSL https://api.github.com/repos/immich-app/immich/releases? per_page=1 | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
18462 if [[ -f ~ /.immich && " $RELEASE " == " $( cat ~ /.immich) " ]]; then
@@ -293,6 +171,143 @@ function update_script() {
293171 exit
294172}
295173
174+ function compile_libjxl() {
175+ SOURCE=${SOURCE_DIR} /libjxl
176+ JPEGLI_LIBJPEG_LIBRARY_SOVERSION=" 62"
177+ JPEGLI_LIBJPEG_LIBRARY_VERSION=" 62.3.0"
178+ : " ${LIBJXL_REVISION:= $(jq -cr ' .revision' " $BASE_DIR " / server/ sources/ libjxl.json)} "
179+ if [[ " ${update:- } " ]] || [[ " $LIBJXL_REVISION " != " $( grep ' libjxl' ~ /.immich_library_revisions | awk ' {print $2}' ) " ]]; then
180+ msg_info " Recompiling libjxl"
181+ if [[ -d " $SOURCE " ]]; then rm -rf " $SOURCE " ; fi
182+ $STD git clone https://github.com/libjxl/libjxl.git " $SOURCE "
183+ cd " $SOURCE "
184+ $STD git reset --hard " $LIBJXL_REVISION "
185+ $STD git submodule update --init --recursive --depth 1 --recommend-shallow
186+ $STD git apply " $BASE_DIR " /server/sources/libjxl-patches/jpegli-empty-dht-marker.patch
187+ $STD git apply " $BASE_DIR " /server/sources/libjxl-patches/jpegli-icc-warning.patch
188+ mkdir build
189+ cd build
190+ $STD cmake \
191+ -DCMAKE_BUILD_TYPE=Release \
192+ -DBUILD_TESTING=OFF \
193+ -DJPEGXL_ENABLE_DOXYGEN=OFF \
194+ -DJPEGXL_ENABLE_MANPAGES=OFF \
195+ -DJPEGXL_ENABLE_PLUGIN_GIMP210=OFF \
196+ -DJPEGXL_ENABLE_BENCHMARK=OFF \
197+ -DJPEGXL_ENABLE_EXAMPLES=OFF \
198+ -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
199+ -DJPEGXL_FORCE_SYSTEM_HWY=ON \
200+ -DJPEGXL_ENABLE_JPEGLI=ON \
201+ -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=ON \
202+ -DJPEGXL_INSTALL_JPEGLI_LIBJPEG=ON \
203+ -DJPEGXL_ENABLE_PLUGINS=ON \
204+ -DJPEGLI_LIBJPEG_LIBRARY_SOVERSION=" $JPEGLI_LIBJPEG_LIBRARY_SOVERSION " \
205+ -DJPEGLI_LIBJPEG_LIBRARY_VERSION=" $JPEGLI_LIBJPEG_LIBRARY_VERSION " \
206+ -DLIBJPEG_TURBO_VERSION_NUMBER=2001005 \
207+ ..
208+ $STD cmake --build . -- -j" $( nproc) "
209+ $STD cmake --install .
210+ ldconfig /usr/local/lib
211+ $STD make clean
212+ cd " $STAGING_DIR "
213+ rm -rf " $SOURCE " /{build,third_party}
214+ msg_ok " Recompiled libjxl"
215+ fi
216+ }
217+
218+ function compile_libheif() {
219+ SOURCE=${SOURCE_DIR} /libheif
220+ if ! dpkg -l | grep -q libaom; then
221+ $STD apt-get install -y libaom-dev
222+ local update=" required"
223+ fi
224+ : " ${LIBHEIF_REVISION:= $(jq -cr ' .revision' " $BASE_DIR " / server/ sources/ libheif.json)} "
225+ if [[ " ${update:- } " ]] || [[ " $LIBHEIF_REVISION " != " $( grep ' libheif' ~ /.immich_library_revisions | awk ' {print $2}' ) " ]]; then
226+ msg_info " Recompiling libheif"
227+ if [[ -d " $SOURCE " ]]; then rm -rf " $SOURCE " ; fi
228+ $STD git clone https://github.com/strukturag/libheif.git " $SOURCE "
229+ cd " $SOURCE "
230+ $STD git reset --hard " $LIBHEIF_REVISION "
231+ mkdir build
232+ cd build
233+ $STD cmake --preset=release-noplugins \
234+ -DWITH_DAV1D=ON \
235+ -DENABLE_PARALLEL_TILE_DECODING=ON \
236+ -DWITH_LIBSHARPYUV=ON \
237+ -DWITH_LIBDE265=ON \
238+ -DWITH_AOM_DECODER=OFF \
239+ -DWITH_AOM_ENCODER=ON \
240+ -DWITH_X265=OFF \
241+ -DWITH_EXAMPLES=OFF \
242+ ..
243+ $STD make install -j " $( nproc) "
244+ ldconfig /usr/local/lib
245+ $STD make clean
246+ cd " $STAGING_DIR "
247+ rm -rf " $SOURCE " /build
248+ msg_ok " Recompiled libheif"
249+ fi
250+ }
251+
252+ function compile_libraw() {
253+ SOURCE=${SOURCE_DIR} /libraw
254+ local update
255+ : " ${LIBRAW_REVISION:= $(jq -cr ' .revision' " $BASE_DIR " / server/ sources/ libraw.json)} "
256+ if [[ " ${update:- } " ]] || [[ " $LIBRAW_REVISION " != " $( grep ' libraw' ~ /.immich_library_revisions | awk ' {print $2}' ) " ]]; then
257+ msg_info " Recompiling libraw"
258+ if [[ -d " $SOURCE " ]]; then rm -rf " $SOURCE " ; fi
259+ $STD git clone https://github.com/libraw/libraw.git " $SOURCE "
260+ cd " $SOURCE "
261+ $STD git reset --hard " $LIBRAW_REVISION "
262+ $STD autoreconf --install
263+ $STD ./configure
264+ $STD make -j" $( nproc) "
265+ $STD make install
266+ ldconfig /usr/local/lib
267+ $STD make clean
268+ cd " $STAGING_DIR "
269+ msg_ok " Recompiled libraw"
270+ fi
271+ }
272+
273+ function compile_imagemagick() {
274+ SOURCE=$SOURCE_DIR /imagemagick
275+ : " ${IMAGEMAGICK_REVISION:= $(jq -cr ' .revision' " $BASE_DIR " / server/ sources/ imagemagick.json)} "
276+ if [[ " ${update:- } " ]] || [[ " $IMAGEMAGICK_REVISION " != " $( grep ' imagemagick' ~ /.immich_library_revisions | awk ' {print $2}' ) " ]]; then
277+ msg_info " Recompiling ImageMagick"
278+ if [[ -d " $SOURCE " ]]; then rm -rf " $SOURCE " ; fi
279+ $STD git clone https://github.com/ImageMagick/ImageMagick.git " $SOURCE "
280+ cd " $SOURCE "
281+ $STD git reset --hard " $IMAGEMAGICK_REVISION "
282+ $STD ./configure --with-modules
283+ $STD make -j" $( nproc) "
284+ $STD make install
285+ ldconfig /usr/local/lib
286+ $STD make clean
287+ cd " $STAGING_DIR "
288+ msg_ok " Recompiled ImageMagick"
289+ fi
290+ }
291+
292+ function compile_libvips() {
293+ SOURCE=$SOURCE_DIR /libvips
294+ : " ${LIBVIPS_REVISION:= $(jq -cr ' .revision' " $BASE_DIR " / server/ sources/ libvips.json)} "
295+ if [[ " ${update:- } " ]] || [[ " $LIBVIPS_REVISION " != " $( grep ' libvips' ~ /.immich_library_revisions | awk ' {print $2}' ) " ]]; then
296+ msg_info " Recompiling libvips"
297+ if [[ -d " $SOURCE " ]]; then rm -rf " $SOURCE " ; fi
298+ $STD git clone https://github.com/libvips/libvips.git " $SOURCE "
299+ cd " $SOURCE "
300+ $STD git reset --hard " $LIBVIPS_REVISION "
301+ $STD meson setup build --buildtype=release --libdir=lib -Dintrospection=disabled -Dtiff=disabled
302+ cd build
303+ $STD ninja install
304+ ldconfig /usr/local/lib
305+ cd " $STAGING_DIR "
306+ rm -rf " $SOURCE " /build
307+ msg_ok " Recompiled libvips"
308+ fi
309+ }
310+
296311start
297312build_container
298313description
0 commit comments