Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Dec 2015 18:51:43 +0000 (UTC)
From:      Koop Mast <kwm@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r403627 - in head/graphics/freeglut: . files
Message-ID:  <201512121851.tBCIphdW094813@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kwm
Date: Sat Dec 12 18:51:42 2015
New Revision: 403627
URL: https://svnweb.freebsd.org/changeset/ports/403627

Log:
  Update freeglut to 3.0.
  
  * Update COMMENT/pkg-message
  * Remove conflicts libglut has been gone for ages.
  
  Obtained from:	xorg devel repo

Added:
  head/graphics/freeglut/files/patch-CMakeLists.txt   (contents, props changed)
  head/graphics/freeglut/files/patch-src_fg__internal.h   (contents, props changed)
  head/graphics/freeglut/files/patch-src_fg__joystick.c   (contents, props changed)
  head/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h   (contents, props changed)
  head/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c   (contents, props changed)
Deleted:
  head/graphics/freeglut/files/patch-src_freeglut_joystick.c
Modified:
  head/graphics/freeglut/Makefile
  head/graphics/freeglut/distinfo
  head/graphics/freeglut/pkg-message
  head/graphics/freeglut/pkg-plist

Modified: head/graphics/freeglut/Makefile
==============================================================================
--- head/graphics/freeglut/Makefile	Sat Dec 12 18:46:05 2015	(r403626)
+++ head/graphics/freeglut/Makefile	Sat Dec 12 18:51:42 2015	(r403627)
@@ -2,34 +2,29 @@
 # $FreeBSD$
 
 PORTNAME=	freeglut
-PORTVERSION=	2.8.1
-PORTREVISION=	4
+PORTVERSION=	3.0.0
 CATEGORIES=	graphics
 MASTER_SITES=	SF
 
 MAINTAINER=	x11@FreeBSD.org
-COMMENT=	Alternative to the OpenGL Utility Toolkit (GLUT) library
+COMMENT=	open source implementation of the GLUT library
 
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-CONFLICTS=	libglut-[0-9].*
-
-USES=		libtool
-GNU_CONFIGURE=	yes
+USES=		cmake
 USE_LDCONFIG=	yes
-USE_XORG=	ice xi xxf86vm xrandr
-USE_GL=		glu
-CONFIGURE_ARGS=	--disable-warnings
+USE_XORG=	ice x11 xi xrandr
+USE_GL=		gl glu
 CPPFLAGS+=	-I${LOCALBASE}/include
 LDFLAGS+=	-L${LOCALBASE}/lib -lusbhid -lm
-USE_LDCONFIG=	yes
-INSTALL_TARGET=	install-strip
+INSTALL_TARGET=	install/strip
 
 DOCS=	download.html freeglut.html freeglut_logo.png		\
 	freeglut_user_interface.html index.html ogl_sm.png	\
 	progress.html structure.html
-BINS=	CallbackMaker Fractals Fractals_random Lorenz One shapes
+BINS=	CallbackMaker Fractals Fractals_random Lorenz One Resizer \
+	multi-touch shapes smooth_opengl3 spaceball subwin timer
 
 OPTIONS_DEFINE=	DOCS EXAMPLES
 
@@ -41,23 +36,19 @@ pre-configure:
 		${WRKSRC}/progs/demos/${fract}
 .endfor
 
-post-build:
-	@${MV} ${WRKSRC}/progs/demos/CallbackMaker/.libs/CallbackMaker	\
-		${WRKSRC}/progs/demos/CallbackMaker/.libs/callbackmaker
-
 post-install:
 .if ${PORT_OPTIONS:MDOCS}
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
 .for FILE in ${DOCS}
-	@${INSTALL_DATA} ${WRKSRC}/doc/${FILE} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/doc/${FILE} ${STAGEDIR}${DOCSDIR}
 .endfor
 	@${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}."
 .endif
 .if ${PORT_OPTIONS:MEXAMPLES}
 	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
-	@${INSTALL_DATA} ${WRKSRC}/progs/demos/Fractals/fractals.dat ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/progs/demos/Fractals/fractals.dat ${STAGEDIR}${EXAMPLESDIR}
 .for prog in ${BINS}
-	@${INSTALL_PROGRAM} ${WRKSRC}/progs/demos/${prog}/.libs/${prog:tl} ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/${prog} ${STAGEDIR}${EXAMPLESDIR}
 .endfor
 	@${ECHO_MSG} "===> Examples installed in ${EXAMPLESDIR}."
 .endif

