From 69929c6c999fd7644fb543ea9f32d32f848d05c7 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Fri, 17 Nov 2023 15:54:53 +0000 Subject: [PATCH] Fix #1076: webp images show up as black https://github.com/BestImageViewer/geeqie/issues/1076 Include additional option -Dsubprojects=true|false The default is "true", which will include subprojects. --- .github/workflows/appimage-aarch64.yml | 1 + .../workflows/appimage-minimal-aarch64.yml | 2 +- .github/workflows/appimage-minimal-x86_64.yml | 2 +- .github/workflows/appimage-x86_64.yml | 2 + .github/workflows/check-build-actions.yml | 2 + AppImageBuilder-aarch64.yml | 1 + AppImageBuilder-x86_64.yml | 1 + meson.build | 64 +++++++++++++++---- meson_options.txt | 3 +- scripts/patch-loaders-cache.sh | 17 +++-- src/meson.build | 5 -- 11 files changed, 72 insertions(+), 28 deletions(-) diff --git a/.github/workflows/appimage-aarch64.yml b/.github/workflows/appimage-aarch64.yml index 75f3f7a2..21561127 100644 --- a/.github/workflows/appimage-aarch64.yml +++ b/.github/workflows/appimage-aarch64.yml @@ -41,6 +41,7 @@ jobs: yes | sudo apt-get install libpoppler-glib-dev yes | sudo apt-get install libraw-dev libomp-dev yes | sudo apt-get install libwebp-dev + yes | sudo apt-get install webp-pixbuf-loader yes | sudo apt-get install gettext yes | sudo apt-get install git yes | sudo apt-get install python3 python3-pip python3-setuptools python3-wheel ninja-build diff --git a/.github/workflows/appimage-minimal-aarch64.yml b/.github/workflows/appimage-minimal-aarch64.yml index 6df19fbd..42dc3b5f 100644 --- a/.github/workflows/appimage-minimal-aarch64.yml +++ b/.github/workflows/appimage-minimal-aarch64.yml @@ -36,7 +36,7 @@ jobs: yes | sudo apt-get install gettext mkdir -p $GITHUB_WORKSPACE/AppDir mkdir -p $GITHUB_WORKSPACE/AppDir/usr - meson setup -Darchive=disabled -Dcms=disabled -Ddevel=disabled -Ddoxygen=disabled -Ddjvu=disabled -Devince=disabled -Dexecinfo=disabled -Dexiv2=disabled -Dgps-map=disabled -Dheif=disabled -Dj2k=disabled -Djpeg=disabled -Djpegxl=disabled -Dlibraw=disabled -Dlua=disabled -Dpdf=disabled -Dspell=disabled -Dtiff=disabled -Dvideothumbnailer=disabled -Dwebp=disabled -Dyelp-build=disabled -Dprefix=$GITHUB_WORKSPACE/AppDir/usr build + meson setup -Darchive=disabled -Dcms=disabled -Ddevel=disabled -Ddoxygen=disabled -Ddjvu=disabled -Devince=disabled -Dexecinfo=disabled -Dexiv2=disabled -Dgps-map=disabled -Dheif=disabled -Dj2k=disabled -Djpeg=disabled -Djpegxl=disabled -Dlibraw=disabled -Dlua=disabled -Dpdf=disabled -Dspell=disabled -Dsubprojects=false -Dtiff=disabled -Dvideothumbnailer=disabled -Dwebp-pixbuf-loader=disabled -Dyelp-build=disabled -Dprefix=$GITHUB_WORKSPACE/AppDir/usr build ninja -C build install tar -czvf geeqie.gz $GITHUB_WORKSPACE/ diff --git a/.github/workflows/appimage-minimal-x86_64.yml b/.github/workflows/appimage-minimal-x86_64.yml index 071841e5..effac76d 100644 --- a/.github/workflows/appimage-minimal-x86_64.yml +++ b/.github/workflows/appimage-minimal-x86_64.yml @@ -18,7 +18,7 @@ jobs: with: action: build directory: build - setup-options: -Darchive=disabled -Dcms=disabled -Ddevel=disabled -Ddoxygen=disabled -Ddjvu=disabled -Devince=disabled -Dexecinfo=disabled -Dexiv2=disabled -Dgps-map=disabled -Dheif=disabled -Dj2k=disabled -Djpeg=disabled -Djpegxl=disabled -Dlibraw=disabled -Dlua=disabled -Dpdf=disabled -Dspell=disabled -Dtiff=disabled -Dvideothumbnailer=disabled -Dwebp=disabled -Dyelp-build=disabled + setup-options: -Darchive=disabled -Dcms=disabled -Ddevel=disabled -Ddoxygen=disabled -Ddjvu=disabled -Devince=disabled -Dexecinfo=disabled -Dexiv2=disabled -Dgps-map=disabled -Dheif=disabled -Dj2k=disabled -Djpeg=disabled -Djpegxl=disabled -Dlibraw=disabled -Dlua=disabled -Dpdf=disabled -Dspell=disabled -Dsubprojects=false -Dtiff=disabled -Dvideothumbnailer=disabled -Dwebp-pixbuf-loader=disabled -Dyelp-build=disabled options: --verbose meson-version: 1.0.1 diff --git a/.github/workflows/appimage-x86_64.yml b/.github/workflows/appimage-x86_64.yml index 2352a663..6d9954a6 100644 --- a/.github/workflows/appimage-x86_64.yml +++ b/.github/workflows/appimage-x86_64.yml @@ -17,7 +17,9 @@ jobs: - run: sudo apt-get install liblua5.3-dev - run: sudo apt-get install libpoppler-glib-dev - run: sudo apt-get install libraw-dev libomp-dev + - run: sudo apt-get install libwebp7 - run: sudo apt-get install libwebp-dev + - run: sudo apt-get install webp-pixbuf-loader - run: sudo apt-get install pandoc - run: sudo apt-get install gettext diff --git a/.github/workflows/check-build-actions.yml b/.github/workflows/check-build-actions.yml index f29ee77c..3bd3425c 100644 --- a/.github/workflows/check-build-actions.yml +++ b/.github/workflows/check-build-actions.yml @@ -48,6 +48,8 @@ jobs: - run: sudo apt-get install libpoppler-glib-dev - run: sudo apt-get install libraw-dev libomp-dev - run: sudo apt-get install libunwind-dev + - run: sudo apt-get install libwebp7 + - run: sudo apt-get install libwebp-dev - run: sudo apt-get install webp-pixbuf-loader - run: sudo apt-get install pandoc #~ - run: sudo apt-get install yelp-tools diff --git a/AppImageBuilder-aarch64.yml b/AppImageBuilder-aarch64.yml index 5cebef43..e485100d 100644 --- a/AppImageBuilder-aarch64.yml +++ b/AppImageBuilder-aarch64.yml @@ -42,6 +42,7 @@ AppDir: - librsvg2-common - libtiff5 - libwebp7 + - webp-pixbuf-loader files: include: [] diff --git a/AppImageBuilder-x86_64.yml b/AppImageBuilder-x86_64.yml index de2e05ea..722c7736 100644 --- a/AppImageBuilder-x86_64.yml +++ b/AppImageBuilder-x86_64.yml @@ -42,6 +42,7 @@ AppDir: - librsvg2-common - libtiff5 - libwebp7 + - webp-pixbuf-loader files: include: [] diff --git a/meson.build b/meson.build index 052eb0b0..1a12f0da 100644 --- a/meson.build +++ b/meson.build @@ -474,6 +474,14 @@ else summary({'spell' : ['disabled - spelling checks enabled', false]}, section : 'Configuration', bool_yn : true) endif +# Check for subproject handling +option = get_option('subprojects') +if option + summary({'subprojects' : ['subprojects enabled:', true]}, section : 'Configuration', bool_yn : true) +else + summary({'subprojects' : ['subprojects enabled:', false]}, section : 'Configuration', bool_yn : true) +endif + tiff_dep = [] option = get_option('tiff') if not option.disabled() @@ -528,19 +536,53 @@ else summary({'videothumbnailer' : ['disabled -thumbnails of video files supported', false]}, section : 'Configuration', bool_yn : true) endif -libwebp_dep = [] -req_version = '>=0.6.1' -option = get_option('webp') +webp_pixbuf_loader_version = '0.0' +webp_pixbuf_loader_subproject = 'disabled' +option = get_option('webp-pixbuf-loader') if not option.disabled() - libwebp_dep = dependency('libwebp', version : req_version, required : get_option('webp')) - if libwebp_dep.found() - conf_data.set('HAVE_WEBP', 1) - summary({'webp' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true) + cmd = find_program('dpkg-query', required: false) + if cmd.found() + dpkg_res = run_command(cmd, '--show', 'webp-pixbuf-loader', check: false) + + if dpkg_res.returncode() == 0 + dpkg_list = dpkg_res.stdout().split() + webp_pixbuf_loader_version = dpkg_list.get(1) + endif + + # Loader version 0.2.1 is OK. Versions 0.2.2 to 0.2.4 need patching via a subproject + # In that case if subprojects are disabled the loader is indicated as failing + # Anything later than 0.2.4 is assumed to be OK + if webp_pixbuf_loader_version.version_compare('==0.0') + summary({'webp_pixbuf_loader' : ['webp-pixbuf-loader not found - webp files supported:', false]}, section : 'Configuration', bool_yn : true) + else + message('webp-pixbuf-loader found: ' + webp_pixbuf_loader_version) + if webp_pixbuf_loader_version.version_compare('<0.2.2') + summary({'webp_pixbuf_loader' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true) + conf_data.set('HAVE_WEBP', 1) + elif webp_pixbuf_loader_version.version_compare('<=0.2.4') + if get_option('subprojects') + webp_pixbuf_loader_proj = subproject('webp-pixbuf-loader') + + if webp_pixbuf_loader_proj.found() + meson.add_install_script('./scripts/update-pixbuf-loaders-cache.sh') + summary({'webp_pixbuf_loader' : ['webp files supported as subproject:', true]}, section : 'Configuration', bool_yn : true) + conf_data.set('HAVE_WEBP', 1) + else + summary({'webp_pixbuf_loader' : ['webp subproject failed - webp files supported:', false]}, section : 'Configuration', bool_yn : true) + endif + else + summary({'webp_pixbuf_loader' : ['webp files supported:', false]}, section : 'Configuration', bool_yn : true) + endif + else + summary({'webp_pixbuf_loader' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true) + conf_data.set('HAVE_WEBP', 1) + endif + endif else - summary({'webp' : ['libwebp ' + req_version + ' not found - webp files supported:', false]}, section : 'Configuration', bool_yn : true) + summary({'webp_pixbuf_loader' : ['dpkg not found - webp files supported:', false]}, section : 'Configuration', bool_yn : true) endif else - summary({'webp' : ['disabled - webp files supported:', false]}, section : 'Configuration', bool_yn : true) + summary({'webp_pixbuf_loader' : ['disabled - webp files supported:', false]}, section : 'Configuration', bool_yn : true) endif # Check for nl_langinfo and _NL_TIME_FIRST_WEEKDAY @@ -768,7 +810,3 @@ if not option.disabled() else summary({'lua' : ['Test runs:', false]}, section : 'Testing', bool_yn : true) endif - -if conf_data.has('HAVE_WEBP') - meson.add_install_script('./scripts/update-pixbuf-loaders-cache.sh') -endif diff --git a/meson_options.txt b/meson_options.txt index 9bc8508a..2e5ecf41 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -43,7 +43,8 @@ option('lua', type : 'feature', value : 'auto', description : 'lua') option('pandoc', type : 'feature', value : 'auto', description : 'README.html') option('pdf', type : 'feature', value : 'auto', description : 'pdf') option('spell', type : 'feature', value : 'auto', description : 'spelling checks') +option('subprojects', type : 'boolean', value : 'true', description : 'subprojects') option('tiff', type : 'feature', value : 'auto', description : 'tiff') option('videothumbnailer', type : 'feature', value : 'auto', description : 'video thumbnailer') -option('webp', type : 'feature', value : 'auto', description : 'webp') +option('webp-pixbuf-loader', type : 'feature', value : 'auto', description : 'webp pixbuf loader') option('yelp-build', type : 'feature', value : 'auto', description : 'help files') diff --git a/scripts/patch-loaders-cache.sh b/scripts/patch-loaders-cache.sh index 53c2c504..0699a6a9 100755 --- a/scripts/patch-loaders-cache.sh +++ b/scripts/patch-loaders-cache.sh @@ -26,12 +26,15 @@ ## is run only when an AppImage is being created ## -loader=$(find ./AppDir -name libpixbufloader-webp.so) -loaders_cache=$(find ./AppDir -name loaders.cache) -dest=$(dirname "$loaders_cache" | sed s/local//) -loaders_cache_dest=$(echo "$loaders_cache" | sed s/local//) +loader=$(find ./AppDir/usr/local -name libpixbufloader-webp.so) -cat << EOF >> "$loaders_cache" +if [ -f "$loader" ] +then + loaders_cache=$(find ./AppDir/usr/local/lib -name loaders.cache) + loaders_src=$(dirname "$loader" | sed s/local//) + loaders_dest=$(dirname "$loader") + + cat << EOF >> "$loaders_cache" "libpixbufloader-webp.so" "webp" 5 "gdk-pixbuf" "The WebP image format" "LGPL" "image/webp" "audio/x-riff" "" @@ -40,5 +43,5 @@ cat << EOF >> "$loaders_cache" EOF -cp -n "$loaders_cache" "$loaders_cache_dest" -cp -n "$loader" "$dest""/loaders" + cp -r "$loaders_src/." "$loaders_dest" +fi diff --git a/src/meson.build b/src/meson.build index 3f9d8df0..3fecfb7f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -264,10 +264,6 @@ if conf_data.has('HAVE_LCMS') project_sources += ClayRGB1998_icc_h endif -if conf_data.has('HAVE_WEBP') - webp_pixbuf_loader_proj = subproject('webp-pixbuf-loader') -endif - geeqie_exe = executable('geeqie', project_sources, dependencies : [ gtk_dep, @@ -290,7 +286,6 @@ libjxl_dep, libopenjp2_dep, libraw_dep, libunwind_dep, -libwebp_dep, lua_dep, poppler_glib_dep, thread_dep, -- 2.20.1