Skip site navigation (1)Skip section navigation (2)
Date:      11 Apr 2000 01:34:45 -0700
From:      asami@FreeBSD.org (Satoshi - Ports Wraith - Asami)
To:        "Akinori -Aki- MUSHA" <knu@idaemons.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: ports/chinese Makefile.inc ports/german Makefile.inc         ports/japanese Makefile.inc ports/korean Makefile.inc         ports/russian Makefile.inc ports/vietnamese Makefile.inc
Message-ID:  <vqc4s99ox22.fsf@silvia.hip.berkeley.edu>
In-Reply-To: "Akinori -Aki- MUSHA"'s message of "Tue, 11 Apr 2000 16:27:12 %2B0900"
References:  <200004101634.JAA94507@freefall.freebsd.org> <86hfd9rzkz.wl@archon.local.idaemons.org> <86d7nxrtbj.wl@archon.local.idaemons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
 * From: "Akinori -Aki- MUSHA" <knu@idaemons.org>

 * Unfortunately, I found bsd.port.mk does not include
 * `${MASTERDIR}/../Makefile.inc' automatically while it includes
 * `${.CURDIR}/../Makefile.inc'.

Yes, I have been thinking about that too. :)

 * I think it'd be bad if every slave port were to be forced to include
 * `${.CURDIR}/../Makefile.inc' for itself before including
 * `${MASTERDIR}/Makefile', so I'd suggest we prepare some files as
 * follows:

I don't think you need to go that far.  How about the following?
Basically it includes ${.CURDIR}/../Makefile.inc iff ${.CURDIR} is
different from ${MASTERDIR} (i.e., this is a slave port).

===
Index: Mk/bsd.port.mk
===================================================================
RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.334
diff -u -r1.334 bsd.port.mk
--- bsd.port.mk	2000/04/10 12:31:02	1.334
+++ bsd.port.mk	2000/04/11 08:26:03
@@ -491,6 +491,10 @@
 # If they exist, include Makefile.inc, then architecture/operating
 # system specific Makefiles, then local Makefile.local.
 
+.if ${MASTERDIR} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc)
+.include "${.CURDIR}/../Makefile.inc"
+.endif
+
 .if exists(${MASTERDIR}/../Makefile.inc)
 .include "${MASTERDIR}/../Makefile.inc"
 .endif
@@ -507,6 +511,25 @@
 .include "${MASTERDIR}/Makefile.local"
 .endif
 
+.if defined(REQUIRE_PORTNAME) && !defined(PORTNAME)
+.BEGIN:
+	@${ECHO} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
+	@${ECHO} "(This port is too old for your bsd.port.mk.)"
+	@${FALSE}
+.endif
+.if defined(PORTNAME)
+.if defined(PKGNAME) || !defined(PORTVERSION)
+.BEGIN:
+	@${ECHO} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
+	@${FALSE}
+.endif
+PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}
+DISTNAME?=	${PORTNAME}-${PORTVERSION}
+.else
+# old style
+PKGNAME?=		${DISTNAME}
+.endif
+
 # These need to be absolute since we don't know how deep in the ports
 # tree we are and thus can't go relative.  They can, of course, be overridden
 # by individual Makefiles or local system make configuration.
@@ -1102,25 +1125,6 @@
 .if defined(FETCH_SYMLINK_DISTFILES)
 FETCH_BEFORE_ARGS+=	-l
 .endif
-.endif
-
-.if defined(REQUIRE_PORTNAME) && !defined(PORTNAME)
-.BEGIN:
-	@${ECHO} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
-	@${ECHO} "(This port is too old for your bsd.port.mk.)"
-	@${FALSE}
-.endif
-.if defined(PORTNAME)
-.if defined(PKGNAME) || !defined(PORTVERSION)
-.BEGIN:
-	@${ECHO} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
-	@${FALSE}
-.endif
-PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}
-DISTNAME?=	${PORTNAME}-${PORTVERSION}
-.else
-# old style
-PKGNAME?=		${DISTNAME}
 .endif
 
 DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
===

I also moved the PKGNAME/DISTNAME setting up to within the pre.mk
section, otherwise a port that tests on the value of PKGNAME will be
dead.

With this, {japanese,korean}/Wnn (thanks for the example), for
instance, can be modified this way (I haven't fixed variable
ordering to keep the diff small):

===
Index: japanese/Wnn/Makefile
===================================================================
RCS file: /usr/cvs/ports/japanese/Wnn/Makefile,v
retrieving revision 1.28
diff -u -r1.28 Makefile
--- Makefile	2000/03/09 03:14:34	1.28
+++ Makefile	2000/04/11 08:24:43
@@ -7,7 +7,8 @@
 #
 
 DISTNAME=	Wnn4.2
-PKGNAME?=	ja-Wnn-4.2
+PORTNAME=	Wnn
+PORTVERSION=	4.2
 CATEGORIES?=	japanese
 MASTER_SITES=	ftp://ftp.u-tokyo.ac.jp/pub/Japanese/Wnn/ \
 		ftp://ftp.wg.omron.co.jp/pub/Wnn/dic/pubdic+/ \
@@ -30,6 +31,8 @@
 BATCH=	yes	# make sure it's not empty
 .endif
 
+.include <bsd.port.pre.mk>
+
 .if (${PKGNAME} == ja-Wnn-4.2)
 DISTFILES+=	pubdic+.tar.gz pubdic+-fix01.gz pubdic+.diff pubdic+.special.diff
 PORT_DOCDIR=	${PREFIX}/share/doc/ja-Wnn
@@ -167,4 +170,4 @@
 	fi
 	${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ${PREFIX}/lib
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: korean/Wnn/Makefile
===================================================================
RCS file: /usr/cvs/ports/korean/Wnn/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- Makefile	1999/08/30 12:08:35	1.8
+++ Makefile	2000/04/11 08:31:47
@@ -6,7 +6,6 @@
 # $FreeBSD: ports/korean/Wnn/Makefile,v 1.8 1999/08/30 12:08:35 peter Exp $
 #
 
-PKGNAME=	ko-Wnn-4.2
 CATEGORIES=	korean
 
 ## COMMENT, DESCR, PLIST is used in a local 'pkg' directory
===

(I only tested "make package-name", but since everything is
conditionalized on ${PKGNAME}, I think it will work.)

Note that you don't even have to set PORTNAME/PORTVERSION in ko-Wnn
anymore!

Satoshi


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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