Skip to content

Commit

Permalink
📦 Add Pango dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dbouron committed May 8, 2022
1 parent 3f42739 commit bc8b6df
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .github/docker/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:32
FROM fedora:33

# Set default build arguments.
ARG NODE_VERSION=10.x
Expand All @@ -9,7 +9,7 @@ ARG UID=1000
ARG GID=1000

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

Expand Down Expand Up @@ -46,7 +46,7 @@ RUN yum install ${YUM_OPTIONS} \
gtk-doc \
gobject-introspection gobject-introspection-devel \
glib2.x86_64 glib2-devel.x86_64 \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
mingw-w64-tools \
mingw64-gcc \
mingw64-gcc-c++ \
Expand All @@ -55,6 +55,9 @@ RUN yum install ${YUM_OPTIONS} \
mingw64-expat \
mingw64-pango

RUN alternatives --install "/usr/bin/java" "java" "${JAVA_HOME}/bin/java" 1
RUN alternatives --set java ${JAVA_HOME}/bin/java

# Link the system version of libmpfr, which is more recent than expected, but works fine.
RUN ln -s /lib64/libmpfr.so.6 /lib64/libmpfr.so.4

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ For Fedora and CentOS:
sudo yum install vips
```

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.
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.

### 🏁 Windows

Expand Down Expand Up @@ -211,7 +211,6 @@ $ docker run --rm -v $(pwd):/app -w /app -u root -it builder bash
- [ ] Add the missing operations
- [ ] Adapt the binding design for calling function by operation name (see also: https://libvips.github.io/libvips/API/current/binding.md.html)
- [ ] Publish artifacts to Maven Central
- [ ] Build pango and its dependencies from scratch (check how to deal with meson and ninja with cmake `ExternalProject_Add` function)
# Contact
Expand Down
25 changes: 24 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ list(APPEND MESON_VARS
--prefix=${EXT_INSTALL_DIR}
)

if (NOT DEFINED BUILD_TARGET)
set(MESON_CROSS_FILE "")
elseif(${BUILD_TARGET} STREQUAL "w64")
set(MESON_CROSS_FILE --cross-file ${PROJECT_SOURCE_DIR}/meson/x86_64-w64-mingw32-crossfile.txt)
endif()

find_library(LIBIMAGEQUANT imagequant PATHS "${EXT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
if (NOT LIBIMAGEQUANT)
# https://github.com/ImageOptim/libimagequant/issues/36
Expand Down Expand Up @@ -294,6 +300,23 @@ else()
add_custom_target(cairo "")
endif()

find_library(PANGO pango-1.0 PATHS "${EXT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
if(NOT PANGO)
ExternalProject_Add(pango
URL "https://gitlab.gnome.org/GNOME/pango/-/archive/${PANGO_VERSION}/pango-${PANGO_VERSION}.tar.gz"
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/pango"
CONFIGURE_COMMAND meson ${CMAKE_CURRENT_BINARY_DIR}/pango/buildir ${MESON_CROSS_FILE}
${MESON_VARS}
-Dintrospection=disabled
BUILD_COMMAND ninja -C ${CMAKE_CURRENT_BINARY_DIR}/pango/buildir
INSTALL_COMMAND ninja -C ${CMAKE_CURRENT_BINARY_DIR}/pango/buildir install
BUILD_IN_SOURCE 1
DEPENDS cairo freetype harfbuzz fribidi
)
else()
add_custom_target(pango "")
endif()

find_library(GIFLIB gif PATHS "${EXT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
if (NOT GIFLIB)
# giflib hasn't a standard build system, don't append CONFIGURE_VARS
Expand Down Expand Up @@ -428,7 +451,7 @@ if(NOT VIPS)
--without-rsvg
${LIBSPNG_FLAGS}
${LIBHEIF_FLAGS}
DEPENDS libjpeg libpng libspng giflib libwebp libimagequant lcms2 libheif tiff
DEPENDS libjpeg libpng libspng giflib libwebp libimagequant lcms2 libheif tiff pango
BUILD_IN_SOURCE 1
)
else()
Expand Down
1 change: 1 addition & 0 deletions lib/VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ FRIBIDI_VERSION=1.0.10
PIXMAN_VERSION=0.40.0
FONTCONFIG_VERSION=2.14.0
CAIRO_VERSION=1.16.0
PANGO_VERSION=1.50.7
VIPS_VERSION=8.12.2
24 changes: 24 additions & 0 deletions meson/x86_64-w64-mingw32-crossfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See: https://github.com/mesonbuild/meson/blob/32c22ec492fb471dc0c1bfdbb83404a486e4a72a/cross/linux-mingw-w64-64bit.txt

[binaries]
c = '/usr/bin/x86_64-w64-mingw32-gcc'
cpp = '/usr/bin/x86_64-w64-mingw32-g++'
ranlib = '/usr/bin/x86_64-w64-mingw32-ranlib'
nm = '/usr/bin/x86_64-w64-mingw32-nm'
ld = '/usr/bin/x86_64-w64-mingw32-ld'
objdump = '/usr/bin/x86_64-w64-mingw32-objdump'
ar = '/usr/bin/x86_64-w64-mingw32-ar'
strip = '/usr/bin/x86_64-w64-mingw32-strip'
pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
windres = '/usr/bin/x86_64-w64-mingw32-windres'

[properties]
# Directory that contains 'bin', 'lib', etc
root = '/usr/x86_64-w64-mingw32'
needs_exe_wrapper = True

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
1 change: 1 addition & 0 deletions src/main/java/com/criteo/vips/Vips.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Vips {
"pixman-1",
"fontconfig",
"cairo",
"pango-1.0",
"aom",
"heif",
"exif",
Expand Down

0 comments on commit bc8b6df

Please sign in to comment.