diff --git a/var/spack/repos/builtin/packages/libogg/package.py b/var/spack/repos/builtin/packages/libogg/package.py index 45613a654c..d711e95483 100644 --- a/var/spack/repos/builtin/packages/libogg/package.py +++ b/var/spack/repos/builtin/packages/libogg/package.py @@ -5,7 +5,7 @@ import os -from spack.build_systems.generic import GenericBuilder +from spack.build_systems import cmake, generic from spack.package import * @@ -22,6 +22,16 @@ class Libogg(CMakePackage, AutotoolsPackage, Package): version("1.3.4", sha256="fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e") version("1.3.2", sha256="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692") + variant("shared", default=True, description="Build shared library", when="build_system=cmake") + variant( + "pic", + default=True, + description="Produce position-independent code (for shared libs)", + when="build_system=cmake", + ) + + requires("+pic", when="+shared") + # Backport a patch that fixes an unsigned typedef problem on macOS: # https://github.com/xiph/ogg/pull/64 patch( @@ -37,7 +47,17 @@ class Libogg(CMakePackage, AutotoolsPackage, Package): ) -class GenericBuilder(GenericBuilder): +class CMakeBuilder(cmake.CMakeBuilder): + def cmake_args(self): + base_cmake_args = [ + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + ] + + return base_cmake_args + + +class GenericBuilder(generic.GenericBuilder): phases = ["build", "install"] def is_64bit(self):