def METHOD_NAME(self, spec, prefix):
    scalapack = spec["scalapack"].libs
    lapack = spec["lapack"].libs
    blas = spec["blas"].libs
    fftw = spec["fftw-api:double,float"].libs
    # see https://nwchemgit.github.io/Compiling-NWChem.html
    args = []
    args.extend(
        [
            "NWCHEM_TOP=%s" % self.stage.source_path,
            # NWCHEM is picky about FC and CC. They should NOT be full path.
            # see https://nwchemgit.github.io/Special_AWCforum/sp/id7524
            "CC=%s" % os.path.basename(spack_cc),
            "FC=%s" % os.path.basename(spack_fc),
            "USE_MPI=y",
            "PYTHONVERSION=%s" % spec["python"].version.up_to(2),
            "BLASOPT=%s" % ((lapack + blas).ld_flags),
            "LAPACK_LIB=%s" % lapack.ld_flags,
            "SCALAPACK_LIB=%s" % scalapack.ld_flags,
            "USE_NOIO=Y",  # skip I/O algorithms
            "MRCC_METHODS=y",  # TCE extra module
            "IPCCSD=y",  # TCE extra module
            "EACCSD=y",  # TCE extra module
            "V=1",  # verbose build
        ]
    )
    if self.spec.satisfies("@7.2.0:"):
        args.extend(["NWCHEM_MODULES=all python gwmol"])
        args.extend(["USE_HWOPT=n"])
    else:
        args.extend(["NWCHEM_MODULES=all python"])
        # archspec flags are injected through the compiler wrapper
        filter_file("(-mtune=native|-mcpu=native|-xHost)", "", "src/config/makefile.h")
    # TODO: query if blas/lapack/scalapack uses 64bit Ints
    # A flag to distinguish between 32bit and 64bit integers in linear
    # algebra (Blas, Lapack, Scalapack)
    use_32_bit_lin_alg = True
    if use_32_bit_lin_alg:
        args.extend(["USE_64TO32=y", "BLAS_SIZE=4", "SCALAPACK_SIZE=4"])
    else:
        args.extend(["BLAS_SIZE=8", "SCALAPACK_SIZE=8"])
    if sys.platform == "darwin":
        target = "MACX64"
        args.extend(["CFLAGS_FORGA=-DMPICH_NO_ATTR_TYPE_TAGS"])
    else:
        target = "LINUX64"
    args.extend(["NWCHEM_TARGET=%s" % target])
    if "+openmp" in spec:
        args.extend(["USE_OPENMP=y"])
    if "+mpipr" in spec:
        args.extend(["ARMCI_NETWORK=MPI-PR"])
    if "+fftw3" in spec:
        args.extend(["USE_FFTW3=y"])
        args.extend(["LIBFFTW3=%s" % fftw.ld_flags])
        args.extend(["FFTW3_INCLUDE={0}".format(spec["fftw-api"].prefix.include)])
    with working_dir("src"):
        make("nwchem_config", *args)
        if use_32_bit_lin_alg:
            make("64_to_32", *args)
        make(*args)
        #  need to install by hand. Follow Ubuntu:
        #  https://packages.ubuntu.com/trusty/all/nwchem-data/filelist
        #  https://packages.ubuntu.com/trusty/amd64/nwchem/filelist
        share_path = join_path(prefix, "share", "nwchem")
        mkdirp(prefix.bin)
        install_tree("data", share_path)
        install_tree(join_path("basis", "libraries"), join_path(share_path, "libraries"))
        install_tree(join_path("basis", "libraries.bse"), join_path(share_path, "libraries"))
        install_tree(join_path("nwpw", "libraryps"), join_path(share_path, "libraryps"))
        b_path = join_path(self.stage.source_path, "bin", target, "nwchem")
        chmod = which("chmod")
        chmod("+x", b_path)
        METHOD_NAME(b_path, prefix.bin)
        # Finally, make user's life easier by creating a .nwchemrc file
        # to point to the required data files.
        nwchemrc = """\