From 323667ce2a84e17c42f193be9eff15ac492ca4d0 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 6 Jan 2021 01:59:12 -0600 Subject: [PATCH] fakexrandr: add new package (#20687) --- .../builtin/packages/fakexrandr/package.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 var/spack/repos/builtin/packages/fakexrandr/package.py diff --git a/var/spack/repos/builtin/packages/fakexrandr/package.py b/var/spack/repos/builtin/packages/fakexrandr/package.py new file mode 100644 index 0000000000..aa38531906 --- /dev/null +++ b/var/spack/repos/builtin/packages/fakexrandr/package.py @@ -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', '')