ports/devel/linux_libusb/Makefile
Tijl Coosemans d7511b9d00 Mk/bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV
And remove it from individual ports.  Use WRK_ENV in custom build
commands where necessary.

FreeBSD make(1) includes /usr/share/mk/sys.mk and that includes
/etc/make.conf if it exists.  This happens when you run make in a port
directory but it also happens when the upstream build system uses make.
This commit disables make.conf inclusion in the latter case because
users can define variables like CFLAGS in make.conf that override ports
framework variables and this can cause problems that are difficult to
diagnose.

If there are any build customisations made through make.conf that stop
working because of this commit then they should be made available by the
ports tree through some mechanism, e.g. an option in a port.

Some ports were picking up variables from Poudriere make.conf and
required fixes:

- astro/wmspaceweather x11-clocks/wmcalclock: Add OPSYS to MAKE_ENV.
- games/zhlt: Add ARCH to MAKE_ENV.
- graphics/tachyon: Upstream ARCH is not ports tree ARCH.
  Set ALL_TARGET=bsd so upstream ARCH is defined correctly.
  Enable multi-threading support while here.

PR:		277455
Exp-run by:	antoine
2024-03-23 12:19:32 +01:00

80 lines
2.2 KiB
Makefile

PORTNAME= linux_libusb
PORTVERSION= 13.1.0
CATEGORIES= devel linux
MAINTAINER= ports@FreeBSD.org
COMMENT= Linux-compatibility LibUSB
WWW= https://github.com/hselasky/linux_libusb
LICENSE= BSD2CLAUSE
ONLY_FOR_ARCHS= aarch64 amd64 i386
USES= linux tar:bzip2
USE_GITHUB= yes
USE_LDCONFIG= yes
USE_LINUX= base:build,run devtools:build
USE_LINUX_PREFIX= yes
GH_ACCOUNT= hselasky
LIBDIR_aarch64= lib64
LIBDIR_amd64= lib64
LIBDIR_i386= lib
PLIST_FILES= usr/${LIBDIR_${ARCH}}/libusb.so.3 \
usr/${LIBDIR_${ARCH}}/libusb-0.1.so.4 \
usr/${LIBDIR_${ARCH}}/libusb-1.0.so.0
CC= ${LINUXBASE}/usr/bin/gcc --sysroot=${LINUXBASE}
CFLAGS:= ${CFLAGS:N-march=*}
CFLAGS+= -I${WRKDIR}/${DISTNAME}/include
SSP_CFLAGS?= -fstack-protector # XXX -strong isn't supported by GCC < 4.9
MAKE_ARGS+= LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h
MAKE_ARGS+= WITHOUT_PROFILE=yes
MAKE_ARGS+= WITHOUT_SSP=yes
MAKE_ARGS+= WITHOUT_WERROR=yes
MAKE_ENV+= LDADD="-lrt"
.include <bsd.port.pre.mk>
MAKE_ARGS+= NO_WDATE_TIME=yes
.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
do-build:
${MKDIR} ${WRKSRC}/${LIBDIR_${ARCH}}
cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} \
MAKEOBJDIR=${LIBDIR_${ARCH}} ${MAKE_CMD} ${MAKE_FLAGS} \
${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS:N${DESTDIRNAME}=*}
.if ${ARCH} == amd64
${MKDIR} ${WRKSRC}/lib
cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV:NCC=*} \
CC="${CC} -m32" MAKEOBJDIR=lib ${MAKE_CMD} ${MAKE_FLAGS} \
${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS:N${DESTDIRNAME}=*} \
COMPAT_32BIT=yes
.endif
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/usr/${LIBDIR_${ARCH}}
${INSTALL_LIB} ${WRKSRC}/${LIBDIR_${ARCH}}/libusb.so.3 \
${STAGEDIR}${PREFIX}/usr/${LIBDIR_${ARCH}}
${LN} -s libusb.so.3 \
${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
${MKDIR} ${STAGEDIR}${PREFIX}/usr/lib
${INSTALL_LIB} ${WRKSRC}/lib/libusb.so.3 \
${STAGEDIR}${PREFIX}/usr/lib
${LN} -s libusb.so.3 \
${STAGEDIR}${PREFIX}/usr/lib/libusb-0.1.so.4
${LN} -s libusb.so.3 \
${STAGEDIR}${PREFIX}/usr/lib/libusb-1.0.so.0
.endif
.include <bsd.port.post.mk>