git: d43f7e3be299 - main - devel/linux_libusb: Flavorize with c7 and rl9 flavors

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Sun, 12 May 2024 10:02:48 UTC
The branch main has been updated by arrowd:

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

commit d43f7e3be2993f4293252037a9a177e9faee7d7b
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2024-02-13 10:32:49 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-05-12 10:01:19 +0000

    devel/linux_libusb: Flavorize with c7 and rl9 flavors
    
    Sponsored by:   Serenity Cybersecurity, LLC
---
 devel/linux_libusb/Makefile | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/devel/linux_libusb/Makefile b/devel/linux_libusb/Makefile
index a594ecc69110..918f78fbd85d 100644
--- a/devel/linux_libusb/Makefile
+++ b/devel/linux_libusb/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	linux_libusb
 PORTVERSION=	13.1.0
 CATEGORIES=	devel linux
+PKGNAMESUFFIX=	-${FLAVOR}
 
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Linux-compatibility LibUSB
@@ -8,9 +9,14 @@ WWW=		https://github.com/hselasky/linux_libusb
 
 LICENSE=	BSD2CLAUSE
 
-ONLY_FOR_ARCHS=	aarch64 amd64 i386
+ONLY_FOR_ARCHS=	aarch64 amd64
 
-USES=		linux tar:bzip2
+FLAVORS=		c7 rl9
+FLAVOR?=		c7
+c7_CONFLICTS_INSTALL=	${PORTNAME}-rl9
+rl9_CONFLICTS_INSTALL=	${PORTNAME}-c7
+
+USES=		linux:${FLAVOR} tar:bzip2
 
 USE_GITHUB=	yes
 USE_LDCONFIG=	yes
@@ -40,10 +46,13 @@ MAKE_ENV+=	LDADD="-lrt"
 
 MAKE_ARGS+=	NO_WDATE_TIME=yes
 
-.if ${ARCH} == amd64
+.if ${FLAVOR} == c7
+ONLY_FOR_ARCHS+=	i386
+.  if ${ARCH} == amd64
 PLIST_FILES+=	usr/lib/libusb.so.3 \
 		usr/lib/libusb-0.1.so.4 \
 		usr/lib/libusb-1.0.so.0
+.  endif
 .endif
 
 do-build:
@@ -51,7 +60,7 @@ do-build:
 	cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} \
 		MAKEOBJDIR=${LIBDIR_${ARCH}} ${MAKE_CMD} ${MAKE_FLAGS} \
 		${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS:N${DESTDIRNAME}=*}
-.if ${ARCH} == amd64
+.if ${ARCH} == amd64 && ${FLAVOR} == c7
 	${MKDIR} ${WRKSRC}/lib
 	cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV:NCC=*} \
 		CC="${CC} -m32" MAKEOBJDIR=lib ${MAKE_CMD} ${MAKE_FLAGS} \
@@ -67,7 +76,7 @@ do-install:
 		${STAGEDIR}${PREFIX}/usr/${LIBDIR_${ARCH}}/libusb-0.1.so.4
 	${LN} -s libusb.so.3 \
 		${STAGEDIR}${PREFIX}/usr/${LIBDIR_${ARCH}}/libusb-1.0.so.0
-.if ${ARCH} == amd64
+.if ${ARCH} == amd64 && ${FLAVOR} == c7
 	${MKDIR} ${STAGEDIR}${PREFIX}/usr/lib
 	${INSTALL_LIB} ${WRKSRC}/lib/libusb.so.3 \
 		${STAGEDIR}${PREFIX}/usr/lib