From owner-freebsd-ports  Fri Apr  5 16: 0:27 2002
Delivered-To: freebsd-ports@hub.freebsd.org
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id EDCD337B41A
	for <freebsd-ports@hub.freebsd.org>; Fri,  5 Apr 2002 16:00:02 -0800 (PST)
Received: (from gnats@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g36002I23848;
	Fri, 5 Apr 2002 16:00:02 -0800 (PST)
	(envelope-from gnats)
Received: from rwcrmhc54.attbi.com (rwcrmhc54.attbi.com [216.148.227.87])
	by hub.freebsd.org (Postfix) with ESMTP id 2091F37B41F
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  5 Apr 2002 15:52:51 -0800 (PST)
Received: from bmah.dyndns.org ([12.233.149.189]) by rwcrmhc54.attbi.com
          (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP
          id <20020405235249.CUZE15826.rwcrmhc54.attbi.com@bmah.dyndns.org>
          for <FreeBSD-gnats-submit@freebsd.org>;
          Fri, 5 Apr 2002 23:52:49 +0000
Received: from intruder.bmah.org (localhost [IPv6:::1])
	by bmah.dyndns.org (8.12.2/8.12.2) with ESMTP id g35Nqkt2055995
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 5 Apr 2002 15:52:46 -0800 (PST)
	(envelope-from bmah@intruder.bmah.org)
Received: (from bmah@localhost)
	by intruder.bmah.org (8.12.2/8.12.2/Submit) id g35Nqkv7055994;
	Fri, 5 Apr 2002 15:52:46 -0800 (PST)
Message-Id: <200204052352.g35Nqkv7055994@intruder.bmah.org>
Date: Fri, 5 Apr 2002 15:52:46 -0800 (PST)
From: "Bruce A. Mah" <bmah@FreeBSD.org>
Reply-To: "Bruce A. Mah" <bmah@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org
X-Send-Pr-Version: 3.113
Subject: ports/36805: [PATCH] Unbreak audio/timidity++ on -CURRENT
Sender: owner-freebsd-ports@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-ports.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-ports>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-ports>
X-Loop: FreeBSD.org


>Number:         36805
>Category:       ports
>Synopsis:       [PATCH] Unbreak audio/timidity++ on -CURRENT
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 05 16:00:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bruce A. Mah
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:

FreeBSD tomcat.bmah.org 5.0-DP1 FreeBSD 5.0-DP1 #5: Wed Mar 27 09:21:42 PST 2002     root@tomcat.bmah.org:/usr/obj/usr/users/bmah/p4/5_dp1/src/sys/GENERIC  i386

>Description:

The audio/timidity++ port won't build on 5-CURRENT, because of some
API changes (byte-swapping macros).

>How-To-Repeat:

>Fix:

Replacing patch-ac with the file below appears to fix the problem, 
but this could really use a review first.  I'm not sure if I'm 
calling the right routines, or if I got the __FreeBSD_version check correct.

Run-tested on i386 5.0-DP1, build-tested on i386 4.5-STABLE.

--- patch-ac begins here ---
--- timidity/timidity.h.orig	Fri Jan 11 23:36:13 2002
+++ timidity/timidity.h	Fri Apr  5 15:37:51 2002
@@ -450,8 +450,19 @@
 #define LE_SHORT(x) (x)
 #define LE_LONG(x) (x)
 #ifdef __FreeBSD__
-#define BE_SHORT(x) __byte_swap_word(x)
-#define BE_LONG(x) __byte_swap_long(x)
+#  include <osreldate.h>
+#  if __FreeBSD_version <= 500000
+#    define BE_SHORT(x) __byte_swap_word(x)
+#    define BE_LONG(x) __byte_swap_long(x)
+#  else
+#    if __FreeBSD_version <= 500028
+#      define BE_SHORT(x) __uint8_swap_uint16(x)
+#      define BE_LONG(x) __uint8_swap_uint32(x)
+#    else
+#      define BE_SHORT(x) __bswap16(x)
+#      define BE_LONG(x) __bswap32(x)
+#    endif
+#  endif
 #else
 #define BE_SHORT(x) XCHG_SHORT(x)
 #define BE_LONG(x) XCHG_LONG(x)
@@ -460,8 +471,19 @@
 #define BE_SHORT(x) (x)
 #define BE_LONG(x) (x)
 #ifdef __FreeBSD__
-#define LE_SHORT(x) __byte_swap_word(x)
-#define LE_LONG(x) __byte_swap_long(x)
+#  include <osreldate.h>
+#  if __FreeBSD_version <= 500000
+#    define LE_SHORT(x) __byte_swap_word(x)
+#    define LE_LONG(x) __byte_swap_long(x)
+#  else
+#    if __FreeBSD_version <= 500028
+#      define LE_SHORT(x) __uint8_swap_uint16(x)
+#      define LE_LONG(x) __uint8_swap_uint32(x)
+#    else
+#      define LE_SHORT(x) __bswap16(x)
+#      define LE_LONG(x) __bswap32(x)
+#    endif
+#  endif
 #else
 #define LE_SHORT(x) XCHG_SHORT(x)
 #define LE_LONG(x) XCHG_LONG(x)
--- patch-ac ends here ---


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

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message