Skip to content

Commit

Permalink
Fix -Wunguarded-availability-new warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlienCowEatCake committed Sep 26, 2022
1 parent b6f282b commit dcef17d
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 28 deletions.
50 changes: 29 additions & 21 deletions modulesets/bootstrap.modules
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,23 @@
</metamodule>

<autotools id="xz" autogen-sh="configure" autogenargs="--disable-doc --disable-static">
<branch repo="tukaani.org" module="xz/xz-${version}.tar.bz2" version="5.2.6"/>
<branch repo="tukaani.org" module="xz/xz-${version}.tar.bz2" version="5.2.6">
<patch file="0001-XZ-disable-futimens.patch" strip="1"/>
</branch>
</autotools>

<autotools id="gettext" autogen-sh="configure" autogenargs="--disable-static">
<branch repo="ftp.gnu.org" module="gettext/gettext-0.21.tar.gz" version="0.21"/>
<branch repo="ftp.gnu.org" module="gettext/gettext-${version}.tar.gz" version="0.21">
<patch file="0001-GETTEXT-disable-futimens-utimensat.patch" strip="1"/>
</branch>
</autotools>

<autotools id="m4" autogen-sh="configure" bootstrap="true">
<branch repo="ftp.gnu.org" module="m4/m4-${version}.tar.gz" version="1.4.19"/>
</autotools>

<autotools id="autoconf" autogen-sh="configure" bootstrap="true">
<branch repo="ftp.gnu.org" module="autoconf/autoconf-2.71.tar.gz" version="2.71"/>
<branch repo="ftp.gnu.org" module="autoconf/autoconf-${version}.tar.gz" version="2.71"/>
<dependencies>
<dep package="m4"/>
</dependencies>
Expand Down Expand Up @@ -117,7 +121,9 @@
</autotools>

<autotools id="libpng" autogen-sh="configure" autogenargs="--enable-shared --disable-static">
<branch repo="sourceforge" module="libpng/libpng-${version}.tar.gz" version="1.6.38"/>
<branch repo="sourceforge" module="libpng/libpng-${version}.tar.gz" version="1.6.38">
<patch file="0001-LIBPNG-add-macOS-10.13-guard-for-inflateValidate.patch" strip="1"/>
</branch>
</autotools>

<autotools id="expat" autogen-sh="configure" autogenargs="--without-examples --without-tests --without-docbook --disable-static">
Expand All @@ -140,7 +146,7 @@
</autotools>

<autotools id="itstool" autogen-sh="autoreconf">
<branch repo="itstool.org" module="itstool-2.0.7.tar.bz2" version="2.0.7"/>
<branch repo="itstool.org" module="itstool-${version}.tar.bz2" version="2.0.7"/>
</autotools>

<autotools id="xorg-macros">
Expand All @@ -156,7 +162,7 @@
</metamodule>

<autotools id="libtiff" autogen-sh="configure" autogenargs="--without-x --disable-static">
<branch version="4.4.0" module="libtiff/tiff-4.4.0.tar.gz" repo="libtiff">
<branch version="4.4.0" module="libtiff/tiff-${version}.tar.gz" repo="libtiff">
<patch file="tiff-nohtml.patch" strip="1"/>
</branch>
<dependencies>
Expand All @@ -179,20 +185,22 @@

<autotools id="libpcre2" autogen-sh="configure" autogenargs="--enable-unicode --enable-pcre2-16 --enable-pcre2-32 --enable-newline-is-any --enable-jit --disable-static">
<branch repo="github-tarball" module="PCRE2Project/pcre2/releases/download/pcre2-${version}/pcre2-${version}.tar.bz2" version="10.40">
<patch file="0001-PCRE2-remove-unneeded-macOS-version-check.patch" strip="1"/>
<patch file="0001-PCRE2-remove-error-on-build-for-macos-11.0.patch" strip="1"/>
</branch>
</autotools>

<meson id="glib" mesonargs="--buildtype=release -Dlibmount=disabled -Dman=false -Dgtk_doc=false -Dtests=false">
<branch module="glib/2.74/glib-2.74.0.tar.xz" version="2.74.0"/>
<branch module="glib/2.74/glib-${version}.tar.xz" version="2.74.0">
<patch file="0001-GLIB-disable-utimensat.patch" strip="1"/>
</branch>
<dependencies>
<dep package="libffi"/>
<dep package="libpcre2"/>
</dependencies>
</meson>

