# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *


class Primer3(MakefilePackage):
    """Primer3 is a widely used program for designing PCR primers
       (PCR = "Polymerase Chain Reaction"). PCR is an essential and
       ubiquitous tool in genetics and molecular biology. Primer3
       can also design hybridization probes and sequencing primers."""

    homepage = "http://primer3.sourceforge.net/"
    url      = "https://sourceforge.net/projects/primer3/files/primer3/2.3.7/primer3-2.3.7.tar.gz/download"

    version('2.3.7', sha256='9e37a301d2ca9e5034c9a9d4afcb3e90041f6cc44c658b63598d0ccfcb176e5e')

    build_directory = 'src'

    def install(self, spec, prefix):
        with working_dir(self.build_directory):
            mkdirp(prefix.bin)
            for binary in ('primer3_core', 'ntdpal', 'oligotm',
                           'long_seq_tm_test'):
                install(binary, prefix.bin)

@@ -537,16 +537,17 @@
  = %22http
+s
 ://prime
@@ -549,31 +549,19 @@
 primer3.
-sourceforge.net
+org
 /%22%0A    u
@@ -583,40 +583,26 @@
 s://
-sourceforge.net/projects
+github.com
 /primer3
 /fil
@@ -601,14 +601,12 @@
 mer3
-/files
+-org
 /pri
@@ -614,22 +614,17 @@
 er3/
-2.3.7/primer3-
+archive/v
 2.3.
@@ -635,17 +635,8 @@
 r.gz
-/download
 %22%0A%0A 
@@ -649,19 +649,19 @@
 sion('2.
-3.7
+5.0
 ', sha25
@@ -667,103 +667,727 @@
 56='
-9e37a301d2ca9e5034c9a9d4afcb3e90041f6cc44c658b63598d0ccfcb176e5e')%0A%0A    build_directory = 'src'
+7581e2fa3228ef0ee1ffa427b2aa0a18fc635d561208327471daf59d1b804da0')%0A    version('2.3.7', sha256='f7ac3e64dc89b7c80882bf0f52c2c0a58572f5fdafd178680d4a7ae91b6c465b')%0A%0A    build_directory = 'src'%0A%0A    # Prior to May 15, 2018, the code contained invalid pointer/int%0A    # comparisons, leading to compilers that default to strict mode%0A    # failing to compile thal.c.%0A    # This prevents building 2.3.7 w/ gcc@8.4.0.  Details here:%0A    # https://github.com/primer3-org/primer3/issues/2%0A    # https://github.com/primer3-org/primer3/issues/3%0A    def patch(self):%0A        if self.spec.version == Version('2.3.7'):%0A            filter_file(r'%5E(CC_OPTS.*)', r'%5C1 -fpermissive',%0A                        join_path('src', 'Makefile'))
 %0A%0A  

move to github, add 2.5.0, fix 2.3.7 (#15958)