Solved Port options in Makefile

Hi,

As being the maintainer of the mail/alpine port, I'm trying to clean up the Makefile (this was kinda messy). Now I'm having the following result:

Code:
PORTNAME?=    alpine
PORTVERSION=    2.21
PORTREVISION?=    0
CATEGORIES?=    mail news ipv6
MASTER_SITES=    http://alpine.freeiz.com/alpine/release/src/
DIST_SUBDIR=    alpine-${PORTVERSION}

MAINTAINER=    mbeis@xs4all.nl
COMMENT?=    Mail and news client descended from Pine

LICENSE=    APACHE20

USES+=            ssl libtool ncurses tar:xz gettext-runtime
MAKE_JOBS_UNSAFE=    yes
GNU_CONFIGURE=        yes
CONFIGURE_ARGS+=    --with-debug-level=2 \
            --enable-background-post \
            --without-krb5 \
            --without-tcl \
            --with-system-pinerc=${PREFIX}/etc/alpine.conf \
            --with-system-fixed-pinerc=${PREFIX}/etc/alpine.conf.fixed \
            --with-password-prog=/usr/bin/passwd \
            --with-system-mail-directory=/var/mail
MAKE_ARGS+=        CC="${CC}" CXX="${CXX}" GCCCFLAGS="${CFLAGS}"

OPTIONS_DEFINE=        ASPELL CONS25 DOCS IPV6 LDAP MAILDIR MOUSE NLS NOSPELL PASSFILE PICO SSL THREADS
OPTIONS_DEFAULT+=    MOUSE PICO SSL THREADS

ASPELL_DESC=    Use aspell as default speller
CONS25_DESC=    Add a patch to support color for default console
DOCS_DESC=    Build and install documentation
IPV6_DESC=    Build with IPv6 support
LDAP_DESC=    Build with LDAP
MAILDIR_DESC=    Add a patch for maildir support
MOUSE_DESC=    Enable mouse support for xterm
NLS_DESC=    Build with native language support
NOSPELL_DESC=    Use simple spellcheck
PASSFILE_DESC=    Support for a stored password file
PICO_DESC=    Build and install pico, the default editor
SSL_DESC=    Build with SSL
THREADS_DESC=    Build with pthreads

.include <bsd.port.options.mk>

# Option ASPELL
ASPELL_CONFIGURE_WITH=        interactive-spellcheck
ASPELL_CONFIGURE_ON=        --with-interactive-spellcheck=${LOCALBASE}/bin/aspell
ASPELL_BUILD_DEPENDS=        aspell:textproc/aspell
ASPELL_RUN_DEPENDS=        aspell:textproc/aspell

# Option CONS25
CONS25_EXTRA_PATCHES=        ${FILESDIR}/cons25-alpine_keymenu.c

# Option IPV6
IPV6_CONFIGURE_WITH=        ipv6

# Option LDAP
OPENLDAP_USE=            openldap=yes
LDAP_CONFIGURE_WITH=        ldap
LDAP_CONFIGURE_ON=        --with-ldap-dir=${LOCALBASE}

# Option MAILDIR
MAILDIR_PATCH_SITES=        http://alpine.freeiz.com/alpine/patches/alpine-${PORTVERSION}/
MAILDIR_PATCHFILES+=        maildir.patch.gz:-p1

# Option MOUSE
MOUSE_CONFIGURE_ENABLE=        mouse

# Option NLS
NLS_CONFIGURE_ENABLE=        nls

# Option NOSPELL
NOSPELL_CONFIGURE_WITH=        simple-spellcheck

# Option PASSFILE
PASSFILE_CONFIGURE_WITH=    passfile
PASSFILE_CONFIGURE_ON=        --with-passfile=.alpine-passfile

# Option PICO
PICO_CONFIGURE_ENABLE=        pico
PICO_RUN_DEPENDS=        pico:editors/pico-alpine

# Option SSL
SSL_USE=            openssl=yes
SSL_CONFIGURE_WITH=        ssl
SSL_CONFIGURE_ON=        --with-ssl-dir=${OPENSSLDIR} \
                --with-ssl-include-dir=${OPENSSLINC} \
                --with-ssl-lib-dir=${OPENSSLLIB} \
                --with-ssl-certs-dir=${OPENSSLDIR}/certs

# Option THREADS
THREADS_CONFIGURE_WITH=        pthread

