# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 106704 2013-06-05 19:49:03Z cal@macports.org $

PortSystem          1.0

name                dex2jar
version             0.0.9.15
maintainers         cal openmaintainer

categories          java devel
description         Tools to work with android .dex and java .class files
long_description    dex2jar contains 4 components:\n\
    - dex-reader is designed to read the Dalvik Executable (.dex/.odex) format.\
      It has a lightweight API similar with ASM.\n\
    - dex-translator is designed to do the convert job. It reads the dex\
      instruction to dex-ir format, after some optimization, and converts to ASM\
      format.\n\
    - dex-ir used by dex-translator, is designed to represent the dex\
      instruction.\n\
    - dex-tools is a set of tools to work with .class files, e.g., to modify an\
      apk or de-obfuscate a jar.

platforms           darwin
supported_archs     noarch

license             Apache-2 BSD

homepage            http://code.google.com/p/dex2jar/
master_sites        googlecode
use_zip             yes

checksums           rmd160  fccaa317fd890e78344f19da96dd02008c845bb2 \
                    sha256  a5d1320e0f53498dd947c369f7a1bc1cbc1a94dd921c56e3075f86f5b01ae720

patchfiles          patch-adjust-classpath.diff
post-patch {
    eval reinplace -W ${worksrcpath} "s#@@PREFIX@@#${prefix}#g" [glob -directory ${worksrcpath} *.sh]
}

use_configure       no
build               {}
destroot {
    xinstall -m 0755 -W ${worksrcpath} \
        d2j-apk-sign.sh d2j-asm-verify.sh d2j-decrpyt-string.sh d2j-dex-asmifier.sh \
        d2j-dex-dump.sh d2j-dex2jar.sh d2j-init-deobf.sh d2j-jar-access.sh d2j-jar-remap.sh \
        d2j-jar2dex.sh d2j-jar2jasmin.sh d2j-jasmin2jar.sh dex-dump.sh dex2jar.sh \
        ${destroot}${prefix}/bin
    xinstall -m 0755 -d ${destroot}${prefix}/lib/dex2jar
    eval xinstall -m 0644 -W ${worksrcpath}/lib \
        [glob -directory ${worksrcpath}/lib *] \
        ${destroot}${prefix}/lib/dex2jar
}