<meson id="cairo" mesonargs="--buildtype=release -Dfontconfig=disabled -Dfreetype=disabled">
<branch module="1.17.6/cairo-1.17.6.tar.bz2" version="1.17.6" repo="cairographics-temp">
<branch module="${version}/cairo-${version}.tar.bz2" version="1.17.6" repo="cairographics-temp">
<!-- https://gitlab.gnome.org/GNOME/gtk/-/issues/1620 -->
<!-- https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/9 -->
<patch file="0001-quartz-font-Add-support-for-color-emoji-glyphs.patch" strip="1"/>
Expand Down Expand Up @@ -228,18 +236,18 @@
</meson>

<meson id="harfbuzz" mesonargs="--buildtype=release -Dcoretext=enabled -Dfreetype=disabled -Ddocs=disabled -Dbenchmark=disabled -Dintrospection=disabled -Dtests=disabled">
<branch repo="github-tarball" version="5.2.0" module="https://github.com/harfbuzz/harfbuzz/releases/download/5.2.0/harfbuzz-5.2.0.tar.xz"/>
<branch repo="github-tarball" version="5.2.0" module="https://github.com/harfbuzz/harfbuzz/releases/download/${version}/harfbuzz-${version}.tar.xz"/>
<dependencies>
<dep package="cairo"/>
</dependencies>
</meson>

<meson id="fribidi" mesonargs="--buildtype=release -Ddocs=false -Dtests=false">
<branch module="fribidi/fribidi/releases/download/v1.0.12/fribidi-1.0.12.tar.xz" repo="github-tarball" version="1.0.12"/>
<branch module="fribidi/fribidi/releases/download/v${version}/fribidi-${version}.tar.xz" repo="github-tarball" version="1.0.12"/>
</meson>

<meson id="pango" mesonargs="--buildtype=release -Dintrospection=disabled -Dfontconfig=disabled -Dfreetype=disabled">
<branch version="1.50.10" module="pango/1.50/pango-1.50.10.tar.xz"/>
<branch version="1.50.10" module="pango/1.50/pango-${version}.tar.xz"/>
<dependencies>
<dep package="glib"/>
<dep package="cairo"/>
Expand All @@ -252,15 +260,15 @@
</meson>

<meson id="atk" mesonargs="--buildtype=release -Dintrospection=false">
<branch module="atk/2.38/atk-2.38.0.tar.xz" version="2.38.0"/>
<branch module="atk/2.38/atk-${version}.tar.xz" version="2.38.0"/>
<after>
<dep package="glib"/>
<dep package="meta-gtk-osx-bootstrap"/>
</after>
</meson>

<meson id="gdk-pixbuf" mesonargs="--buildtype=release -Drelocatable=true -Dman=false -Dgtk_doc=false -Dintrospection=disabled -Dinstalled_tests=false">
<branch module="gdk-pixbuf/2.42/gdk-pixbuf-2.42.9.tar.xz" version="2.42.9">
<branch module="gdk-pixbuf/2.42/gdk-pixbuf-${version}.tar.xz" version="2.42.9">
<patch file="gdk-pixbuf-loader-name.patch" strip="1"/>
</branch>
<after>
Expand All @@ -269,11 +277,11 @@
</meson>

<autotools id="hicolor-icon-theme">
<branch module="hicolor-icon-theme-0.17.tar.xz" version="0.17" repo="icon-theme.freedesktop.org"/>
<branch module="hicolor-icon-theme-${version}.tar.xz" version="0.17" repo="icon-theme.freedesktop.org"/>
</autotools>

<autotools id="gtk+-2.0" autogen-sh="autoreconf" autogenargs="--with-gdktarget=quartz --enable-quartz-relocation --disable-introspection --disable-visibility">
<branch module="gtk+/2.24/gtk+-2.24.33.tar.xz" version="2.24.33">
<branch module="gtk+/2.24/gtk+-${version}.tar.xz" version="2.24.33">
<patch file="0008-Implement-GtkDragSourceOwner-pasteboardChangedOwner.patch" strip="1"/>
<patch file="0006-Bug-658722-Drag-and-Drop-sometimes-stops-working.patch" strip="1"/>
<patch file="gtk+-2-m4-creation.patch" strip="1"/>
Expand Down Expand Up @@ -301,7 +309,7 @@
</autotools>

