diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py
index 7a8432ecfa0..9be10b0826e 100644
--- a/lib/spack/spack/compilers/msvc.py
+++ b/lib/spack/spack/compilers/msvc.py
@@ -122,7 +122,19 @@ def platform_toolset_ver(self):
@property
def cl_version(self):
"""Cl toolset version"""
- return spack.compiler.get_compiler_version_output(self.cc)
+ return Version(
+ re.search(
+ Msvc.version_regex,
+ spack.compiler.get_compiler_version_output(self.cc, version_arg=None),
+ ).group(1)
+ )
+
+ @property
+ def vs_root(self):
+ # The MSVC install root is located at a fix level above the compiler
+ # and is referenceable idiomatically via the pattern below
+ # this should be consistent accross versions
+ return os.path.abspath(os.path.join(self.cc, "../../../../../../../.."))
def setup_custom_environment(self, pkg, env):
"""Set environment variables for MSVC using the
diff --git a/var/spack/repos/builtin/packages/libogg/package.py b/var/spack/repos/builtin/packages/libogg/package.py
index c0fad6bbf3c..c82794e9ba6 100644
--- a/var/spack/repos/builtin/packages/libogg/package.py
+++ b/var/spack/repos/builtin/packages/libogg/package.py
@@ -3,10 +3,13 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os
+
+from spack.build_systems.generic import GenericBuilder
from spack.package import *
-class Libogg(AutotoolsPackage):
+class Libogg(CMakePackage, AutotoolsPackage, Package):
"""Ogg is a multimedia container format, and the native file and stream
format for the Xiph.org multimedia codecs."""
@@ -24,3 +27,35 @@ class Libogg(AutotoolsPackage):
sha256="0f4d289aecb3d5f7329d51f1a72ab10c04c336b25481a40d6d841120721be485",
when="@1.3.4 platform=darwin",
)
+ build_system(
+ conditional("cmake", when="@1.3.4:"),
+ conditional("generic", when="@1.3.2 platform=windows"),
+ "autotools",
+ default="autotools",
+ )
+
+
+class GenericBuilder(GenericBuilder):
+ phases = ["build", "install"]
+
+ def is_64bit(self):
+ return "64" in self.pkg.spec.target.family
+
+ def build(self, spec, prefix):
+ if spec.satisfies("%msvc"):
+ plat_tools = self.pkg.compiler.msvc_version
+ else:
+ raise RuntimeError("Package does not support non MSVC compilers on Windows")
+ ms_build_args = ["libogg_static.vcxproj", "/p:PlatformToolset=v%s" % plat_tools]
+ msbuild(*ms_build_args)
+
+ def install(self, spec, prefix):
+ mkdirp(prefix.include.ogg)
+ mkdirp(prefix.lib)
+ mkdirp(prefix.share)
+ install(
+ os.path.join(self.pkg.stage.source_path, "include", "ogg", "*.h"), prefix.include.ogg
+ )
+ plat_prefix = "x64" if self.is_64bit() else "x86"
+ install(os.path.join(plat_prefix, "Debug", "*.lib"), prefix.lib)
+ install_tree(os.path.join(self.pkg.stage.source_path, "doc"), prefix.share)
diff --git a/var/spack/repos/builtin/packages/libtheora/libtheora-inc-external-ogg.patch b/var/spack/repos/builtin/packages/libtheora/libtheora-inc-external-ogg.patch
new file mode 100644
index 00000000000..fd88480e7c4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/libtheora/libtheora-inc-external-ogg.patch
@@ -0,0 +1,35 @@
+diff --git a/win32/VS2008/libogg.vsprops b/win32/VS2008/libogg.vsprops
+index 1355b50..8b3c5b8 100644
+--- a/win32/VS2008/libogg.vsprops
++++ b/win32/VS2008/libogg.vsprops
+@@ -6,11 +6,11 @@
+ >
+
+
+