zlib: added 'pic' variant (#2470)

It looks more complicated because zlib has custom configure which does
not support CFLAGS option. So instead, we take it from environment.
This commit is contained in:
Andrey Prokopenko 2016-12-03 19:43:44 -05:00 committed by Todd Gamblin
parent 6ddc518417
commit f17c22dfb5

View file

@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
from os import environ
class Zlib(AutotoolsPackage):
@ -33,3 +34,14 @@ class Zlib(AutotoolsPackage):
url = "http://zlib.net/zlib-1.2.8.tar.gz"
version('1.2.8', '44d667c142d7cda120332623eab69f40')
variant('pic', default=True,
description='Produce position-independent code (for shared libs)')
def configure(self, spec, prefix):
if '+pic' in spec:
environ['CFLAGS'] = self.compiler.pic_flag
config_args = ['--prefix', prefix]
configure(*config_args)