set CXXFLAGS for dpkg-buildpackage

News and discussion about development of the Debian OS itself

set CXXFLAGS for dpkg-buildpackage

Postby hurryup » 2014-11-10 10:05

Could you please explain me how can i set CXXFLAGS from the environment for dpkg-buildpackage.

debian/rules
%:
dh $@
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

I try CFLAGS+="-g -O6" dpkg-buildpackage -us -uc, but I see -g -O2 when package builds.
hurryup
 
Posts: 2
Joined: 2014-10-15 10:41

Re: set CXXFLAGS for dpkg-buildpackage

Postby PeterB » 2014-11-10 20:32

Can't help you much with compiler flags, but in a rules file, the environment stuff must go before the first target. Also the white-space needs to be correctly formatted. Recipes need a single leading tab. Make sure there is a empty/blank line right at the end. Start by trying this instead;

Code: Select all
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
   dh $@

PeterB
 
Posts: 109
Joined: 2010-10-03 16:53

Re: set CXXFLAGS for dpkg-buildpackage

Postby stevepusser » 2014-11-10 21:06

I'm pretty sure you just add to the rules fileL

debian/rules
Code: Select all
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

CXXFLAGS=-g -O6 

%:
dh $@
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: GIMP 2.10.2, Pale Moon 27.9.3, wine-staging 3.10, QuiteRSS 0.18.11, Linux kernel 4.17, Krita 4.0.4
User avatar
stevepusser
 
Posts: 9648
Joined: 2009-10-06 05:53

Re: set CXXFLAGS for dpkg-buildpackage

Postby slackguy » 2014-12-25 23:10

for automake(1) or typical Makefile one can use:

export CXXFLAGS="foo"

(which is used where appropriate not necessarily everywhere)

likely debian should consume the same
User avatar
slackguy
 
Posts: 91
Joined: 2014-11-29 03:22


Return to Debian Development

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable