From 4be224e3f9ef0841245760ae10112a0405447644 Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Mon, 26 Apr 2021 23:59:12 -0700 Subject: [PATCH 01/10] [vcpkg baseline][gdk-pixbuf] Fix build error on windows --- .../gdk-pixbuf/fix_build_error_windows.patch | 41 +++++++++++++++++++ ports/gdk-pixbuf/portfile.cmake | 4 +- ports/gdk-pixbuf/vcpkg.json | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 ports/gdk-pixbuf/fix_build_error_windows.patch diff --git a/ports/gdk-pixbuf/fix_build_error_windows.patch b/ports/gdk-pixbuf/fix_build_error_windows.patch new file mode 100644 index 00000000000000..5369c446546875 --- /dev/null +++ b/ports/gdk-pixbuf/fix_build_error_windows.patch @@ -0,0 +1,41 @@ +diff --git a/gdk-pixbuf/fallback-c89.c b/gdk-pixbuf/fallback-c89.c +index f2078ff..8def6a6 100644 +--- a/gdk-pixbuf/fallback-c89.c ++++ b/gdk-pixbuf/fallback-c89.c +@@ -34,7 +34,7 @@ round (double x) + /* Workaround for lrint() for non-GCC/non-C99 compilers */ + #ifndef HAVE_LRINT + static inline long +-lrint (double x) ++opj_lrint (double x) + { + if (ceil (x + 0.5) == floor (x + 0.5)) + { +diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c +index 623dbd0..c435f67 100644 +--- a/gdk-pixbuf/pixops/pixops.c ++++ b/gdk-pixbuf/pixops/pixops.c +@@ -1769,8 +1769,8 @@ prescale (const guchar **src_bufp, + /* Scale the whole source image into a top-left-aligned temporary pixbuf. + * render_[xy][01] are done in the final scaling, not here, as they are + * measured in the coordinate system of the scaled image. */ +- tmp_width = lrint (src_width * prescale_x); +- tmp_height = lrint (src_height * prescale_y); ++ tmp_width = opj_lrint (src_width * prescale_x); ++ tmp_height = opj_lrint (src_height * prescale_y); + + /* We are below the gdk_ interface, so create the temp image manually. + * Code copied from gdk_pixbuf_new() */ +diff --git a/meson.build b/meson.build +index b39c55d..bb67d3f 100644 +--- a/meson.build ++++ b/meson.build +@@ -89,7 +89,7 @@ if cc.has_function('round', dependencies: mathlib_dep) + gdk_pixbuf_conf.set('HAVE_ROUND', 1) + endif + +-if cc.has_function('lrint', dependencies: mathlib_dep) ++if cc.has_function('opj_lrint', dependencies: mathlib_dep) + gdk_pixbuf_conf.set('HAVE_LRINT', 1) + endif + diff --git a/ports/gdk-pixbuf/portfile.cmake b/ports/gdk-pixbuf/portfile.cmake index f235c5b312e27a..bf16064f89e9ea 100644 --- a/ports/gdk-pixbuf/portfile.cmake +++ b/ports/gdk-pixbuf/portfile.cmake @@ -10,7 +10,9 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ARCHIVE ${ARCHIVE} - PATCHES fix_build.patch + PATCHES + fix_build.patch + fix_build_error_windows.patch ) if(VCPKG_TARGET_IS_WINDOWS) #list(APPEND OPTIONS -Dnative_windows_loaders=true) # Use Windows system components to handle BMP, EMF, GIF, ICO, JPEG, TIFF and WMF images, overriding jpeg and tiff. To build this into gdk-pixbuf, pass in windows" with the other loaders to build in or use "all" with the builtin_loaders option diff --git a/ports/gdk-pixbuf/vcpkg.json b/ports/gdk-pixbuf/vcpkg.json index c123f6a3e7d015..bac81e56078a08 100644 --- a/ports/gdk-pixbuf/vcpkg.json +++ b/ports/gdk-pixbuf/vcpkg.json @@ -1,6 +1,7 @@ { "name": "gdk-pixbuf", "version": "2.42.2", + "port-version": 1 "description": "Image loading library.", "homepage": "https://developer.gnome.org/gdk-pixbuf/", "dependencies": [ From 1b0c41c805da382cfcac983c01d83d17ef8ebf9a Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 00:18:05 -0700 Subject: [PATCH 02/10] Format the vcpkg.json --- ports/gdk-pixbuf/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/gdk-pixbuf/vcpkg.json b/ports/gdk-pixbuf/vcpkg.json index bac81e56078a08..ca65da57a9f2f3 100644 --- a/ports/gdk-pixbuf/vcpkg.json +++ b/ports/gdk-pixbuf/vcpkg.json @@ -1,7 +1,7 @@ { "name": "gdk-pixbuf", "version": "2.42.2", - "port-version": 1 + "port-version": 1, "description": "Image loading library.", "homepage": "https://developer.gnome.org/gdk-pixbuf/", "dependencies": [ From 3bfa473de79534dfaf9faf26361435813e0aecb9 Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 00:18:49 -0700 Subject: [PATCH 03/10] Update the baseline version --- versions/baseline.json | 2 +- versions/g-/gdk-pixbuf.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/versions/baseline.json b/versions/baseline.json index b3ec11325bab7c..69bd20f46bbbf2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2170,7 +2170,7 @@ }, "gdk-pixbuf": { "baseline": "2.42.2", - "port-version": 0 + "port-version": 1 }, "genann": { "baseline": "2019-07-10", diff --git a/versions/g-/gdk-pixbuf.json b/versions/g-/gdk-pixbuf.json index 60824653dd46b6..6fe53959d63b7c 100644 --- a/versions/g-/gdk-pixbuf.json +++ b/versions/g-/gdk-pixbuf.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "7d3a1830065f2ca29f0df5a704c13a46cc5af8e0", + "version": "2.42.2", + "port-version": 1 + }, { "git-tree": "609b77f244ec0d76aac5616cd8654dfcbc608297", "version": "2.42.2", From 2889b21a45d3c3a1a7a4bc0d3b9b2b1a95295152 Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 02:24:03 -0700 Subject: [PATCH 04/10] Update the patch --- .../gdk-pixbuf/fix_build_error_windows.patch | 49 +++++++------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/ports/gdk-pixbuf/fix_build_error_windows.patch b/ports/gdk-pixbuf/fix_build_error_windows.patch index 5369c446546875..f85d2e46ae8d35 100644 --- a/ports/gdk-pixbuf/fix_build_error_windows.patch +++ b/ports/gdk-pixbuf/fix_build_error_windows.patch @@ -1,41 +1,28 @@ -diff --git a/gdk-pixbuf/fallback-c89.c b/gdk-pixbuf/fallback-c89.c -index f2078ff..8def6a6 100644 ---- a/gdk-pixbuf/fallback-c89.c -+++ b/gdk-pixbuf/fallback-c89.c -@@ -34,7 +34,7 @@ round (double x) - /* Workaround for lrint() for non-GCC/non-C99 compilers */ - #ifndef HAVE_LRINT - static inline long --lrint (double x) -+opj_lrint (double x) - { - if (ceil (x + 0.5) == floor (x + 0.5)) - { -diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c -index 623dbd0..c435f67 100644 ---- a/gdk-pixbuf/pixops/pixops.c -+++ b/gdk-pixbuf/pixops/pixops.c -@@ -1769,8 +1769,8 @@ prescale (const guchar **src_bufp, - /* Scale the whole source image into a top-left-aligned temporary pixbuf. - * render_[xy][01] are done in the final scaling, not here, as they are - * measured in the coordinate system of the scaled image. */ -- tmp_width = lrint (src_width * prescale_x); -- tmp_height = lrint (src_height * prescale_y); -+ tmp_width = opj_lrint (src_width * prescale_x); -+ tmp_height = opj_lrint (src_height * prescale_y); - - /* We are below the gdk_ interface, so create the temp image manually. - * Code copied from gdk_pixbuf_new() */ diff --git a/meson.build b/meson.build -index b39c55d..bb67d3f 100644 +index b39c55d..3abf53b 100644 --- a/meson.build +++ b/meson.build -@@ -89,7 +89,7 @@ if cc.has_function('round', dependencies: mathlib_dep) +@@ -85,11 +85,21 @@ endforeach + mathlib_dep = cc.find_library('m', required: false) + + # XXX: Remove the checks for round() and lrint() once GDK-Pixbuf is declared C99 +-if cc.has_function('round', dependencies: mathlib_dep) ++if cc.compiles(''' ++ #include ++ int main () { ++ return round(0); ++ }''', ++ name : 'round Support') gdk_pixbuf_conf.set('HAVE_ROUND', 1) endif -if cc.has_function('lrint', dependencies: mathlib_dep) -+if cc.has_function('opj_lrint', dependencies: mathlib_dep) ++if cc.compiles(''' ++ #include ++ int main () { ++ return lrint(0); ++ }''', ++ name : 'lrint Support') gdk_pixbuf_conf.set('HAVE_LRINT', 1) endif From 5883cf924d33cefe6e1cb9ffddbed820b7959dff Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 02:25:59 -0700 Subject: [PATCH 05/10] Update the baseline version --- versions/g-/gdk-pixbuf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/g-/gdk-pixbuf.json b/versions/g-/gdk-pixbuf.json index 6fe53959d63b7c..4835b0aa4f9110 100644 --- a/versions/g-/gdk-pixbuf.json +++ b/versions/g-/gdk-pixbuf.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "7d3a1830065f2ca29f0df5a704c13a46cc5af8e0", + "git-tree": "bd1dbe2aeb1e9aa06b5723c62970f3c81392205c", "version": "2.42.2", "port-version": 1 }, From 04dbcea2b0bd9d80e38b1057b9526f0f1128af05 Mon Sep 17 00:00:00 2001 From: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com> Date: Tue, 27 Apr 2021 14:05:02 -0700 Subject: [PATCH 06/10] Apply suggestions from code review --- ports/gdk-pixbuf/fix_build_error_windows.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/gdk-pixbuf/fix_build_error_windows.patch b/ports/gdk-pixbuf/fix_build_error_windows.patch index f85d2e46ae8d35..f9f97a7a0cc764 100644 --- a/ports/gdk-pixbuf/fix_build_error_windows.patch +++ b/ports/gdk-pixbuf/fix_build_error_windows.patch @@ -12,7 +12,7 @@ index b39c55d..3abf53b 100644 + int main () { + return round(0); + }''', -+ name : 'round Support') ++ name : 'round Support', dependencies: mathlib_dep) gdk_pixbuf_conf.set('HAVE_ROUND', 1) endif @@ -22,7 +22,7 @@ index b39c55d..3abf53b 100644 + int main () { + return lrint(0); + }''', -+ name : 'lrint Support') ++ name : 'lrint Support', dependencies: mathlib_dep) gdk_pixbuf_conf.set('HAVE_LRINT', 1) endif From d6a5b9fe56928c4ea28a7573c39a8823db7c641d Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 17:58:56 -0700 Subject: [PATCH 07/10] Apply suggestions from code review --- .../gdk-pixbuf/fix_build_error_windows.patch | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/ports/gdk-pixbuf/fix_build_error_windows.patch b/ports/gdk-pixbuf/fix_build_error_windows.patch index f9f97a7a0cc764..ef2acba67a6add 100644 --- a/ports/gdk-pixbuf/fix_build_error_windows.patch +++ b/ports/gdk-pixbuf/fix_build_error_windows.patch @@ -1,28 +1,17 @@ -diff --git a/meson.build b/meson.build -index b39c55d..3abf53b 100644 ---- a/meson.build -+++ b/meson.build -@@ -85,11 +85,21 @@ endforeach - mathlib_dep = cc.find_library('m', required: false) - - # XXX: Remove the checks for round() and lrint() once GDK-Pixbuf is declared C99 --if cc.has_function('round', dependencies: mathlib_dep) -+if cc.compiles(''' -+ #include -+ int main () { -+ return round(0); -+ }''', -+ name : 'round Support', dependencies: mathlib_dep) - gdk_pixbuf_conf.set('HAVE_ROUND', 1) - endif - --if cc.has_function('lrint', dependencies: mathlib_dep) -+if cc.compiles(''' -+ #include -+ int main () { -+ return lrint(0); -+ }''', -+ name : 'lrint Support', dependencies: mathlib_dep) - gdk_pixbuf_conf.set('HAVE_LRINT', 1) - endif - +diff --git a/meson.build b/meson.build +index b39c55d5d..e1c5018a6 100644 +--- a/meson.build ++++ b/meson.build +@@ -89,7 +89,11 @@ if cc.has_function('round', dependencies: mathlib_dep) + gdk_pixbuf_conf.set('HAVE_ROUND', 1) + endif + +-if cc.has_function('lrint', dependencies: mathlib_dep) ++function_check_args ='' ++if cc.get_id() == 'msvc' ++ function_check_args ='-Oi-' ++endif ++if cc.has_function('lrint', dependencies: mathlib_dep, args: function_check_args) + gdk_pixbuf_conf.set('HAVE_LRINT', 1) + endif + From e7994c58435cc4a6508a9dc15ea29ef39b8441d5 Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 17:59:51 -0700 Subject: [PATCH 08/10] Update the baseline version --- versions/g-/gdk-pixbuf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/g-/gdk-pixbuf.json b/versions/g-/gdk-pixbuf.json index 4835b0aa4f9110..b0a078e22b43e3 100644 --- a/versions/g-/gdk-pixbuf.json +++ b/versions/g-/gdk-pixbuf.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "bd1dbe2aeb1e9aa06b5723c62970f3c81392205c", + "git-tree": "6b39f217d5336b508a27ca1d56769285de4069cb", "version": "2.42.2", "port-version": 1 }, From 053abc22aeb1358c5317ce655dcc854261d71872 Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 18:58:41 -0700 Subject: [PATCH 09/10] Update the patch --- ports/gdk-pixbuf/fix_build_error_windows.patch | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ports/gdk-pixbuf/fix_build_error_windows.patch b/ports/gdk-pixbuf/fix_build_error_windows.patch index ef2acba67a6add..b6f6332dac9189 100644 --- a/ports/gdk-pixbuf/fix_build_error_windows.patch +++ b/ports/gdk-pixbuf/fix_build_error_windows.patch @@ -1,17 +1,21 @@ diff --git a/meson.build b/meson.build -index b39c55d5d..e1c5018a6 100644 +index b39c55d..4b050c7 100644 --- a/meson.build +++ b/meson.build -@@ -89,7 +89,11 @@ if cc.has_function('round', dependencies: mathlib_dep) +@@ -89,8 +89,14 @@ if cc.has_function('round', dependencies: mathlib_dep) gdk_pixbuf_conf.set('HAVE_ROUND', 1) endif -if cc.has_function('lrint', dependencies: mathlib_dep) -+function_check_args ='' +- gdk_pixbuf_conf.set('HAVE_LRINT', 1) +if cc.get_id() == 'msvc' -+ function_check_args ='-Oi-' -+endif -+if cc.has_function('lrint', dependencies: mathlib_dep, args: function_check_args) - gdk_pixbuf_conf.set('HAVE_LRINT', 1) ++ if cc.has_function('lrint', dependencies: mathlib_dep, args: '-Oi-') ++ gdk_pixbuf_conf.set('HAVE_LRINT', 1) ++ endif ++else ++ if cc.has_function('lrint', dependencies: mathlib_dep) ++ gdk_pixbuf_conf.set('HAVE_LRINT', 1) ++ endif endif + if cc.has_function('bind_textdomain_codeset', prefix: '#include ') From 7085064abdc9b95fa8b4f0ef4f4604fdaaa7ee4d Mon Sep 17 00:00:00 2001 From: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com> Date: Tue, 27 Apr 2021 18:59:27 -0700 Subject: [PATCH 10/10] Update the baseline version --- versions/g-/gdk-pixbuf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/g-/gdk-pixbuf.json b/versions/g-/gdk-pixbuf.json index b0a078e22b43e3..efc409eaf5498e 100644 --- a/versions/g-/gdk-pixbuf.json +++ b/versions/g-/gdk-pixbuf.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "6b39f217d5336b508a27ca1d56769285de4069cb", + "git-tree": "f90cd0dd11fd312fe803519706f422a9207336d0", "version": "2.42.2", "port-version": 1 },