from spack import *

class Mrnet(Package):
    """The MRNet Multi-Cast Reduction Network."""
    homepage = "http://paradyn.org/mrnet"
    url      = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"

    version('4.0.0', 'd00301c078cba57ef68613be32ceea2f')
    version('4.1.0', '5a248298b395b329e2371bf25366115c')

    parallel = False

    depends_on("boost")

    def install(self, spec, prefix):
        configure("--prefix=%s" %prefix, "--enable-shared")

        make()
        make("install")


from spack import *

class Mrnet(Package):
    """The MRNet Multi-Cast Reduction Network."""
    homepage = "http://paradyn.org/mrnet"
    url      = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"

    version('4.0.0', 'd00301c078cba57ef68613be32ceea2f')
    version('4.1.0', '5a248298b395b329e2371bf25366115c')

    variant('krelloptions', default=False, description="Also build the MRNet LW threadsafe libraries")
    parallel = False

    depends_on("boost")

    def install(self, spec, prefix):
        # Build the MRNet LW thread safe libraries when the krelloptions variant is present
        if '+krelloptions' in spec:
           configure("--prefix=%s" %prefix, "--enable-shared", "--enable-ltwt-threadsafe")
        else:
           configure("--prefix=%s" %prefix, "--enable-shared")

        make()
        make("install")


Add krelloptions variant that is used to turn on a configuration option to build the thread safe lightweight libraries.
Add krelloptions variant that is used to turn on a configuration option to build the thread safe lightweight libraries.

  from spack import *
  
  class Mrnet(Package):
      """The MRNet Multi-Cast Reduction Network."""
      homepage = "http://paradyn.org/mrnet"
      url      = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"
  
      version('4.0.0', 'd00301c078cba57ef68613be32ceea2f')
      version('4.1.0', '5a248298b395b329e2371bf25366115c')
  
+     variant('krelloptions', default=False, description="Also build the MRNet LW threadsafe libraries")
      parallel = False
  
      depends_on("boost")
  
      def install(self, spec, prefix):
+         # Build the MRNet LW thread safe libraries when the krelloptions variant is present
+         if '+krelloptions' in spec:
+            configure("--prefix=%s" %prefix, "--enable-shared", "--enable-ltwt-threadsafe")
+         else:
-         configure("--prefix=%s" %prefix, "--enable-shared")
+            configure("--prefix=%s" %prefix, "--enable-shared")
  
          make()
          make("install")
  
  
Add krelloptions variant that is used to turn on a configuration option to build the thread safe lightweight libraries.
## Code Before:
from spack import *

class Mrnet(Package):
    """The MRNet Multi-Cast Reduction Network."""
    homepage = "http://paradyn.org/mrnet"
    url      = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"

    version('4.0.0', 'd00301c078cba57ef68613be32ceea2f')
    version('4.1.0', '5a248298b395b329e2371bf25366115c')

    parallel = False

    depends_on("boost")

    def install(self, spec, prefix):
        configure("--prefix=%s" %prefix, "--enable-shared")

        make()
        make("install")


## Instruction:
Add krelloptions variant that is used to turn on a configuration option to build the thread safe lightweight libraries.
## Code After:
from spack import *

class Mrnet(Package):
    """The MRNet Multi-Cast Reduction Network."""
    homepage = "http://paradyn.org/mrnet"
    url      = "ftp://ftp.cs.wisc.edu/paradyn/mrnet/mrnet_4.0.0.tar.gz"

    version('4.0.0', 'd00301c078cba57ef68613be32ceea2f')
    version('4.1.0', '5a248298b395b329e2371bf25366115c')

    variant('krelloptions', default=False, description="Also build the MRNet LW threadsafe libraries")
    parallel = False

    depends_on("boost")

    def install(self, spec, prefix):
        # Build the MRNet LW thread safe libraries when the krelloptions variant is present
        if '+krelloptions' in spec:
           configure("--prefix=%s" %prefix, "--enable-shared", "--enable-ltwt-threadsafe")
        else:
           configure("--prefix=%s" %prefix, "--enable-shared")

        make()
        make("install")

