public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeglut/files/, media-libs/freeglut/
@ 2019-03-27 19:54 Matt Turner
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Turner @ 2019-03-27 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     27083133bfb71b4fe269d35b4158e553859d81fe
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 27 19:36:24 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Mar 27 19:54:01 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27083133

media-libs/freeglut: Drop linking with unnecessary X11 libs

Many thanks go to Christian <christian <AT> ch-sc.de> for tracking down and
fixing the bug!

Closes: https://bugs.gentoo.org/557286
Closes: https://bugs.gentoo.org/647326
Closes: https://bugs.gentoo.org/658936
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 .../freeglut-3.0.0-drop-unnecessary-x11-libs.patch | 30 ++++++++++++++++++++++
 media-libs/freeglut/freeglut-3.0.0.ebuild          |  4 +++
 2 files changed, 34 insertions(+)

diff --git a/media-libs/freeglut/files/freeglut-3.0.0-drop-unnecessary-x11-libs.patch b/media-libs/freeglut/files/freeglut-3.0.0-drop-unnecessary-x11-libs.patch
new file mode 100644
index 00000000000..761a6bfce7c
--- /dev/null
+++ b/media-libs/freeglut/files/freeglut-3.0.0-drop-unnecessary-x11-libs.patch
@@ -0,0 +1,30 @@
+From bbdaa724ef363e34bd19fb2308739e59a9e8ddc8 Mon Sep 17 00:00:00 2001
+From: jtsiomb <jtsiomb@7f0cb862-5218-0410-a997-914c9d46530a>
+Date: Tue, 26 Mar 2019 18:55:42 +0000
+Subject: [PATCH] Applied Christian's change to drop unnecessary dependency to
+ X11 libraries we don't actually use, by asking cmake to link with X11_X11_LIB
+ instead of the catch-all X11_LIBRARIES.
+
+git-svn-id: http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1845 7f0cb862-5218-0410-a997-914c9d46530a
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d1c20e8..e324a02 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -312,8 +312,8 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC)
+ INCLUDE(CheckIncludeFiles)
+ IF(UNIX AND NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
+     FIND_PACKAGE(X11 REQUIRED)
+-    INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
+-    LIST(APPEND LIBS ${X11_LIBRARIES})
++    INCLUDE_DIRECTORIES(${X11_X11_INCLUDE_PATH})
++    LIST(APPEND LIBS ${X11_X11_LIB})
+     IF(X11_Xrandr_FOUND)
+         SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
+         LIST(APPEND LIBS ${X11_Xrandr_LIB})
+-- 
+2.19.2
+

diff --git a/media-libs/freeglut/freeglut-3.0.0.ebuild b/media-libs/freeglut/freeglut-3.0.0.ebuild
index 2a60b23ef11..95ec4c4bca8 100644
--- a/media-libs/freeglut/freeglut-3.0.0.ebuild
+++ b/media-libs/freeglut/freeglut-3.0.0.ebuild
@@ -29,6 +29,10 @@ DEPEND="${RDEPEND}
 
 HTML_DOCS=( doc/. )
 
+PATCHES=(
+	"${FILESDIR}"/${P}-drop-unnecessary-x11-libs.patch
+)
+
 src_configure() {
 	local mycmakeargs=(
 		"-DFREEGLUT_GLES=OFF"


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeglut/files/, media-libs/freeglut/
@ 2019-03-27 19:54 Matt Turner
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Turner @ 2019-03-27 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     b50fc04a3397c0d43f97e3ffc852e1066790d1b1
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 27 19:53:18 2019 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Mar 27 19:54:01 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b50fc04a

media-libs/freeglut: Pull in BSD support patches from upstream

Closes: https://bugs.gentoo.org/544614
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 .../files/freeglut-3.0.0-bsd-usb-joystick.patch    | 753 +++++++++++++++++++++
 media-libs/freeglut/freeglut-3.0.0.ebuild          |   1 +
 2 files changed, 754 insertions(+)

diff --git a/media-libs/freeglut/files/freeglut-3.0.0-bsd-usb-joystick.patch b/media-libs/freeglut/files/freeglut-3.0.0-bsd-usb-joystick.patch
new file mode 100644
index 00000000000..505b3467ec4
--- /dev/null
+++ b/media-libs/freeglut/files/freeglut-3.0.0-bsd-usb-joystick.patch
@@ -0,0 +1,753 @@
+From 5908c36a4a3964cdc8db5c7bfdfd4381ec0996df Mon Sep 17 00:00:00 2001
+From: dcnieho <dcnieho@7f0cb862-5218-0410-a997-914c9d46530a>
+Date: Wed, 12 Jul 2017 20:44:35 +0000
+Subject: [PATCH] Fix build on NetBSD.
+
+(cherry picked from commit 06e1d815cf9abda49b845754ff420734446eb95b)
+
+(cherry picked from commit c4294ad59093c27159ea6028d33e3c9581df5354)
+
+git-svn-id: http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1829 7f0cb862-5218-0410-a997-914c9d46530a
+---
+ src/fg_joystick.c         |  5 ++---
+ src/x11/fg_joystick_x11.c | 10 +++++-----
+ 2 files changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/src/fg_joystick.c b/src/fg_joystick.c
+index 6f6771c..b73d7e7 100644
+--- a/src/fg_joystick.c
++++ b/src/fg_joystick.c
+@@ -46,21 +46,20 @@
+ 
+ #    ifdef HAVE_USB_JS
+ #        if defined(__NetBSD__)
+-/* XXX The below hack is done until freeglut's autoconf is updated. */
+-#            define HAVE_USBHID_H 1
+ #            ifdef HAVE_USBHID_H
+ #                include <usbhid.h>
+ #            else
+ #                include <usb.h>
+ #            endif
++#            include <dev/usb/usb.h>
+ #        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #            ifdef HAVE_USBHID_H
+ #                include <usbhid.h>
+ #            else
+ #                include <libusbhid.h>
+ #            endif
++#            include <legacy/dev/usb/usb.h>
+ #        endif
+-#        include <legacy/dev/usb/usb.h>
+ #        include <dev/usb/usbhid.h>
+ 
+ /* Compatibility with older usb.h revisions */
+diff --git a/src/x11/fg_joystick_x11.c b/src/x11/fg_joystick_x11.c
+index a37388b..04bc373 100644
+--- a/src/x11/fg_joystick_x11.c
++++ b/src/x11/fg_joystick_x11.c
+@@ -50,7 +50,7 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+ {
+     int status;
+ 
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+     int len;
+ 
+     if ( joy->pJoystick.os->is_analog )
+@@ -215,7 +215,7 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+ 
+ void fgPlatformJoystickOpen( SFG_Joystick* joy )
+ {
+-#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
++#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__)
+ 	int i = 0;
+        char *cp;
+ #endif
+@@ -229,7 +229,7 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy )
+ #  endif
+ #endif
+ 
+-#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
++#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__)
+     for( i = 0; i < _JS_MAX_AXES; i++ )
+         joy->pJoystick.os->cache_axes[ i ] = 0.0f;
+ 
+@@ -409,7 +409,7 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy )
+ 
+ void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident )
+ {
+-#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
++#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__)
+     fgJoystick[ ident ]->id = ident;
+     fgJoystick[ ident ]->error = GL_FALSE;
+ 
+@@ -436,7 +436,7 @@ void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident )
+ 
+ void fgPlatformJoystickClose ( int ident )
+ {
+-#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )
++#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__)
+     if( fgJoystick[ident]->pJoystick.os )
+     {
+         if( ! fgJoystick[ ident ]->error )
+-- 
+2.19.2
+
+From c0f0f1e0903a5dd848825db0fe1f01d5db37c4e1 Mon Sep 17 00:00:00 2001
+From: dcnieho <dcnieho@7f0cb862-5218-0410-a997-914c9d46530a>
+Date: Wed, 12 Jul 2017 20:44:47 +0000
+Subject: [PATCH] some whitespace cleanup
+
+(cherry picked from commit 2dd5aa4aa1b5c19392f9abd00e0f6893907df205)
+
+git-svn-id: http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1830 7f0cb862-5218-0410-a997-914c9d46530a
+---
+ src/fg_init.c                 |  32 ++--
+ src/fg_joystick.c             |   8 +-
+ src/fg_main.c                 |  14 +-
+ src/freeglutdll.def.in        | 312 +++++++++++++++++-----------------
+ src/mswin/fg_joystick_mswin.c |   2 +-
+ src/mswin/fg_main_mswin.c     | 160 ++++++++---------
+ 6 files changed, 264 insertions(+), 264 deletions(-)
+
+diff --git a/src/fg_joystick.c b/src/fg_joystick.c
+index b73d7e7..2f4f6ed 100644
+--- a/src/fg_joystick.c
++++ b/src/fg_joystick.c
+@@ -581,7 +581,7 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+ 
+ void fgPlatformJoystickOpen( SFG_Joystick* joy )
+ {
+-	int i = 0;
++    int i = 0;
+     OSStatus err;
+ 
+     /* XXX FIXME: get joystick name in Mac */
+@@ -856,7 +856,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
+     joy->num_axes = joy->num_buttons = 0;
+     joy->name[ 0 ] = '\0';
+ 
+-	fgPlatformJoystickOpen ( joy );
++    fgPlatformJoystickOpen ( joy );
+ 
+ }
+ 
+@@ -878,7 +878,7 @@ static void fghJoystickInit( int ident )
+     fgJoystick[ ident ]->num_axes = fgJoystick[ ident ]->num_buttons = 0;
+     fgJoystick[ ident ]->error = GL_TRUE;
+ 
+-	fgPlatformJoystickInit( fgJoystick, ident );
++    fgPlatformJoystickInit( fgJoystick, ident );
+ 
+     fghJoystickOpen( fgJoystick[ ident  ] );
+ }
+@@ -906,7 +906,7 @@ void fgJoystickClose( void )
+     {
+         if( fgJoystick[ ident ] )
+         {
+-			fgPlatformJoystickClose ( ident );
++            fgPlatformJoystickClose ( ident );
+ 
+             free( fgJoystick[ ident ] );
+             fgJoystick[ ident ] = NULL;
+-- 
+2.19.2
+
+From 6096caf2468ad4557968b9156ea9fcab2efb3fd1 Mon Sep 17 00:00:00 2001
+From: dcnieho <dcnieho@7f0cb862-5218-0410-a997-914c9d46530a>
+Date: Wed, 12 Jul 2017 20:45:07 +0000
+Subject: [PATCH] moved static variables and functions that should not have
+ stuck behind in fg_joystick.c, but should have been in fg_joystick_x11.c
+
+(cherry picked from commit 0d98472817921dc95d070f13bba59b72d792a7b2)
+
+git-svn-id: http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1832 7f0cb862-5218-0410-a997-914c9d46530a
+---
+ src/fg_joystick.c         | 173 ----------------------------------
+ src/x11/fg_joystick_x11.c | 190 +++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 185 insertions(+), 178 deletions(-)
+
+diff --git a/src/fg_joystick.c b/src/fg_joystick.c
+index 2f4f6ed..e548c04 100644
+--- a/src/fg_joystick.c
++++ b/src/fg_joystick.c
+@@ -68,8 +68,6 @@
+ #        endif
+ #    endif
+ 
+-static int hatmap_x[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
+-static int hatmap_y[9] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
+ struct os_specific_s {
+   char             fname [128 ];
+   int              fd;
+@@ -98,178 +96,7 @@ struct os_specific_s {
+ #    define UHIDDEV "/dev/uhid"
+ #    define AJSDEV "/dev/joy"
+ 
+-#    ifdef HAVE_USB_JS
+-/*
+- * fghJoystickFindUSBdev (and its helper, fghJoystickWalkUSBdev) try to locate
+- * the full name of a USB device. If /dev/usbN isn't readable, we punt and
+- * return the uhidN device name. We warn the user of this situation once.
+- */
+-static char *fghJoystickWalkUSBdev(int f, char *dev, char *out, int outlen)
+-{
+-  struct usb_device_info di;
+-  int i, a;
+-  char *cp;
+-
+-  for (a = 1; a < USB_MAX_DEVICES; a++) {
+-    di.udi_addr = a;
+-    if (ioctl(f, USB_DEVICEINFO, &di) != 0)
+-      return NULL;
+-    for (i = 0; i < USB_MAX_DEVNAMES; i++)
+-      if (di.udi_devnames[i][0] &&
+-          strcmp(di.udi_devnames[i], dev) == 0) {
+-        cp =  calloc( 1, strlen(di.udi_vendor) + strlen(di.udi_product) + 2);
+-        strcpy(cp, di.udi_vendor);
+-        strcat(cp, " ");
+-        strcat(cp, di.udi_product);
+-        strncpy(out, cp, outlen - 1);
+-        out[outlen - 1] = 0;
+-        free( cp );
+-        return out;
+-      }
+-  }
+-  return NULL;
+-}
+-
+-static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
+-{
+-  int i, f;
+-  char buf[50];
+-  char *cp;
+-  static int protection_warned = 0;
+-
+-  for (i = 0; i < 16; i++) {
+-    snprintf(buf, sizeof(buf), "%s%d", USBDEV, i);
+-    f = open(buf, O_RDONLY);
+-    if (f >= 0) {
+-      cp = fghJoystickWalkUSBdev(f, name, out, outlen);
+-      close(f);
+-      if (cp)
+-        return 1;
+-    }
+-    else if (errno == EACCES) {
+-      if (!protection_warned) {
+-        fgWarning ( "Can't open %s for read!", buf );
+-        protection_warned = 1;
+-      }
+-    }
+-  }
+-  return 0;
+-}
+ 
+-static int fghJoystickInitializeHID(struct os_specific_s *os,
+-       int *num_axes, int *num_buttons)
+-{
+-    int size, is_joystick;
+-#   ifdef HAVE_USBHID_H
+-        int report_id = 0;
+-#   endif
+-    struct hid_data *d;
+-    struct hid_item h;
+-    report_desc_t rd;
+-
+-    if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 )
+-    {
+-        fgWarning ( "error: %s: %s", os->fname, strerror( errno ) );
+-        return FALSE;
+-    }
+-
+-    os->hids = NULL;
+-
+-#   ifdef HAVE_USBHID_H
+-        if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0)
+-        {
+-            /*** XXX {report_id} may not be the right variable? ***/
+-            fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) );
+-            return FALSE;
+-        }
+-
+-        size = hid_report_size( rd, hid_input, report_id );
+-#   else
+-        size = hid_report_size( rd, 0, hid_input );
+-#   endif
+-    os->hid_data_buf = calloc( 1, size );
+-    os->hid_dlen = size;
+-
+-    is_joystick = 0;
+-#   ifdef HAVE_USBHID_H
+-        d = hid_start_parse( rd, 1 << hid_input, report_id );
+-#   else
+-        d = hid_start_parse( rd, 1 << hid_input );
+-#   endif
+-        while( hid_get_item( d, &h ) )
+-        {
+-            int usage, page, interesting_hid;
+-
+-            page = HID_PAGE( h.usage );
+-            usage = HID_USAGE( h.usage );
+-
+-            /* This test is somewhat too simplistic, but this is how MicroSoft
+-             * does, so I guess it works for all joysticks/game pads. */
+-            is_joystick = is_joystick ||
+-                ( h.kind == hid_collection &&
+-                  page == HUP_GENERIC_DESKTOP &&
+-                  ( usage == HUG_JOYSTICK || usage == HUG_GAME_PAD ) );
+-
+-            if( h.kind != hid_input )
+-                continue;
+-
+-            if( !is_joystick )
+-                continue;
+-
+-            interesting_hid = TRUE;
+-            if( page == HUP_GENERIC_DESKTOP )
+-            {
+-                switch( usage )
+-                {
+-                case HUG_X:
+-                case HUG_RX:
+-                case HUG_Y:
+-                case HUG_RY:
+-                case HUG_Z:
+-                case HUG_RZ:
+-                case HUG_SLIDER:
+-                    if( *num_axes < _JS_MAX_AXES )
+-                    {
+-                        os->axes_usage[ *num_axes ] = usage;
+-                        ( *num_axes )++;
+-                    }
+-                    break;
+-                case HUG_HAT_SWITCH:
+-                    /* Allocate two axes for a hat */
+-                    if( *num_axes + 1 < _JS_MAX_AXES )
+-                    {
+-                        os->axes_usage[ *num_axes ] = usage;
+-                        (*num_axes)++;
+-                        os->axes_usage[ *num_axes ] = usage;
+-                        (*num_axes)++;
+-                    }
+-                    break;
+-                default:
+-                    interesting_hid = FALSE;
+-                    break;
+-                }
+-            }
+-            else if( page == HUP_BUTTON )
+-            {
+-                interesting_hid = ( usage > 0 ) &&
+-                    ( usage <= _JS_MAX_BUTTONS );
+-
+-                if( interesting_hid && usage - 1 > *num_buttons )
+-                    *num_buttons = usage - 1;
+-            }
+-
+-            if( interesting_hid )
+-            {
+-                h.next = os->hids;
+-                os->hids = calloc( 1, sizeof ( struct hid_item ) );
+-                *os->hids = h;
+-            }
+-        }
+-        hid_end_parse( d );
+-
+-        return os->hids != NULL;
+-}
+-#    endif
+ #endif
+ 
+ /*
+diff --git a/src/x11/fg_joystick_x11.c b/src/x11/fg_joystick_x11.c
+index 04bc373..30ad4b5 100644
+--- a/src/x11/fg_joystick_x11.c
++++ b/src/x11/fg_joystick_x11.c
+@@ -42,8 +42,188 @@
+ #include <fcntl.h>
+ 
+ 
++#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++
++static int hatmap_x[9] = {0, 0, 1, 1, 1, 0, -1, -1, -1};
++static int hatmap_y[9] = {0, 1, 1, 0, -1, -1, -1, 0, 1};
++
++#    ifdef HAVE_USB_JS
++/*
++* fghJoystickFindUSBdev (and its helper, fghJoystickWalkUSBdev) try to locate
++* the full name of a USB device. If /dev/usbN isn't readable, we punt and
++* return the uhidN device name. We warn the user of this situation once.
++*/
++static char *fghJoystickWalkUSBdev(int f, char *dev, char *out, int outlen)
++{
++    struct usb_device_info di;
++    int i, a;
++    char *cp;
++
++    for (a = 1; a < USB_MAX_DEVICES; a++) {
++        di.udi_addr = a;
++        if (ioctl(f, USB_DEVICEINFO, &di) != 0)
++            return NULL;
++        for (i = 0; i < USB_MAX_DEVNAMES; i++)
++            if (di.udi_devnames[i][0] &&
++                strcmp(di.udi_devnames[i], dev) == 0) {
++                cp = calloc(1, strlen(di.udi_vendor) + strlen(di.udi_product) + 2);
++                strcpy(cp, di.udi_vendor);
++                strcat(cp, " ");
++                strcat(cp, di.udi_product);
++                strncpy(out, cp, outlen - 1);
++                out[outlen - 1] = 0;
++                free(cp);
++                return out;
++            }
++    }
++    return NULL;
++}
++
++static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
++{
++    int i, f;
++    char buf[50];
++    char *cp;
++    static int protection_warned = 0;
++
++    for (i = 0; i < 16; i++) {
++        snprintf(buf, sizeof(buf), "%s%d", USBDEV, i);
++        f = open(buf, O_RDONLY);
++        if (f >= 0) {
++            cp = fghJoystickWalkUSBdev(f, name, out, outlen);
++            close(f);
++            if (cp)
++                return 1;
++        }
++        else if (errno == EACCES) {
++            if (!protection_warned) {
++                fgWarning("Can't open %s for read!", buf);
++                protection_warned = 1;
++            }
++        }
++    }
++    return 0;
++}
++
++static int fghJoystickInitializeHID(struct os_specific_s *os,
++                                    int *num_axes, int *num_buttons)
++{
++    int size, is_joystick;
++#   ifdef HAVE_USBHID_H
++    int report_id = 0;
++#   endif
++    struct hid_data *d;
++    struct hid_item h;
++    report_desc_t rd;
++
++    if ((rd = hid_get_report_desc(os->fd)) == 0)
++    {
++        fgWarning("error: %s: %s", os->fname, strerror(errno));
++        return FALSE;
++    }
++
++    os->hids = NULL;
++
++#   ifdef HAVE_USBHID_H
++    if (ioctl(os->fd, USB_GET_REPORT_ID, &report_id) < 0)
++    {
++        /*** XXX {report_id} may not be the right variable? ***/
++        fgWarning("error: %s%d: %s", UHIDDEV, report_id, strerror(errno));
++        return FALSE;
++    }
++
++    size = hid_report_size(rd, hid_input, report_id);
++#   else
++    size = hid_report_size(rd, 0, hid_input);
++#   endif
++    os->hid_data_buf = calloc(1, size);
++    os->hid_dlen = size;
++
++    is_joystick = 0;
++#   ifdef HAVE_USBHID_H
++    d = hid_start_parse(rd, 1 << hid_input, report_id);
++#   else
++    d = hid_start_parse(rd, 1 << hid_input);
++#   endif
++    while (hid_get_item(d, &h))
++    {
++        int usage, page, interesting_hid;
++
++        page = HID_PAGE(h.usage);
++        usage = HID_USAGE(h.usage);
++
++        /* This test is somewhat too simplistic, but this is how MicroSoft
++        * does, so I guess it works for all joysticks/game pads. */
++        is_joystick = is_joystick ||
++            (h.kind == hid_collection &&
++             page == HUP_GENERIC_DESKTOP &&
++             (usage == HUG_JOYSTICK || usage == HUG_GAME_PAD));
++
++        if (h.kind != hid_input)
++            continue;
++
++        if (!is_joystick)
++            continue;
++
++        interesting_hid = TRUE;
++        if (page == HUP_GENERIC_DESKTOP)
++        {
++            switch (usage)
++            {
++                case HUG_X:
++                case HUG_RX:
++                case HUG_Y:
++                case HUG_RY:
++                case HUG_Z:
++                case HUG_RZ:
++                case HUG_SLIDER:
++                    if (*num_axes < _JS_MAX_AXES)
++                    {
++                        os->axes_usage[*num_axes] = usage;
++                        (*num_axes)++;
++                    }
++                    break;
++                case HUG_HAT_SWITCH:
++                    /* Allocate two axes for a hat */
++                    if (*num_axes + 1 < _JS_MAX_AXES)
++                    {
++                        os->axes_usage[*num_axes] = usage;
++                        (*num_axes)++;
++                        os->axes_usage[*num_axes] = usage;
++                        (*num_axes)++;
++                    }
++                    break;
++                default:
++                    interesting_hid = FALSE;
++                    break;
++            }
++        }
++        else if (page == HUP_BUTTON)
++        {
++            interesting_hid = (usage > 0) &&
++                (usage <= _JS_MAX_BUTTONS);
++
++            if (interesting_hid && usage - 1 > *num_buttons)
++                *num_buttons = usage - 1;
++        }
++
++        if (interesting_hid)
++        {
++            h.next = os->hids;
++            os->hids = calloc(1, sizeof(struct hid_item));
++            *os->hids = h;
++        }
++    }
++    hid_end_parse(d);
++
++    return os->hids != NULL;
++}
++#    endif
++#endif
++
++
+ /*this should be defined in a header file */
+-#define MAX_NUM_JOYSTICKS  2   
++#define MAX_NUM_JOYSTICKS  2
+ extern SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+ 
+ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+@@ -216,15 +396,15 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+ void fgPlatformJoystickOpen( SFG_Joystick* joy )
+ {
+ #if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__)
+-	int i = 0;
++    int i = 0;
+        char *cp;
+ #endif
+ #ifdef JS_NEW
+        unsigned char u;
+-	int i=0;
++    int i=0;
+ #else
+ #  if defined( __linux__ ) || TARGET_HOST_SOLARIS
+-	int i = 0;
++    int i = 0;
+     int counter = 0;
+ #  endif
+ #endif
+@@ -448,7 +628,7 @@ void fgPlatformJoystickClose ( int ident )
+             free( fgJoystick[ ident ]->pJoystick.os->hid_data_buf );
+ #endif
+         free( fgJoystick[ident]->pJoystick.os );
+-	}
++    }
+ #endif
+ 
+     if( ! fgJoystick[ident]->error )
+-- 
+2.19.2
+
+From f310b56bb6f93e255cf880c8970c794e0f2efc8d Mon Sep 17 00:00:00 2001
+From: dcnieho <dcnieho@7f0cb862-5218-0410-a997-914c9d46530a>
+Date: Mon, 31 Jul 2017 20:49:26 +0000
+Subject: [PATCH] Fix build on NetBSD.
+
+(cherry picked from commit 1236c7644508227b616e97e29e123b34257e36d1)
+
+git-svn-id: http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1835 7f0cb862-5218-0410-a997-914c9d46530a
+---
+ src/fg_joystick.c         | 59 -------------------------------------
+ src/x11/fg_joystick_x11.c | 61 +++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 61 insertions(+), 59 deletions(-)
+
+diff --git a/src/fg_joystick.c b/src/fg_joystick.c
+index e548c04..b24476a 100644
+--- a/src/fg_joystick.c
++++ b/src/fg_joystick.c
+@@ -40,65 +40,6 @@
+ #define JS_TRUE  1
+ #define JS_FALSE 0
+ 
+-/* BSD defines from "jsBSD.cxx" around lines 42-270 */
+-
+-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-
+-#    ifdef HAVE_USB_JS
+-#        if defined(__NetBSD__)
+-#            ifdef HAVE_USBHID_H
+-#                include <usbhid.h>
+-#            else
+-#                include <usb.h>
+-#            endif
+-#            include <dev/usb/usb.h>
+-#        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-#            ifdef HAVE_USBHID_H
+-#                include <usbhid.h>
+-#            else
+-#                include <libusbhid.h>
+-#            endif
+-#            include <legacy/dev/usb/usb.h>
+-#        endif
+-#        include <dev/usb/usbhid.h>
+-
+-/* Compatibility with older usb.h revisions */
+-#        if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES)
+-#            define USB_MAX_DEVNAMES MAXDEVNAMES
+-#        endif
+-#    endif
+-
+-struct os_specific_s {
+-  char             fname [128 ];
+-  int              fd;
+-  int              is_analog;
+-  /* The following structure members are specific to analog joysticks */
+-  struct joystick  ajs;
+-#    ifdef HAVE_USB_JS
+-  /* The following structure members are specific to USB joysticks */
+-  struct hid_item *hids;
+-  int              hid_dlen;
+-  int              hid_offset;
+-  char            *hid_data_buf;
+-  int              axes_usage [ _JS_MAX_AXES ];
+-#    endif
+-  /* We keep button and axes state ourselves, as they might not be updated
+-   * on every read of a USB device
+-   */
+-  int              cache_buttons;
+-  float            cache_axes [ _JS_MAX_AXES ];
+-};
+-
+-/* Idents lower than USB_IDENT_OFFSET are for analog joysticks. */
+-#    define USB_IDENT_OFFSET    2
+-
+-#    define USBDEV "/dev/usb"
+-#    define UHIDDEV "/dev/uhid"
+-#    define AJSDEV "/dev/joy"
+-
+-
+-#endif
+-
+ /*
+  * Functions associated with the "jsJoystick" class in PLIB
+  */
+diff --git a/src/x11/fg_joystick_x11.c b/src/x11/fg_joystick_x11.c
+index 30ad4b5..8c75bbe 100644
+--- a/src/x11/fg_joystick_x11.c
++++ b/src/x11/fg_joystick_x11.c
+@@ -42,8 +42,68 @@
+ #include <fcntl.h>
+ 
+ 
++/* BSD defines from "jsBSD.cxx" around lines 42-270 */
++
++#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++
++#    ifdef HAVE_USB_JS
++#        if defined(__NetBSD__)
++#            ifdef HAVE_USBHID_H
++#                include <usbhid.h>
++#            else
++#                include <usb.h>
++#            endif
++#            include <dev/usb/usb.h>
++#        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#            ifdef HAVE_USBHID_H
++#                include <usbhid.h>
++#            else
++#                include <libusbhid.h>
++#            endif
++#            include <legacy/dev/usb/usb.h>
++#        endif
++#        include <dev/usb/usbhid.h>
++
++/* Compatibility with older usb.h revisions */
++#        if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES)
++#            define USB_MAX_DEVNAMES MAXDEVNAMES
++#        endif
++#    endif
++
++struct os_specific_s {
++  char             fname [128 ];
++  int              fd;
++  int              is_analog;
++  /* The following structure members are specific to analog joysticks */
++  struct joystick  ajs;
++#    ifdef HAVE_USB_JS
++  /* The following structure members are specific to USB joysticks */
++  struct hid_item *hids;
++  int              hid_dlen;
++  int              hid_offset;
++  char            *hid_data_buf;
++  int              axes_usage [ _JS_MAX_AXES ];
++#    endif
++  /* We keep button and axes state ourselves, as they might not be updated
++   * on every read of a USB device
++   */
++  int              cache_buttons;
++  float            cache_axes [ _JS_MAX_AXES ];
++};
++
++/* Idents lower than USB_IDENT_OFFSET are for analog joysticks. */
++#    define USB_IDENT_OFFSET    2
++
++#    define USBDEV "/dev/usb"
++#    define UHIDDEV "/dev/uhid"
++#    define AJSDEV "/dev/joy"
++
++
++#endif
++
+ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ static int hatmap_x[9] = {0, 0, 1, 1, 1, 0, -1, -1, -1};
+ static int hatmap_y[9] = {0, 1, 1, 0, -1, -1, -1, 0, 1};
+ 
+@@ -104,6 +164,7 @@ static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
+     }
+     return 0;
+ }
++#endif
+ 
+ static int fghJoystickInitializeHID(struct os_specific_s *os,
+                                     int *num_axes, int *num_buttons)
+-- 
+2.19.2
+

diff --git a/media-libs/freeglut/freeglut-3.0.0.ebuild b/media-libs/freeglut/freeglut-3.0.0.ebuild
index 95ec4c4bca8..3fcb972cf75 100644
--- a/media-libs/freeglut/freeglut-3.0.0.ebuild
+++ b/media-libs/freeglut/freeglut-3.0.0.ebuild
@@ -31,6 +31,7 @@ HTML_DOCS=( doc/. )
 
 PATCHES=(
 	"${FILESDIR}"/${P}-drop-unnecessary-x11-libs.patch
+	"${FILESDIR}"/${P}-bsd-usb-joystick.patch
 )
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeglut/files/, media-libs/freeglut/
@ 2020-02-25 23:38 David Seifert
  0 siblings, 0 replies; 5+ messages in thread
From: David Seifert @ 2020-02-25 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     f9102571b69d9fc05471a592fda252681fdfdef1
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 25 23:37:47 2020 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Tue Feb 25 23:37:47 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9102571

media-libs/freeglut: Fix GCC 10 / -fno-common

Closes: https://bugs.gentoo.org/705840
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Acked-by: Matt Turner <mattst88 <AT> gentoo.org>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../files/freeglut-3.2.1-gcc10-fno-common.patch    | 81 ++++++++++++++++++++++
 media-libs/freeglut/freeglut-3.2.1.ebuild          |  1 +
 2 files changed, 82 insertions(+)

diff --git a/media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch b/media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch
new file mode 100644
index 00000000000..655c01bf94b
--- /dev/null
+++ b/media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch
@@ -0,0 +1,81 @@
+From 5791564dd934d193df771a0a7c52013e9f456aa1 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue, 21 Jan 2020 22:33:49 +0000
+Subject: [PATCH] fg_gl2: fix build failure against gcc-10
+
+On gcc-10 (and gcc-9 -fno-common) build fails as:
+
+```
+[ 31%] Linking C executable bin/Lorenz_static
+/usr/bin/cmake -E cmake_link_script CMakeFiles/Lorenz_static.dir/link.txt --verbose=1
+/usr/lib/ccache/bin/cc  -Wall -pedantic  -rdynamic CMakeFiles/Lorenz_static.dir/progs/demos/Lorenz/lorenz.c.o \
+   -o bin/Lorenz_static  -lGLU -lGL -lm -lX11 -lXrandr -lXxf86vm -lXi -lm lib/libglut.a -lGL -lm -lX11 -lXrandr -lXxf86vm -lXi
+ld: lib/libglut.a(fg_gl2.c.o):(.bss+0x0):
+  multiple definition of `fghGenBuffers'; lib/libglut.a(fg_window.c.o):(.bss+0x0): first defined here
+ld: lib/libglut.a(fg_gl2.c.o):(.bss+0x8):
+  multiple definition of `fghDeleteBuffers'; lib/libglut.a(fg_window.c.o):(.bss+0x8): first defined here
+```
+
+Note: duplicate definition comes here from 'fg_gl2.h'.
+The fix is to move declaration to a 'fg_gl2.c' file.
+
+gcc-10 will change the default from -fcommon to fno-common:
+https://gcc.gnu.org/PR85678.
+
+The error also happens if CFLAGS=-fno-common passed explicitly.
+
+Bug: https://bugs.gentoo.org/705840
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/fg_gl2.c | 12 ++++++++++++
+ src/fg_gl2.h | 14 +++++++-------
+ 2 files changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/freeglut/freeglut/src/fg_gl2.c b/freeglut/freeglut/src/fg_gl2.c
+index 38b0acbb..f79c432a 100644
+--- a/src/fg_gl2.c
++++ b/src/fg_gl2.c
+@@ -27,6 +27,18 @@
+ #include "fg_internal.h"
+ #include "fg_gl2.h"
+ 
++#ifdef GL_ES_VERSION_2_0
++/* Use existing functions on GLES 2.0 */
++#else
++FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
++FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
++FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
++FGH_PFNGLBUFFERDATAPROC fghBufferData;
++FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
++FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
++FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
++#endif
++
+ void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) {
+   if (fgStructure.CurrentWindow != NULL)
+     fgStructure.CurrentWindow->Window.attribute_v_coord = attrib;
+diff --git a/freeglut/freeglut/src/fg_gl2.h b/freeglut/freeglut/src/fg_gl2.h
+index ab8ba5c7..fb3d4676 100644
+--- a/src/fg_gl2.h
++++ b/src/fg_gl2.h
+@@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+ typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);
+ typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+ 
+-FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
+-FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
+-FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
+-FGH_PFNGLBUFFERDATAPROC fghBufferData;
+-FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
+-FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
+-FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
++extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
++extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
++extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
++extern FGH_PFNGLBUFFERDATAPROC fghBufferData;
++extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
++extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
++extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
+ 
+ #    endif
+ 

