Skip to content

Instantly share code, notes, and snippets.

@kometchtech
Created April 16, 2018 08:43
Show Gist options
  • Save kometchtech/1271c65520fb50a1cc4fc93d60c928d8 to your computer and use it in GitHub Desktop.
Save kometchtech/1271c65520fb50a1cc4fc93d60c928d8 to your computer and use it in GitHub Desktop.
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install glibc
#
# You can edit this file again by typing:
#
# spack edit glibc
#
# See the Spack documentation for more information on packaging.
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
from spack import *
import os.path
class Glibc(AutotoolsPackage):
"""FIXME: Put a proper description of your package here."""
# FIXME: Add a proper url for your package's homepage here.
homepage = "http://www.example.com"
url = "https://ftp.gnu.org/gnu/glibc/glibc-2.27.tar.gz"
version('2.27', '527bc6270e37ab97314a3af0b7b83db8')
version('2.26', 'ae2a3cddba005b34792dabe8c103e866')
version('2.25', '0c9f827298841dbf3bff3060f3d7f19c')
version('2.24', 'f0017697aeadf0d7cc127a9f52852480')
version('2.23', '99a1da43815f6585c5e61239b6240e0e')
version('2.22', '91dcaa30870c1ce5c9974c49c3af03eb')
version('2.21', '641021d33934b327b216af60af71a728')
version('2.20', 'aabb1776353e6bc60ecc707af78a3813')
version('2.17', '8a7f11b9ac5d0d5efa4c82175b5a9c1b', preferred=True)
# FIXME: Add dependencies if required.
# depends_on('foo')
depends_on('automake', type='build')
depends_on('bison', type='build')
depends_on('gcc@5:', when='@2.25:')
depends_on('binutils -gold')
depends_on('autoconf', type='build')
depends_on('m4 -sigsegv cppflags="-fgnu89-inline"', type='build')
depends_on('ncurses -symlinks -termlib', type='build')
depends_on('gettext -bzip2 +curses -git -xz')
depends_on('zlib')
patch('glibc-2.17-fhs-1.patch', when='@2.17')
#phases = ['configure', 'build', 'install']
def configure_args(self):
# FIXME: Add arguments other than --prefix
# FIXME: If not needed delete this function
args = []
spec = self.spec
arch = spec.architecture # check architecture
cflags = []
if (arch.target == 'x86_64'):
cflags.append('-Wno-error -mtune=generic')
args.append('--build=x86_64-redhat-linux')
args.append('--enable-multi-arch')
if(arch.target == 'aarch64'):
args.append('--build=aarch64-redhat-linux')
# common
args.append('CFLAGS=-fasynchronous-unwind-tables -DNDEBUG -g -O3 -fno-asynchronous-unwind-tables ' + ' '.join(cflags))
args += ['--enable-add-ons',
'--with-headers=/usr/include',
'--enable-kernel=2.6.32',
'--enable-bind-now',
'--enable-obsolete-rpc',
'--disable-profile',
'--enable-nss-crypt',
'--enable-systemtap',
'CC=gcc',
'CXX=g++',
]
return args
# configure
def configure(self, spec, prefix):
#configure = Executable('%s/configure' % self.stage.source_path)
p = join_path(self.stage.path, 'build-glibc')
q = self.stage.source_path
with working_dir(p, create=True):
options = ['--prefix={0}'.format(prefix)]
options += self.configure_args()
configure = Executable('%s/configure' % q)
configure(*options)
# make setting
def build(self, spec, prefix):
with working_dir(join_path(self.stage.path, 'build-glibc')):
make()
# install
def install(self, spec, prefix):
with working_dir(join_path(self.stage.path, 'build-glibc')):
make("install")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment