Hello,
I was looking at the guide.html and the MULTI_PACKAGE example caught my
eye: it keeps mentioning -core but AFAIK the main package is, err,
-main. Also, after a recent-ish change by espie the various PKGNAME-xyz
are not needed as they have a sensible default.
While I was here I've also indented the lines and sorted some variables
as per template more or less, the reasoning being that IMHO it still
count as an example of how to write a port makefile so we might just as
well do it well. I've also changed slightly how MULTI_PACKAGES is
handled: i.e. define both -main and -x11 together since the x11 is
already excluded when the user specifies the no_x11 flavor. This
produces:
% make show=PKGNAMES
foo-1.0 foo-x11-1.0
% FLAVOR=no_x11 make show=PKGNAMES
foo-1.0
as expected.
I've also changed how the CONFIGURE_ARGS is handled following how
x11/wxWidgets does it.
What do you think?
Index: guide.html
===================================================================
RCS file: /home/cvs/www/faq/ports/guide.html,v
retrieving revision 1.95
diff -u -p -r1.95 guide.html
--- guide.html 26 Nov 2021 07:53:26 -0000 1.95
+++ guide.html 26 Jan 2022 12:28:42 -0000
@@ -801,8 +801,6 @@ in two variants:
You need to write those <code>COMMENT-s1</code> and <code>COMMENT-s2</code>
in the <code>Makefile</code>, split your <code>PLIST</code> into two parts,
and create <code>DESCR-s1/DESCR-s2</code>.
-You will also need to specify separate <code>PKGNAME</code>s
-for all subpackages.
<p>
It is a good idea to start with the minimal framework work required:
@@ -846,35 +844,37 @@ allowed to modify the actual package con
<p>
For instance, assuming you separated the graphical interface into a separate
-subpackage (<code>MULTI_PACKAGES=-core -x11</code>), you could create a pseudo
+subpackage (<code>MULTI_PACKAGES=-main -x11</code>), you could create a pseudo
flavor <code>no_x11</code> that avoids building the -x11 subpackage.
-The crucial point is that this flavor should NOT affect the -core package
+The crucial point is that this flavor should NOT affect the -main package
in any way.
<p>
You would end up with a <code>Makefile</code> that looks something like this:
<pre class="cmdbox">
-CATEGORIES = app
-COMMENT-core = foo core application
-COMMENT-x11 = foo graphical interface
-V = 1.0
-DISTNAME = foo-$V
-PKGNAME-core = foo-core-$V
-PKGNAME-x11 = foo-x11-$V
-PSEUDO_FLAVORS = no_x11
+COMMENT-main = foo core application
+COMMENT-x11 = foo graphical interface
+
+V = 1.0
+DISTNAME = foo-$V
+CATEGORIES = app
+
+MULTI_PACKAGES = -main -x11
+PSEUDO_FLAVORS = no_x11
FLAVOR ?=
-CONFIGURE_STYLE = gnu
-MULTI_PACKAGES = -core
WANTLIB = c m crypto ssl
WANTLIB-x11 = ${WANTLIB} X11 Xt
-RUN_DEPENDS-x11 = ${BASE_PKGPATH},-core
-.if ${FLAVOR:L:Mno_x11}
+RUN_DEPENDS-x11 = ${BASE_PKGPATH},-main>=$V
+
+CONFIGURE_STYLE = gnu
+
+.include <bsd.port.arch.mk>
+
+.if !${BUILD_PACKAGES:M-x11}
CONFIGURE_ARGS += --disable-x11
-.else
-MULTI_PACKAGES += -x11
.endif
.include <bsd.port.mk>
No comments:
Post a Comment