diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2019-04-05 21:17:31 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2019-04-05 21:17:31 +0100 |
commit | dc7cbdfa65fd814b3b9aa3c56257da201109e807 (patch) | |
tree | c85d72f6f31f21f178069c9d41d41a7c1ff4b362 /media-libs/freeglut | |
parent | 0706fc6986773f4e4d391deff4ad5143c464ea4e (diff) |
gentoo resync : 05.04.2019
Diffstat (limited to 'media-libs/freeglut')
4 files changed, 791 insertions, 1 deletions
diff --git a/media-libs/freeglut/Manifest b/media-libs/freeglut/Manifest index 1e55496cdd71..2c000bda8b98 100644 --- a/media-libs/freeglut/Manifest +++ b/media-libs/freeglut/Manifest @@ -1,6 +1,8 @@ AUX freeglut-2.4.0-bsd-usb-joystick.patch 755 BLAKE2B 858a7f7b4845e75963855cd7d6191cb57c96da017faf50a78addd75a994a53f5adca66c33e8aa2564623a469596e443a24caefb3288b2e77e768ee13e8b3d287 SHA512 7aa28f277864357e9b2bb6e7fcd801bb9dd6e131fec8989aca26990cf59b60c3465030ea5068ca01cb7f46bf406c0f3fce2327affb7f288ee3026b5717717561 +AUX freeglut-3.0.0-bsd-usb-joystick.patch 23398 BLAKE2B a55c99083262409976a3074bdafbaf42e19ea980f7d8e3641cb65cd6d502668f1f8ec653eb7d23852276a0634ba5841e7b989f32b8a50036b6b26a69d6630988 SHA512 fe527efb2be40a87c6767e65315795efd632627503f6e43b6ba50d81b7a7d59608f4bf4387001ef1443f47dfb739d972259eb406e6f32996dd710a78a10976cf +AUX freeglut-3.0.0-drop-unnecessary-x11-libs.patch 1158 BLAKE2B 85f025a23d1fb0e4866ffdeafcd563e6d752d5d56a5f4d0648a376e8a6b9dbc54f80f5ab6d35d4a6bd71f469e9fd7225df2f93eecd49916bd86cbca580d369aa SHA512 414ace62ec3b6db139e4667648d0af8c4ad1beb6a91ea86218aa4ef6e27bab1eb1d3749ad08bc55a028ed1d9020840763f20fe4c5a317cdf374fc8494eb8c2bf DIST freeglut-2.8.1.tar.gz 1005343 BLAKE2B d830f6d19659ba6bbe60fc9c981ae16582de8d90e05d58bcaee43133b7699a5f0b2507a777c11c5fcdb730b17c394dd6fc562d5e857024d99d4feb2130ff7cde SHA512 935fddfa197c5f0ec74c5f2005fe5a0ebfd39f4a402cc79363da7cfe2e8576263130e44bd7e4f6c07ea53d3137bd7ca8ee8db85c0a09f25508fcf1b9ed07052e DIST freeglut-3.0.0.tar.gz 419095 BLAKE2B 6065044fb2816ddfebd363189cdb897e00fa433d79c09f5a705b80ff730e1312158ed5db8d7a2cbfc2ddac0d0a9400300c5c245d967c33c937da11303fc316de SHA512 9c45d5b203b26a7ff92331b3e080a48e806c92fbbe7c65d9262dd18c39cd6efdad8a795a80f499a2d23df84b4909dbd7c1bab20d7dd3555d3d88782ce9dd15b0 EBUILD freeglut-2.8.1-r1.ebuild 1091 BLAKE2B 6f80874ea0d55177b70898e7886a9b4f016008a8672e8fabc82ec88e4d29ecfaf7a7d7e031cbc88760056881a87db2c90342a6b4f78d9a70d634fb4544b9f451 SHA512 87fb9a6d839b74c77a2e1fcd4c51bee57d34cf57f4f4d7eb551c478a7f1ae6a714470e18b9ff7d6cade2364953a48fe77278d75a7f3b81389db7b23676ebb40c -EBUILD freeglut-3.0.0.ebuild 1218 BLAKE2B 9a8ca641d99a2cc91fc3a78400c2380d76aaa8ecf7c3405d3bc3c8a20a9fafbc29cc360638547bd25f8dff401b096ee8ce839685db4c6047d3eb5fa8b42bbd29 SHA512 bb14cd5cc3d8e120a2ada00d6afdb469acabf348a592a910edbdc44537a5132c3a3773a7f93a38eff95ca14de3b91c3051f3cc39df6419fde7d57fcbeda0cb68 +EBUILD freeglut-3.0.0.ebuild 1326 BLAKE2B 66b2e5ca4264de2b30f231c79eb45551c188dfe23e9f52a9aef68b6aad2d516e0495ceb213cb6df2c535abb6aafb32e21036908d04b834dad3ffa05f90a87dd5 SHA512 c0dd7fe97de5627d30e621990d16e56c79318eb62bd7ac48f4b2c06795fc3aa24fa8e78dbb9741583f2c7064fb09bcb1cee2d162f7e1828f32264dee8e9abd23 MISC metadata.xml 528 BLAKE2B ee8c09e46677ec77c1d6771b31ac1b28e75464d7e0e4405c41831e19446c5a442c782dbd32a79d0fe5e7ed85ecbd2404764f2121f5f4bff5483db4571fd89212 SHA512 94dc412f8f049bb88723fdba9f9b89645eb792547a768ea524a711ad9302c5cac38a7292ab09726154fc6829a05f41af05220f91d9f6eaed056e4cff8324370e 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 000000000000..505b3467ec46 --- /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/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 000000000000..761a6bfce7c2 --- /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 2a60b23ef112..3fcb972cf759 100644 --- a/media-libs/freeglut/freeglut-3.0.0.ebuild +++ b/media-libs/freeglut/freeglut-3.0.0.ebuild @@ -29,6 +29,11 @@ DEPEND="${RDEPEND} HTML_DOCS=( doc/. ) +PATCHES=( + "${FILESDIR}"/${P}-drop-unnecessary-x11-libs.patch + "${FILESDIR}"/${P}-bsd-usb-joystick.patch +) + src_configure() { local mycmakeargs=( "-DFREEGLUT_GLES=OFF" |