Skip to content

Commit

Permalink
Add libde256 openjpeg poppler for Tropy
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Sep 5, 2023
1 parent b79cd00 commit f23ae50
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
os: [ ubuntu-22.04 ]
platform:
- 'linux-x64'
- 'linux-armv6'
- 'linux-armv7'
- 'linuxmusl-x64'
- 'linuxmusl-arm64v8'
#- 'linux-armv6'
#- 'linux-armv7'
#- 'linuxmusl-x64'
#- 'linuxmusl-arm64v8'
- 'win32-ia32'
- 'win32-x64'
- 'win32-arm64v8'
Expand Down
163 changes: 163 additions & 0 deletions THIRD-PARTY-NOTICES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
[
{
"name": "aom",
"license": "BSD 2-Clause + Alliance for Open Media Patent License 1.0",
"licenseURL": [
"https://aomedia.googlesource.com/aom/+/refs/heads/master/LICENSE?format=TEXT",
"https://aomedia.googlesource.com/aom/+/refs/heads/master/PATENTS?format=TEXT"
]
},
{
"name": "archive",
"license": "BDS 2-Clause",
"licenseURL": "https://raw.githubusercontent.com/libarchive/libarchive/master/COPYING"
},
{
"name": "cairo",
"license": "MPL-2.0",
"licenseURL": "https://raw.githubusercontent.com/freedesktop/cairo/master/COPYING"
},
{
"name": "expat",
"license": "MIT",
"licenseURL": "https://raw.githubusercontent.com/libexpat/libexpat/master/expat/COPYING"
},
{
"name": "fontconfig",
"license": "fontconfig Licence",
"licenseURL": "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/raw/master/COPYING"
},
{
"name": "freetype",
"license": "freetype Licence",
"licenseURL": "https://gitlab.freedesktop.org/freetype/freetype/-/raw/master/LICENSE.TXT"
},
{
"name": "fribidi",
"license": "LGPL-2.1",
"licenseURL": "https://raw.githubusercontent.com/fribidi/fribidi/master/COPYING"
},
{
"name": "gdk-pixbuf",
"license": "LGPL-2.1",
"licenseURL": "https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/raw/master/COPYING"
},
{
"name": "glib",
"license": "LGPL-2.1",
"licenseURL": "https://gitlab.gnome.org/GNOME/glib/-/raw/master/COPYING"
},
{
"name": "harfbuzz",
"license": "MIT",
"licenseURL": "https://raw.githubusercontent.com/harfbuzz/harfbuzz/master/COPYING"
},
{
"name": "lcms",
"license": "MIT",
"licenseURL": "https://raw.githubusercontent.com/mm2/Little-CMS/master/COPYING"
},
{
"name": "libde265",
"license": "LGPL-3.0",
"licenseURL": "https://raw.githubusercontent.com/strukturag/libde265/master/COPYING"
},
{
"name": "libexif",
"license": "LGPL-2.1",
"licenseURL": "https://raw.githubusercontent.com/libexif/libexif/master/COPYING"
},
{
"name": "libffi",
"license": "MIT",
"licenseURL": "https://raw.githubusercontent.com/libffi/libffi/master/LICENSE"
},
{
"name": "libheif",
"license": "LGPL-3.0",
"licenseURL": "https://raw.githubusercontent.com/strukturag/libheif/master/COPYING"
},
{
"name": "libimagequant",
"license": "BSD 2-Clause",
"licenseURL": "https://raw.githubusercontent.com/lovell/libimagequant/main/COPYRIGHT"
},
{
"name": "mozjpeg",
"license": "zlib License, IJG License, BSD-3-Clause",
"licenseURL": "https://raw.githubusercontent.com/mozilla/mozjpeg/master/LICENSE.md"
},
{
"name": "libpng",
"license": "libpng License",
"licenseURL": "https://raw.githubusercontent.com/glennrp/libpng/libpng16/LICENSE"
},
{
"name": "librsvg",
"license": "LGPL-2.1",
"licenseURL": "https://gitlab.gnome.org/GNOME/librsvg/-/raw/main/COPYING.LIB"
},
{
"name": "libspng",
"license": "BSD 2-Clause, libpng License",
"licenseURL": "https://raw.githubusercontent.com/randy408/libspng/master/LICENSE"
},
{
"name": "libtiff",
"license": "libtiff License",
"licenseURL": "https://gitlab.com/libtiff/libtiff/-/raw/master/COPYRIGHT"
},
{
"name": "libvips",
"license": "LGPL-2.1",
"licenseURL": "https://raw.githubusercontent.com/libvips/libvips/master/COPYING"
},
{
"name": "libwebp",
"license": "BSD-3-Clause",
"licenseURL": [
"https://chromium.googlesource.com/webm/libwebp/+/refs/heads/main/COPYING?format=TEXT",
"https://chromium.googlesource.com/webm/libwebp/+/refs/heads/main/PATENTS?format=TEXT"
]
},
{
"name": "libxml2",
"license": "MIT",
"licenseURL": "https://gitlab.gnome.org/GNOME/libxml2/-/raw/master/Copyright"
},
{
"name": "orc",
"license": "orc License",
"licenseURL": "https://gitlab.freedesktop.org/gstreamer/orc/-/raw/master/COPYING"
},
{
"name": "openjpeg",
"license": "BDS 2-Clause",
"licenseURL": "https://raw.githubusercontent.com/uclouvain/openjpeg/master/LICENSE"
},
{
"name": "pango",
"license": "GPL-2.0",
"licenseURL": "https://gitlab.gnome.org/GNOME/pango/-/raw/master/COPYING"
},
{
"name": "pixman",
"license": "MIT",
"licenseURL": "https://cgit.freedesktop.org/pixman/plain/COPYING"
},
{
"name": "poppler",
"license": "GPL-2.0",
"licenseURL": "https://gitlab.freedesktop.org/poppler/poppler/-/raw/master/COPYING"
},
{
"name": "proxy-libintl",
"license": "LGPL-2.0",
"licenseURL": "https://raw.githubusercontent.com/frida/proxy-libintl/master/COPYING"
},
{
"name": "zlib-ng",
"license": "zlib Licence",
"licenseURL": "https://raw.githubusercontent.com/zlib-ng/zlib-ng/develop/LICENSE.md"
}
]
11 changes: 7 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ for flavour in darwin-x64 darwin-arm64v8; do
export FLAGS+=" -Werror=unguarded-availability-new"