post-patch:
    @${CP} ${WRKSRC}/imap/Makefile ${WRKSRC}/imap/Makefile.presed
    @${SED}    -e "s#^\(all:.*\) bundled\$$#\1#" \
       ${WRKSRC}/imap/Makefile.presed > ${WRKSRC}/imap/Makefile
    @${CP} ${WRKSRC}/pico/Makefile.in ${WRKSRC}/pico/Makefile.in.presed
    @${SED} -e "s#^bin_PROGRAMS = pico.*#bin_PROGRAMS =#" \
       -e "s#\$$(pico_SOURCES) \$$(pilot_SOURCES)##" \
       ${WRKSRC}/pico/Makefile.in.presed > ${WRKSRC}/pico/Makefile.in
    @${CP} ${WRKSRC}/Makefile.in ${WRKSRC}/Makefile.in.presed
    @${SED}    -e "s#doc/man1/pico.1 doc/man1/pilot.1 ##" \
       ${WRKSRC}/Makefile.in.presed > ${WRKSRC}/Makefile.in
    @${CP} ${WRKSRC}/imap/src/osdep/unix/Makefile \
       ${WRKSRC}/imap/src/osdep/unix/Makefile.presed
    @${SED} -e "s#^LOCKPGM=.*#LOCKPGM= ${PREFIX}/libexec/mlock#" \
       ${WRKSRC}/imap/src/osdep/unix/Makefile.presed \
       > ${WRKSRC}/imap/src/osdep/unix/Makefile
    @for i in ${WRKSRC}/README ${WRKSRC}/doc/man1/alpine.1 \
       ${WRKSRC}/doc/*.txt \
       ${WRKSRC}/doc/tech-notes/*.txt \
       ${WRKSRC}/doc/tech-notes/*.html \
       ${WRKSRC}/pith/pine.hlp ; do \
        ${CP} $$i $$i.presed ; \
        ${SED} -e "s:/usr/local/lib/:${PREFIX}/etc/:g" \
           -e "s:/usr/local/pine.conf:${PREFIX}/etc/pine.conf:g" \
           -e "s:pine\.conf:alpine.conf:g" \
           -e "s:/usr/local:${PREFIX}:g" \
           -e "s:@@PREFIX@@:${PREFIX}:g" \
           $$i.presed > $$i ; \
    done

PORTDOCSbase=        LICENSE NOTICE README
PORTDOCSdoc=        brochure.txt
PORTDOCShtml=        tech-notes/background.html tech-notes/cmd-line.html \
            tech-notes/config-notes.html tech-notes/config.html \
            tech-notes/index.html tech-notes/installation.html \
            tech-notes/introduction.html tech-notes/low-level.html \
            tech-notes/tech-notes.txt
PORTDOCS=        ${PORTDOCSbase} ${PORTDOCSdoc} ${PORTDOCShtml}

post-install:
    ${STAGEDIR}${PREFIX}/bin/alpine -conf > ${STAGEDIR}${PREFIX}/etc/alpine.conf.sample
.if ${PORT_OPTIONS:MDOCS}
    ${INSTALL} -d ${STAGEDIR}${DOCSDIR} ${STAGEDIR}${DOCSDIR}/tech-notes
.for f in ${PORTDOCSbase}
    ${INSTALL_MAN} ${WRKSRC}/$f ${STAGEDIR}${DOCSDIR}
.endfor
.for f in ${PORTDOCSdoc}
    ${INSTALL_MAN} ${WRKSRC}/doc/$f ${STAGEDIR}${DOCSDIR}
.endfor
.for f in ${PORTDOCShtml}
    ${INSTALL_MAN} ${WRKSRC}/doc/$f ${STAGEDIR}${DOCSDIR}/tech-notes
.endfor
.endif

.include <bsd.port.mk>

It all builds and installs fine. But it looks as if the options that are set, are ignored completely. The default options are set I think, but not the options set differently from the defaults. For example, for testing I have all options set in make config, but the option PASSFILE (for saving the passwords in a encrypted file) doesn't seem to work after installation.

So what is set wrong in my new Makefile?

Thanks in advance,
Marco
 
.include <bsd.port.options.mk>
Remove this. You don't need it. The problem you see is that all options helpers need to be set correctly before including bsd.port.options.mk. It does options helpers processing and bsd.port.mk won't do it again afterwards.

ASPELL_DESC= Use aspell as default speller CONS25_DESC= Add a patch to support color for default console DOCS_DESC= Build and install documentation IPV6_DESC= Build with IPv6 support LDAP_DESC= Build with LDAP MAILDIR_DESC= Add a patch for maildir support MOUSE_DESC= Enable mouse support for xterm NLS_DESC= Build with native language support NOSPELL_DESC= Use simple spellcheck PASSFILE_DESC= Support for a stored password file PICO_DESC= Build and install pico, the default editor SSL_DESC= Build with SSL THREADS_DESC= Build with pthreads
A lot of these can be removed. There are already canonical descriptions in bsd.options.desc.mk for them.

SSL_USE= openssl=yes
This should be SSL_USES=openssl, but do you need the option at all? You also set USES=ssl unconditionally.
 
Remove this. You don't need it. The problem you see is that all options helpers need to be set correctly before including bsd.port.options.mk. It does options helpers processing and bsd.port.mk won't do it again afterwards.
Looks like the bsd.port.options.mk is needed because it won't build without it.

A lot of these can be removed. There are already canonical descriptions in bsd.options.desc.mk for them.
OK thanks I removed the descriptions not in bsd.options.desc.mk.

This should be SSL_USES=openssl, but do you need the option at all? You also set USES=ssl unconditionally.
Thanks, I decided to keep the USES=ssl and removed the openssl-option. A MUA without ssl doesn't seem ok to me anyway.
 
Looks like the bsd.port.options.mk is needed because it won't build without it.
What error are you getting without it? EDIT: Nevermind. Your post-install target is at fault since your using PORT_OPTIONS there. You can rewrite it like this:
Code:
post-install:
	${STAGEDIR}${PREFIX}/bin/alpine -conf > ${STAGEDIR}${PREFIX}/etc/alpine.conf.sample

post-install-DOCS-on:
	${INSTALL} -d ${STAGEDIR}${DOCSDIR} ${STAGEDIR}${DOCSDIR}/tech-notes
.for f in ${PORTDOCSbase}
	${INSTALL_MAN} ${WRKSRC}/$f ${STAGEDIR}${DOCSDIR}
.endfor
.for f in ${PORTDOCSdoc}
	${INSTALL_MAN} ${WRKSRC}/doc/$f ${STAGEDIR}${DOCSDIR}
.endfor
.for f in ${PORTDOCShtml}
	${INSTALL_MAN} ${WRKSRC}/doc/$f ${STAGEDIR}${DOCSDIR}/tech-notes
.endfor
 
Poudriere error messages:
Code:
[00:00:50] ====>> Starting jail 110R-local
[00:00:51] ====>> Warning: (mail/alpine): make: "/usr/ports/mail/alpine/Makefile" line 123: Malformed conditional (${PORT_OPTIONS:MDOCS})
[00:00:51] ====>> Logs: /poudriere/data/logs/bulk/110R-local/2017-06-08_21h30m50s
[00:00:51] ====>> Loading MOVED
[00:00:51] ====>> Calculating ports order and dependencies
[00:00:51] ====>> Error: Nonexistent port listed for build: make:
[00:00:51] ====>> Error: Nonexistent port listed for build: stopped
[00:00:51] ====>> Error: Nonexistent port listed for build: in
[00:00:51] ====>> Error: Nonexistent port listed for build: /usr/ports/mail/alpine
[00:00:51] ====>> Error: Fatal errors encountered calculating dependencies
[00:00:51] ====>> Cleaning up
[00:00:51] ====>> Unmounting file systems
 
It works better when using
Code:
.include <bsd.port.pre.mk>
and
Code:
.include <bsd.port.post.mk>
instead of
Code:
.include <bsd.port.mk>
. But then I get:
Code:
[00:00:48] ====>> Starting jail 110R-local
[00:00:48] ====>> Logs: /poudriere/data/logs/bulk/110R-local/2017-06-08_21h36m14s
[00:00:48] ====>> Loading MOVED
[00:00:49] ====>> Calculating ports order and dependencies
[00:00:52] ====>> Error: editors/pico-alpine incorrectly depends on itself. Please contact maintainer of the port to fix this.
[00:00:52] ====>> Error: Fatal errors encountered calculating dependencies
[00:00:52] ====>> Cleaning up
[00:00:52] ====>> Unmounting file systems
 
Got finally a working Makefile. Removed all .include lines except for ".include <bsd.port.mk>" at the end. It appeared that the line ".include bsd.port.options.mk>" causes all options being ignored.

Needed to make some changes in the options after that but now it works.

Thanks,
Marco
 
Back
Top