Skip to content

Commit 8cc6f1e

Browse files
committed
Add zstd to 'all' group dependencies (#80)
For Zstd-compressed TIFF support.
1 parent 6611819 commit 8cc6f1e

File tree

21 files changed

+149
-134
lines changed

21 files changed

+149
-134
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Run the top-level [build script](build.sh) with the `--help` parameter for help.
4040
| [libvips] | 8.18.0[^2] | LGPLv3 |
4141
| [libwebp] | 1.6.0 | New BSD License |
4242
| [libxml2] | 2.14.6 | MIT Licence |
43-
| [mozjpeg] | 4.1.5 | [zlib License, IJG License, BSD-3-Clause] |
43+
| [mozjpeg] | 4.1.5 | [zlib License, IJG License, BSD 3-Clause] |
4444
| [pango] | 1.57.0 | LGPLv3 |
4545
| [pixman] | 0.46.4 | MIT Licence |
4646
| [proxy-libintl] | 0.5 | LGPLv3 |
@@ -79,7 +79,7 @@ https://github.com/libvips/libvips/releases/tag/v8.18.0-test1
7979
[libwebp]: https://github.com/webmproject/libwebp
8080
[libxml2]: https://gitlab.gnome.org/GNOME/libxml2
8181
[mozjpeg]: https://github.com/mozilla/mozjpeg
82-
[zlib License, IJG License, BSD-3-Clause]: https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md
82+
[zlib License, IJG License, BSD 3-Clause]: https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md
8383
[pango]: https://gitlab.gnome.org/GNOME/pango
8484
[pixman]: https://gitlab.freedesktop.org/pixman/pixman
8585
[proxy-libintl]: https://github.com/frida/proxy-libintl
@@ -108,6 +108,7 @@ Same as libvips-web + these extra dependencies:
108108
| [openslide] | 4.0.0 | LGPLv3 |
109109
| [poppler] | 25.09.1 | GPLv2 |
110110
| [sqlite] | 3.50.4 | Public domain |
111+
| [zstd] | 1.5.7 | BSD 3-Clause |
111112

112113
[brotli]: https://github.com/google/brotli
113114
[cfitsio]: https://github.com/HEASARC/cfitsio
@@ -126,6 +127,7 @@ Same as libvips-web + these extra dependencies:
126127
[openslide]: https://github.com/openslide/openslide
127128
[poppler]: https://gitlab.freedesktop.org/poppler/poppler
128129
[sqlite]: https://sqlite.org/
130+
[zstd]: https://github.com/facebook/zstd
129131

130132
## libjpeg-turbo
131133

TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
## TODO
22
- [ ] Add CI that builds libvips with pre-compiled dependencies.
33
- [ ] Incorporate all new dependencies and patches into [MXE](https://github.com/mxe/mxe).
4-
- [ ] Should we also add vips-web?
54
- [ ] Incorporate the llvm-mingw toolchain plugin into MXE (see [mxe/mxe#2330](https://github.com/mxe/mxe/issues/2330)).

build.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,7 @@ fi
144144
# GitHub's tarball API requires the short SHA commit as the directory name
145145
git_commit="${git_commit:0:7}"
146146

147-
# Ensure separate build targets
148-
if [ "$build_all_variant" = true ]; then
149-
mxe_targets=("${mxe_targets[@]/%/.all}")
150-
fi
151-
152-
if [ "$with_ffi_compat" = true ]; then
153-
mxe_targets=("${mxe_targets[@]/%/.ffi}")
154-
fi
155-
147+
# Ensure separate debug build targets
156148
if [ "$with_debug" = true ]; then
157149
mxe_targets=("${mxe_targets[@]/%/.debug}")
158150
fi
@@ -187,18 +179,28 @@ if [ "$jpeg_impl" != "libjpeg-turbo" ]; then
187179
plugin_dirs+=" /data/plugins/$jpeg_impl"
188180
fi
189181

190-
if [ "$build_gtk" = true ]; then
191-
plugin_dirs+=" /data/plugins/gtk4"
192-
fi
193-
194182
if [ "$with_hevc" = true ]; then
195-
plugin_dirs+=" /data/plugins/hevc"
183+
plugin_dirs+=" /data/plugins/hevc-deps"
196184
fi
197185

198186
if [ "$with_zlib_ng" = true ]; then
199187
plugin_dirs+=" /data/plugins/zlib-ng"
200188
fi
201189

190+
if [ "$with_ffi_compat" = true ]; then
191+
plugin_dirs+=" /data/plugins/ffi-compat"
192+
fi
193+
194+
if [ "$build_web_variant" = true ]; then
195+
plugin_dirs+=" /data/plugins/web-deps"
196+
elif [ "$build_all_variant" = true ]; then
197+
plugin_dirs+=" /data/plugins/all-deps"
198+
fi
199+
200+
if [ "$build_gtk" = true ]; then
201+
plugin_dirs+=" /data/plugins/gtk4"
202+
fi
203+
202204
# Avoid shipping the gettext DLL (libintl-8.dll),
203205
# use a statically build dummy implementation instead.
204206
# This intentionally disables the i18n features of (GNU)

build/overrides.mk

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ define librsvg_BUILD
581581
-Dtests=false \
582582
-Dtriplet='$(PROCESSOR)-pc-windows-gnullvm' \
583583
-Dc_link_args='$(LDFLAGS) -lntdll -luserenv' \
584-
$(librsvg_CONFIGURE_OPTS) \
584+
$(PKG_MESON_OPTS) \
585585
'$(SOURCE_DIR)' \
586586
'$(BUILD_DIR)'
587587

@@ -657,6 +657,7 @@ define tiff_BUILD
657657
--disable-cxx \
658658
--disable-lzma \
659659
--disable-zstd \
660+
$(PKG_CONFIGURE_OPTS) \
660661
$(if $(and $(IS_JPEGLI),$(BUILD_STATIC)), LIBS="`'$(TARGET)-pkg-config' --libs libjpeg`")
661662
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' $(MXE_DISABLE_CRUFT)
662663
$(MAKE) -C '$(BUILD_DIR)' -j 1 $(INSTALL_STRIP_LIB) $(MXE_DISABLE_CRUFT)
@@ -700,7 +701,7 @@ define cairo_BUILD
700701
-Dspectre=disabled \
701702
-Dsymbol-lookup=disabled \
702703
-Dgtk_doc=false \
703-
$(cairo_CONFIGURE_OPTS) \
704+
$(PKG_MESON_OPTS) \
704705
'$(SOURCE_DIR)' \
705706
'$(BUILD_DIR)'
706707

@@ -722,16 +723,10 @@ endef
722723

723724
# build with the Meson build system
724725
# build a minimal libxml2, see: https://github.com/lovell/sharp-libvips/pull/92
725-
# OpenSlide needs -Dxpath=enabled
726-
# ImageMagick's internal MSVG parser needs -Dpush=enabled -Dsax1=enabled
727726
define libxml2_BUILD
728727
$(MXE_MESON_WRAPPER) \
729728
-Dminimum=true \
730-
$(if $(findstring .all,$(TARGET)), \
731-
-Dxpath=enabled \
732-
-Dpush=enabled \
733-
-Dsax1=enabled) \
734-
$(libxml2_MESON_OPTS) \
729+
$(PKG_MESON_OPTS) \
735730
'$(SOURCE_DIR)' \
736731
'$(BUILD_DIR)'
737732

@@ -766,22 +761,16 @@ endef
766761
# build with the Meson build system
767762
# compile with the internal PCRE library
768763
define glib_BUILD
769-
$(if $(findstring .ffi,$(TARGET)), \
770-
(cd '$(SOURCE_DIR)' && $(PATCH) -p1 -u) < $(realpath $(dir $(lastword $(glib_PATCHES))))/glib-static.patch)
771-
772-
# Build as shared library when `--with-ffi-compat` is passed, since we
773-
# need `libgobject-2.0-0.dll` and `libglib-2.0-0.dll` for these bindings.
774764
# Enable networking to allow gvdb to be downloaded from WrapDB
775765
MXE_ENABLE_NETWORK=1 $(MXE_MESON_WRAPPER) \
776-
$(if $(findstring .ffi,$(TARGET)), --default-library=shared) \
777766
--force-fallback-for=gvdb \
778767
-Dsysprof=disabled \
779768
-Dtests=false \
780769
-Dnls=disabled \
781770
-Dglib_debug=disabled \
782771
-Dglib_assert=false \
783772
-Dglib_checks=false \
784-
$(glib_CONFIGURE_OPTS) \
773+
$(PKG_MESON_OPTS) \
785774
'$(SOURCE_DIR)' \
786775
'$(BUILD_DIR)'
787776

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$(PLUGIN_HEADER)
2+
3+
# OpenSlide needs -Dxpath=enabled
4+
# ImageMagick's internal MSVG parser needs -Dpush=enabled -Dsax1=enabled
5+
libxml2_MESON_OPTS = -Dxpath=enabled -Dpush=enabled -Dsax1=enabled
6+
7+
# Patch to ensure the DLL directory is used as libdir
8+
vips_PATCHES := $(vips_PATCHES) \
9+
$(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/patches/vips-[0-9]*.patch)))
10+
11+
vips_MESON_OPTS = \
12+
-Dmodules=enabled \
13+
-Dheif-module=$(if $(IS_HEVC),enabled,disabled) \
14+
$(if $(findstring graphicsmagick,$(vips_all_DEPS)), -Dmagick-package=GraphicsMagick) \
15+
-Dpdfium=disabled \
16+
-Dquantizr=disabled
17+
18+
# https://github.com/libvips/build-win64-mxe/issues/80
19+
tiff_CONFIGURE_OPTS = --enable-zstd
20+
21+
# Override sub-dependencies
22+
tiff_DEPS := $(tiff_DEPS) zstd

build/patches/vips-8-dlldir-as-libdir.patch renamed to build/plugins/all-deps/patches/vips-8-dlldir-as-libdir.patch

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,32 @@ index 1111111..2222222 100644
2525
const char *
2626
vips_guess_libdir(const char *argv0, const char *env_name)
2727
{
28-
+#if defined(G_OS_WIN32) && defined(VIPS_DLLDIR_AS_LIBDIR)
28+
+#ifdef G_OS_WIN32
2929
+ /* Sometimes users want to use the DLL directory where the libvips DLL
3030
+ * resides as libdir.
3131
+ */
3232
+ return vips__dll_dir();
33-
+#else /*!G_OS_WIN32 || !VIPS_DLLDIR_AS_LIBDIR*/
33+
+#else /*!G_OS_WIN32*/
3434
const char *prefix = vips_guess_prefix(argv0, env_name);
3535
static char *libdir = NULL;
3636

3737
@@ -1225,6 +1231,7 @@ vips_guess_libdir(const char *argv0, const char *env_name)
3838
libdir = g_strdup_printf("%s/lib", prefix);
3939

4040
return libdir;
41-
+#endif /*G_OS_WIN32 && VIPS_DLLDIR_AS_LIBDIR*/
41+
+#endif /*G_OS_WIN32*/
4242
}
4343

4444
/**
4545
diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c
4646
index 1111111..2222222 100644
4747
--- a/libvips/iofuncs/util.c
4848
+++ b/libvips/iofuncs/util.c
49-
@@ -1992,6 +1992,53 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
49+
@@ -1992,6 +1992,51 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
5050
return TRUE;
5151
}
5252
#endif
5353
+
54-
+#ifdef VIPS_DLLDIR_AS_LIBDIR
5554
+static void *
5655
+vips__dll_dir_once(void *null)
5756
+{
@@ -96,7 +95,6 @@ index 1111111..2222222 100644
9695
+
9796
+ return (const char *) g_once(&once, vips__dll_dir_once, NULL);
9897
+}
99-
+#endif /*VIPS_DLLDIR_AS_LIBDIR*/
10098
#endif /*G_OS_WIN32*/
10199

102100
static void *

build/vips-all.mk renamed to build/plugins/all-deps/vips-all.mk

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
PKG := vips-all
2-
$(PKG)_WEBSITE := https://libvips.github.io/libvips/
3-
$(PKG)_DESCR := A fast image processing library with low memory needs.
4-
$(PKG)_IGNORE :=
5-
$(PKG)_VERSION := 8.18.0-test1
6-
$(PKG)_CHECKSUM := 242eaa2c195fd5a3021e5daaa4448cdbfa5b9702ec4377cbb9b2b18c4f542163
7-
$(PKG)_PATCHES := $(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/patches/vips-[0-9]*.patch)))
8-
$(PKG)_GH_CONF := libvips/libvips/releases,v,,,,-test1.tar.xz
9-
$(PKG)_SUBDIR := vips-$(firstword $(subst -, ,$($(PKG)_VERSION)))
10-
$(PKG)_FILE := vips-$($(PKG)_VERSION).tar.xz
11-
$(PKG)_DEPS := cc meson-wrapper libwebp librsvg glib pango libarchive \
12-
libjpeg-turbo tiff lcms libexif libheif libspng \
13-
libimagequant highway imagemagick matio openexr \
14-
cfitsio nifticlib poppler fftw openslide libjxl cgif \
15-
libraw
2+
$(PKG)_WEBSITE = $(vips_WEBSITE)
3+
$(PKG)_DESCR = $(vips_DESCR)
4+
$(PKG)_IGNORE = $(vips_IGNORE)
5+
$(PKG)_VERSION = $(vips_VERSION)
6+
$(PKG)_CHECKSUM = $(vips_CHECKSUM)
7+
$(PKG)_PATCHES = $(vips_PATCHES)
8+
$(PKG)_SUBDIR = $(vips_SUBDIR)
9+
$(PKG)_FILE = $(vips_FILE)
10+
$(PKG)_URL = $(vips_URL)
11+
$(PKG)_DEPS := $(vips_DEPS) imagemagick matio openexr cfitsio \
12+
nifticlib poppler fftw openslide libjxl libraw
1613

