Add support for FreeBSD optimized byteswap routines
This commit is contained in:
parent
3a0f8513a1
commit
322ad7ebe0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=70899
@ -46,4 +46,25 @@ post-install:
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
# FreeBSD byteswap optimized routines
|
||||
.if ${ARCH} == "i386"
|
||||
. if (defined(MACHINE_CPU) && ${MACHINE_CPU:Mi486} == "i486")
|
||||
WITH_OPTIMIZED_BYTESWAP=yes
|
||||
. endif
|
||||
|
||||
. if defined(WITH_OPTIMIZED_BYTESWAP)
|
||||
EXTRA_PATCHES= ${FILESDIR}/extra-patch-dvdread::bswap.h
|
||||
. endif
|
||||
.endif
|
||||
|
||||
pre-everything::
|
||||
.ifndef(WITH_OPTIMIZED_BYTESWAP)
|
||||
@${ECHO_MSG} '===>'
|
||||
@${ECHO_MSG} '===> Define WITH_OPTIMIZED_BYTESWAP to use optimized byteswap'
|
||||
@${ECHO_MSG} '===> routines. This works only in the i386 architecture, and'
|
||||
@${ECHO_MSG} '===> only with 486 processors and above.'
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
|
17
graphics/libdvdread/files/extra-patch-dvdread::bswap.h
Normal file
17
graphics/libdvdread/files/extra-patch-dvdread::bswap.h
Normal file
@ -0,0 +1,17 @@
|
||||
--- dvdread/bswap.h.orig Sat Nov 23 18:53:53 2002
|
||||
+++ dvdread/bswap.h Sat Nov 23 18:57:27 2002
|
||||
@@ -54,6 +54,14 @@
|
||||
* functionality!
|
||||
*/
|
||||
|
||||
+#elif defined(__FreeBSD__)
|
||||
+# define _KERNEL
|
||||
+# define I486_CPU /* Will crash unless 486+ */
|
||||
+# include <machine/endian.h>
|
||||
+# undef _KERNEL
|
||||
+# undef I486_CPU
|
||||
+# define FROM_BE_32(x) (ntohl(x))
|
||||
+
|
||||
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
|
||||
#define B2N_16(x) \
|
||||
x = ((((x) & 0xff00) >> 8) | \
|
34
graphics/libdvdread/files/patch-dvdread::bswap.h
Normal file
34
graphics/libdvdread/files/patch-dvdread::bswap.h
Normal file
@ -0,0 +1,34 @@
|
||||
--- dvdread/bswap.h.orig Sat Nov 23 18:53:53 2002
|
||||
+++ dvdread/bswap.h Sat Nov 23 18:56:21 2002
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
/* All bigendian systems are fine, just ignore the swaps. */
|
||||
#define B2N_16(x) (void)(x)
|
||||
@@ -53,6 +57,20 @@
|
||||
* FreeBSD and Solaris don't have <byteswap.h> or any other such
|
||||
* functionality!
|
||||
*/
|
||||
+
|
||||
+#elif defined(__FreeBSD__) && __FreeBSD_version >= 470000
|
||||
+#include <sys/endian.h>
|
||||
+#define B2N_16(x) x = (be16toh(x))
|
||||
+#define B2N_32(x) x = (be32toh(x))
|
||||
+#define B2N_64(x) \
|
||||
+ x = ((((x) & 0xff00000000000000) >> 56) | \
|
||||
+ (((x) & 0x00ff000000000000) >> 40) | \
|
||||
+ (((x) & 0x0000ff0000000000) >> 24) | \
|
||||
+ (((x) & 0x000000ff00000000) >> 8) | \
|
||||
+ (((x) & 0x00000000ff000000) << 8) | \
|
||||
+ (((x) & 0x0000000000ff0000) << 24) | \
|
||||
+ (((x) & 0x000000000000ff00) << 40) | \
|
||||
+ (((x) & 0x00000000000000ff) << 56))
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
|
||||
#define B2N_16(x) \
|
@ -46,4 +46,25 @@ post-install:
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
# FreeBSD byteswap optimized routines
|
||||
.if ${ARCH} == "i386"
|
||||
. if (defined(MACHINE_CPU) && ${MACHINE_CPU:Mi486} == "i486")
|
||||
WITH_OPTIMIZED_BYTESWAP=yes
|
||||
. endif
|
||||
|
||||
. if defined(WITH_OPTIMIZED_BYTESWAP)
|
||||
EXTRA_PATCHES= ${FILESDIR}/extra-patch-dvdread::bswap.h
|
||||
. endif
|
||||
.endif
|
||||
|
||||
pre-everything::
|
||||
.ifndef(WITH_OPTIMIZED_BYTESWAP)
|
||||
@${ECHO_MSG} '===>'
|
||||
@${ECHO_MSG} '===> Define WITH_OPTIMIZED_BYTESWAP to use optimized byteswap'
|
||||
@${ECHO_MSG} '===> routines. This works only in the i386 architecture, and'
|
||||
@${ECHO_MSG} '===> only with 486 processors and above.'
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
|
17
multimedia/libdvdread/files/extra-patch-dvdread::bswap.h
Normal file
17
multimedia/libdvdread/files/extra-patch-dvdread::bswap.h
Normal file
@ -0,0 +1,17 @@
|
||||
--- dvdread/bswap.h.orig Sat Nov 23 18:53:53 2002
|
||||
+++ dvdread/bswap.h Sat Nov 23 18:57:27 2002
|
||||
@@ -54,6 +54,14 @@
|
||||
* functionality!
|
||||
*/
|
||||
|
||||
+#elif defined(__FreeBSD__)
|
||||
+# define _KERNEL
|
||||
+# define I486_CPU /* Will crash unless 486+ */
|
||||
+# include <machine/endian.h>
|
||||
+# undef _KERNEL
|
||||
+# undef I486_CPU
|
||||
+# define FROM_BE_32(x) (ntohl(x))
|
||||
+
|
||||
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
|
||||
#define B2N_16(x) \
|
||||
x = ((((x) & 0xff00) >> 8) | \
|
34
multimedia/libdvdread/files/patch-dvdread::bswap.h
Normal file
34
multimedia/libdvdread/files/patch-dvdread::bswap.h
Normal file
@ -0,0 +1,34 @@
|
||||
--- dvdread/bswap.h.orig Sat Nov 23 18:53:53 2002
|
||||
+++ dvdread/bswap.h Sat Nov 23 18:56:21 2002
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
/* All bigendian systems are fine, just ignore the swaps. */
|
||||
#define B2N_16(x) (void)(x)
|
||||
@@ -53,6 +57,20 @@
|
||||
* FreeBSD and Solaris don't have <byteswap.h> or any other such
|
||||
* functionality!
|
||||
*/
|
||||
+
|
||||
+#elif defined(__FreeBSD__) && __FreeBSD_version >= 470000
|
||||
+#include <sys/endian.h>
|
||||
+#define B2N_16(x) x = (be16toh(x))
|
||||
+#define B2N_32(x) x = (be32toh(x))
|
||||
+#define B2N_64(x) \
|
||||
+ x = ((((x) & 0xff00000000000000) >> 56) | \
|
||||
+ (((x) & 0x00ff000000000000) >> 40) | \
|
||||
+ (((x) & 0x0000ff0000000000) >> 24) | \
|
||||
+ (((x) & 0x000000ff00000000) >> 8) | \
|
||||
+ (((x) & 0x00000000ff000000) << 8) | \
|
||||
+ (((x) & 0x0000000000ff0000) << 24) | \
|
||||
+ (((x) & 0x000000000000ff00) << 40) | \
|
||||
+ (((x) & 0x00000000000000ff) << 56))
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
|
||||
#define B2N_16(x) \
|
Loading…
Reference in New Issue
Block a user