libogg does not build a shared libary with cmake (#42877)

* when built with cmake, libogg does not build with a shared libary by default. This resolves that

* spack style fixes

* Clean up imports

* enforce +pic when +shared
This commit is contained in:
Chris Marsh 2024-02-29 21:12:27 -06:00 committed by GitHub
parent d0bdd66238
commit 983422facf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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):