commit:     3d30c71b98b558ed263d0d4894aa7d01fbe66dec
Author:     Cristian Othón Martínez Vera <cfuga <AT> cfuga <DOT> mx>
AuthorDate: Sun Dec  7 02:09:47 2025 +0000
Commit:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
CommitDate: Mon Dec  8 19:50:25 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d30c71b

net-misc/nx: fix compilation for gcc15 and musl

Closes: https://bugs.gentoo.org/945519
Signed-off-by: Cristian Othón Martínez Vera <cfuga <AT> cfuga.mx>
Part-of: https://github.com/gentoo/gentoo/pull/44934
Closes: https://github.com/gentoo/gentoo/pull/44934
Signed-off-by: Bernard Cafarelli <voyageur <AT> gentoo.org>

 net-misc/nx/files/nx-3.5.99.27-gcc15-musl.patch | 104 ++++++++++++++++
 net-misc/nx/nx-3.5.99.27-r3.ebuild              | 157 ++++++++++++++++++++++++
 2 files changed, 261 insertions(+)

diff --git a/net-misc/nx/files/nx-3.5.99.27-gcc15-musl.patch 
b/net-misc/nx/files/nx-3.5.99.27-gcc15-musl.patch
new file mode 100644
index 000000000000..8d17b18f33ad
--- /dev/null
+++ b/net-misc/nx/files/nx-3.5.99.27-gcc15-musl.patch
@@ -0,0 +1,104 @@
+Bug: https://bugs.gentoo.org/945519
+
+Patch copied from Alpine Linux.
+https://gitlab.alpinelinux.org/strophy/aports/-/commit/10d31cd725f131693153f003893f8a9c41fec5d9
+
+--- a/nx-X11/programs/Xserver/dbe/dbe.c
++++ b/nx-X11/programs/Xserver/dbe/dbe.c
+@@ -56,7 +56,7 @@
+ /* GLOBALS */
+ 
+ /* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */
+-static Bool   (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
++static Bool   (* DbeInitFunct[MAXSCREENS])(ScreenPtr, DbeScreenPrivPtr);      
/* pScreen, pDbeScreenPriv */
+ 
+ /* These are static globals copied to DBE's screen private for use by DDX */
+ static int    dbeScreenPrivIndex;
+@@ -89,7 +89,7 @@ static Bool  firstRegistrationPass = TRUE;
+  
*****************************************************************************/
+ 
+ void
+-DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */))
++DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (ScreenPtr, 
DbeScreenPrivPtr))
+ {
+     int       i;
+ 
+--- a/nx-X11/programs/Xserver/dix/window.c
++++ b/nx-X11/programs/Xserver/dix/window.c
+@@ -375,7 +375,7 @@ AllocateWindow(ScreenPtr pScreen)
+           else
+               ppriv->ptr = (void *)NULL;
+       }
+-#if _XSERVER64
++#ifdef _XSERVER64
+       pWin->drawable.pad0 = 0;
+         pWin->drawable.pad1 = 0;
+ #endif
+--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h
++++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h
+@@ -26,6 +26,15 @@
+ #ifndef __Clipboard_H__
+ #define __Clipboard_H__
+ 
++#ifndef _XSERVER64
++typedef unsigned long XlibAtom;
++#else
++typedef unsigned long Atom64;
++#define XlibAtom Atom64
++#endif
++
++typedef union _XEvent XEvent;
++
+ /*
+  * Queried at clipboard initialization.
+  */
+@@ -58,17 +67,10 @@ extern int nxagentConvertSelection(ClientPtr client, 
WindowPtr pWin, Atom select
+                                       Window requestor, Atom property, Atom 
target, Time time);
+ 
+ extern void nxagentHandleSelectionClearFromXServerByIndex(int index);
+-#ifdef XEvent
+ extern void nxagentHandleSelectionClearFromXServerByAtom(XlibAtom sel);
+ extern void nxagentHandleSelectionClearFromXServer(XEvent *X);
+ extern void nxagentHandleSelectionRequestFromXServer(XEvent *X);
+ extern void nxagentHandleSelectionNotifyFromXServer(XEvent *X);
+-#else
+-extern void nxagentHandleSelectionClearFromXServerByAtom();
+-extern void nxagentHandleSelectionClearFromXServer();
+-extern void nxagentHandleSelectionRequestFromXServer();
+-extern void nxagentHandleSelectionNotifyFromXServer();
+-#endif
+ 
+ extern int nxagentFindCurrentSelectionIndex(Atom sel);
+ /*
+--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
++++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+@@ -1533,8 +1533,8 @@ N/A
+     pScreen->SaveScreen = nxagentSaveScreen;
+     pScreen->GetImage = nxagentGetImage;
+     pScreen->GetSpans = nxagentGetSpans;
+-    pScreen->PointerNonInterestBox = (void (*)()) 0;
+-    pScreen->SourceValidate = (void (*)()) 0;
++    pScreen->PointerNonInterestBox = NULL;
++    pScreen->SourceValidate = NULL;
+ 
+     pScreen->CreateScreenResources = nxagentCreateScreenResources;
+ 
+@@ -1610,12 +1610,12 @@ N/A
+      * Backing store procedures.
+      */
+ 
+-    pScreen->SaveDoomedAreas = (void (*)()) 0;
+-    pScreen->RestoreAreas = (RegionPtr (*)()) 0;
+-    pScreen->ExposeCopy = (void (*)()) 0;
+-    pScreen->TranslateBackingStore = (RegionPtr (*)()) 0;
+-    pScreen->ClearBackingStore = (RegionPtr (*)()) 0;
+-    pScreen->DrawGuarantee = (void (*)()) 0;
++    pScreen->SaveDoomedAreas = NULL;
++    pScreen->RestoreAreas = NULL;
++    pScreen->ExposeCopy = NULL;
++    pScreen->TranslateBackingStore = NULL;
++    pScreen->ClearBackingStore = NULL;
++    pScreen->DrawGuarantee = NULL;
+ 
+     if (enableBackingStore)
+     {

diff --git a/net-misc/nx/nx-3.5.99.27-r3.ebuild 
b/net-misc/nx/nx-3.5.99.27-r3.ebuild
new file mode 100644
index 000000000000..a6ce50141878
--- /dev/null
+++ b/net-misc/nx/nx-3.5.99.27-r3.ebuild
@@ -0,0 +1,157 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit autotools flag-o-matic toolchain-funcs
+
+DESCRIPTION="NX compression technology core libraries"
+HOMEPAGE="https://github.com/ArcticaProject/nx-libs";
+
+SRC_URI="https://github.com/ArcticaProject/nx-libs/archive/${PV}.tar.gz -> 
nx-libs-${PV}.tar.gz"
+S="${WORKDIR}/nx-libs-${PV}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc ~riscv ~x86"
+
+RDEPEND="
+       dev-libs/libxml2:=
+       media-libs/libjpeg-turbo:*
+       >=media-libs/libpng-1.2.8:0=
+       >=virtual/zlib-1.2.3:=
+       x11-apps/xkbcomp
+       x11-libs/libX11
+       x11-libs/libXcomposite
+       x11-libs/libXdamage
+       x11-libs/libXdmcp
+       x11-libs/libXext
+       x11-libs/libXfixes
+       x11-libs/libXfont2
+       x11-libs/libXinerama
+       x11-libs/libXpm
+       x11-libs/libXrandr
+       x11-libs/libXrender
+       x11-libs/libXtst
+       x11-libs/pixman
+"
+DEPEND="
+       ${RDEPEND}
+       x11-base/xorg-proto
+       x11-libs/libfontenc
+"
+BDEPEND="
+       virtual/pkgconfig
+       x11-misc/gccmakedep
+       x11-misc/imake
+"
+PATCHES=(
+       "${FILESDIR}/${PN}-3.5.99.26-musl.patch"
+       "${FILESDIR}/${PN}-3.5.99.27-which.patch"
+       # https://github.com/ArcticaProject/nx-libs/pull/1087
+       "${FILESDIR}/${PN}-3.5.99.26-gcc14-32bit.patch"
+       "${FILESDIR}/${PN}-3.5.99.26-gcc14-access.patch"
+       # https://github.com/ArcticaProject/nx-libs/issues/1044
+       "${FILESDIR}/${PN}-3.5.99.26-clang-bind.patch"
+       "${FILESDIR}/${PN}-3.5.99.27-gcc15-musl.patch"
+)
+
+src_prepare() {
+       default
+
+       # We want predictable behavior. So let's assume we never
+       # have quilt installed.
+       sed 's@which quilt@false@' -i mesa-quilt || die
+
+       # Do not compress man pages by default
+       sed '/^[[:space:]]*gzip.*man/d' -i Makefile || die
+
+       # run autoreconf in all needed folders
+       local subdir
+       for subdir in nxcomp nxdialog nx-X11/lib nxcompshad nxproxy ; do
+               pushd ${subdir} || die
+               eautoreconf
+               popd || die
+       done
+}
+
+src_configure() {
+       # -Werror=strict-aliasing
+       # https://bugs.gentoo.org/861680
+       #
+       # inherited from libX11 vendored code. libX11 passes this flag already.
+       append-flags -fno-strict-aliasing
+       filter-lto
+
+       # From xorg-x11-6.9.0-r3.ebuild
+       pushd nx-X11 || die
+       HOSTCONF="config/cf/host.def"
+       echo "#define CcCmd $(tc-getCC)" >> ${HOSTCONF}
+       echo "#define OptimizedCDebugFlags ${CFLAGS} GccAliasingArgs" >> 
${HOSTCONF}
+       echo "#define OptimizedCplusplusDebugFlags ${CXXFLAGS} GccAliasingArgs" 
>> ${HOSTCONF}
+       # Respect LDFLAGS
+       echo "#define ExtraLoadFlags ${LDFLAGS}" >> ${HOSTCONF}
+       echo "#define SharedLibraryLoadFlags -shared ${LDFLAGS}" >> ${HOSTCONF}
+       # Disable SunRPC, #370767
+       echo "#define HasSecureRPC NO" >> ${HOSTCONF}
+       popd || die
+
+       local subdir
+       for subdir in nxcomp nxdialog nxcompshad nxproxy ; do
+               pushd ${subdir} || die
+               econf --enable-static
+               popd || die
+       done
+
+       pushd "nx-X11/lib" || die
+       econf --disable-poll
+       popd || die
+}
+
+src_compile() {
+       # First set up the build environment
+       emake build-env
+
+       # We replicate the "build-full" make target here because
+       # we cannot call "make build-full" as it
+       #  - calls autoreconf several times
+       #  - invokes make directly but we prefer our emake
+
+       emake -C nxcomp
+       emake -C nx-X11/lib
+
+       mkdir -p nx-X11/exports/lib/ || die
+       local nxlib
+       for nxlib in libNX_X11.so{,.6{,.3.0}} ; do
+               ln -s ../../lib/src/.libs/${nxlib} nx-X11/exports/lib/${nxlib} 
|| die
+       done
+
+       emake -C nxcompshad
+
+       ./mesa-quilt push -a || die
+
+       emake -C nx-X11 BuildDependsOnly
+       # Parallel make issue resurfaced, upstream working on autotools switch
+       emake -j1 -C nx-X11 World \
+               USRLIBDIR="${EPREFIX}/usr/$(get_libdir)/${PN}/X11" \
+               SHLIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+               ETCDIR_NX="${EPREFIX}/etc/nxagent"
+
+       emake -C nxproxy
+}
+
+src_install() {
+       emake \
+               DESTDIR="${D}" \
+               PREFIX="${EPREFIX}/usr" \
+               NXLIBDIR="${EPREFIX}/usr/$(get_libdir)/${PN}" \
+               SHLIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+               USRLIBDIR="${EPREFIX}/usr/$(get_libdir)/${PN}/X11" \
+               ETCDIR_NX="${EPREFIX}/etc/nxagent" \
+               install
+
+       # Already provided by mesa & related packages
+       rm -r "${ED}"/usr/include/GL || die
+
+       # Get rid of libtool files and static libs.
+       find "${ED}" \( -name "*.a" -o -name "*.la" \) -delete || die
+}

Reply via email to