1714
define $(PKG)_PRE_CONFIGURE
1815
# Copy some files to the packaging directory
@@ -66,35 +63,20 @@ define $(PKG)_PRE_CONFIGURE
6663
printf ' "spng": "$(libspng_VERSION)",\n'; \
6764
printf ' "sqlite": "$(sqlite_VERSION)",\n'; \
6865
printf ' "tiff": "$(tiff_VERSION)",\n'; \
69-
printf ' "vips": "$(vips-all_VERSION)",\n'; \
66+
printf ' "vips": "$(vips_VERSION)",\n'; \
7067
printf ' "webp": "$(libwebp_VERSION)",\n'; \
7168
$(if $(IS_HEVC),printf ' "x265": "$(x265_VERSION)"$(comma)\n';) \
7269
printf ' "xml2": "$(libxml2_VERSION)",\n'; \
7370
$(if $(IS_ZLIB_NG), \
74-
printf ' "zlib-ng": "$(zlib-ng_VERSION)"\n';, \
75-
printf ' "zlib": "$(zlib_VERSION)"\n';) \
71+
printf ' "zlib-ng": "$(zlib-ng_VERSION)"$(comma)\n';, \
72+
printf ' "zlib": "$(zlib_VERSION)"$(comma)\n';) \
73+
printf ' "zstd": "$(zstd_VERSION)"\n'; \
7674
printf '}';) \
7775
> '$(PREFIX)/$(TARGET)/vips-packaging/versions.json'
7876
endef
7977

