# $Id: Portfile 102253 2013-01-29 16:53:04Z jeremyhu@macports.org $

PortSystem 1.0

name            gnustep-make
version         2.6.1
categories      gnustep devel cross
platforms       darwin
license         GPL-3+
maintainers     nomaintainer
supported_archs noarch
installs_libs   no

homepage        http://www.gnustep.org/
description     GNUstep makefile package
long_description \
    The GNUstep makefile package is a simple, powerful and extensible way to \
    write makefiles for a GNUstep-based project.  It allows the user to \
    write a project without having to deal with the complex issues \
    associated with configuration, building, installation, and packaging. \
    It also allows the user to easily create cross-compiled binaries.

master_sites        gnustep:core

checksums           rmd160  a72970e1bf0fa93622981e991717714795cdb7a5 \
                    sha256  c48b0a4c85eee4799b12cceeb327c470b168100cbcda4f111b1edad71f8762eb

destroot.violate_mtree yes

compiler.blacklist  gcc-4.0

# TODO: base should do this: http://trac.macports.org/ticket/32542
if {[info exists portconfigure::compiler_name_map(${configure.compiler})]} {
    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})

    # base 2.1.x ignores the argument and just use ${configure.compiler}
    if {[portconfigure::arch_flag_supported ${configure.compiler}]} {
        depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
    }

    if {[string match macports-gcc* ${configure.compiler}]} {
        depends_lib-append port:$portconfigure::compiler_name_map(${configure.compiler})
    }
}

configure.args      CC=${configure.cc} \
                    --with-library-combo=gnu-gnu-gnu \
                    --with-objc-lib-flag=-lobjc-gnu

destroot.args       messages=yes

if {![variant_isset fhs_layout]} {
    default_variants    +gnustep_layout
}

# for the curious only, not really supported by MacPorts
variant fhs_layout conflicts gnustep_layout description {Use FHS layout (unsupported)} {
    configure.args-append   --with-layout=fhs \
                            --with-config-file=${prefix}/etc/GNUstep.conf
    post-patch {
        reinplace "s|=/man|=/share/man|g" \
            ${worksrcpath}/FilesystemLayouts/fhs
        reinplace "s|=/info|=/share/info|g" \
            ${worksrcpath}/FilesystemLayouts/fhs
    }
}

variant gnustep_layout conflicts fhs_layout description {Use standard GNUstep layout} {
    configure.pre_args      --prefix=${prefix}/GNUstep
    configure.args-append   \
        --with-config-file=${prefix}/GNUstep/System/Library/GNUstep.conf

    destroot.keepdirs       ${destroot}${prefix}/GNUstep/Local

        notes "\
##########################################################
To have a fully working GNUstep make system, please add
'. ${prefix}/GNUstep/share/GNUstep/Makefiles/GNUstep.sh'
to your shell login (in ~/.profile)

You may also want to set up your MANPATH :
export MANPATH=\$GNUSTEP_LOCAL_ROOT/Library/Documentation/man:\$GNUSTEP_SYSTEM_ROOT/Library/Documentation/man:${prefix}/share/man:/usr/share/man
##########################################################
"
}

platform darwin {
    post-patch {
        reinplace "s|/home|/Users|g" \
            ${worksrcpath}/FilesystemLayouts/gnustep \
            ${worksrcpath}/FilesystemLayouts/fhs
    }
}
