# -*- 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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        macosforge darwinbuild 37 darwinbuild-
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
categories          devel
maintainers         nomaintainer
license             BSD
description         Darwinbuild is a set of tools that facilitate building the sources \
                    released by Apple.

long_description    The Darwin Build Scripts are a collection of tools that assist compilation of \
                    the many projects contained in Darwin, the open source base of Apple's \
                    Mac OS X operating system.  Apple publishes the sources of these projects \
                    in an archive format (.tar.gz).  An archive is published for each project \
                    version on Apple's site. These tools will provide the proper build environment \
                    as well as help to resolve any necessary dependencies prior to building.

homepage            https://macosforge.github.io/darwinbuild/

checksums           rmd160  07fc93baeb10209b21d9aff843877556ba8b8f4f \
                    sha256  2bb2e1458b6b9e3e6a189fb48e3cc0b72b7cb253607366b9ab6b92cdbac1e62b

# fix a 64 -> 32 bit implicit integer cast
patchfiles-append   patch-darwinxref-plugins-register-64bit.diff

depends_lib-append  port:sqlite3 \
                    port:tcl

xcode.configuration Public
xcode.target        world
xcode.build.settings \
                    PREFIX=${prefix} \
                    GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS=NO
xcode.destroot.settings \
                    PREFIX=${prefix} \
                    GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS=NO \
                    LIBRARY_SEARCH_PATHS=${prefix}/lib \
                    HEADER_SEARCH_PATHS=${prefix}/include \
                    FRAMEWORK_SEARCH_PATHS=${frameworks_dir}
xcode.destroot.type none

default_variants    +universal

variant universal {
    set xcode.universal.settings ""
    set xcode.universal.sdk ""
}

if {${os.major} < 10} {
    known_fail      yes
    pre-fetch {
        return -code error "For Darwin 8 & 9 support, install the darwinbuild-legacy port."
    }
}
pre-fetch {
    if {![variant_isset universal]} {
        return -code error "You must install ${name} with the universal variant.\
                    Try running `port install ${name} +universal` "
    }
}

platform darwin 9 {
    replaced_by     darwinbuild-legacy
}

platform darwin 8 {
    replaced_by     darwinbuild-legacy
}