if [ $PLATFORM = "darwin-arm64v8" ]; then
# ARM64 builds work via cross compilation from an x86_64 machine
export CHOST="aarch64-apple-darwin"
export FLAGS+=" -target arm64-apple-macos11"
export MESON="--cross-file=$PWD/$PLATFORM/meson.ini"
if [ "$(uname -m)" != "arm64" ]; then
# ARM64 builds work via cross compilation from an x86_64 machine
export CHOST="aarch64-apple-darwin"
export FLAGS+=" -target arm64-apple-macos11"
export MESON="--cross-file=$PWD/$PLATFORM/meson.ini"
fi

# macOS 11 Big Sur is the first version to support ARM-based macs
export MACOSX_DEPLOYMENT_TARGET="11.0"
# Set SDKROOT to the latest SDK available
Expand Down
72 changes: 65 additions & 7 deletions build/lin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export RUSTFLAGS+=" --remap-path-prefix=$CARGO_HOME/registry/="
# We don't want to use any native libraries, so unset PKG_CONFIG_PATH
unset PKG_CONFIG_PATH


# Common options for curl
CURL="curl --silent --location --retry 3 --retry-max-time 30"

Expand Down Expand Up @@ -119,6 +120,11 @@ VERSION_AOM=3.6.1
VERSION_HEIF=1.16.2
VERSION_CGIF=0.3.2

# Additional Tropy dependencies
VERSION_DE265=1.0.12
VERSION_OPENJPEG=2.5.0
VERSION_POPPLER=23.08.0

# Remove patch version component
without_patch() {
echo "${1%.[[:digit:]]*}"
Expand Down Expand Up @@ -177,6 +183,9 @@ version_latest "rsvg" "$VERSION_RSVG" "5420"
version_latest "aom" "$VERSION_AOM" "17628"
version_latest "heif" "$VERSION_HEIF" "strukturag/libheif"
version_latest "cgif" "$VERSION_CGIF" "dloebl/cgif"
version_latest "de265" "$VERSION_DE265" "11239"
version_latest "openjpeg" "$VERSION_OPENJPEG" "2550"
version_latest "poppler" "$VERSION_POPPLER" "3686"
if [ "$ALL_AT_VERSION_LATEST" = "false" ]; then exit 1; fi

# Download and build dependencies from source
Expand Down Expand Up @@ -258,12 +267,19 @@ AOM_AS_FLAGS="${FLAGS}" cmake -G"Unix Makefiles" \
..
make install/strip

mkdir ${DEPS}/de265
$CURL https://github.com/strukturag/libde265/releases/download/v${VERSION_DE265}/libde265-${VERSION_DE265}.tar.gz | tar xzC ${DEPS}/de265 --strip-components=1
cd ${DEPS}/de265
./configure --host=${CHOST} --prefix=${TARGET} --enable-static --disable-shared --disable-dependency-tracking \
--disable-dec265 --disable-sherlock265 ${DARWIN_ARM:+--disable-arm}
make install-strip

mkdir ${DEPS}/heif
$CURL https://github.com/strukturag/libheif/releases/download/v${VERSION_HEIF}/libheif-${VERSION_HEIF}.tar.gz | tar xzC ${DEPS}/heif --strip-components=1
cd ${DEPS}/heif
CFLAGS="${CFLAGS} -O3" CXXFLAGS="${CXXFLAGS} -O3" cmake -G"Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=FALSE -DENABLE_PLUGIN_LOADING=0 -DWITH_EXAMPLES=0 -DWITH_LIBDE265=0 -DWITH_X265=0
-DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_PREFIX_PATH=${TARGET} -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=FALSE -DENABLE_PLUGIN_LOADING=0 -DWITH_EXAMPLES=0 -DWITH_LIBDE265=ON -DWITH_X265=0
make install/strip

mkdir ${DEPS}/jpeg
Expand Down Expand Up @@ -432,6 +448,49 @@ CFLAGS="${CFLAGS} -O3" meson setup _build --default-library=static --buildtype=r
-Dtests=false
meson install -C _build --tag devel

mkdir -p ${DEPS}/openjpeg/build
$CURL https://github.com/uclouvain/openjpeg/archive/v${VERSION_OPENJPEG}.tar.gz | tar xzC ${DEPS}/openjpeg --strip-components=1
cd ${DEPS}/openjpeg/build
LDFLAGS=${LDFLAGS/\$/} cmake .. -G"Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake -DCMAKE_PREFIX_PATH=${TARGET} -DCMAKE_INSTALL_PREFIX=${TARGET} -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=FALSE -DBUILD_CODEC=OFF
make install/strip

mkdir -p ${DEPS}/poppler/build
$CURL https://gitlab.freedesktop.org/poppler/poppler/-/archive/poppler-${VERSION_POPPLER}/poppler-poppler-${VERSION_POPPLER}.tar.bz2 | tar xjC ${DEPS}/poppler --strip-components=1
cd ${DEPS}/poppler/build
LDFLAGS=${LDFLAGS/\$/} cmake .. -G"Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE=${ROOT}/Toolchain.cmake\
-DCMAKE_PREFIX_PATH=${TARGET} \
-DCMAKE_INSTALL_PREFIX=${TARGET} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=FALSE \
-DBUILD_CPP_TESTS=OFF \
-DBUILD_GTK_TESTS=OFF \
-DBUILD_QT5_TESTS=OFF \
-DBUILD_QT6_TESTS=OFF \
-DBUILD_MANUAL_TESTS=OFF \
-DENABLE_BOOST=OFF \
-DENABLE_CMS=lcms2 \
-DENABLE_CPP=OFF \
-DENABLE_DCTDECODER=libjpeg \
-DENABLE_GLIB=ON \
-DENABLE_GOBJECT_INTROSPECTION=OFF \
-DENABLE_GTK_DOC=OFF \
-DENABLE_LIBCURL=OFF \
-DENABLE_LIBOPENJPEG=openjpeg2 \
-DENABLE_LIBPNG=ON \
-DENABLE_LIBTIFF=ON \
-DENABLE_QT5=OFF \
-DENABLE_QT6=OFF \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
-DENABLE_UTILS=OFF \
-DENABLE_ZLIB=ON \
-DENABLE_ZLIB_UNCOMPRESS=OFF \
-DEXTRA_WARN=OFF
make install/strip

mkdir ${DEPS}/vips
$CURL https://github.com/libvips/libvips/releases/download/v${VERSION_VIPS}/vips-$(without_prerelease $VERSION_VIPS).tar.xz | tar xJC ${DEPS}/vips --strip-components=1
cd ${DEPS}/vips
Expand All @@ -457,8 +516,8 @@ fi
sed -i'.bak' "/subdir('man')/{N;N;N;N;d;}" meson.build
CFLAGS="${CFLAGS} -O3" CXXFLAGS="${CXXFLAGS} -O3" meson setup _build --default-library=shared --buildtype=release --strip --prefix=${TARGET} ${MESON} \
-Ddeprecated=false -Dintrospection=false -Dmodules=disabled -Dcfitsio=disabled -Dfftw=disabled -Djpeg-xl=disabled \
-Dmagick=disabled -Dmatio=disabled -Dnifti=disabled -Dopenexr=disabled -Dopenjpeg=disabled -Dopenslide=disabled \
-Dpdfium=disabled -Dpoppler=disabled -Dquantizr=disabled \
-Dmagick=disabled -Dmatio=disabled -Dnifti=disabled -Dopenexr=disabled -Dopenslide=disabled \
-Dpdfium=disabled -Dquantizr=disabled \
-Dppm=false -Danalyze=false -Dradiance=false \
${LINUX:+-Dcpp_link_args="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--version-script=$DEPS/vips/vips.map $EXCLUDE_LIBS"}
meson install -C _build --tag runtime,devel
Expand Down Expand Up @@ -548,7 +607,7 @@ printf "{\n\
printf "\"${PLATFORM}\"" >platform.json

# Add third-party notices
$CURL -O https://raw.githubusercontent.com/lovell/sharp-libvips/main/THIRD-PARTY-NOTICES.md
$CURL -O https://raw.githubusercontent.com/tropy/sharp-libvips/main/THIRD-PARTY-NOTICES.json

# Create the tarball
ls -al lib
Expand All @@ -557,8 +616,7 @@ mv lib-filtered lib
tar chzf ${PACKAGE}/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz \
include \
lib \
*.json \
THIRD-PARTY-NOTICES.md
*.json

# Recompress using AdvanceCOMP, ~5% smaller
advdef --recompress --shrink-insane ${PACKAGE}/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz
Expand Down
20 changes: 12 additions & 8 deletions build/win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ case ${PLATFORM} in
;;
esac

FILENAME="vips-dev-${ARCH}-web-${VERSION_VIPS}-static.zip"
URL="https://github.com/libvips/build-win64-mxe/releases/download/v${VERSION_VIPS}/${FILENAME}"
echo "Downloading $URL"
$CURL -O $URL
FILENAME="vips-dev-${ARCH}-tropy-${VERSION_VIPS}.zip"

if [ -f /packaging/$FILENAME ]; then
cp /packaging/$FILENAME $FILENAME
else
URL="https://github.com/tropy/build-win64-mxe/releases/download/v${VERSION_VIPS}/${FILENAME}"
echo "Downloading $URL"
$CURL -O $URL
fi
unzip $FILENAME

# Clean and zip
Expand All @@ -37,7 +42,7 @@ cp bin/*.dll lib/
printf "\"${PLATFORM}\"" >platform.json

# Add third-party notices
$CURL -O https://raw.githubusercontent.com/lovell/sharp-libvips/main/THIRD-PARTY-NOTICES.md
$CURL -O https://raw.githubusercontent.com/tropy/sharp-libvips/main/THIRD-PARTY-NOTICES.json

echo "Creating tarball"
tar czf /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz \
Expand All @@ -47,8 +52,7 @@ tar czf /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz \
lib/libglib-2.0.lib \
lib/libgobject-2.0.lib \
lib/*.dll \
*.json \
THIRD-PARTY-NOTICES.md
*.json

# Recompress using AdvanceCOMP, ~5% smaller
advdef --recompress --shrink-insane /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz
Expand All @@ -60,4 +64,4 @@ gunzip -c /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.gz | brotli -o /pac
chmod 644 /packaging/libvips-${VERSION_VIPS}-${PLATFORM}.tar.*

# Remove working directories
rm -rf lib include *.json THIRD-PARTY-NOTICES.md
rm -rf lib include *.json
3 changes: 2 additions & 1 deletion linux-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ENV \

# Build dependencies
RUN \
ulimit -n 1024 && \
yum update -y && \
yum install -y epel-release centos-release-scl && \
yum group install -y "Development Tools" && \
Expand All @@ -34,7 +35,7 @@ RUN \

# Compiler settings
ENV \
PKG_CONFIG="pkg-config --static" \
PKG_CONFIG="/usr/bin/pkg-config --static" \
PLATFORM="linux-x64" \
FLAGS="-march=x86-64-v2 -mtune=nehalem" \
MESON="--cross-file=/root/meson.ini"
Expand Down
3 changes: 3 additions & 0 deletions linux-x64/Toolchain.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(PKG_CONFIG_EXECUTABLE "/usr/bin/pkg-config" CACHE PATH "pkg-config-executable")
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)

0 comments on commit f23ae50

Please sign in to comment.