Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Nov 1998 03:51:26 -0800 (PST)
From:      asami@FreeBSD.ORG (Satoshi Asami)
To:        ports@FreeBSD.ORG
Subject:   Re: bsd.port.{pre,post}.mk
Message-ID:  <199811081151.DAA04642@silvia.hip.berkeley.edu>
In-Reply-To: <199811081121.DAA04535@silvia.hip.berkeley.edu> (asami@cs.berkeley.edu)

next in thread | previous in thread | raw e-mail | index | archive | help
 * Here's a patch to bsd.port.mk itself and Makefile.  I had to move some

Oops, try this one.  The previous one didn't propagate USE_IMAKE to
USE_X_PREFIX properly.

===
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/share/mk/Makefile,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 Makefile
--- Makefile	1998/05/30 22:40:58	1.13.2.3
+++ Makefile	1998/11/08 11:23:26
@@ -4,7 +4,8 @@
 FILES=	bsd.README
 FILES+=	bsd.dep.mk bsd.doc.mk bsd.info.mk bsd.kern.mk bsd.kmod.mk
 FILES+=	bsd.lib.mk bsd.libnames.mk bsd.man.mk bsd.obj.mk bsd.own.mk
-FILES+=	bsd.port.mk bsd.port.subdir.mk bsd.prog.mk bsd.sgml.mk bsd.subdir.mk
+FILES+=	bsd.port.mk bsd.port.post.mk  bsd.port.pre.mk bsd.port.subdir.mk
+FILES+=	bsd.prog.mk bsd.sgml.mk bsd.subdir.mk
 FILES+=	sys.mk
 NOOBJ=	noobj
 
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.port.mk,v
retrieving revision 1.227.2.59
diff -u -r1.227.2.59 bsd.port.mk
--- bsd.port.mk	1998/11/08 10:30:53	1.227.2.59
+++ bsd.port.mk	1998/11/08 11:47:00
@@ -36,6 +36,7 @@
 #				  makefile is being used on.  Automatically set to
 #				  "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
 # OSREL			- The release version (numeric) of the operating system.
+# OSVER			- __FreeBSD_version.
 # PORTOBJFORMAT	- The object format ("aout" or "elf").
 #
 # These variables are used to identify your port.
@@ -393,6 +394,9 @@
 #				  a different checksum and you intend to verify if
 #				  the port still works with it.
 
+# Start of pre-makefile section.
+.if !defined(AFTERPORTMK)
+
 # Get the architecture
 ARCH!=	uname -m
 
@@ -401,14 +405,12 @@
 
 # Get the operating system revision
 OSREL!=	uname -r | sed -e 's/[-(].*//'
-PLIST_SUB+=	OSREL=${OSREL}
+
+# Get __FreeBSD_version
+OSVER!=	sysctl -n kern.osreldate
 
 # Get the object format.
 PORTOBJFORMAT!=	test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
-CONFIGURE_ENV+=	PORTOBJFORMAT=${PORTOBJFORMAT}
-SCRIPTS_ENV+=	PORTOBJFORMAT=${PORTOBJFORMAT}
-MAKE_ENV+=		PORTOBJFORMAT=${PORTOBJFORMAT}
-PLIST_SUB+=		PORTOBJFORMAT=${PORTOBJFORMAT}
 
 # If they exist, include Makefile.inc, then architecture/operating
 # system specific Makefiles, then local Makefile.local.
@@ -494,6 +496,31 @@
 PKGDIR?=		${.CURDIR}/pkg
 .endif
 
+.if defined(USE_IMAKE)
+USE_X_PREFIX=	yes
+.endif
+.if defined(USE_X_PREFIX)
+USE_XLIB=		yes
+.endif
+.if defined(USE_X_PREFIX)
+PREFIX?=		${X11BASE}
+.else
+PREFIX?=		${LOCALBASE}
+.endif
+
+.endif
+# End of pre-makefile section.
+
+# Start of post-makefile section.
+.if !defined(BEFOREPORTMK)
+
+PLIST_SUB+=	OSREL=${OSREL}
+
+CONFIGURE_ENV+=	PORTOBJFORMAT=${PORTOBJFORMAT}
+SCRIPTS_ENV+=	PORTOBJFORMAT=${PORTOBJFORMAT}
+MAKE_ENV+=		PORTOBJFORMAT=${PORTOBJFORMAT}
+PLIST_SUB+=		PORTOBJFORMAT=${PORTOBJFORMAT}
+
 .if defined(MANCOMPRESSED)
 .if ${MANCOMPRESSED} != yes && ${MANCOMPRESSED} != no && \
 	${MANCOMPRESSED} != maybe
@@ -509,18 +536,6 @@
 MANCOMPRESSED?=	no
 .endif
 
-.if defined(USE_IMAKE)
-USE_X_PREFIX=	yes
-.endif
-.if defined(USE_X_PREFIX)
-USE_XLIB=		yes
-.endif
-.if defined(USE_X_PREFIX)
-PREFIX?=		${X11BASE}
-.else
-PREFIX?=		${LOCALBASE}
-.endif
-
 .if defined(USE_GMAKE)
 BUILD_DEPENDS+=		gmake:${PORTSDIR}/devel/gmake
 .endif
 # Loop through several options for package building
@@ -2189,3 +2209,6 @@
 .if !target(tags)
 tags:
 .endif
+
+.endif
+# End of post-makefile section.
===

Also, here's a real life example, graphics/xanim.

===
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/graphics/xanim/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile	1998/09/27 09:18:30	1.15
+++ Makefile	1998/11/08 11:44:14
@@ -18,22 +18,13 @@
 EXTRACT_ONLY=   ${DISTNAME}.tar.gz
 USE_IMAKE=	yes
 MAN1=		xanim.1
-MANCOMPRESSED=	yes
-
-post-extract:
-	@for file in ${EXTRA_FILES}; do \
-	  ${CP} ${DISTDIR}/$$file ${WRKSRC}; \
-	  uncompress ${WRKSRC}/$$file; \
-	done
-	${CP} ${WRKSRC}/docs/xanim.man ${WRKSRC}
-
-MAKE_ENV+=	XA_IV32_DEF=-DXA_INDEO \
+MAKE_ENV=	XA_IV32_DEF=-DXA_INDEO \
 		XA_CVID_DEF=-DXA_CINEPAK \
 		XA_CYUV_DEF=-DXA_CYUV
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
 
-.if ${PORTOBJFORMAT} != elf
+.if ${PORTOBJFORMAT} == aout
 EXTRA_FILES=    xa2.0_cvid_netbsd386.o.Z xa2.0_iv32_netbsd386.o.Z \
 		xa1.0_cyuv_netbsd386.o.Z
 MAKE_ENV+=	XA_IV32_LIB=xa2.0_cvid_netbsd386.o \
@@ -46,3 +37,12 @@
 		XA_CVID_LIB=xa2.0_iv32_linuxELF.o \
 		XA_CYUV_LIB=xa1.0_cyuv_linuxELF.o
 .endif
+
+post-extract:
+	@for file in ${EXTRA_FILES}; do \
+	  ${CP} ${DISTDIR}/$$file ${WRKSRC}; \
+	  uncompress ${WRKSRC}/$$file; \
+	done
+	${CP} ${WRKSRC}/docs/xanim.man ${WRKSRC}
+
+.include <bsd.port.post.mk>
===

(The stupid diff thinks I moved post-extract but actually I moved the
 EXTRA_FILES= and MAKE_ENV+= lines.)

Satoshi

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



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