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

name                drupal8
version             8.4.0
categories          www php
license             GPL-2
platforms           darwin
supported_archs     noarch

maintainers         nomaintainer
description         Drupal Open Source enterprise content management platform
long_description    Drupal is Open Source social publishing software that \
    empowers individuals, teams, and communities to easily publish, manage and \
    organize a wide variety of content on a website. Tens of thousands of \
    people and organizations have used Drupal to power scores of different web \
    sites, including community web portals, corporate web sites, social \
    networking sites, personal web sites or blogs, and much more.

homepage            http://drupal.org
distname            drupal-${version}
master_sites        https://ftp.drupal.org/files/projects/ \
                    http://ftp.osuosl.org/pub/drupal/files/projects/

checksums           md5     074795a2f5fc0b599a7dcfb9d1fb03f5 \
                    sha1    289ad45ca0766edc78b8196b0fca98f54ee10a3f \
                    rmd160  ee818599848705fd03e09fff072669549495942e \
                    sha256  d6bd8182da6ab07c72557cc5cffe0a44ea2a8f8ab69831c6cd28d051e12e5013

depends_lib         port:apache2 \
                    port:php71 \
                    path:bin/mysql_config:mysql57 \
                    port:php71-gd \
                    port:php71-mbstring

variant apache22 description "use apache22 instead of apache2" {
    depends_lib-replace port:apache2 port:apache22
}

variant nginx description "use nginx instead of apache 2.x" {
    depends_lib-append      port:nginx \
                            port:php71-fpm
    depends_lib-delete      port:apache2

notes "
See: https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
for a configuration recipe.
"
}

variant sqlite conflicts postgresql description "use sqlite3 as the drupal database" {
    depends_lib-append      port:php71-sqlite
    depends_lib-delete      path:bin/mysql_config:mysql57
}

variant postgresql conflicts sqlite description "use postgresql as the drupal database" {
    depends_lib-append      port:postgresql96
    depends_lib-delete      path:bin/mysql_config:mysql57
}

worksrcdir          drupal-${version}
use_configure       no
build               {}

set docroot ${destroot}${prefix}/www/data

destroot {
    xinstall -d -m 0755 ${docroot}/drupal8
    file copy {*}[glob ${worksrcpath}/*] ${docroot}/drupal8
    file copy ${worksrcpath}/.htaccess ${docroot}/drupal8
}

livecheck.type  regex
livecheck.url   https://www.drupal.org/project/drupal
livecheck.regex "Drupal core (8.\[0-9.\].\[0-9.\])"