8078
define $(PKG)_BUILD
8179
$($(PKG)_PRE_CONFIGURE)
8280

83-
$(eval export CFLAGS += -O3)
84-
$(eval export CXXFLAGS += -O3)
85-
86-
$(MXE_MESON_WRAPPER) \
87-
-Ddeprecated=false \
88-
-Dexamples=false \
89-
-Dintrospection=disabled \
90-
-Dmodules=enabled \
91-
-Dheif-module=$(if $(IS_HEVC),enabled,disabled) \
92-
$(if $(findstring graphicsmagick,$($(PKG)_DEPS)), -Dmagick-package=GraphicsMagick) \
93-
-Dpdfium=disabled \
94-
-Dquantizr=disabled \
95-
-Dc_args='$(CFLAGS) -DVIPS_DLLDIR_AS_LIBDIR' \
96-
'$(SOURCE_DIR)' \
97-
'$(BUILD_DIR)'
98-
99-
$(MXE_NINJA) -C '$(BUILD_DIR)' -j '$(JOBS)' install
81+
$(vips_BUILD)
10082
endef
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$(PLUGIN_HEADER)
2+
3+
# Patch to build gio and gmodule statically
4+
glib_PATCHES := $(glib_PATCHES) \
5+
$(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/patches/glib-[0-9]*.patch)))
6+
7+
# Build as shared library when `--with-ffi-compat` is passed, since we
8+
# need `libgobject-2.0-0.dll` and `libglib-2.0-0.dll` for these bindings.
9+
glib_MESON_OPTS = --default-library=shared
File renamed without changes.

