From owner-freebsd-ports@FreeBSD.ORG Tue Sep 9 22:17:26 2014 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2940912E for ; Tue, 9 Sep 2014 22:17:26 +0000 (UTC) Received: from mail-yk0-x22e.google.com (mail-yk0-x22e.google.com [IPv6:2607:f8b0:4002:c07::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6DA5FC8 for ; Tue, 9 Sep 2014 22:17:25 +0000 (UTC) Received: by mail-yk0-f174.google.com with SMTP id q200so780669ykb.33 for ; Tue, 09 Sep 2014 15:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=iNkR6KfdN84J6xQ/W9JeHc+n6tSoMzMZSzkbZgMXrKI=; b=IM4MCJrNMH+b0ja9UEM9ycYKYxe+sbZUxDgNYXKdjiwsvM63xMVWM82j+ij5HA4jSw blklGytR784aRgZa5VQNQkUXcaieMBGnryjFiJmR7tBrPujX9eRhaOr+i3VJI3xClh4e Or7DKzpiaK1a5OSD1WoWV47pE0G4mzEhmkSAshTRFakSXxM2PxsZI3tnwdHuza15Pqap 0bJ89XP8VBXvsbGk5gvrUkc72VdugiCdfAk7RYmWiNKsnYuIE56HP4Lkt9hdw0ln75oY ROA9vEDg8UJJLnpaChOpF43dSKGNgTDtsNOhb1ywXAn4k/gxLCvh7+VA2RWgrW18ApxX u1ow== MIME-Version: 1.0 X-Received: by 10.236.207.73 with SMTP id m49mr56360744yho.90.1410301044842; Tue, 09 Sep 2014 15:17:24 -0700 (PDT) Sender: antoine.brodin.freebsd@gmail.com Received: by 10.170.164.197 with HTTP; Tue, 9 Sep 2014 15:17:24 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Sep 2014 00:17:24 +0200 X-Google-Sender-Auth: vXzGfiJh26dUKFOOcC_UBu2uZdY Message-ID: Subject: Re: Check for set Makefile options and compile accordingly From: Antoine Brodin To: Oliver Mahmoudi Content-Type: text/plain; charset=UTF-8 Cc: FreeBSD Ports X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2014 22:17:26 -0000 On Wed, Sep 10, 2014 at 12:10 AM, Oliver Mahmoudi wrote: > Hello, > > I am working on a new port here and have a few questions regarding the new > style of handling Makefile options. > > The program I got, is configured in a non standard way, i.e. there is no > configure script or the like. Depending on what modules/libraries you want > to build along with the executable, > > pre-build: > ${GMAKE} ${MAKE_ARGS} cfg > > is run, to configure the program's build system. This can be translated to: > > pre-build: > ${GMAKE} include_modules="module_1 module_2 ..." cfg > > I set up MAKE_ARGS in the following way: > > .if !empty (EXTRA_MODULES) > MAKE_ARGS= include_modules="${EXTRA_MODULES}" > .endif > > About a year ago, when writing the original Makefile, I handled the > situation like this: > > .if ${PORT_OPTIONS:MMYSQL} > BUILD_DEPENDS+= > ${LOCALBASE}/libexec/mysqld:${PORTSDIR}/databases/mysql56-server > RUN_DEPENDS+:= ${BUILD_DEPENDS} > EXTRA_MODULES+= db_mysql > PLIST_SUB+= MYSQL="" > .else > PLIST_SUB+= MYSQL="@comment " > .endif > > To get the port out there, folks now want me to change the way I handle the > Makefile options. Therefore, the above if/else/endif block now now looks > like this: > > OPT_ABOVEVARIABLE= YES > OPTIONS_SUB= YES > > MYSQL_BUILD_DEPENDS= > ${LOCALBASE}/libexec/mysqld:${PORTSDIR}/databases/mysql56-server > > # > # This stuff now hangs loose > # > RUN_DEPENDS+:= ${BUILD_DEPENDS} > EXTRA_MODULES+= db_mysql > # > # > # > > Given the new style of handling Makefile options how do I handle passing my > EXTRA_MODULES variable - there is more than just the one above - to the > port's configure stage via MAKE_ARGS and how would I deal with the > RUN_DEPENDS+:= ${BUILD_DEPENDS} situation? > > None of the situations offered on: > > https://www.freebsd.org/doc/en/books/porters-handbook/makefile-options.html > > match my given scenario. > > Any pointers? Hi, If the options helpers do not fit your needs, you can still use constructs like .include .if ${PORT_OPTIONS:MMYSQL} ... Cheers, Antoine