# $Id: Portfile 88435 2012-01-02 10:15:05Z ryandesign@macports.org $

PortSystem          1.0
name                msieve
version             1.45
categories          math
maintainers         nomaintainer
description         A library for factoring large integers
long_description    ${description}

platforms           darwin

homepage            http://www.boo.net/~jasonp/qs.html
master_sites        sourceforge:project/msieve/msieve/Msieve%20v${version}
distname            ${name}[strsed ${version} {g/\.//}]
worksrcdir          ${name}-${version}

checksums           md5     12fdbc862ca53550763b87d6f0956a87 \
                    sha1    0059e518371f8127415ff664a30845ad60388232 \
                    rmd160  7f0456d992a58670c345e3e8daf751b1a80025f0

depends_lib         port:gmp

patchfiles          patch-Makefile

post-patch {
    reinplace "s|@CC@|${configure.cc}|g" ${worksrcpath}/Makefile
}

use_configure       no

build.args          CPPFLAGS="${configure.cppflags}" \
                    LDFLAGS="${configure.ldflags}" \
                    MACHINE_FLAGS="${configure.cc_archflags}"

switch ${build_arch} {
    i386 {
        build.target x86
    }
    x86_64 {
        build.target x86_64
    }
    default {
        build.target generic
    }
}

destroot {
   xinstall -m 755 -d ${destroot}${prefix}/include/msieve \
      ${destroot}${prefix}/share/doc/${name}
   xinstall -m 755 ${worksrcpath}/msieve ${destroot}${prefix}/bin
   xinstall -m 644 ${worksrcpath}/libmsieve.a ${destroot}${prefix}/lib
   eval xinstall -m 644 [glob ${worksrcpath}/include/*] \
      ${destroot}${prefix}/include/msieve
   xinstall -m 644 -W ${worksrcpath} Readme Readme.qs Readme.nfs \
      ${destroot}${prefix}/share/doc/${name}
}

livecheck.type      regex
livecheck.url       http://sourceforge.net/projects/${name}/files/
livecheck.regex     {Msieve v([0-9.]+)}
