From owner-freebsd-ports@FreeBSD.ORG Tue Nov 26 05:14:45 2013 Return-Path: Delivered-To: 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 DA51FA53 for ; Tue, 26 Nov 2013 05:14:44 +0000 (UTC) Received: from mail-qa0-x230.google.com (mail-qa0-x230.google.com [IPv6:2607:f8b0:400d:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E64F2250 for ; Tue, 26 Nov 2013 05:14:44 +0000 (UTC) Received: by mail-qa0-f48.google.com with SMTP id w5so8011901qac.7 for ; Mon, 25 Nov 2013 21:14:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:from:date:message-id:subject:to:content-type; bh=wheFhggzCzfaFyWkqxireuABE5kuh08KYlwVT6vNmuI=; b=X2dmtY10K78+fWjj4kftrqJ8lGqh6pkkhFfIJ5/ALXV170jsrreOmejdWkhmdOuE0l GWydhzLO+rITuFZ8ybzGUibMdqSQAphT77xMkvOljd007LMnosvHIhT2eO8ERiW69B1a uNKA4zzzFTz1T88NIupbYUxP3WgYVfJIPU7qA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=wheFhggzCzfaFyWkqxireuABE5kuh08KYlwVT6vNmuI=; b=TZxpRgypcY0JRNWVGC7lpG3V3n+PDYYF2Sn3LGD73c1U6iTi7mgwr2dXXtbK2a3m7W 0k/K92DXVu4LpUJWBisGPN85zDrvuTJlULVU8pwo5dI2W0XVIvMA2ZDzQzPNkq5LI8aT CwWuKW2uc9Oiaob5XzJ8ykqTuQVwPnjuOulpMfJDIWs3MzTKbYtlNpXPH0EkcOazOPSo hnJWGmBasgiBcgt9LzZaDKmgPadCDVsCYWTfvpzhsskva9rbLYNhi6UrvggLl1J9bXOm 4RXuBsKahjH3h53E6CZXDXmmlNpKGe5Br1ZMLSJzV8ZcAVg3NvWu2k5t/58Nqdo4fByi R3hQ== X-Gm-Message-State: ALoCoQm3bdOOy0amvvM/0co2/+jBj8lGAYxtOfygVaLSHlV+lKMmvFn3SFnyJhtfp5KlZeDqZGlT X-Received: by 10.49.101.105 with SMTP id ff9mr53061577qeb.34.1385442883490; Mon, 25 Nov 2013 21:14:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.96.63.101 with HTTP; Mon, 25 Nov 2013 21:14:13 -0800 (PST) From: Eitan Adler Date: Tue, 26 Nov 2013 00:14:13 -0500 Message-ID: Subject: Making WITH_DEBUG less magical To: Kubilay Kocak , Andriy Gapon , Baptiste Daroussin , FreeBSD Ports Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Nov 2013 05:14:45 -0000 Hi all, At the moment WITH_DEBUG is treated specially by the ports system. I propose to turn the old WITH_DEBUG into a port option 'DEBUG' which is understood by the port system as a whole (similar to DOCS, etc.) This change also changes what DEBUG does: it only appends DEBUG_{CFLAGS,CPPFLAGS,CXXFLAGS} to the appropriate variable. It does not any longer strip off -O*. My first attempt is below. One known problem is that requires the option DEBUG to be in OPTIONS_DEFINE. I am not sure how to change this (or if we want to change it). I am also unsure if the code changes should live above or below the inclusion of Mk/bsd.options.mk. Documentation changes are intentionally ignored at the moment. Thoughts? Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk (revision 334916) +++ Mk/bsd.port.mk (working copy) @@ -1311,17 +1311,6 @@ MAKE_ENV+= TMPDIR="${TMPDIR}" CONFIGURE_ENV+= TMPDIR="${TMPDIR}" .endif # defined(TMPDIR) -.if defined(WITH_DEBUG_PORTS) -.if ${WITH_DEBUG_PORTS:M${PKGORIGIN}} -WITH_DEBUG= yes -.endif -.endif - -# Reset value from bsd.own.mk. -.if defined(WITH_DEBUG) && !defined(WITHOUT_DEBUG) -STRIP= #none -.endif - .include "${PORTSDIR}/Mk/bsd.options.mk" # Start of pre-makefile section. @@ -1603,11 +1592,25 @@ CFLAGS:= ${CFLAGS:C/${_CPUCFLAGS}//} .endif .endif -.if defined(WITH_DEBUG) && !defined(WITHOUT_DEBUG) +.if defined(WITH_DEBUG_PORTS) +.if ${WITH_DEBUG_PORTS:M${PKGORIGIN}} +WITH_DEBUG= yes +.endif +.endif + +DEBUG_CFLAGS?= -g +DEBUG_CXXFLAGS?= -g +DEBUG_CPPFLAGS?= -g + +.if defined(PORT_OPTIONS) +.if ${PORT_OPTIONS:MDEBUG} || defined(WITH_DEBUG) +STRIP= #none STRIP_CMD= ${TRUE} -DEBUG_FLAGS?= -g -CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} +CFLAGS+= ${DEBUG_CFLAGS} +CXXFLAGS+= ${DEBUG_CXXFLAGS} +CPPFLAGS+= ${DEBUG_CPPFLAGS} .endif +.endif .if defined(WITH_SSP) || defined(WITH_SSP_PORTS) .include "${PORTSDIR}/Mk/bsd.ssp.mk" -- Eitan Adler