NASM package: fix install on Windows (#29905)
* Don't rely on NASM's nmake to export install target. Spack now handles NASM installation; the install tree structure mimics NASM Windows installer behavior. * Add dependency on perl
This commit is contained in:
parent
ce0346abd9
commit
2d3a613128
1 changed files with 25 additions and 1 deletions
|
@ -2,6 +2,9 @@
|
|||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import glob
|
||||
import os
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
|
@ -28,6 +31,8 @@ class Nasm(Package):
|
|||
conflicts('%intel@:14', when='@2.14:',
|
||||
msg="Intel 14 has immature C11 support")
|
||||
|
||||
depends_on('perl', when='platform=windows')
|
||||
|
||||
def patch(self):
|
||||
# Remove flags not recognized by the NVIDIA compiler
|
||||
if self.spec.satisfies('%nvhpc@:20.11'):
|
||||
|
@ -43,7 +48,26 @@ def install(self, spec, prefix):
|
|||
make('install')
|
||||
|
||||
@when('platform=windows')
|
||||
def build(self, spec, prefix):
|
||||
def install(self, spec, prefix):
|
||||
with working_dir(self.stage.source_path, create=True):
|
||||
# build NASM with nmake
|
||||
touch('asm\\warnings.time')
|
||||
nmake('/f', 'Mkfiles\\msvc.mak')
|
||||
|
||||
# install manually because the nmake file defines
|
||||
# no install target
|
||||
# This install tree schema mimics the pattern established
|
||||
# by the NASM windows installer
|
||||
build_dir = self.stage.source_path
|
||||
rdoff_dir = os.path.join(build_dir, 'rdoff')
|
||||
binaries = glob.glob(os.path.join(build_dir, "*.exe"))
|
||||
rdoff = glob.glob(os.path.join(rdoff_dir, "*.exe"))
|
||||
rdoff.extend(glob.glob(os.path.join(rdoff_dir, "*.lib")))
|
||||
|
||||
for file in binaries:
|
||||
install(file, self.prefix)
|
||||
|
||||
os.makedirs(self.prefix.rdoff)
|
||||
|
||||
for file in rdoff:
|
||||
install(file, self.prefix.rdoff)
|
||||
|
|
Loading…
Reference in a new issue