fakexrandr: add new package (#20687)

This commit is contained in:
Adam J. Stewart 2021-01-06 01:59:12 -06:00 committed by GitHub
parent 564aebdb1a
commit 323667ce2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,46 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Fakexrandr(MakefilePackage):
"""This is a tool to cheat an X11 server to believe that there are more
monitors than there actually are."""
homepage = "https://github.com/phillipberndt/fakexrandr"
git = "https://github.com/phillipberndt/fakexrandr.git"
version('master', branch='master')
depends_on('libxrandr')
depends_on('libxinerama')
depends_on('libx11')
depends_on('python', type=('build', 'run'))
def edit(self, spec, prefix):
# Installation instructions involve running `configure` script,
# but this script just writes a `config.h` file like below.
version = spec['libxrandr'].version
with open('config.h', 'w') as config:
config.write("""
#define XRANDR_MAJOR {0}
#define XRANDR_MINOR {1}
#define XRANDR_PATCH {2}
#define REAL_XRANDR_LIB "{3}"
#define FAKEXRANDR_INSTALL_DIR "{4}"
""".format(version[0], version[1], version[2],
spec['libxrandr'].libs[0], prefix.lib))
# Also need to hack Makefile
makefile = FileFilter('Makefile')
makefile.filter('PREFIX=/usr', 'PREFIX=' + prefix)
makefile.filter('-fPIC', self.compiler.cc_pic_flag)
# And tool used to generate skeleton
filter_file('gcc', spack_cc, 'make_skeleton.py')
if 'platform=darwin' in spec:
makefile.filter('ldconfig', '')