| 1 | # -*- 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 |
|---|
| 2 | # $Id: Portfile 149304 2016-06-10 14:19:18Z mps@macports.org $ |
|---|
| 3 | |
|---|
| 4 | PortSystem 1.0 |
|---|
| 5 | |
|---|
| 6 | name lua |
|---|
| 7 | conflicts lua50 |
|---|
| 8 | version 5.3.3 |
|---|
| 9 | categories lang |
|---|
| 10 | license MIT |
|---|
| 11 | platforms darwin |
|---|
| 12 | maintainers nomaintainer |
|---|
| 13 | description powerful, lightweight programming language |
|---|
| 14 | long_description Lua is a powerful, light-weight programming language designed for \ |
|---|
| 15 | extending applications. Lua is also frequently used as a general-purpose, \ |
|---|
| 16 | standalone language. |
|---|
| 17 | |
|---|
| 18 | homepage http://www.lua.org/ |
|---|
| 19 | master_sites ${homepage}ftp/ |
|---|
| 20 | |
|---|
| 21 | checksums rmd160 c4989f7ae83c61f745fc174f7953c4c601fdc5de \ |
|---|
| 22 | sha256 5113c06884f7de453ce57702abaac1d618307f33f6789fa870e87a59d772aca2 |
|---|
| 23 | |
|---|
| 24 | patchfiles patch-Makefile.diff \ |
|---|
| 25 | patch-src-Makefile.diff \ |
|---|
| 26 | patch-src-luaconf.h.diff |
|---|
| 27 | |
|---|
| 28 | # TODO: also add lua50 and lua51 here |
|---|
| 29 | subport lua52 { |
|---|
| 30 | version 5.2.3 |
|---|
| 31 | revision 0 |
|---|
| 32 | checksums rmd160 b8714669c8c0f8272104effd8a9675921ddb2fa5 \ |
|---|
| 33 | sha256 13c2fb97961381f7d06d5b5cea55b743c163800896fd5c5e2356201d3619002d |
|---|
| 34 | |
|---|
| 35 | patchfiles patch-Makefile-52.diff \ |
|---|
| 36 | patch-src-Makefile-52.diff \ |
|---|
| 37 | patch-src-luaconf.h-52.diff |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | set branch [join [lrange [split ${version} .] 0 1] .] |
|---|
| 41 | |
|---|
| 42 | depends_lib port:readline |
|---|
| 43 | build.target macosx |
|---|
| 44 | |
|---|
| 45 | test.run yes |
|---|
| 46 | test.env DYLD_LIBRARY_PATH=./lib |
|---|
| 47 | |
|---|
| 48 | post-patch { |
|---|
| 49 | reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/lua.pc ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile ${worksrcpath}/src/luaconf.h |
|---|
| 50 | reinplace "s|@VERSION@|${version}|g" ${worksrcpath}/lua.pc ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile |
|---|
| 51 | reinplace "s|@BRANCH@|${branch}|g" ${worksrcpath}/lua.pc ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | configure { |
|---|
| 55 | reinplace -E "/^MYLDFLAGS=/s|\$| ${configure.ldflags} [get_canonical_archflags]|" ${worksrcpath}/src/Makefile |
|---|
| 56 | reinplace -E "/^CFLAGS=/s|\$| ${configure.cflags} ${configure.cppflags} [get_canonical_archflags]|" ${worksrcpath}/src/Makefile |
|---|
| 57 | reinplace "s|CC= .*\$|CC= ${configure.cc}|" ${worksrcpath}/src/Makefile |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | use_parallel_build no |
|---|
| 61 | |
|---|
| 62 | destroot.target install INSTALL_TOP=${destroot}${prefix} |
|---|
| 63 | post-destroot { |
|---|
| 64 | # documentation |
|---|
| 65 | set docdir ${prefix}/share/doc/${subport} |
|---|
| 66 | xinstall -d -m 0755 ${destroot}${docdir}/html |
|---|
| 67 | xinstall -m 0644 -W ${worksrcpath} COPYRIGHT README ${destroot}${docdir} |
|---|
| 68 | foreach html [glob ${worksrcpath}/doc/*.html ${worksrcpath}/doc/*.css ${worksrcpath}/doc/*.gif ${worksrcpath}/doc/*.png] { |
|---|
| 69 | xinstall -m 0644 ${html} ${destroot}${docdir}/html |
|---|
| 70 | } |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | if {$subport eq $name} { |
|---|
| 74 | post-extract { |
|---|
| 75 | xinstall -m 0644 -W ${filespath} COPYRIGHT lua.pc ${worksrcpath} |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | post-destroot { |
|---|
| 79 | xinstall -W ${worksrcpath} -m 0644 lua.pc ${destroot}${prefix}/lib/pkgconfig/ |
|---|
| 80 | } |
|---|
| 81 | } else { |
|---|
| 82 | post-extract { |
|---|
| 83 | xinstall -m 0644 -W ${filespath}/${branch} COPYRIGHT lua.pc ${worksrcpath} |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | post-destroot { |
|---|
| 87 | # version executable and man pages files |
|---|
| 88 | foreach f [glob ${destroot}${prefix}/bin/*] { |
|---|
| 89 | move $f ${f}${branch} |
|---|
| 90 | } |
|---|
| 91 | foreach f [glob ${destroot}${prefix}/share/man/man1/*] { |
|---|
| 92 | move $f [file rootname $f]-${branch}[file extension $f] |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | # install versioned pkgconfig file |
|---|
| 96 | xinstall -d -m 0755 ${destroot}${prefix}/lib/pkgconfig |
|---|
| 97 | xinstall -m 0644 ${worksrcpath}/lua.pc ${destroot}${prefix}/lib/pkgconfig/lua-${branch}.pc |
|---|
| 98 | } |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | # TODO: fixme (a different livecheck is needed for different subports) |
|---|
| 102 | livecheck.type regex |
|---|
| 103 | livecheck.url ${master_sites} |
|---|
| 104 | livecheck.regex {lua-(\d+(?:\.\d+)*)} |
|---|