Date: Mon, 20 Mar 2006 00:08:36 +0300 From: Alexander Zhuravlev <zaa@ulstu.ru> To: freebsd-ports@freebsd.org Subject: conditional (FreeBSD version specific) OPTIONS definition Message-ID: <20060319210836.GA14373@wave.zaa.local>
next in thread | raw e-mail | index | archive | help
Hello, My port needs to provide option for zlib support inclusion in a php extension. The thing is that it requires zlib version which is not shipped with OSVERSION < 500000. Thus I tried to use the following code in Makefile: OPTIONS= CURL "Enable cURL HTTP requests" on \ MAGIC_MIME "Enable response content type guessing" off .include <bsd.port.pre.mk> .if ${OSVERSION} >= 500000 OPTIONS+= ZLIB_COMPRESSION "Enable support for encoded message bodies" on .endif .if defined(WITH_ZLIB_COMPRESSION) CONFIGURE_ARGS+=--with-http-zlib-compression=/usr .else CONFIGURE_ARGS+=--without-http-zlib-compression .endif .if defined(WITH_CURL) LIB_DEPENDS+= curl.3:${PORTSDIR}/ftp/curl CONFIGURE_ARGS+=--with-http-curl-requests=${LOCALBASE} .else CONFIGURE_ARGS+=--without-http-curl-requests .endif .if defined(WITH_MAGIC_MIME) LIB_DEPENDS+= magic.1:${PORTSDIR}/sysutils/file CONFIGURE_ARGS+=--with-http-magic-mime=${LOCALBASE} .else CONFIGURE_ARGS+=--without-http-magic-mime .endif .include <bsd.port.post.mk> When I run portlint -Aa (portlink version 2.8.7) I got the following error message: FATAL: Makefile [34]: OPTIONS is set after including bsd.port.pre.mk. Why is it declined to define OPTIONS after inclusion of the bsd.port.pre.mk file? Is it possible to impement dynamic options definition using other means? For now I overcame the issue by using the following code: OPTIONS= CURL "Enable cURL HTTP requests" on \ MAGIC_MIME "Enable response content type guessing" off \ ZLIB_COMPRESSION "Enable support for encoded message bodies" off .include <bsd.port.pre.mk> .if defined(WITH_CURL) LIB_DEPENDS+= curl.3:${PORTSDIR}/ftp/curl CONFIGURE_ARGS+=--with-http-curl-requests=${LOCALBASE} .else CONFIGURE_ARGS+=--without-http-curl-requests .endif .if defined(WITH_MAGIC_MIME) LIB_DEPENDS+= magic.1:${PORTSDIR}/sysutils/file CONFIGURE_ARGS+=--with-http-magic-mime=${LOCALBASE} .else CONFIGURE_ARGS+=--without-http-magic-mime .endif .if defined(WITH_ZLIB_COMPRESSION) && ${OSVERSION} < 500000 CONFIGURE_ARGS+=--with-http-zlib-compression=/usr .else CONFIGURE_ARGS+=--without-http-zlib-compression .endif .include <bsd.port.post.mk> But it is not that elegant solution because users of FreeBSD will be presented with not supported option for their FreeBSD version. Thank you. -- Alexander Zhuravlev
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060319210836.GA14373>