From owner-freebsd-ports@FreeBSD.ORG Sun Mar 19 22:40:53 2006 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A01A416A480 for ; Sun, 19 Mar 2006 22:40:53 +0000 (UTC) (envelope-from zaa@ulstu.ru) Received: from kernel.ulstu.ru (kernel.ulstu.ru [62.76.34.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id A13C243D45 for ; Sun, 19 Mar 2006 22:40:49 +0000 (GMT) (envelope-from zaa@ulstu.ru) Received: from localhost (localhost [127.0.0.1]) by kernel.ulstu.ru (ulstuMail) with ESMTP id C2D964AC66; Mon, 20 Mar 2006 01:40:42 +0300 (MSK) Received: from kernel.ulstu.ru ([127.0.0.1]) by localhost (kernel.ulstu.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 49717-05; Mon, 20 Mar 2006 01:40:42 +0300 (MSK) Received: from wave.zaa.local (zaa.ulstu.ru [62.76.34.17]) by kernel.ulstu.ru (ulstuMail) with ESMTP id 3419F4AC1D for ; Mon, 20 Mar 2006 01:40:41 +0300 (MSK) Received: by wave.zaa.local (Postfix, from userid 3909) id 75EFEB81F; Mon, 20 Mar 2006 00:08:36 +0300 (MSK) Date: Mon, 20 Mar 2006 00:08:36 +0300 From: Alexander Zhuravlev To: freebsd-ports@freebsd.org Message-ID: <20060319210836.GA14373@wave.zaa.local> Mail-Followup-To: freebsd-ports@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline X-Virus-Scanned: by amavisd-new at ulstu.ru Subject: conditional (FreeBSD version specific) OPTIONS definition X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alexander Zhuravlev List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Mar 2006 22:40:53 -0000 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 .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 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 .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 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