Modified: head/graphics/freeglut/distinfo
==============================================================================
--- head/graphics/freeglut/distinfo	Sat Dec 12 18:46:05 2015	(r403626)
+++ head/graphics/freeglut/distinfo	Sat Dec 12 18:51:42 2015	(r403627)
@@ -1,2 +1,2 @@
-SHA256 (freeglut-2.8.1.tar.gz) = dde46626a62a1cd9cf48a11951cdd592e7067c345cffe193a149dfd47aef999a
-SIZE (freeglut-2.8.1.tar.gz) = 1005343
+SHA256 (freeglut-3.0.0.tar.gz) = 2a43be8515b01ea82bcfa17d29ae0d40bd128342f0930cd1f375f1ff999f76a2
+SIZE (freeglut-3.0.0.tar.gz) = 419095

Added: head/graphics/freeglut/files/patch-CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/freeglut/files/patch-CMakeLists.txt	Sat Dec 12 18:51:42 2015	(r403627)
@@ -0,0 +1,10 @@
+--- CMakeLists.txt.orig	2015-02-18 04:59:57 UTC
++++ CMakeLists.txt
+@@ -522,6 +522,6 @@ IF(FREEGLUT_GLES)
+   SET(PC_FILENAME "freeglut-gles.pc")
+ ENDIF()
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
+-INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME})
++INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig/ RENAME ${PC_FILENAME})
+ # TODO: change the library and .pc name when building for GLES,
+ # e.g. -lglut-GLES

Added: head/graphics/freeglut/files/patch-src_fg__internal.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/freeglut/files/patch-src_fg__internal.h	Sat Dec 12 18:51:42 2015	(r403627)
@@ -0,0 +1,10 @@
+--- src/fg_internal.h.orig	2014-12-22 16:27:02 UTC
++++ src/fg_internal.h
+@@ -967,6 +967,7 @@ int         fgJoystickDetect( void );
+ void        fgInitialiseJoysticks( void );
+ void        fgJoystickClose( void );
+ void        fgJoystickPollWindow( SFG_Window* window );
++void        fgJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes );
+ 
+ /* InputDevice Initialisation and Closure */
+ int         fgInputDeviceDetect( void );

Added: head/graphics/freeglut/files/patch-src_fg__joystick.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/freeglut/files/patch-src_fg__joystick.c	Sat Dec 12 18:51:42 2015	(r403627)
@@ -0,0 +1,304 @@
+--- src/fg_joystick.c.orig	2014-10-20 15:27:04 UTC
++++ src/fg_joystick.c
+@@ -40,238 +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__)
+-/* 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
+-#        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-#            ifdef HAVE_USBHID_H
+-#                include <usbhid.h>
+-#            else
+-#                include <libusbhid.h>
+-#            endif
+-#        endif
+-#        include <legacy/dev/usb/usb.h>
+-#        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
+-
+-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;
+-  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"
+-
+-#    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
+ 
+ /*
+  * Functions associated with the "jsJoystick" class in PLIB
+@@ -306,26 +74,6 @@ extern void fgPlatformJoystickClose ( in
+ #define MAX_NUM_JOYSTICKS  2
+ SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+ 
+-/*
+- * Read the raw joystick data
+- */
+-static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+-{
+-    int i;
+-
+-    /* Defaults */
+-    if( buttons )
+-        *buttons = 0;
+-
+-    if( axes )
+-        for( i = 0; i < joy->num_axes; i++ )
+-            axes[ i ] = 1500.0f;
+-
+-    if( joy->error )
+-        return;
+-
+-	fgPlatformJoystickRawRead ( joy, buttons, axes );
+-}
+ 
+ /*
+  * Correct the joystick axis data
+@@ -384,7 +132,7 @@ static void fghJoystickRead( SFG_Joystic
+                 axes[ i ] = 0.0f;
+     }
+ 
+-    fghJoystickRawRead( joy, buttons, raw_axes );
++    fgJoystickRawRead( joy, buttons, raw_axes );
+ 
+     if( axes )
+         for( i=0; i<joy->num_axes; i++ )
+@@ -966,6 +714,26 @@ int fgJoystickDetect( void )
+ }
+ 
+ /*
++ * Read the raw joystick data
++ */
++void fgJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
++{
++    int i;
++
++    /* Defaults */
++    if( buttons )
++        *buttons = 0;
++
++    if( axes )
++        for( i = 0; i < joy->num_axes; i++ )
++            axes[ i ] = 1500.0f;
++
++    if( joy->error )
++        return;
++
++	fgPlatformJoystickRawRead ( joy, buttons, axes );
++}
++/*
+  * Joystick information, setup and execution functions
+  */
+ 