<autotools id="gtk-mac-integration" autogen-sh="configure" autogenargs="--disable-python">
<branch module="gtk-mac-integration/3.0/gtk-mac-integration-3.0.1.tar.xz" version="3.0.1">
<branch module="gtk-mac-integration/3.0/gtk-mac-integration-${version}.tar.xz" version="3.0.1">
<patch file="gtk-mac-integration-work-around-svg-locale-bug.patch" strip="1"/>
</branch>
<after>
Expand All @@ -318,22 +326,22 @@
</metamodule>

<autotools id="icon-naming-utils" autogen-sh="configure">
<branch repo="tango.freedesktop.org" version="0.8.90" module="icon-naming-utils-0.8.90.tar.bz2"/>
<branch repo="tango.freedesktop.org" version="0.8.90" module="icon-naming-utils-${version}.tar.bz2"/>
<after>
<dep package="meta-gtk-osx-bootstrap"/>
</after>
</autotools>

<autotools id="tango-icon-theme" autogenargs="--disable-icon-framing" autogen-sh="configure">
<branch repo="tango.freedesktop.org" version="0.8.90" module="tango-icon-theme-0.8.90.tar.gz"/>
<branch repo="tango.freedesktop.org" version="0.8.90" module="tango-icon-theme-${version}.tar.gz"/>
<dependencies>
<dep package="icon-naming-utils"/>
<dep package="hicolor-icon-theme"/>
</dependencies>
</autotools>

<autotools id="gtk-engines" autogen-sh="configure" autogenargs="--disable-crux --disable-hc --disable-industrial --disable-mist --disable-redmond --disable-glide --disable-thinice">
<branch module="gtk-engines/2.20/gtk-engines-2.20.2.tar.bz2" version="2.20.2"/>
<branch module="gtk-engines/2.20/gtk-engines-${version}.tar.bz2" version="2.20.2"/>
<after>
<dep package="meta-gtk-osx-gtk2"/>
</after>
Expand All @@ -355,7 +363,7 @@

<!-- of the many arguments such as prefix and libdir that jhbuild might pass to configure, openssl only understands prefix, and only with =. -->
<autotools id="openssl" autogen-sh="Configure" autogenargs="shared " autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s --openssldir=%(prefix)s/etc/ssl %(autogenargs)s" makeinstallargs="install_sw" supports-non-srcdir-builds="no">
<branch module="openssl-1.1.1q.tar.gz" version="1.1.1q" repo="openssl">
<branch module="openssl-${version}.tar.gz" version="1.1.1q" repo="openssl">
<!-- https://github.com/openssl/openssl/pull/18719 -->
<patch file="openssl-fix-missing-header.patch" strip="1"/>
</branch>
Expand Down
38 changes: 38 additions & 0 deletions patches/0001-GETTEXT-disable-futimens-utimensat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 38a2bd810baf13107a87eb86087d0a24c47b0396 Mon Sep 17 00:00:00 2001
From: Peter Zhigalov <[email protected]>
Date: Mon, 26 Sep 2022 09:08:56 +0700
Subject: [PATCH] GETTEXT: disable futimens/utimensat

---
gettext-tools/config.h.in | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/gettext-tools/config.h.in b/gettext-tools/config.h.in
index 030077b..346fec2 100644
--- a/gettext-tools/config.h.in
+++ b/gettext-tools/config.h.in
@@ -1044,7 +1044,10 @@
#undef HAVE_FUNLOCKFILE

/* Define to 1 if you have the `futimens' function. */
+/*
+// warning: 'futimens' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
#undef HAVE_FUTIMENS
+*/

/* Define to 1 if you have the `futimes' function. */
#undef HAVE_FUTIMES
@@ -1697,7 +1700,10 @@
#undef HAVE_UTIME

/* Define to 1 if you have the `utimensat' function. */
+/*
+// warning: 'utimensat' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
#undef HAVE_UTIMENSAT
+*/

/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
--
2.37.0 (Apple Git-136)

47 changes: 47 additions & 0 deletions patches/0001-GLIB-disable-utimensat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 6506b885fa34679df2c35bc281ea35fb8ee8129b Mon Sep 17 00:00:00 2001
From: Peter Zhigalov <[email protected]>
Date: Mon, 26 Sep 2022 09:33:09 +0700
Subject: [PATCH] GLIB: disable utimensat

