diff options
author | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2002-11-23 21:12:24 +0000 |
---|---|---|
committer | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2002-11-23 21:12:24 +0000 |
commit | 322ad7ebe04ed8c83be4c430029165d65aaef0c1 (patch) | |
tree | 49e8b4524c5530b986aafc3798ec02f483dfaa13 /multimedia | |
parent | 3a0f8513a18e948c8ed94b379b2e30a912b11571 (diff) |
Add support for FreeBSD optimized byteswap routines
Notes
Notes:
svn path=/head/; revision=70899
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/libdvdread/Makefile | 23 | ||||
-rw-r--r-- | multimedia/libdvdread/files/extra-patch-dvdread::bswap.h | 17 | ||||
-rw-r--r-- | multimedia/libdvdread/files/patch-dvdread::bswap.h | 34 |
3 files changed, 73 insertions, 1 deletions
diff --git a/multimedia/libdvdread/Makefile b/multimedia/libdvdread/Makefile index 352e0d2c3b38..78d1f211a6c8 100644 --- a/multimedia/libdvdread/Makefile +++ b/multimedia/libdvdread/Makefile @@ -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> diff --git a/multimedia/libdvdread/files/extra-patch-dvdread::bswap.h b/multimedia/libdvdread/files/extra-patch-dvdread::bswap.h new file mode 100644 index 000000000000..91f08856dd37 --- /dev/null +++ b/multimedia/libdvdread/files/extra-patch-dvdread::bswap.h @@ -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) | \ diff --git a/multimedia/libdvdread/files/patch-dvdread::bswap.h b/multimedia/libdvdread/files/patch-dvdread::bswap.h new file mode 100644 index 000000000000..ad7f78b04ea8 --- /dev/null +++ b/multimedia/libdvdread/files/patch-dvdread::bswap.h @@ -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) \ |