diff --git a/media-libs/freeglut/freeglut-3.2.1.ebuild b/media-libs/freeglut/freeglut-3.2.1.ebuild
index 5efa6e62413..dec72e4fdd6 100644
--- a/media-libs/freeglut/freeglut-3.2.1.ebuild
+++ b/media-libs/freeglut/freeglut-3.2.1.ebuild
@@ -27,6 +27,7 @@ DEPEND="${RDEPEND}
 	x11-base/xorg-proto"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=( "${FILESDIR}"/${PN}-3.2.1-gcc10-fno-common.patch )
 HTML_DOCS=( doc/. )
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeglut/files/, media-libs/freeglut/
@ 2022-07-27 16:01 Matt Turner
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Turner @ 2022-07-27 16:01 UTC (permalink / raw
  To: gentoo-commits

commit:     4dadfc6e58f9c4176b84b36992103b9cb5ba7f5d
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 27 16:00:21 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Jul 27 16:00:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dadfc6e

media-libs/freeglut: Fix build with -Werror=lto-type-mismatch

Closes: https://bugs.gentoo.org/859847
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 .../files/3.2.2-Fix-aliasing-violation.patch       | 65 ++++++++++++++++++++++
 media-libs/freeglut/freeglut-3.2.2.ebuild          |  4 ++
 2 files changed, 69 insertions(+)

diff --git a/media-libs/freeglut/files/3.2.2-Fix-aliasing-violation.patch b/media-libs/freeglut/files/3.2.2-Fix-aliasing-violation.patch
new file mode 100644
index 000000000000..d6544578bcf1
--- /dev/null
+++ b/media-libs/freeglut/files/3.2.2-Fix-aliasing-violation.patch
@@ -0,0 +1,65 @@
+https://bugs.gentoo.org/859847
+
+From 8c6f6bf3ad2fd33d15de6ee96175cd29bf804d9f Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88@gmail.com>
+Date: Tue, 26 Jul 2022 15:47:02 -0400
+Subject: [PATCH] Fix aliasing violation
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Noticed when compiling with link-time optimizations.
+
+include/GL/freeglut_std.h:240:18: error: type of ‘glutBitmapHelvetica18’ does not match original declaration [-Werror=lto-type-mismatch]
+  240 |     extern void* glutBitmapHelvetica18;
+      |                  ^
+src/x11/fg_glutfont_definitions_x11.c:103:27: note: ‘glutBitmapHelvetica18’ was previously declared here
+  103 | struct freeglutBitmapFont glutBitmapHelvetica18 ;
+      |                           ^
+src/x11/fg_glutfont_definitions_x11.c:103:27: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
+---
+ src/x11/fg_glutfont_definitions_x11.c | 29 ++++++++++++++++++---------
+ 1 file changed, 20 insertions(+), 9 deletions(-)
+
+diff --git a/src/x11/fg_glutfont_definitions_x11.c b/src/x11/fg_glutfont_definitions_x11.c
+index bec20371..d086a990 100644
+--- a/src/x11/fg_glutfont_definitions_x11.c
++++ b/src/x11/fg_glutfont_definitions_x11.c
+@@ -91,14 +91,25 @@ struct freeglutBitmapFont
+ };
+ 
+ 
+-struct freeglutStrokeFont glutStrokeRoman ;
+-struct freeglutStrokeFont glutStrokeMonoRoman ;
++static struct freeglutStrokeFont glutStrokeRoman_ ;
++static struct freeglutStrokeFont glutStrokeMonoRoman_ ;
+ 
+-struct freeglutBitmapFont glutBitmap9By15 ;
+-struct freeglutBitmapFont glutBitmap8By13 ;
+-struct freeglutBitmapFont glutBitmapTimesRoman10 ;
+-struct freeglutBitmapFont glutBitmapTimesRoman24 ;
+-struct freeglutBitmapFont glutBitmapHelvetica10 ;
+-struct freeglutBitmapFont glutBitmapHelvetica12 ;
+-struct freeglutBitmapFont glutBitmapHelvetica18 ;
++static struct freeglutBitmapFont glutBitmap9By15_ ;
++static struct freeglutBitmapFont glutBitmap8By13_ ;
++static struct freeglutBitmapFont glutBitmapTimesRoman10_ ;
++static struct freeglutBitmapFont glutBitmapTimesRoman24_ ;
++static struct freeglutBitmapFont glutBitmapHelvetica10_ ;
++static struct freeglutBitmapFont glutBitmapHelvetica12_ ;
++static struct freeglutBitmapFont glutBitmapHelvetica18_ ;
+ 
++
++void *glutStrokeRoman = &glutStrokeRoman_ ;
++void *glutStrokeMonoRoman = &glutStrokeMonoRoman_ ;
++
++void *glutBitmap9By15 = &glutBitmap9By15_ ;
++void *glutBitmap8By13 = &glutBitmap8By13_ ;
++void *glutBitmapTimesRoman10 = &glutBitmapTimesRoman10_ ;
++void *glutBitmapTimesRoman24 = &glutBitmapTimesRoman24_ ;
++void *glutBitmapHelvetica10 = &glutBitmapHelvetica10_ ;
++void *glutBitmapHelvetica12 = &glutBitmapHelvetica12_ ;
++void *glutBitmapHelvetica18 = &glutBitmapHelvetica18_ ;
+-- 
+2.35.1
+

