Subject: pkg/23894: misc/libdvdread doesn't compile on FreeBSD; fix attached
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <dotz@irc.pl>
List: netbsd-bugs
Date: 12/26/2003 19:15:58
>Number:         23894
>Category:       pkg
>Synopsis:       misc/libdvdread doesn't compile on FreeBSD; fix attached
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 26 19:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michal Pasternak
>Release:        N/A
>Organization:
>Environment:
FreeBSD mainframe.w.lub.pl 4.9-STABLE FreeBSD 4.9-STABLE #0: Thu Dec 25 12:02:15 CET 2003     doc@mainframe.w.lub.pl:/usr/obj/usr/src/sys/MP-UX  i386

>Description:
misc/libdvdread compilation will fail on FreeBSD while:

cc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -I/usr/pkgsrc/misc/libdvdread/work/.buildlink/include -Wl,-R/usr/pkg/lib -o .libs/ifo_dump ifo_dump.o  -L/usr/pkgsrc/misc/libdvdread/work/.buildlink/lib ../dvdread/.libs/libdvdread.so -Wl,--rpath -Wl,/usr/pkg/lib
../dvdread/.libs/libdvdread.so: undefined reference to `be64toh'
gmake[2]: *** [ifo_dump] Error 1
gmake[2]: Leaving directory `/usr/pkgsrc/misc/libdvdread/work/libdvdread-0.9.4/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/pkgsrc/misc/libdvdread/work/libdvdread-0.9.4'
gmake: *** [all] Error 2
*** Error code 2

Stop.
bmake: stopped in /usr/pkgsrc/misc/libdvdread
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/misc/libdvdread

>How-To-Repeat:
Obvious.
>Fix:
This patch:
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/multimedia/libdvdread/files/patch-dvdread%3a%3abswap.h?rev=1.2&content-type=text/plain
should be included in pkgsrc.

The patch modifies only the part of bswap.h, which is already in 
#ifdef __FreeBSD__ , so it doesn't change anything on other platforms.

You could as well add this patch:
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/multimedia/libdvdread/files/extra-patch-dvdread%3a%3abswap.h?rev=1.1&content-type=text/plain
-- which performs "FreeBSD optimized byte-swap" -- but is used
instead of previous patch only in case of some options defined in 
makefile (see
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/multimedia/libdvdread/Makefile?rev=1.13&content-type=text/plain )
which seems a bit strange to me, so I guess it would be better to stay
with "portable" patch.

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/misc/libdvdread/distinfo,v
retrieving revision 1.5
diff -u -r1.5 distinfo
--- distinfo    26 Feb 2003 10:12:34 -0000      1.5
+++ distinfo    26 Dec 2003 19:12:39 -0000
@@ -2,3 +2,4 @@
 
 SHA1 (libdvdread-0.9.4.tar.gz) = a4b626e49ba8bd33857693c3abe8b34196bc3360
 Size (libdvdread-0.9.4.tar.gz) = 256858 bytes
+SHA1 (patch-aa) = 8d651f72a9affd8cd868ad53cd5e55dbedcd769f
Index: patches/patch-aa
===================================================================
RCS file: patches/patch-aa
diff -N patches/patch-aa
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-aa    26 Dec 2003 19:12:39 -0000
@@ -0,0 +1,19 @@
+--- dvdread/bswap.h.orig       Wed Mar  5 23:13:17 2003
++++ dvdread/bswap.h    Wed Mar  5 23:14:24 2003
+@@ -57,7 +57,15 @@
+ #include <sys/endian.h>
+ #define B2N_16(x) x = be16toh(x)
+ #define B2N_32(x) x = be32toh(x)
+-#define B2N_64(x) x = be64toh(x)
++#define B2N_64(x) 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))
+ 
+ /* This is a slow but portable implementation, it has multiple evaluation 
+  * problems so beware.

>Release-Note:
>Audit-Trail:
>Unformatted: