diff --git a/gimp.changes b/gimp.changes index 753ed11..1637043 100644 --- a/gimp.changes +++ b/gimp.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue Oct 27 00:27:00 UTC 2020 - Marcus Rueckert + +- updates to buildrequires + - synced required versions with configure.ac + - convert more buildrequires to pkgconfig() versions +- enable libheif on Tumbleweed, since we have the version in TW + with avif support, but not actual HEIF support unless libheif + from packman is used. +- added libheif-avif-only.patch: + libheif based exporter will only offer the formats supported by + the installed libheif (via runtime check) + ------------------------------------------------------------------- Sun Oct 18 14:04:36 UTC 2020 - Atri Bhattacharya diff --git a/gimp.spec b/gimp.spec index b286b3c..5d57b00 100644 --- a/gimp.spec +++ b/gimp.spec @@ -18,6 +18,13 @@ %global abiver 4 %global apiver 2.0 + +%if 0%{?suse_version} >= 1550 +%bcond_without libheif +%else +%bcond_with libheif +%endif + %if 0%{?sle_version} %bcond_with python_plugin %else @@ -35,6 +42,8 @@ Source1: macros.gimp # openSUSE palette file Source2: openSUSE.gpl Source99: baselibs.conf +# PATCH-FIX-UPSTREAM git diff GIMP_2_10_22..gimp-2-10 -- plug-ins/common/file-heif.c > libheif-avif-only.patch mrueckert@suse.de -- only offer the fileformats that our current libheif actually supports +Patch: libheif-avif-only.patch BuildRequires: aalib-devel BuildRequires: alsa-devel >= 1.0.0 @@ -55,11 +64,6 @@ BuildRequires: ghostscript-devel BuildRequires: ghostscript-library BuildRequires: glib-networking BuildRequires: intltool >= 0.40.1 -BuildRequires: iso-codes-devel -BuildRequires: libbz2-devel -BuildRequires: libjpeg-devel -BuildRequires: libmng-devel -BuildRequires: librsvg-devel >= 2.40.6 BuildRequires: libtiff-devel BuildRequires: libwmf-devel >= 0.2.8 BuildRequires: libxslt-tools @@ -71,6 +75,7 @@ BuildRequires: translation-update-upstream BuildRequires: update-desktop-files BuildRequires: pkgconfig(atk) >= 2.2.0 BuildRequires: pkgconfig(babl) >= 0.1.78 +BuildRequires: pkgconfig(bzip2) BuildRequires: pkgconfig(cairo) >= 1.12.2 BuildRequires: pkgconfig(cairo-pdf) >= 1.12.2 BuildRequires: pkgconfig(dbus-glib-1) >= 0.70 @@ -78,21 +83,32 @@ BuildRequires: pkgconfig(gdk-pixbuf-2.0) >= 2.30.8 BuildRequires: pkgconfig(gegl-0.4) >= 0.4.24 BuildRequires: pkgconfig(gexiv2) >= 0.10.6 BuildRequires: pkgconfig(glib-2.0) >= 2.54.2 -BuildRequires: pkgconfig(gtk+-2.0) >= 2.24.10 +BuildRequires: pkgconfig(gtk+-2.0) >= 2.24.32 BuildRequires: pkgconfig(gudev-1.0) >= 167 +BuildRequires: pkgconfig(harfbuzz) >= 0.9.19 +BuildRequires: pkgconfig(iso-codes) +BuildRequires: pkgconfig(json-glib-1.0) >= 1.2.6 BuildRequires: pkgconfig(lcms2) >= 2.8 BuildRequires: pkgconfig(libexif) >= 0.6.15 -# TODO: BuildRequires: pkgconfig(libheif) >= 1.1.0 +%if %{with libheif} +BuildRequires: pkgconfig(libheif) >= 1.3.2 +%endif +BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(liblzma) >= 5.0.0 +BuildRequires: pkgconfig(libmng) BuildRequires: pkgconfig(libmypaint) >= 1.3.0 BuildRequires: pkgconfig(libopenjp2) >= 2.1.0 BuildRequires: pkgconfig(libpng) >= 1.6.25 +BuildRequires: pkgconfig(librsvg-2.0) >= 2.40.6 +BuildRequires: pkgconfig(libunwind) BuildRequires: pkgconfig(libwebp) >= 0.6.0 +BuildRequires: pkgconfig(xmu) BuildRequires: pkgconfig(mypaint-brushes-1.0) BuildRequires: pkgconfig(OpenEXR) >= 1.6.1 BuildRequires: pkgconfig(pango) >= 1.29.4 BuildRequires: pkgconfig(poppler-data) >= 0.4.7 BuildRequires: pkgconfig(poppler-glib) >= 0.44.0 +BuildRequires: pkgconfig(libtiff-4) BuildRequires: pkgconfig(xcursor) BuildRequires: pkgconfig(xfixes) BuildRequires: pkgconfig(xpm) @@ -203,6 +219,7 @@ applications that want to make use of the GIMP libraries. %prep %setup -q +%patch -p1 export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 diff --git a/libheif-avif-only.patch b/libheif-avif-only.patch new file mode 100644 index 0000000..9180866 --- /dev/null +++ b/libheif-avif-only.patch @@ -0,0 +1,274 @@ +diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c +index 945951e5f4..e79419d5f0 100644 +--- a/plug-ins/common/file-heif.c ++++ b/plug-ins/common/file-heif.c +@@ -47,7 +47,7 @@ struct _SaveParams + + /* local function prototypes */ + +-static void query (void); ++static void init (void); + static void run (const gchar *name, + gint nparams, + const GimpParam *param, +@@ -73,9 +73,9 @@ static gboolean save_dialog (SaveParams *params, + + GimpPlugInInfo PLUG_IN_INFO = + { +- NULL, /* init_proc */ ++ init, /* init_proc */ + NULL, /* quit_proc */ +- query, /* query_proc */ ++ NULL, /* query_proc */ + run, /* run_proc */ + }; + +@@ -84,7 +84,7 @@ MAIN () + + + static void +-query (void) ++init (void) + { + static const GimpParamDef load_args[] = + { +@@ -110,87 +110,102 @@ query (void) + { GIMP_PDB_INT32, "lossless", "Use lossless compression (0 = lossy, 1 = lossless)" } + }; + +- gimp_install_procedure (LOAD_PROC, +- _("Loads HEIF images"), +- _("Load image stored in HEIF format (High " +- "Efficiency Image File Format). Typical " +- "suffices for HEIF files are .heif, .heic."), +- "Dirk Farin ", +- "Dirk Farin ", +- "2018", +- _("HEIF/HEIC"), +- NULL, +- GIMP_PLUGIN, +- G_N_ELEMENTS (load_args), +- G_N_ELEMENTS (load_return_vals), +- load_args, load_return_vals); +- +- gimp_register_load_handler (LOAD_PROC, +- "heic,heif" ++ if (heif_have_decoder_for_format (heif_compression_HEVC) + #if LIBHEIF_HAVE_VERSION(1,8,0) +- ",avif" ++ || heif_have_decoder_for_format (heif_compression_AV1) + #endif +- , ""); +- gimp_register_file_handler_mime (LOAD_PROC, +- "image/heif" +-#if LIBHEIF_HAVE_VERSION(1,8,0) +- ",image/avif" +-#endif +- ); +- gimp_register_file_handler_uri (LOAD_PROC); +- /* HEIF is an ISOBMFF format whose "brand" (the value after "ftyp") +- * can be of various values. +- * See also: https://gitlab.gnome.org/GNOME/gimp/issues/2209 +- */ +- gimp_register_magic_load_handler (LOAD_PROC, +- "heif,heic" +-#if LIBHEIF_HAVE_VERSION(1,8,0) +- ",avif" +-#endif +- , "", +- "4,string,ftypheic,4,string,ftypheix," +- "4,string,ftyphevc,4,string,ftypheim," +- "4,string,ftypheis,4,string,ftyphevm," +- "4,string,ftyphevs,4,string,ftypmif1," +- "4,string,ftypmsf1" ++ ) ++ { ++ GString *extensions = g_string_new (NULL); ++ GString *mimetypes = g_string_new (NULL); ++ GString *magic = g_string_new ("4,string,ftypmif1"); ++ ++ if (heif_have_decoder_for_format (heif_compression_HEVC)) ++ { ++ g_string_append (extensions, "heic,heif"); ++ g_string_append (mimetypes, "image/heif"); ++ g_string_append (magic, ",4,string,ftypheic,4,string,ftypheix," ++ "4,string,ftyphevc,4,string,ftypheim," ++ "4,string,ftypheis,4,string,ftyphevm," ++ "4,string,ftyphevs,4,string,ftypmsf1"); ++ } ++ + #if LIBHEIF_HAVE_VERSION(1,8,0) +- ",4,string,ftypavif" ++ if (heif_have_decoder_for_format (heif_compression_AV1)) ++ { ++ g_string_append_printf (extensions, "%savif", extensions->len ? "," : ""); ++ g_string_append_printf (mimetypes, "%simage/avif", mimetypes->len ? "," : ""); ++ g_string_append (magic, ",4,string,ftypavif"); ++ } + #endif +- ); +- +- gimp_install_procedure (SAVE_PROC, +- _("Exports HEIF images"), +- _("Save image in HEIF format (High Efficiency " +- "Image File Format)."), +- "Dirk Farin ", +- "Dirk Farin ", +- "2018", +- _("HEIF/HEIC"), +- "RGB*", +- GIMP_PLUGIN, +- G_N_ELEMENTS (save_args), 0, +- save_args, NULL); +- +- gimp_register_save_handler (SAVE_PROC, "heic,heif", ""); +- gimp_register_file_handler_mime (SAVE_PROC, "image/heif"); +- gimp_register_file_handler_uri (SAVE_PROC); ++ ++ gimp_install_procedure (LOAD_PROC, ++ _("Loads HEIF images"), ++ _("Load image stored in HEIF format (High " ++ "Efficiency Image File Format). Typical " ++ "suffices for HEIF files are .heif, .heic."), ++ "Dirk Farin ", ++ "Dirk Farin ", ++ "2018", ++ _("HEIF/HEIC"), ++ NULL, ++ GIMP_PLUGIN, ++ G_N_ELEMENTS (load_args), ++ G_N_ELEMENTS (load_return_vals), ++ load_args, load_return_vals); ++ ++ gimp_register_load_handler (LOAD_PROC, extensions->str, ""); ++ gimp_register_file_handler_mime (LOAD_PROC, mimetypes->str); ++ gimp_register_file_handler_uri (LOAD_PROC); ++ ++ gimp_register_magic_load_handler (LOAD_PROC, ++ extensions->str, "", ++ magic->str); ++ ++ g_string_free (magic, TRUE); ++ g_string_free (mimetypes, TRUE); ++ g_string_free (extensions, TRUE); ++ } ++ ++ if (heif_have_encoder_for_format (heif_compression_HEVC)) ++ { ++ gimp_install_procedure (SAVE_PROC, ++ _("Exports HEIF images"), ++ _("Save image in HEIF format (High Efficiency " ++ "Image File Format)."), ++ "Dirk Farin ", ++ "Dirk Farin ", ++ "2018", ++ _("HEIF/HEIC"), ++ "RGB*", ++ GIMP_PLUGIN, ++ G_N_ELEMENTS (save_args), 0, ++ save_args, NULL); ++ ++ gimp_register_save_handler (SAVE_PROC, "heic,heif", ""); ++ gimp_register_file_handler_mime (SAVE_PROC, "image/heif"); ++ gimp_register_file_handler_uri (SAVE_PROC); ++ } + + #if LIBHEIF_HAVE_VERSION(1,8,0) +- gimp_install_procedure (SAVE_PROC_AV1, +- "Exports AVIF images", +- "Save image in AV1 Image File Format (AVIF)", +- "Daniel Novomesky ", +- "Daniel Novomesky ", +- "2020", +- "HEIF/AVIF", +- "RGB*", +- GIMP_PLUGIN, +- G_N_ELEMENTS (save_args), 0, +- save_args, NULL); +- +- gimp_register_save_handler (SAVE_PROC_AV1, "avif", ""); +- gimp_register_file_handler_mime (SAVE_PROC_AV1, "image/avif"); +- gimp_register_file_handler_uri (SAVE_PROC_AV1); ++ if (heif_have_encoder_for_format (heif_compression_AV1)) ++ { ++ gimp_install_procedure (SAVE_PROC_AV1, ++ _("Exports AVIF images"), ++ _("Save image in AV1 Image File Format (AVIF)"), ++ "Daniel Novomesky ", ++ "Daniel Novomesky ", ++ "2020", ++ "HEIF/AVIF", ++ "RGB*", ++ GIMP_PLUGIN, ++ G_N_ELEMENTS (save_args), 0, ++ save_args, NULL); ++ ++ gimp_register_save_handler (SAVE_PROC_AV1, "avif", ""); ++ gimp_register_file_handler_mime (SAVE_PROC_AV1, "image/avif"); ++ gimp_register_file_handler_uri (SAVE_PROC_AV1); ++ } + #endif + } + +@@ -1139,12 +1154,12 @@ load_image (GFile *file, + while (new_exif_size >= 4) /*Searching for TIFF Header*/ + { + if (tiffheader[0] == tiffHeaderBE[0] && tiffheader[1] == tiffHeaderBE[1] && +- tiffheader[2] == tiffHeaderBE[2] && tiffheader[2] == tiffHeaderBE[2]) ++ tiffheader[2] == tiffHeaderBE[2] && tiffheader[3] == tiffHeaderBE[3]) + { + break; + } + if (tiffheader[0] == tiffHeaderLE[0] && tiffheader[1] == tiffHeaderLE[1] && +- tiffheader[2] == tiffHeaderLE[2] && tiffheader[2] == tiffHeaderLE[2]) ++ tiffheader[2] == tiffHeaderLE[2] && tiffheader[3] == tiffHeaderLE[3]) + { + break; + } +@@ -1525,6 +1540,17 @@ save_image (GFile *file, + heif_encoder_set_lossless (encoder, params->lossless); + /* heif_encoder_set_logging_level (encoder, logging_level); */ + ++#if LIBHEIF_HAVE_VERSION(1,9,0) ++ if (params->lossless && params->save_bit_depth == 8) ++ { ++ err = heif_encoder_set_parameter_string (encoder, "chroma", "444"); ++ if (err.code != 0) ++ { ++ g_printerr ("Failed to set chroma=444 for %s encoder: %s", heif_encoder_get_name (encoder), err.message); ++ } ++ } ++#endif ++ + err = heif_context_encode_image (context, + image, + encoder, +@@ -1984,7 +2010,7 @@ save_dialog (SaveParams *params, + frame = gimp_frame_new (NULL); + gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); + +- lossless_button = gtk_check_button_new_with_mnemonic (_("Nearly _lossless (YUV420 format)")); ++ lossless_button = gtk_check_button_new_with_mnemonic (_("Nearly _lossless")); + gtk_frame_set_label_widget (GTK_FRAME (frame), lossless_button); + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); +@@ -1998,7 +2024,7 @@ save_dialog (SaveParams *params, + gtk_range_set_value (GTK_RANGE (quality_slider), params->quality); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lossless_button), + params->lossless); +- gtk_widget_set_sensitive (quality_slider, !params->lossless); ++ gtk_widget_set_sensitive (hbox, !params->lossless); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), quality_slider); + + g_signal_connect (lossless_button, "toggled", +@@ -2038,8 +2064,8 @@ save_dialog (SaveParams *params, + gtk_widget_show (label2); + + combo = gimp_int_combo_box_new (_("8 bit/channel"), 8, +- _("10 bit/channel (HDR)"), 10, +- _("12 bit/channel (HDR)"), 12, ++ _("10 bit/channel"), 10, ++ _("12 bit/channel"), 12, + NULL); + gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, + GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);