git: 6a4e552e4076 - main - net/realtek-re-kmod: allow building for other architectures

From: Alex Dupre <ale_at_FreeBSD.org>
Date: Mon, 17 Jan 2022 16:15:16 UTC
The branch main has been updated by ale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6a4e552e40762e99e2b7b15e9542d46fbfd3c6d9

commit 6a4e552e40762e99e2b7b15e9542d46fbfd3c6d9
Author:     Alex Dupre <ale@FreeBSD.org>
AuthorDate: 2022-01-17 16:11:24 +0000
Commit:     Alex Dupre <ale@FreeBSD.org>
CommitDate: 2022-01-17 16:14:06 +0000

    net/realtek-re-kmod: allow building for other architectures
    
    Disable dash support on such archs and fix version number.
    
    PR:             258473
    Submitted by:   Franco Fichtner <franco@opnsense.org>
---
 net/realtek-re-kmod/Makefile                  |  9 +++------
 net/realtek-re-kmod/files/patch-optional-dash | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/net/realtek-re-kmod/Makefile b/net/realtek-re-kmod/Makefile
index 9b84f684119f..0b48af7d3664 100644
--- a/net/realtek-re-kmod/Makefile
+++ b/net/realtek-re-kmod/Makefile
@@ -1,22 +1,19 @@
 # Created by: Alex Dupre <ale@FreeBSD.org>
 
 PORTNAME=	re
-DISTVERSION=	v196.04
-PORTREVISION=	3
+PORTVERSION=	196.04
+DISTVERSIONPREFIX=	v
 CATEGORIES=	net
 MASTER_SITES=	LOCAL/ale
 PKGNAMEPREFIX=	realtek-
 PKGNAMESUFFIX=	-kmod
-DISTNAME=	rtl_bsd_drv_${DISTVERSION}
+DISTNAME=	rtl_bsd_drv_${DISTVERSIONPREFIX}${PORTVERSION}
 
 MAINTAINER=	ale@FreeBSD.org
 COMMENT=	Kernel driver for Realtek PCIe Ethernet Controllers
 
 LICENSE=	BSD4CLAUSE
 
-ONLY_FOR_ARCHS=		amd64 i386
-ONLY_FOR_ARCHS_REASON=	uses x86-specific code
-
 USES=		kmod tar:tgz uidfix
 
 PLIST_FILES=	${KMODDIR}/if_re.ko
diff --git a/net/realtek-re-kmod/files/patch-optional-dash b/net/realtek-re-kmod/files/patch-optional-dash
new file mode 100644
index 000000000000..4aee04bc51c3
--- /dev/null
+++ b/net/realtek-re-kmod/files/patch-optional-dash
@@ -0,0 +1,20 @@
+--- if_re.c.orig	2022-01-17 17:01:39 UTC
++++ if_re.c
+@@ -4355,6 +4355,7 @@
+                 sc->re_dash = re_check_dash(sc);
+ 
+         if (sc->re_dash) {
++#if defined(__amd64__) || defined(__i386__)
+                 if (HW_DASH_SUPPORT_TYPE_3(sc)) {
+                         u_int64_t CmacMemPhysAddress;
+                         bus_space_handle_t cmac_ioaddr;
+@@ -4374,6 +4375,9 @@
+                                         sc->re_mapped_cmac_handle = cmac_ioaddr;
+                         }
+                 }
++#else
++                sc->re_dash = 0;
++#endif
+         }
+ 
+         switch(sc->re_type) {