Added: head/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h	Sat Dec 12 18:51:42 2015	(r403627)
@@ -0,0 +1,76 @@
+--- src/x11/fg_internal_x11.h.orig	2014-10-20 15:27:04 UTC
++++ src/x11/fg_internal_x11.h
+@@ -136,8 +136,42 @@ struct tagSFG_PlatformWindowState
+ #include <string.h>
+ 
+ #    if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
++
++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 };
++
++/* 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"
++
+ /* XXX The below hack is done until freeglut's autoconf is updated. */
+ #        define HAVE_USB_JS    1
++#        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
++#        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#            ifdef HAVE_USBHID_H
++#                include <usbhid.h>
++#            else
++#                include <libusbhid.h>
++#            endif
++#            include <dev/usb/usb_ioctl.h>
++#        endif
++#        include <dev/usb/usb.h>
++#        include <dev/usb/usbhid.h>
++
++/* Compatibility with older usb.h revisions */
++#        if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES)
++#            define USB_MAX_DEVNAMES MAXDEVNAMES
++#        endif
+ 
+ #        if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #            include <sys/joystick.h>
+@@ -189,6 +223,30 @@ struct tagSFG_PlatformWindowState
+  */
+ #    define _JS_MAX_AXES 16
+ typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;
++
++#    if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
++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 ];
++};
++#    endif
++
+ struct tagSFG_PlatformJoystick
+ {
+ #   if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)

Added: head/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c	Sat Dec 12 18:51:42 2015	(r403627)
@@ -0,0 +1,204 @@
+--- src/x11/fg_joystick_x11.c.orig	2014-12-02 05:22:12 UTC
++++ src/x11/fg_joystick_x11.c
+@@ -46,6 +46,183 @@
+ #define MAX_NUM_JOYSTICKS  2   
+ extern SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+ 
++#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#  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)
++{
++#if __FreeBSD_version < 800061
++  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;
++      }
++  }
++#endif
++  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 /* HAVE_USB_JS */
++#endif /* FreeBSD or NetBSD */
++
+ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+ {
+     int status;
+@@ -259,7 +436,7 @@ void fgPlatformJoystickOpen( SFG_Joystic
+         joy->num_axes    =  2;
+         joy->num_buttons = 32;
+ 
+-        fghJoystickRawRead( joy, buttons, axes );
++        fgJoystickRawRead( joy, buttons, axes );
+         joy->error = axes[ 0 ] < -1000000000.0f;
+         if( joy->error )
+             return;
+@@ -379,7 +556,7 @@ void fgPlatformJoystickOpen( SFG_Joystic
+ 
+     do
+     {
+-        fghJoystickRawRead( joy, NULL, joy->center );
++        fgJoystickRawRead( joy, NULL, joy->center );
+         counter++;
+     } while( !joy->error &&
+              counter < 100 &&

Modified: head/graphics/freeglut/pkg-message
==============================================================================
--- head/graphics/freeglut/pkg-message	Sat Dec 12 18:46:05 2015	(r403626)
+++ head/graphics/freeglut/pkg-message	Sat Dec 12 18:51:42 2015	(r403627)
@@ -1,9 +1,3 @@
-Since FreeBSD has new USB stack, freeglut normally doesn't build on FreeBSD 8
-(yet). To workaround this a small patch adds one include file and comments out
-content of one function (only leaves return NULL).
+Joystick support is untested and it is unknown if it works.
 
-This might cause side effects.  Joysticks do not work, and there might be ports
-that do not compile or applications that crash because of this.
-
-Do not hesitate to contact x11@FreeBSD.org if there are any issues and side
-effects because of this.
+Do not hesitate to contact x11@FreeBSD.org if this causes issues.

Modified: head/graphics/freeglut/pkg-plist
==============================================================================
--- head/graphics/freeglut/pkg-plist	Sat Dec 12 18:46:05 2015	(r403626)
+++ head/graphics/freeglut/pkg-plist	Sat Dec 12 18:51:42 2015	(r403627)
@@ -5,14 +5,21 @@ include/GL/glut.h
 lib/libglut.a
 lib/libglut.so
 lib/libglut.so.3
-lib/libglut.so.3.9.0
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/callbackmaker
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fractals
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fractals_random
+lib/libglut.so.3.10.0
+libdata/pkgconfig/freeglut.pc
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/CallbackMaker
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Fractals
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Fractals_random
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/fractals.dat
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/lorenz
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/one
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Lorenz
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/One
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Resizer
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/multi-touch
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/smooth_opengl3
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/spaceball
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/subwin
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/shapes
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/timer
 %%PORTDOCS%%%%DOCSDIR%%/download.html
 %%PORTDOCS%%%%DOCSDIR%%/freeglut.html
 %%PORTDOCS%%%%DOCSDIR%%/freeglut_logo.png



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512121851.tBCIphdW094813>