from spack import *

class Openssl(Package):
    """The OpenSSL Project is a collaborative effort to develop a
       robust, commercial-grade, full-featured, and Open Source
       toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
       Transport Layer Security (TLS v1) protocols as well as a
       full-strength general purpose cryptography library."""
    homepage = "http://www.openssl.org"
    url      = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"

    version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
    version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a')
    version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5')

    depends_on("zlib")
    parallel = False

    def install(self, spec, prefix):
        config = Executable("./config")
        config("--prefix=%s" % prefix,
               "--openssldir=%s/etc/openssl" % prefix,
               "zlib",
               "no-krb5",
               "shared")

        make()
        make("install")

from spack import *

class Openssl(Package):
    """The OpenSSL Project is a collaborative effort to develop a
       robust, commercial-grade, full-featured, and Open Source
       toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
       Transport Layer Security (TLS v1) protocols as well as a
       full-strength general purpose cryptography library."""
    homepage = "http://www.openssl.org"
    url      = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"

    version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
    version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a')
    version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5')

    depends_on("zlib")
    parallel = False

    def install(self, spec, prefix):
        if spec.satisfies("=darwin-x86_64"):
            perl = which('perl')
            perl("./Configure",
                 "--prefix=%s" % prefix,
                 "--openssldir=%s/etc/openssl" % prefix,
                 "zlib",
                 "no-krb5",
                 "shared",
                 "darwin64-x86_64-cc")
            perl('-pi', '-e', 's/-arch x86_64//g', 'Makefile')
        else:
            exit(1)
            config = Executable("./config")
            config("--prefix=%s" % prefix,
                   "--openssldir=%s/etc/openssl" % prefix,
                   "zlib",
                   "no-krb5",
                   "shared")

        make()
        make("install")

Make OpenSSL build on Darwin
Make OpenSSL build on Darwin

  from spack import *
  
  class Openssl(Package):
      """The OpenSSL Project is a collaborative effort to develop a
         robust, commercial-grade, full-featured, and Open Source
         toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
         Transport Layer Security (TLS v1) protocols as well as a
         full-strength general purpose cryptography library."""
      homepage = "http://www.openssl.org"
      url      = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"
  
      version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
      version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a')
      version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5')
  
      depends_on("zlib")
      parallel = False
  
      def install(self, spec, prefix):
-         config = Executable("./config")
+         if spec.satisfies("=darwin-x86_64"):
+             perl = which('perl')
+             perl("./Configure",
-         config("--prefix=%s" % prefix,
+                  "--prefix=%s" % prefix,
-                "--openssldir=%s/etc/openssl" % prefix,
+                  "--openssldir=%s/etc/openssl" % prefix,
-                "zlib",
+                  "zlib",
-                "no-krb5",
+                  "no-krb5",
+                  "shared",
+                  "darwin64-x86_64-cc")
+             perl('-pi', '-e', 's/-arch x86_64//g', 'Makefile')
+         else:
+             exit(1)
+             config = Executable("./config")
+             config("--prefix=%s" % prefix,
+                    "--openssldir=%s/etc/openssl" % prefix,
+                    "zlib",
+                    "no-krb5",
-                "shared")
+                    "shared")
  
          make()
          make("install")
  
Make OpenSSL build on Darwin
## Code Before:
from spack import *

class Openssl(Package):
    """The OpenSSL Project is a collaborative effort to develop a
       robust, commercial-grade, full-featured, and Open Source
       toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
       Transport Layer Security (TLS v1) protocols as well as a
       full-strength general purpose cryptography library."""
    homepage = "http://www.openssl.org"
    url      = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"

    version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
    version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a')
    version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5')

    depends_on("zlib")
    parallel = False

    def install(self, spec, prefix):
        config = Executable("./config")
        config("--prefix=%s" % prefix,
               "--openssldir=%s/etc/openssl" % prefix,
               "zlib",
               "no-krb5",
               "shared")

        make()
        make("install")

## Instruction:
Make OpenSSL build on Darwin
## Code After:
from spack import *

class Openssl(Package):
    """The OpenSSL Project is a collaborative effort to develop a
       robust, commercial-grade, full-featured, and Open Source
       toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
       Transport Layer Security (TLS v1) protocols as well as a
       full-strength general purpose cryptography library."""
    homepage = "http://www.openssl.org"
    url      = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"

    version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
    version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a')
    version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5')

    depends_on("zlib")
    parallel = False

    def install(self, spec, prefix):
        if spec.satisfies("=darwin-x86_64"):
            perl = which('perl')
            perl("./Configure",
                 "--prefix=%s" % prefix,
                 "--openssldir=%s/etc/openssl" % prefix,
                 "zlib",
                 "no-krb5",
                 "shared",
                 "darwin64-x86_64-cc")
            perl('-pi', '-e', 's/-arch x86_64//g', 'Makefile')
        else:
            exit(1)
            config = Executable("./config")
            config("--prefix=%s" % prefix,
                   "--openssldir=%s/etc/openssl" % prefix,
                   "zlib",
                   "no-krb5",
                   "shared")

        make()
        make("install")
