Skip to content

Commit bc8b6df

Browse files
committed
📦 Add Pango dependency
1 parent 3f42739 commit bc8b6df

File tree

6 files changed

+57
-6
lines changed

6 files changed

+57
-6
lines changed

.github/docker/windows/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM fedora:32
1+
FROM fedora:33
22

33
# Set default build arguments.
44
ARG NODE_VERSION=10.x
@@ -9,7 +9,7 @@ ARG UID=1000
99
ARG GID=1000
1010

1111
# Set default environment variables.
12-
ENV JAVA_HOME=/usr/lib/jvm/java-openjdk
12+
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
1313
ENV PATH="${OSX_CROSS_HOME}/bin:${PATH}"
1414
ENV YUM_OPTIONS="-y --setopt=skip_missing_names_on_install=False"
1515

@@ -46,7 +46,7 @@ RUN yum install ${YUM_OPTIONS} \
4646
gtk-doc \
4747
gobject-introspection gobject-introspection-devel \
4848
glib2.x86_64 glib2-devel.x86_64 \
49-
java-1.8.0-openjdk \
49+
java-1.8.0-openjdk-devel \
5050
mingw-w64-tools \
5151
mingw64-gcc \
5252
mingw64-gcc-c++ \
@@ -55,6 +55,9 @@ RUN yum install ${YUM_OPTIONS} \
5555
mingw64-expat \
5656
mingw64-pango
5757

58+
RUN alternatives --install "/usr/bin/java" "java" "${JAVA_HOME}/bin/java" 1
59+
RUN alternatives --set java ${JAVA_HOME}/bin/java
60+
5861
# Link the system version of libmpfr, which is more recent than expected, but works fine.
5962
RUN ln -s /lib64/libmpfr.so.6 /lib64/libmpfr.so.4
6063

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For Fedora and CentOS:
4848
sudo yum install vips
4949
```
5050

51-
However, note that `JVips.jar` embeds `libvips.so` and its dependencies (expected pango used for `vips_text`). The `jar` file is self-sufficient for Linux. Look the `--minimal` flag documented below if you don't want this behavior and prefer to rely on system-wide libraries.
51+
However, note that `JVips.jar` embeds `libvips.so` and its dependencies. The `jar` file is self-sufficient for Linux. Look the `--minimal` flag documented below if you don't want this behavior and prefer to rely on system-wide libraries.
5252

5353
### 🏁 Windows
5454

@@ -211,7 +211,6 @@ $ docker run --rm -v $(pwd):/app -w /app -u root -it builder bash
211211
- [ ] Add the missing operations
212212
- [ ] Adapt the binding design for calling function by operation name (see also: https://libvips.github.io/libvips/API/current/binding.md.html)
213213
- [ ] Publish artifacts to Maven Central
214-
- [ ] Build pango and its dependencies from scratch (check how to deal with meson and ninja with cmake `ExternalProject_Add` function)
215214
216215
# Contact
217216

lib/CMakeLists.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ list(APPEND MESON_VARS
5555
--prefix=${EXT_INSTALL_DIR}
5656
)
5757

58+
if (NOT DEFINED BUILD_TARGET)
59+
set(MESON_CROSS_FILE "")
60+
elseif(${BUILD_TARGET} STREQUAL "w64")
61+
set(MESON_CROSS_FILE --cross-file ${PROJECT_SOURCE_DIR}/meson/x86_64-w64-mingw32-crossfile.txt)
62+
endif()
63+
5864
find_library(LIBIMAGEQUANT imagequant PATHS "${EXT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
5965
if (NOT LIBIMAGEQUANT)
6066
# https://github.com/ImageOptim/libimagequant/issues/36
@@ -294,6 +300,23 @@ else()
294300
add_custom_target(cairo "")
295301
endif()
296302

303+
find_library(PANGO pango-1.0 PATHS "${EXT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
304+
if(NOT PANGO)
305+
ExternalProject_Add(pango
306+
URL "https://gitlab.gnome.org/GNOME/pango/-/archive/${PANGO_VERSION}/pango-${PANGO_VERSION}.tar.gz"
307+
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/pango"
308+
CONFIGURE_COMMAND meson ${CMAKE_CURRENT_BINARY_DIR}/pango/buildir ${MESON_CROSS_FILE}
309+
${MESON_VARS}
310+
-Dintrospection=disabled
311+
BUILD_COMMAND ninja -C ${CMAKE_CURRENT_BINARY_DIR}/pango/buildir
312+
INSTALL_COMMAND ninja -C ${CMAKE_CURRENT_BINARY_DIR}/pango/buildir install
313+
BUILD_IN_SOURCE 1
314+
DEPENDS cairo freetype harfbuzz fribidi
315+
)
316+
else()
317+
add_custom_target(pango "")
318+
endif()
319+
297320
find_library(GIFLIB gif PATHS "${EXT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
298321
if (NOT GIFLIB)
299322
# giflib hasn't a standard build system, don't append CONFIGURE_VARS
@@ -428,7 +451,7 @@ if(NOT VIPS)
428451
--without-rsvg
429452
${LIBSPNG_FLAGS}
430453
${LIBHEIF_FLAGS}
431-
DEPENDS libjpeg libpng libspng giflib libwebp libimagequant lcms2 libheif tiff
454+
DEPENDS libjpeg libpng libspng giflib libwebp libimagequant lcms2 libheif tiff pango
432455
BUILD_IN_SOURCE 1
433456
)
434457
else()

lib/VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ FRIBIDI_VERSION=1.0.10
1515
PIXMAN_VERSION=0.40.0
1616
FONTCONFIG_VERSION=2.14.0
1717
CAIRO_VERSION=1.16.0
18+
PANGO_VERSION=1.50.7
1819
VIPS_VERSION=8.12.2
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# See: https://github.com/mesonbuild/meson/blob/32c22ec492fb471dc0c1bfdbb83404a486e4a72a/cross/linux-mingw-w64-64bit.txt
2+
3+
[binaries]
4+
c = '/usr/bin/x86_64-w64-mingw32-gcc'
5+
cpp = '/usr/bin/x86_64-w64-mingw32-g++'
6+
ranlib = '/usr/bin/x86_64-w64-mingw32-ranlib'
7+
nm = '/usr/bin/x86_64-w64-mingw32-nm'
8+
ld = '/usr/bin/x86_64-w64-mingw32-ld'
9+
objdump = '/usr/bin/x86_64-w64-mingw32-objdump'
10+
ar = '/usr/bin/x86_64-w64-mingw32-ar'
11+
strip = '/usr/bin/x86_64-w64-mingw32-strip'
12+
pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
13+
windres = '/usr/bin/x86_64-w64-mingw32-windres'
14+
15+
[properties]
16+
# Directory that contains 'bin', 'lib', etc
17+
root = '/usr/x86_64-w64-mingw32'
18+
needs_exe_wrapper = True
19+
20+
[host_machine]
21+
system = 'windows'
22+
cpu_family = 'x86_64'
23+
cpu = 'x86_64'
24+
endian = 'little'

src/main/java/com/criteo/vips/Vips.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class Vips {
3030
"pixman-1",
3131
"fontconfig",
3232
"cairo",
33+
"pango-1.0",
3334
"aom",
3435
"heif",
3536
"exif",

0 commit comments

Comments
 (0)