Blob Blame History Raw
From 0307d7c229cda63a55bc53ccb7a71fd62a669bdf Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@cryptomilk.org>
Date: Tue, 9 Dec 2014 09:32:05 +0100
Subject: [PATCH] setup: Honor CFLAGS set as environment variable

Distributions normally have their preferred set of CFLAGS so the
binaries are optimized and include debug symbols to create a debuginfo
package. For this we need to be able to set the CFLAGS via the
commandline and the setup.py should forward them to the compiler.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
---
 setup.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 434dff5..00503f1 100755
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,8 @@ def compile_client():
 	else:
 		from distutils.ccompiler import new_compiler
 		compiler = new_compiler().compiler
-		subprocess.check_call(compiler + ['-O3', 'client/powerline.c', '-o', 'scripts/powerline'])
+		cflags = os.environ['CFLAGS'].get() or '-O3'
+		subprocess.check_call(compiler + [cflags, 'client/powerline.c', '-o', 'scripts/powerline'])
 
 try:
 	compile_client()
-- 
2.2.0