diff --git a/graphics/libskiasharp/Makefile b/graphics/libskiasharp/Makefile index 897b6df67775..651883ca6b57 100644 --- a/graphics/libskiasharp/Makefile +++ b/graphics/libskiasharp/Makefile @@ -1,79 +1,78 @@ PORTNAME= libskiasharp DISTVERSIONPREFIX= v DISTVERSION= 116 -PORTREVISION= 2 -PORTREPOCH= 1 +PORTREVISION= 3 CATEGORIES= graphics MAINTAINER= bapt@FreeBSD.org COMMENT= Complete 2D graphic library for drawing Text, Geometries, and Images WWW= https://skia.org/ LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= gn:devel/gn LIB_DEPENDS= libexpat.so:textproc/expat2 \ libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libpng.so:graphics/png \ libwebp.so:graphics/webp USES= jpeg ninja python:build USE_GITHUB= yes GH_ACCOUNT= mono GH_PROJECT= skia GH_TAGNAME= c16e913577083761d847146db7a04b8d3b3bf755 USE_LDCONFIG= yes USE_BINUTILS= yes SOVERSION= 116.0.0 GN_ARGS= is_official_build=true \ skia_enable_tools=false \ target_os="linux" \ skia_use_icu=false \ skia_use_sfntly=false \ skia_use_piex=true \ skia_use_harfbuzz=false \ skia_use_wuffs=false \ skia_use_system_expat=true \ skia_use_system_libjpeg_turbo=true \ skia_use_system_freetype2=true \ skia_use_system_libpng=true \ skia_use_system_libwebp=true \ skia_use_system_zlib=true \ skia_enable_gpu=true \ ska_enable_ganesh=true \ skia_enable_skottie=true \ skia_enable_pdf=true \ skia_use_dng_sdk=false \ extra_cflags=[ \ "-DSKIA_C_DLL", \ "-I${LOCALBASE}/include", \ "-I${LOCALBASE}/include/freetype2"] \ extra_ldflags=["-L${LOCALBASE}/lib", \ "-Wl,--version-script=${FILESDIR}/libskiasharp.map" ] \ linux_soname_version="${SOVERSION}" BINARY_ALIAS= python3=${PYTHON_CMD} \ ar=${LOCALBASE}/bin/ar ALL_TARGET= SkiaSharp BUILD_WRKSRC= ${WRKSRC}/out PLIST_FILES= lib/libSkiaSharp.so \ lib/libSkiaSharp.so.${SOVERSION} do-configure: cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} gn gen 'out' --args='${GN_ARGS}' do-install: ${INSTALL_DATA} ${BUILD_WRKSRC}/libSkiaSharp.so.${SOVERSION} \ ${STAGEDIR}${PREFIX}/lib ${RLN} ${STAGEDIR}${PREFIX}/lib/libSkiaSharp.so.${SOVERSION} \ ${STAGEDIR}${PREFIX}/lib/libSkiaSharp.so .include diff --git a/graphics/libskiasharp/files/patch-src_codec_SkJpegCodec.cpp b/graphics/libskiasharp/files/patch-src_codec_SkJpegCodec.cpp new file mode 100644 index 000000000000..a03a0306500d --- /dev/null +++ b/graphics/libskiasharp/files/patch-src_codec_SkJpegCodec.cpp @@ -0,0 +1,55 @@ +--- src/codec/SkJpegCodec.cpp.orig 2024-10-24 03:17:23 UTC ++++ src/codec/SkJpegCodec.cpp +@@ -426,16 +426,19 @@ SkISize SkJpegCodec::onGetScaledDimensions(float desir + num = 1; + } + +- // Set up a fake decompress struct in order to use libjpeg to calculate output dimensions ++ // Set up a fake decompress struct in order to use libjpeg to calculate output dimensions. ++ // This isn't conventional use of libjpeg-turbo but initializing the decompress struct with ++ // jpeg_create_decompress allows for less violation of the API regardless of the version. + jpeg_decompress_struct dinfo; +- sk_bzero(&dinfo, sizeof(dinfo)); ++ jpeg_create_decompress(&dinfo); + dinfo.image_width = this->dimensions().width(); + dinfo.image_height = this->dimensions().height(); + dinfo.global_state = fReadyState; + calc_output_dimensions(&dinfo, num, denom); ++ SkISize outputDimensions = SkISize::Make(dinfo.output_width, dinfo.output_height); ++ jpeg_destroy_decompress(&dinfo); + +- // Return the calculated output dimensions for the given scale +- return SkISize::Make(dinfo.output_width, dinfo.output_height); ++ return outputDimensions; + } + + bool SkJpegCodec::onRewind() { +@@ -534,9 +537,11 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& + const unsigned int dstHeight = size.height(); + + // Set up a fake decompress struct in order to use libjpeg to calculate output dimensions ++ // This isn't conventional use of libjpeg-turbo but initializing the decompress struct with ++ // jpeg_create_decompress allows for less violation of the API regardless of the version. + // FIXME: Why is this necessary? + jpeg_decompress_struct dinfo; +- sk_bzero(&dinfo, sizeof(dinfo)); ++ jpeg_create_decompress(&dinfo); + dinfo.image_width = this->dimensions().width(); + dinfo.image_height = this->dimensions().height(); + dinfo.global_state = fReadyState; +@@ -549,6 +554,7 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& + + // Return a failure if we have tried all of the possible scales + if (1 == num || dstWidth > dinfo.output_width || dstHeight > dinfo.output_height) { ++ jpeg_destroy_decompress(&dinfo); + return false; + } + +@@ -556,6 +562,7 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& + num -= 1; + calc_output_dimensions(&dinfo, num, denom); + } ++ jpeg_destroy_decompress(&dinfo); + + fDecoderMgr->dinfo()->scale_num = num; + fDecoderMgr->dinfo()->scale_denom = denom;