aboutsummaryrefslogtreecommitdiffstats
path: root/lang/rubinius/Makefile
blob: 8184dbca03ae8893f77f9372c162667c0f782dc6 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Created by: stas
# $FreeBSD$

PORTNAME=   rubinius
PORTVERSION=    2.2.9
CATEGORIES= lang
MASTER_SITES=   http://releases.rubini.us/

MAINTAINER= ashish@FreeBSD.org
COMMENT=    LLVM based ruby language implementation

LICENSE=    BSD3CLAUSE
LICENSE_FILE=   ${WRKSRC}/LICENSE

BUILD_DEPENDS=  ${LOCALBASE}/bin/bundle:${PORTSDIR}/sysutils/rubygem-bundler \
        ${LOCALBASE}/bin/llvm-config34:${PORTSDIR}/devel/llvm34 \
        ${LOCALBASE}/bin/bison:${PORTSDIR}/devel/bison

HAS_CONFIGURE=  yes
CONFIGURE_ARGS= -P "${PREFIX}" \
        -I "${PREFIX}/include/rubinius" \
        -L "${PREFIX}/lib/ruby/rubinius" \
        -G "${PREFIX}/lib/ruby/gems/rubinius" \
        -B "${PREFIX}/bin" \
        -M "${PREFIX}/man" \
        --cc ${CC} \
        --cxx ${CXX} \
        --no-bin-links \
        --llvm-config ${LOCALBASE}/bin/llvm-config34 \
        --sitedir "${PREFIX}/lib/ruby/site_ruby/rubinius" \
        --vendordir "${PREFIX}/lib/ruby/vendor_ruby/rubinius" \
        --stagingdir "${STAGEDIR}${PREFIX}" --with-execinfo

USE_BZIP2=  yes
USES=       perl5 gmake
USE_RUBY=   yes
RUBY_NO_RUN_DEPENDS=    yes
USE_PERL5=  build
NO_INSTALL= yes
PLIST_SUB+= FREEBSD_DIR=${FREEBSD_DIR}
GEM_PATH=   ${WRKSRC}/gems/ruby/${RUBY_VER}
RAKE_BIN=   ${GEM_PATH}/bin/rake

# Hack to prevent rbx from creating $HOME/.rbx during compilation of gems
MAKE_ENV+=  HOME=${WRKSRC}

# Hack to switch to a local gem path so locally activated rake can be used
MAKE_ENV+=  GEM_PATH=${GEM_PATH}

# Hack to build under a UTF-8 locale
MAKE_ENV+=  LANG=en_US.UTF-8

F_OS=       ${OPSYS:tl}
F_MAJOR=    ${OSREL:C/\..*$//}
FREEBSD_DIR=    ${F_ARCH}-${F_OS}-${F_MAJOR}

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 1000000
LIB_DEPENDS+=       libexecinfo.so:${PORTSDIR}/devel/libexecinfo
CONFIGURE_ARGS+=    --with-opt-dir "${LOCALBASE}"
.endif

.if ${ARCH} == "sparc64"
BROKEN=     Does not compile on sparc64
.elif ${ARCH} == "amd64"
F_ARCH=     x86_64
.elif ${ARCH} == "i386"
F_ARCH=     x86
.endif

post-patch:
    @${GREP} -Rl '#!.*ruby$$'  ${WRKSRC} |${XARGS} ${REINPLACE_CMD} -e '/^#!.*ruby$$/s/ruby$$/${RUBY_NAME}/g'

pre-configure:
    @cd ${WRKSRC} && ${MKDIR} gems && ${LOCALBASE}/bin/bundle install --local --path=${WRKSRC}/gems

do-build:
    # "build" target here installs into ${STAGEDIR}${PREFIX}
    @(cd ${WRKSRC}/; ${SETENV} ${MAKE_ENV} ${RAKE_BIN} -j ${MAKE_JOBS_NUMBER} build)
    @${MKDIR} ${STAGEDIR}${PREFIX}/lib/ruby/site_ruby/rubinius
    @${MKDIR} ${STAGEDIR}${PREFIX}/lib/ruby/vendor_ruby/rubinius
    @${TOUCH} ${STAGEDIR}${PREFIX}/lib/ruby/site_ruby/rubinius/.keep_me
    @${TOUCH} ${STAGEDIR}${PREFIX}/lib/ruby/vendor_ruby/rubinius/.keep_me
    @${MV} ${STAGEDIR}${PREFIX}/bin/testrb ${STAGEDIR}${PREFIX}/bin/testrbx

plist:
    @truncate -s0 pkg-plist
    @${ECHO_CMD} "bin/rbx" >> pkg-plist
#
# Includes
#
    @${FIND} -ds ${STAGEDIR}${PREFIX}/include/rubinius ! -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/include/rubinius -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,@dirrm ,' >> pkg-plist
#
# Libs
#
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/rubinius ! -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/rubinius -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,@dirrm ,' >> pkg-plist
#
# Kernel and Runtime
#
    @${FIND} -ds ${STAGEDIR}${PREFIX}/rubinius ! -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/rubinius -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,@dirrm ,' >> pkg-plist
#
# Gems
#
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/gems/rubinius ! -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/gems/rubinius -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,@dirrm ,' >> pkg-plist
#
# Site libs and vendor libs
#
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/site_ruby/rubinius ! -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/site_ruby/rubinius -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,@dirrm ,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/vendor_ruby/rubinius ! -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,,' >> pkg-plist
    @${FIND} -ds ${STAGEDIR}${PREFIX}/lib/ruby/vendor_ruby/rubinius -type d | \
        ${SED} 's,^${STAGEDIR}${PREFIX}/*,@dirrm ,' >> pkg-plist
#
# Shared dirs
#
    @${ECHO_CMD} "@dirrmtry lib/ruby/site_ruby" >> pkg-plist
    @${ECHO_CMD} "@dirrmtry lib/ruby/vendor_ruby" >> pkg-plist
    @${ECHO_CMD} "@dirrmtry lib/ruby/gems" >> pkg-plist
    @${ECHO_CMD} "@dirrmtry lib/ruby" >> pkg-plist

.include <bsd.port.post.mk>