/
Portfile
112 lines (91 loc) · 4.06 KB
/
Portfile
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
# -*- 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 lua
conflicts lua50
version 5.3.5
revision 0
categories lang
license MIT
platforms darwin
maintainers nomaintainer
description powerful, lightweight programming language
long_description Lua is a powerful, light-weight programming language designed for \
extending applications. Lua is also frequently used as a general-purpose, \
standalone language.
homepage http://www.lua.org/
master_sites ${homepage}ftp/
checksums rmd160 f260c6f60139cb1464d87b5a7d9673e3f305f368 \
sha256 0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac \
size 303543
patchfiles patch-Makefile.diff \
patch-src-Makefile.diff \
patch-src-luaconf.h.diff
# TODO: fixme (a different livecheck is needed for different subports)
livecheck.type regex
livecheck.url ${master_sites}
livecheck.regex {lua-(\d+(?:\.\d+)*)}
# TODO: also add lua50 and lua51 here
subport lua52 {
version 5.2.4
revision 2
checksums rmd160 3bad2da85f354132da6a53b45882006f0a451b5c \
sha256 b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b
patchfiles patch-Makefile-52.diff \
patch-src-Makefile-52.diff \
patch-src-luaconf.h-52.diff
# this is needed only on lua52, to fix build in 10.4
# this patch is already in lua53+ and works on all tested systems
patchfiles-append \
patch-src-liolib-tiger.diff
livecheck.type none
}
set branch [join [lrange [split ${version} .] 0 1] .]
depends_lib port:readline
build.target macosx
test.run yes
test.env DYLD_LIBRARY_PATH=./lib
post-patch {
reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/lua.pc ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile ${worksrcpath}/src/luaconf.h
reinplace "s|@VERSION@|${version}|g" ${worksrcpath}/lua.pc ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile
reinplace "s|@BRANCH@|${branch}|g" ${worksrcpath}/lua.pc ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile
}
configure {
reinplace -E "/^MYLDFLAGS=/s|\$| ${configure.ldflags} [get_canonical_archflags]|" ${worksrcpath}/src/Makefile
reinplace -E "/^CFLAGS=/s|\$| ${configure.cflags} ${configure.cppflags} [get_canonical_archflags]|" ${worksrcpath}/src/Makefile
reinplace "s|CC= .*\$|CC= ${configure.cc}|" ${worksrcpath}/src/Makefile
}
use_parallel_build no
destroot.target install INSTALL_TOP=${destroot}${prefix}
post-destroot {
# documentation
set docdir ${prefix}/share/doc/${subport}
xinstall -d -m 0755 ${destroot}${docdir}/html
xinstall -m 0644 -W ${worksrcpath} COPYRIGHT README ${destroot}${docdir}
foreach html [glob ${worksrcpath}/doc/*.html ${worksrcpath}/doc/*.css ${worksrcpath}/doc/*.gif ${worksrcpath}/doc/*.png] {
xinstall -m 0644 ${html} ${destroot}${docdir}/html
}
}
if {$subport eq $name} {
post-extract {
xinstall -m 0644 -W ${filespath} COPYRIGHT lua.pc ${worksrcpath}
}
post-destroot {
xinstall -W ${worksrcpath} -m 0644 lua.pc ${destroot}${prefix}/lib/pkgconfig/
}
} else {
post-extract {
xinstall -m 0644 -W ${filespath}/${branch} COPYRIGHT lua.pc ${worksrcpath}
}
post-destroot {
# version executable and man pages files
foreach f [glob ${destroot}${prefix}/bin/*] {
move $f ${f}${branch}
}
foreach f [glob ${destroot}${prefix}/share/man/man1/*] {
move $f [file rootname $f]-${branch}[file extension $f]
}
# install versioned pkgconfig file
xinstall -d -m 0755 ${destroot}${prefix}/lib/pkgconfig
xinstall -m 0644 ${worksrcpath}/lua.pc ${destroot}${prefix}/lib/pkgconfig/lua-${branch}.pc
}
}