aboutsummaryrefslogtreecommitdiffstats
path: root/lang/crystal/Makefile
blob: f338eb4649355892e6eda2b666bd7d424493f2e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# $FreeBSD$

PORTNAME=       crystal
DISTVERSIONPREFIX=  v
DISTVERSION=        0.24.1
PORTREVISION=       2
CATEGORIES=     lang
MASTER_SITES=       https://unrelentingtech.s3.dualstack.eu-west-1.amazonaws.com/crystal/:bootstrap
DISTFILES=      ${BOOTSTRAP_PATH}:bootstrap
DIST_SUBDIR=        ${PORTNAME}
EXTRACT_ONLY=       ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= greg@unrelenting.technology
COMMENT=    Language with Ruby-like syntax and static type checking

LICENSE=    APACHE20

ONLY_FOR_ARCHS= amd64
ONLY_FOR_ARCHS_REASON=  requires prebuilt bootstrap compiler

LIB_DEPENDS=    libgc-threaded.so:devel/boehm-gc-threaded \
        libevent.so:devel/libevent \
        libpcre.so:devel/pcre \
        libLLVM-${LLVM_VERSION:C/([1-9])([0-9])/\1.\2/}.so:devel/llvm${LLVM_VERSION}
BUILD_DEPENDS=  ${LOCALBASE}/bin/llvm-config${LLVM_VERSION}:devel/llvm${LLVM_VERSION}

USES=       compiler gmake pkgconfig
LLVM_VERSION=   50

USE_GITHUB= yes
GH_ACCOUNT= crystal-lang

MAKE_ARGS=  SHELL=sh \
        LLVM_CONFIG="${LOCALBASE}/bin/llvm-config${LLVM_VERSION}" \
        FLAGS="--release --no-debug --progress" \
        EXPORTS='CRYSTAL_CONFIG_PATH="lib:${PREFIX}/lib/${PORTNAME}"' \
        CRYSTAL_CACHE_DIR="${WRKDIR}/cache"

PORTDOCS=   *
PORTEXAMPLES=   *

OPTIONS_DEFINE=     DOCS EXAMPLES BASH ZSH
OPTIONS_DEFAULT=    DOCS EXAMPLES BASH ZSH
OPTIONS_SUB=        yes

.include <bsd.port.options.mk>

.if ${OSVERSION} >= 1200000
BOOTSTRAP_PATH= crystal-0.24.1-freebsd12.0-2
.else
BOOTSTRAP_PATH= crystal-0.24.1-freebsd11.1-2
.endif
.if ${OSVERSION} < 1100000
IGNORE=     not supported on 10.x or older
.endif
.if ${OPSYS} != FreeBSD
IGNORE=     not supported on anything but FreeBSD
.endif

post-extract:
    ${MKDIR} ${WRKSRC}/.build
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/${BOOTSTRAP_PATH} ${WRKSRC}/.build/crystal
    ${CHMOD} +x ${WRKSRC}/.build/crystal

post-patch:
    ${LN} -s x86_64-portbld-freebsd ${WRKSRC}/src/lib_c/x86_64-unknown-freebsd

do-build-DOCS-on:
    cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} docs \
            CRYSTAL_CACHE_DIR="${WRKDIR}/cache"

do-install:
    ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/.build/crystal ${STAGEDIR}${PREFIX}/bin/
    ${INSTALL_MAN} ${INSTALL_WRKSRC}/man/crystal.1 ${STAGEDIR}${MANPREFIX}/man/man1/
    (cd ${INSTALL_WRKSRC}/src && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/lib/${PORTNAME})

do-install-DOCS-on:
    (cd ${INSTALL_WRKSRC}/docs && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})

do-install-EXAMPLES-on:
    (cd ${INSTALL_WRKSRC}/samples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})

do-install-BASH-on:
    ${MKDIR} ${STAGEDIR}${LOCALBASE}/etc/bash_completion.d
    ${INSTALL_DATA} ${INSTALL_WRKSRC}/etc/completion.bash \
            ${STAGEDIR}${LOCALBASE}/etc/bash_completion.d/_crystal.bash

do-install-ZSH-on:
    ${MKDIR} ${STAGEDIR}${LOCALBASE}/share/zsh/site-functions
    ${INSTALL_DATA} ${INSTALL_WRKSRC}/etc/completion.zsh \
            ${STAGEDIR}${LOCALBASE}/share/zsh/site-functions/_crystal

.include <bsd.port.mk>