commit:     00b9b7656bd5c43209af6c1b37dd832f9fdbcfc4
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 19 20:06:36 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Apr 19 20:07:48 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00b9b765

dev-vcs/git-2.49.0-r2: fix build on Solaris

Allow building git on Solaris via meson, so we can complete stage3.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../files/git-2.49.0-meson-solaris-override.patch  | 38 ++++++++++++++++++++++
 dev-vcs/git/git-2.49.0-r2.ebuild                   |  9 +++++
 2 files changed, 47 insertions(+)

diff --git a/dev-vcs/git/files/git-2.49.0-meson-solaris-override.patch 
b/dev-vcs/git/files/git-2.49.0-meson-solaris-override.patch
new file mode 100644
index 000000000000..7866afd13817
--- /dev/null
+++ b/dev-vcs/git/files/git-2.49.0-meson-solaris-override.patch
@@ -0,0 +1,38 @@
+meson.build: hardwire Solaris support
+
+- need __EXTENSIONS__ in order to use functions like memmem, strlcopy,
+  etc.
+- need __EXTENSIONS__ for NSIG symbol from signal.h too
+- define for appropriate missing functions and struct members
+- avoid believing sys/sysinfo.h is providing the same as on Linux
+- add missing network libraries so we can succeed linking the final
+  executable
+
+--- a/meson.build
++++ b/meson.build
+@@ -1014,7 +1014,7 @@
+   libgit_c_args += '-DHAVE_ALLOCA_H'
+ endif
+ 
+-if compiler.has_header('sys/sysinfo.h')
++if host_machine.system() != 'sunos' and compiler.has_header('sys/sysinfo.h')
+   libgit_c_args += '-DHAVE_SYSINFO'
+ endif
+
+@@ -1250,6 +1250,16 @@
+   libgit_sources += 'compat/strlcpy.c'
+ endif
+ 
++if host_machine.system() == 'sunos'
++  libgit_c_args += '-DNO_HSTRERROR'
++  libgit_c_args += '-DNO_GETPAGESIZE'
++  libgit_c_args += '-DNO_NSEC'
++  libgit_c_args += '-D__EXTENSIONS__'
++  libgit_sources += 'compat/hstrerror.c'
++  libgit_dependencies += compiler.find_library('socket')
++  libgit_dependencies += compiler.find_library('nsl')
++endif
++
+ if not compiler.has_function('strdup')
+   libgit_c_args += '-DOVERRIDE_STRDUP'
+   libgit_sources += 'compat/strdup.c'

diff --git a/dev-vcs/git/git-2.49.0-r2.ebuild b/dev-vcs/git/git-2.49.0-r2.ebuild
index 1e18108eca7b..56d25e42eaa3 100644
--- a/dev-vcs/git/git-2.49.0-r2.ebuild
+++ b/dev-vcs/git/git-2.49.0-r2.ebuild
@@ -197,6 +197,15 @@ src_prepare() {
                )
        fi
 
+       if [[ ${CHOST} == *-solaris* ]] ; then
+               # meson.build doesn't carry any Solaris logic, and "sees"
+               # functions that are not available by default, provide backup
+               # definitions to match autoconf/Makefile
+               PATCHES+=(
+                       "${FILESDIR}"/${PN}-2.49.0-meson-solaris-override.patch
+               )
+       fi
+
        default
 }
 

Reply via email to