build/plugins/gtk4/overrides.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ $(PLUGIN_HEADER)
22

33
# GTK requires GRegex
44
glib_PATCHES := $(filter-out $(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/../../patches/glib-2-without-gregex.patch))),$(glib_PATCHES))
5-
glib_CONFIGURE_OPTS = --force-fallback-for=libpcre2-8
5+
glib_MESON_OPTS = --force-fallback-for=libpcre2-8
66

77
# GTK requires cairo-win32, cairo-ps and cairo-pdf
88
# https://gitlab.gnome.org/GNOME/gtk/-/issues/5072
99
# Also enable the DWrite font backend in Cairo
1010
# https://gitlab.gnome.org/GNOME/gtk/-/issues/7144
1111
cairo_PATCHES := $(filter-out $(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/../../patches/cairo-1-nanoserver-compat.patch))),$(cairo_PATCHES))
12-
cairo_CONFIGURE_OPTS = -Dzlib=enabled -Ddwrite=enabled
12+
cairo_MESON_OPTS = -Dzlib=enabled -Ddwrite=enabled
1313

1414
# GTK requires a relocatable GDK-PixBuf plugin with SVG support.
1515
# TODO(kleisauke): Probably no longer needed in GTK >= 4.19.2.
1616
gdk-pixbuf_PATCHES := $(filter-out $(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/../../patches/gdk-pixbuf-2-without-relocation.patch))),$(gdk-pixbuf_PATCHES))
1717
librsvg_DEPS := $(librsvg_DEPS) gdk-pixbuf
18-
librsvg_CONFIGURE_OPTS = -Dpixbuf=enabled -Dpixbuf-loader=enabled
18+
librsvg_MESON_OPTS = -Dpixbuf=enabled -Dpixbuf-loader=enabled
1919

2020
# nip4 needs -Doutput=enabled
21-
libxml2_MESON_OPTS = -Doutput=enabled
21+
libxml2_MESON_OPTS := $(libxml2_MESON_OPTS) -Doutput=enabled
2222

2323
# Override sub-dependencies
2424
adwaita-icon-theme_DEPS := $(subst gtk3,gtk4,$(adwaita-icon-theme_DEPS))

0 commit comments

Comments
 (0)