---
gio/glocalfileinfo.c | 2 ++
meson.build | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 6f18695..c9e5c8b 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -2800,6 +2800,7 @@ set_mtime_atime (char *filename,
return FALSE;
}

+#if defined (HAVE_UTIMENSAT)
res = utimensat (AT_FDCWD, filename, times_n, 0);
if (res == -1)
{
@@ -2811,6 +2812,7 @@ set_mtime_atime (char *filename,
g_strerror (errsv));
return FALSE;
}
+#endif
return TRUE;
}
#endif
diff --git a/meson.build b/meson.build
index 3aa1a10..d7118fd 100644
--- a/meson.build
+++ b/meson.build
@@ -635,7 +635,8 @@ functions = [
'unsetenv',
'uselocale',
'utimes',
- 'utimensat',
+ # warning: 'utimensat' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
+ # 'utimensat',
'valloc',
'vasprintf',
'vsnprintf',
--
2.37.0 (Apple Git-136)

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 9f48523e5c41afb145349f4b7f4bbe9a0e520bf3 Mon Sep 17 00:00:00 2001
From: Peter Zhigalov <[email protected]>
Date: Mon, 26 Sep 2022 09:18:50 +0700
Subject: [PATCH] LIBPNG: add macOS 10.13 guard for inflateValidate

---
pngrutil.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pngrutil.c b/pngrutil.c
index ca060dd..610272c 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -425,7 +425,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
- ret = inflateValidate(&png_ptr->zstream, 0);
+ /* warning: 'inflateValidate' is only available on macOS 10.13 or newer [-Wunguarded-availability-new] */
+ if (__builtin_available(macOS 10.13, *)) {
+ ret = inflateValidate(&png_ptr->zstream, 0);
+ }
#endif

if (ret == Z_OK)
--
2.37.0 (Apple Git-136)

Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
From af11089244154e613cf3c265cee152216be40516 Mon Sep 17 00:00:00 2001
From 0dfb08db4b77545d730d2c65b6a3b30ccfe8684f Mon Sep 17 00:00:00 2001
From: Peter Zhigalov <[email protected]>
Date: Tue, 20 Sep 2022 23:28:42 +0700
Subject: [PATCH] PCRE2: remove unneeded macOS version check
Subject: [PATCH] PCRE2: remove error on build for macos < 11.0

---
src/sljit/sljitExecAllocator.c | 4 ----
1 file changed, 4 deletions(-)
src/sljit/sljitExecAllocator.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/sljit/sljitExecAllocator.c b/src/sljit/sljitExecAllocator.c
index 92d940d..30b23d5 100644
index 92d940d..b9d0e33 100644
--- a/src/sljit/sljitExecAllocator.c
+++ b/src/sljit/sljitExecAllocator.c
@@ -150,11 +150,7 @@ static SLJIT_INLINE int get_map_jit_flag()
@@ -150,11 +150,9 @@ static SLJIT_INLINE int get_map_jit_flag()

static SLJIT_INLINE void apple_update_wx_flags(sljit_s32 enable_exec)
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
pthread_jit_write_protect_np(enable_exec);
- pthread_jit_write_protect_np(enable_exec);
-#else
-#error "Must target Big Sur or newer"
-#endif /* BigSur */
+ if (__builtin_available(macOS 11.0, *)) {
+ pthread_jit_write_protect_np(enable_exec);
+ }
}
#endif /* SLJIT_CONFIG_X86 */
#else /* !TARGET_OS_OSX */
Expand Down
27 changes: 27 additions & 0 deletions patches/0001-XZ-disable-futimens.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From f641dccf2eebd527d5a6e8073d1b813766a43929 Mon Sep 17 00:00:00 2001
From: Peter Zhigalov <[email protected]>
Date: Mon, 26 Sep 2022 08:59:50 +0700
Subject: [PATCH] XZ: disable futimens

---
config.h.in | 3 +++
1 file changed, 3 insertions(+)

diff --git a/config.h.in b/config.h.in
index c8ba420..f95b12c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -133,7 +133,10 @@
#undef HAVE_FCNTL_H

/* Define to 1 if you have the `futimens' function. */
+/*
+// warning: 'futimens' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
#undef HAVE_FUTIMENS
+*/

/* Define to 1 if you have the `futimes' function. */
#undef HAVE_FUTIMES
--
2.37.0 (Apple Git-136)

0 comments on commit dcef17d

Please sign in to comment.