diff --git a/media-libs/freeglut/freeglut-3.2.2.ebuild b/media-libs/freeglut/freeglut-3.2.2.ebuild
index d8fb60843cac..0a46c30d469d 100644
--- a/media-libs/freeglut/freeglut-3.2.2.ebuild
+++ b/media-libs/freeglut/freeglut-3.2.2.ebuild
@@ -28,6 +28,10 @@ DEPEND="${RDEPEND}
 	x11-base/xorg-proto"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+	"${FILESDIR}"/${PV}-Fix-aliasing-violation.patch
+)
+
 src_configure() {
 	local mycmakeargs=(
 #		"-DOpenGL_GL_PREFERENCE=GLVND" # bug 721006


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/freeglut/files/, media-libs/freeglut/
@ 2024-11-17  1:18 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2024-11-17  1:18 UTC (permalink / raw
  To: gentoo-commits

commit:     a97f88a3641ce086c6f8e00f276a9760b1b9bfb8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 01:17:23 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 01:17:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a97f88a3

media-libs/freeglut: fix build w/ C23

Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-libs/freeglut/files/freeglut-3.6.0-c23.patch | 27 +++++++++++++
 media-libs/freeglut/freeglut-3.6.0-r1.ebuild       | 46 ++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/media-libs/freeglut/files/freeglut-3.6.0-c23.patch b/media-libs/freeglut/files/freeglut-3.6.0-c23.patch
new file mode 100644
index 000000000000..c5cd5ee5dbf3
--- /dev/null
+++ b/media-libs/freeglut/files/freeglut-3.6.0-c23.patch
@@ -0,0 +1,27 @@
+https://github.com/freeglut/freeglut/pull/187
+
+From ca500e65b40267efe7a05ec7ebae1141544c0cfb Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 17 Nov 2024 01:14:26 +0000
+Subject: [PATCH] egl: fix fgPlatformDestroyContext prototype for C23
+
+C23 removes unprototyped functions, so this conflicted with the definition
+in fg_init_x11.c.
+
+Bug: https://github.com/freeglut/freeglut/issues/186
+---
+ src/egl/fg_init_egl.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/egl/fg_init_egl.h b/src/egl/fg_init_egl.h
+index 592c5221d..8753dc0bc 100644
+--- a/src/egl/fg_init_egl.h
++++ b/src/egl/fg_init_egl.h
+@@ -28,6 +28,6 @@
+ 
+ extern void fghPlatformInitializeEGL();
+ extern void fghPlatformCloseDisplayEGL();
+-extern void fgPlatformDestroyContext();
++extern void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext );
+ 
+ #endif

diff --git a/media-libs/freeglut/freeglut-3.6.0-r1.ebuild b/media-libs/freeglut/freeglut-3.6.0-r1.ebuild
new file mode 100644
index 000000000000..d21631d891b0
--- /dev/null
+++ b/media-libs/freeglut/freeglut-3.6.0-r1.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib
+
+DESCRIPTION="A free OpenGL utility toolkit, the open-sourced alternative to the GLUT library"
+HOMEPAGE="https://freeglut.sourceforge.net/"
+SRC_URI="https://downloads.sourceforge.net/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+
+# enabling GLES support seems to cause build failures
+RDEPEND=">=virtual/glu-9.0-r1[${MULTILIB_USEDEP}]
+	>=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}]
+	>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
+	>=x11-libs/libXi-1.7.2[${MULTILIB_USEDEP}]
+	>=x11-libs/libXrandr-1.4.2[${MULTILIB_USEDEP}]
+	>=x11-libs/libXxf86vm-1.1.3[${MULTILIB_USEDEP}]"
+# gles? ( media-libs/mesa[egl(+),gles1,gles2,${MULTILIB_USEDEP}] )
+DEPEND="${RDEPEND}
+	x11-base/xorg-proto"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-3.6.0-c23.patch
+)
+
+src_configure() {
+	local mycmakeargs=(
+#		"-DOpenGL_GL_PREFERENCE=GLVND" # bug 721006
+		"-DFREEGLUT_GLES=OFF"
+		"-DFREEGLUT_BUILD_DEMOS=OFF"
+		"-DFREEGLUT_BUILD_STATIC_LIBS=OFF"
+	)
+#	$(cmake-utils_use gles FREEGLUT_GLES)
+	cmake-multilib_src_configure
+}
+
+multilib_src_install() {
+	cmake_src_install
+	cp "${ED}"/usr/$(get_libdir)/pkgconfig/{,free}glut.pc || die
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-17  1:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-27 19:54 [gentoo-commits] repo/gentoo:master commit in: media-libs/freeglut/files/, media-libs/freeglut/ Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2024-11-17  1:18 Sam James
2022-07-27 16:01 Matt Turner
2020-02-25 23:38 David Seifert
2019-03-27 19:54 Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox