Subject: Re: broken Makefile for libdvdcss?
To: None <tech-pkg@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-pkg
Date: 07/29/2005 00:08:04
On Thu, 28 Jul 2005, Krister Walfridsson wrote:
> >No, that will print the _FETCH_MESSAGE even of LIBDVDCSS_MASTER_SITES is
> >defined.  I think you want something more like the appended patch, which
> >conditionally sets BROKEN.
> 
> But this will mark the package as broken even if you already have
> the distfile in the DISTDIR.

Good point.  The appended patch addresses that problem.  I set
PKG_FAIL_REASON instead of BROKEN, because it allows multiple lines of
output.

The patch also allows LIBDVDCSS_MASTER_SITES to be set to a list of
sites, which didn't work before.

--apb (Alan Barrett)

Index: multimedia/libdvdcss/Makefile
--- multimedia/libdvdcss/Makefile	21 Jul 2005 01:35:50 -0000	1.8
+++ multimedia/libdvdcss/Makefile	28 Jul 2005 22:02:33 -0000
@@ -4,12 +4,15 @@
 # that we are not able to provide pointers to the source or homepage
 # for this software, even in other countries.
 #
+# If you know the correct values, you can define LIBDVDCSS_MASTER_SITES
+# and LIBDVDCSS_HOMEPAGE in /etc/mk.conf.
+#
 # Please do not submit any PRs telling us the contents of the HOMEPAGE
 # or MASTER_SITES definitions in this Makefile.
 
 DISTNAME=	libdvdcss-1.2.9
 CATEGORIES=	multimedia
-MASTER_SITES=	${LIBDVDCSS_MASTER_SITES}/${DISTNAME:S/libdvdcss-//}/
+MASTER_SITES=	${LIBDVDCSS_MASTER_SITES:=/${DISTNAME:S/libdvdcss-//}/}
 EXTRACT_SUFX=	.tar.bz2
 
 MAINTAINER=	recht@NetBSD.org
@@ -18,6 +21,23 @@
 
 RESTRICTED=	Legal problems due to CSS code
 
+.include "../../mk/bsd.prefs.mk"
+
+# If LIBDVDCSS_MASTER_SITES is not defined, then it will be impossible
+# to fetch the distfile.  If, in addition, the distfile has not
+# previously been fetched, then mark the package as broken.
+LIBDVDCSS_DISTFILE= ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX}
+.if !defined(LIBDVDCSS_MASTER_SITES) || empty(LIBDVDCSS_MASTER_SITES)
+.  if !exists(${LIBDVDCSS_DISTFILE})
+PKG_FAIL_REASON=	"To build libdvdcss, you must either" \
+			"manually fetch ${LIBDVDCSS_DISTFILE:T}" \
+			"into ${_DISTDIR}," \
+			"or define LIBDVDCSS_MASTER_SITES in" \
+			"/etc/mk.conf or on the command line" \
+			"or in the environment."
+.  endif
+.endif
+
 # no source because of the CSS source code in it
 NO_SRC_ON_FTP=		${RESTRICTED}
 NO_BIN_ON_FTP=		${RESTRICTED}