Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2019 20:36:11 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r511702 - head/audio/linux-c7-alsa-plugins-oss
Message-ID:  <201909092036.x89KaBTm097208@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tijl
Date: Mon Sep  9 20:36:10 2019
New Revision: 511702
URL: https://svnweb.freebsd.org/changeset/ports/511702

Log:
  - Make the port safe to build as root. [1]
  
  Given an absolute /path Linux programs first try to access
  /compat/linux/path before trying /path.  That means mkdir -p ${STAGEDIR}
  will always create /compat/linux${STAGEDIR} when run as root and echo >
  /dev/null will create /compat/linux/dev/null as a regular file.  Fix this
  by running configure with FreeBSD /bin/sh and build/install using FreeBSD
  gmake.  PATH is set to /compat/linux/usr/bin and MKDIR_P to /bin/mkdir -p
  so all commands except mkdir are still Linux programs.
  
  - Add USES=libtool:build because libtoolize is needed. [2]
  - Add USES=pkgconfig.
  - Remove -DFREEBSD_OSS_BUFSZ_P2 because it breaks some games. [3]
  - Replace -nostdinc -isystem ... with --sysroot=${LINUXBASE}. [3]
  - Include bsd.port.options.mk to get ARCH. [3]
  
  PR:		240043
  Reported by:	VVD <vvd@unislabs.com> [1]
  Reported by:	Giacomo Olgeni <olgeni@olgeni.com> [2]
  Reported by:	Alex S <iwtcex@gmail.com> [3]

Modified:
  head/audio/linux-c7-alsa-plugins-oss/Makefile

Modified: head/audio/linux-c7-alsa-plugins-oss/Makefile
==============================================================================
--- head/audio/linux-c7-alsa-plugins-oss/Makefile	Mon Sep  9 20:34:54 2019	(r511701)
+++ head/audio/linux-c7-alsa-plugins-oss/Makefile	Mon Sep  9 20:36:10 2019	(r511702)
@@ -4,7 +4,7 @@
 PORTNAME=	alsa-plugins
 PORTVERSION=	1.1.6
 DISTVERSIONSUFFIX=	-1.el7
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	audio linux
 MASTER_SITES=	CENTOS_LINUX
 MASTER_SITE_SUBDIR=	centos/${LINUX_DIST_VER}/os/Source/SPackages/ \
@@ -19,10 +19,9 @@ COMMENT=	OSS plugin for ALSA (Linux CentOS ${LINUX_DIS
 
 LICENSE=	LGPL21+
 
-USES=		autoreconf:build linux:c7
+USES=		autoreconf:build gmake libtool:build linux:c7 pkgconfig
 USE_LDCONFIG=	yes
-USE_LINUX=	alsalib:build,run alsa-lib-devel:build devtools:build \
-		make:build
+USE_LINUX=	alsalib:build,run alsa-lib-devel:build devtools:build
 USE_LINUX_PREFIX=yes
 
 RPM_PATCHES=	alsa-plugins-1.1.6-post.patch \
@@ -31,13 +30,8 @@ CONFIG_ARGS=	--disable-static --disable-mix --disable-
 		--disable-arcamav --disable-jack --disable-pulseaudio \
 		--disable-samplerate --disable-libav --disable-a52 \
 		--disable-lavrate --disable-speexdsp --with-speex=no
-CFLAGS+=	-DFREEBSD_OSS -DFREEBSD_OSS_USE_IO_PTR -DFREEBSD_OSS_BUFSZ_P2
-CFLAGS_amd64=	-nostdinc -isystem \
-		${LINUXBASE}/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include \
-		-isystem /usr/include
-CFLAGS_i386=	-nostdinc -isystem \
-		${LINUXBASE}/usr/lib/gcc/i686-redhat-linux/4.8.5/include \
-		-isystem /usr/include
+CPPFLAGS+=	-DFREEBSD_OSS -DFREEBSD_OSS_USE_IO_PTR
+CFLAGS+=	--sysroot=${LINUXBASE}
 COMPAT32_CFLAGS_amd64=	-m32
 LIBDIR_amd64=	/usr/lib64
 LIBDIR_i386=	/usr/lib
@@ -48,6 +42,8 @@ CONFLICTS=	linux-c6-${PORTNAME}${PKGNAMESUFFIX}-[0-9]*
 DESCR=		${.CURDIR}/../${PORTNAME}/pkg-descr
 PLIST=		${PKGDIR}/pkg-plist.${ARCH}
 
+.include <bsd.port.options.mk>
+
 post-extract:
 .if !empty(COMPAT32_CFLAGS_${ARCH})
 	@${MKDIR} ${WRKDIR}/32
@@ -58,6 +54,8 @@ post-extract:
 		${PORTNAME}-${PORTVERSION}.tar.bz2 ${EXTRACT_AFTER_ARGS})
 
 do-patch:
+	@${REINPLACE_CMD} 's/mkdir -p/$$(MKDIR_P)/' \
+		${WRKDIR}/alsa-plugins-1.1.6-post.patch
 .for p in ${RPM_PATCHES}
 .if !empty(COMPAT32_CFLAGS_${ARCH})
 	@${PATCH} -d ${WRKSRC32} --forward --quiet -E -p1 < ${WRKDIR}/${p}
@@ -74,28 +72,38 @@ do-patch:
 do-configure:
 .if !empty(COMPAT32_CFLAGS_${ARCH})
 	@(cd ${WRKSRC32} && ${AUTORECONF} -f -i && ${SETENV} \
+		PATH=${LINUXBASE}/usr/bin ./configure CPPFLAGS="${CPPFLAGS}" \
+		CFLAGS="${CFLAGS} ${COMPAT32_CFLAGS_${ARCH}}" \
+		LDFLAGS="${LDFLAGS}" MAKE="${LOCALBASE}/bin/gmake" \
+		MKDIR_P="${MKDIR}" PKG_CONFIG="${LOCALBASE}/bin/pkgconf" \
 		PKG_CONFIG_PATH=${LINUXBASE}/usr/lib/pkgconfig \
-		${LINUXBASE}/bin/sh ./configure \
-		CFLAGS="${CFLAGS} ${COMPAT32_CFLAGS_${ARCH}}" ${CONFIG_ARGS})
+		${CONFIG_ARGS})
 .endif
 	@(cd ${WRKSRC} && ${AUTORECONF} -f -i && ${SETENV} \
+		PATH=${LINUXBASE}/usr/bin ./configure CPPFLAGS="${CPPFLAGS}" \
+		CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+		MAKE="${LOCALBASE}/bin/gmake" MKDIR_P="${MKDIR}" \
+		PKG_CONFIG="${LOCALBASE}/bin/pkgconf" \
 		PKG_CONFIG_PATH=${LINUXBASE}${LIBDIR_${ARCH}}/pkgconfig \
-		${LINUXBASE}/bin/sh ./configure --libdir ${LIBDIR_${ARCH}} \
-		CFLAGS="${CFLAGS}" ${CONFIG_ARGS})
+		--libdir ${LIBDIR_${ARCH}} ${CONFIG_ARGS})
 
 do-build:
 .if !empty(COMPAT32_CFLAGS_${ARCH})
-	@(cd ${WRKSRC32} && ${LINUXBASE}/usr/bin/make)
+	@(cd ${WRKSRC32} && ${SETENV} PATH=${LINUXBASE}/usr/bin \
+		${LOCALBASE}/bin/gmake)
 .endif
-	@(cd ${WRKSRC} && ${LINUXBASE}/usr/bin/make)
+	@(cd ${WRKSRC} && ${SETENV} PATH=${LINUXBASE}/usr/bin \
+		${LOCALBASE}/bin/gmake)
 
 do-install:
 .if !empty(COMPAT32_CFLAGS_${ARCH})
-	@(cd ${WRKSRC32} && ${LINUXBASE}/usr/bin/make install-strip \
+	@(cd ${WRKSRC32} && ${SETENV} PATH=${LINUXBASE}/usr/bin \
+		${LOCALBASE}/bin/gmake install-strip \
 		DESTDIR=${STAGEDIR}${LINUXBASE})
 	${RM} -r ${STAGEDIR}${LINUXBASE}/usr/lib/alsa-lib/*.la
 .endif
-	@(cd ${WRKSRC} && ${LINUXBASE}/usr/bin/make install-strip \
+	@(cd ${WRKSRC} && ${SETENV} PATH=${LINUXBASE}/usr/bin \
+		${LOCALBASE}/bin/gmake install-strip \
 		DESTDIR=${STAGEDIR}${LINUXBASE})
 	${RM} -r ${STAGEDIR}${LINUXBASE}${LIBDIR_${ARCH}}/alsa-lib/*.la
 	${RM} -r ${STAGEDIR}${LINUXBASE}/etc ${STAGEDIR}${LINUXBASE}/usr/share



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909092036.x89KaBTm097208>