diff options
| author | William Ahern <william@25thandclement.com> | 2016-06-24 21:59:02 -0700 |
|---|---|---|
| committer | William Ahern <william@25thandclement.com> | 2016-06-24 21:59:02 -0700 |
| commit | d99465ce769657b6946190377cc8a5223f5e8261 (patch) | |
| tree | d4ff546c128543fbe97dc39c8fd8ac4d2f6a3a5a | |
| parent | 81bbb1fa5e14a1911cfd99f4ee791ed1e340602e (diff) | |
| download | luaossl-d99465ce769657b6946190377cc8a5223f5e8261.tar.gz luaossl-d99465ce769657b6946190377cc8a5223f5e8261.tar.bz2 luaossl-d99465ce769657b6946190377cc8a5223f5e8261.zip | |
upgrade luapath script
| -rwxr-xr-x | mk/luapath (renamed from mk/lua.path) | 513 | ||||
| -rw-r--r-- | src/GNUmakefile | 2 |
2 files changed, 344 insertions, 171 deletions
| @@ -26,10 +26,10 @@ | |||
| 26 | # Changelog: | 26 | # Changelog: |
| 27 | # | 27 | # |
| 28 | # * 2013-08-02 - Published. Derived from an earlier script, lua.path, | 28 | # * 2013-08-02 - Published. Derived from an earlier script, lua.path, |
| 29 | # written for the cqueues project. | 29 | # written for the cqueues project. |
| 30 | # | 30 | # |
| 31 | # * 2013-08-05 - Redirect stdin from /dev/null when probing so we don't | 31 | # * 2013-08-05 - Redirect stdin from /dev/null when probing so we don't |
| 32 | # freeze if a utility tries to read from stdin. | 32 | # freeze if a utility tries to read from stdin. |
| 33 | # | 33 | # |
| 34 | # chdir to a read-only directory by default to try to prevent creation | 34 | # chdir to a read-only directory by default to try to prevent creation |
| 35 | # of temporary files. These features address the issues of LuaTeX | 35 | # of temporary files. These features address the issues of LuaTeX |
| @@ -82,9 +82,31 @@ | |||
| 82 | # hardcode /usr/local/lib/lua/5.1, ordered before the LuaJIT | 82 | # hardcode /usr/local/lib/lua/5.1, ordered before the LuaJIT |
| 83 | # installation prefix. | 83 | # installation prefix. |
| 84 | # | 84 | # |
| 85 | # * 2015-07-14 - Add recursive glob function implemented in shell code | ||
| 86 | # and use instead of find(1). | ||
| 87 | # | ||
| 88 | # * 2016-03-18 - Fix bug in tryluac where a continue statement was used | ||
| 89 | # instead of return 0. | ||
| 90 | # | ||
| 91 | # * 2016-03-25 - Support ${CC} values with trailing flags, which invoke | ||
| 92 | # the compiler through env(1), or which otherwise are intended to | ||
| 93 | # expand as multiple words. | ||
| 94 | # | ||
| 95 | # OpenBSD 5.8 sh does not suppress strict errors within an eval | ||
| 96 | # invoked from an if condition compound-list. Workaround by changing | ||
| 97 | # trylua to return 0 on matching failure, like tryluainclude and | ||
| 98 | # tryluac do. | ||
| 99 | # | ||
| 100 | # Undeprecate ldir and cdir. The names are more intuitive and | ||
| 101 | # convenient as evidenced by the fact that I keep using them instead | ||
| 102 | # of package.path and package.cpath. Try to maintain backwards | ||
| 103 | # compatibility by using a simple heuristic to differentiate lua | ||
| 104 | # interpreter glob patterns from preferred install directory | ||
| 105 | # string.match expressions. | ||
| 106 | # | ||
| 85 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | 107 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| 86 | # | 108 | # |
| 87 | # Copyright (C) 2012-2015 William Ahern | 109 | # Copyright (C) 2012-2016 William Ahern |
| 88 | # | 110 | # |
| 89 | # Permission is hereby granted, free of charge, to any person obtaining a | 111 | # Permission is hereby granted, free of charge, to any person obtaining a |
| 90 | # copy of this software and associated documentation files (the "Software"), | 112 | # copy of this software and associated documentation files (the "Software"), |
| @@ -116,7 +138,7 @@ unset IFS # no field splitting surprises | |||
| 116 | unset LUA_PATH || true # interferes search for module install directory | 138 | unset LUA_PATH || true # interferes search for module install directory |
| 117 | unset LUA_CPATH || true | 139 | unset LUA_CPATH || true |
| 118 | 140 | ||
| 119 | MYVERSION=20150119 | 141 | MYVERSION=20160325 |
| 120 | MYVENDOR="william@25thandClement.com" | 142 | MYVENDOR="william@25thandClement.com" |
| 121 | 143 | ||
| 122 | 144 | ||
| @@ -129,8 +151,7 @@ LDDIRS= # -L directories from LDFLAGS | |||
| 129 | LIBDIRS= | 151 | LIBDIRS= |
| 130 | BINDIRS= | 152 | BINDIRS= |
| 131 | RECURSE=no | 153 | RECURSE=no |
| 132 | MAXDEPTH= # full command switch, like "-maxdepth 3", if supported | 154 | MAXDEPTH=5 # maximum recursion depth |
| 133 | XDEV= # do not cross device boundaries; i.e. "-xdev" | ||
| 134 | SHORTEST= # continue searching until shortest pathname found | 155 | SHORTEST= # continue searching until shortest pathname found |
| 135 | PKGCONFIG= # path to pkg-config, found by `command -v` when -k option invoked | 156 | PKGCONFIG= # path to pkg-config, found by `command -v` when -k option invoked |
| 136 | GLOB= # -e GLOB expression for lua, luac, ldir, and cdir | 157 | GLOB= # -e GLOB expression for lua, luac, ldir, and cdir |
| @@ -165,6 +186,27 @@ LUA_VER= | |||
| 165 | 186 | ||
| 166 | 187 | ||
| 167 | # | 188 | # |
| 189 | # warn FORMAT [...] | ||
| 190 | # | ||
| 191 | # Print message to original stderr. | ||
| 192 | # | ||
| 193 | exec 9>&2 | ||
| 194 | warn() { | ||
| 195 | printf "%s: %.0s${1}\n" "${0##*/}" "$@" >&9 | ||
| 196 | } | ||
| 197 | |||
| 198 | # | ||
| 199 | # panic FORMAT [...] | ||
| 200 | # | ||
| 201 | # Print message to original stderr, then exit with failure. | ||
| 202 | # | ||
| 203 | panic() { | ||
| 204 | warn "$@" | ||
| 205 | exit 1 | ||
| 206 | } | ||
| 207 | |||
| 208 | |||
| 209 | # | ||
| 168 | # parse CPPFLAGS -I or LDFLAGS -L directories | 210 | # parse CPPFLAGS -I or LDFLAGS -L directories |
| 169 | # | 211 | # |
| 170 | xdirs() { | 212 | xdirs() { |
| @@ -231,6 +273,46 @@ append() { | |||
| 231 | } | 273 | } |
| 232 | 274 | ||
| 233 | # | 275 | # |
| 276 | # glob PATTERN [MAXDEPTH] [EXEC-COMMAND] [INTERNAL:GLOB-COUNT] | ||
| 277 | # | ||
| 278 | glob() { | ||
| 279 | glob_N="${4:-0}" | ||
| 280 | |||
| 281 | IFS= | ||
| 282 | set +f | ||
| 283 | for F in ${1}; do | ||
| 284 | [ -e "${F}" ] || continue | ||
| 285 | if eval "${3:-printf '%s\\n'} \"\${F}\""; then | ||
| 286 | glob_N=$((${glob_N} + 1)) | ||
| 287 | fi | ||
| 288 | done | ||
| 289 | set -f | ||
| 290 | unset IFS | ||
| 291 | |||
| 292 | if [ "${2-0}" -gt 0 ]; then | ||
| 293 | glob "${1%/*}/*/${1##*/}" "$((${2} - 1))" "${3:-}" "${glob_N}" || : | ||
| 294 | fi | ||
| 295 | |||
| 296 | [ "${glob_N}" -gt 0 ] | ||
| 297 | } # glob | ||
| 298 | |||
| 299 | |||
| 300 | # | ||
| 301 | # runcc [...] | ||
| 302 | # | ||
| 303 | # Wrapper for invoking ${CC}. Some build system include flags in ${CC}, | ||
| 304 | # invoke the compiler through env(1), or employ other hacks. | ||
| 305 | # | ||
| 306 | # TODO: Optionally handle unescaping of words in a manner similar to how | ||
| 307 | # ${CC} would be evaluated from a make rule--typically by being passed | ||
| 308 | # through system(3). | ||
| 309 | # | ||
| 310 | runcc() { | ||
| 311 | (unset IFS; exec ${CC} "$@") | ||
| 312 | } | ||
| 313 | |||
| 314 | |||
| 315 | # | ||
| 234 | # evalmacro PATH MACRO [REGEX] [SUBST] | 316 | # evalmacro PATH MACRO [REGEX] [SUBST] |
| 235 | # | 317 | # |
| 236 | # PATH Header identifier--#include <PATH> | 318 | # PATH Header identifier--#include <PATH> |
| @@ -240,7 +322,7 @@ append() { | |||
| 240 | # | 322 | # |
| 241 | evalmacro() { | 323 | evalmacro() { |
| 242 | printf "#include <$1>\n[===[$2]===]\n" \ | 324 | printf "#include <$1>\n[===[$2]===]\n" \ |
| 243 | | "${CC:-cc}" ${CPPFLAGS:-} -E - 2>>/dev/null \ | 325 | | runcc ${CPPFLAGS:-} -E - 2>>/dev/null \ |
| 244 | | sed -ne " | 326 | | sed -ne " |
| 245 | s/^.*\\[===\\[ *\\(${3:-.*}\\) *\\]===\\].*$/${4:-\\1}/ | 327 | s/^.*\\[===\\[ *\\(${3:-.*}\\) *\\]===\\].*$/${4:-\\1}/ |
| 246 | t Found | 328 | t Found |
| @@ -267,7 +349,7 @@ testsym() { | |||
| 267 | # and within [A-T]. | 349 | # and within [A-T]. |
| 268 | (nm -Pg ${1} 2>>/dev/null || nm -g 2>>/dev/null) \ | 350 | (nm -Pg ${1} 2>>/dev/null || nm -g 2>>/dev/null) \ |
| 269 | | sed -ne '/ [A-T] /p' \ | 351 | | sed -ne '/ [A-T] /p' \ |
| 270 | | grep -qE "${2}" | 352 | | grep -q "${2}" |
| 271 | } | 353 | } |
| 272 | 354 | ||
| 273 | 355 | ||
| @@ -398,7 +480,9 @@ luapc() { | |||
| 398 | findinstalldir() { | 480 | findinstalldir() { |
| 399 | V_DIR=$((${LUA_VER} / 100 % 100)).$((${LUA_VER} % 100)) | 481 | V_DIR=$((${LUA_VER} / 100 % 100)).$((${LUA_VER} % 100)) |
| 400 | 482 | ||
| 401 | if [ "${1}" = "package.cpath" ]; then | 483 | if [ "${1}" = "package.cpath" -o "${1}" = "cdir" ]; then |
| 484 | ARRAY="package.cpath" | ||
| 485 | |||
| 402 | DIR="$(luapc --variable INSTALL_CMOD)" | 486 | DIR="$(luapc --variable INSTALL_CMOD)" |
| 403 | [ -n "${DIR}" ] && set -- "$@" "${DIR}" | 487 | [ -n "${DIR}" ] && set -- "$@" "${DIR}" |
| 404 | 488 | ||
| @@ -418,6 +502,8 @@ findinstalldir() { | |||
| 418 | set -- "$@" "${LUA_PATH}/../../lib/lua/${V_DIR}" | 502 | set -- "$@" "${LUA_PATH}/../../lib/lua/${V_DIR}" |
| 419 | set -- "$@" "${LUA_PATH}/../../lib/*/lua/${V_DIR}" # e.g. lib/x86_64-linux-gnu | 503 | set -- "$@" "${LUA_PATH}/../../lib/*/lua/${V_DIR}" # e.g. lib/x86_64-linux-gnu |
| 420 | else | 504 | else |
| 505 | ARRAY="package.path" | ||
| 506 | |||
| 421 | DIR="$(luapc --variable INSTALL_LMOD)" | 507 | DIR="$(luapc --variable INSTALL_LMOD)" |
| 422 | [ -n "${DIR}" ] && set -- "$@" "${DIR}" | 508 | [ -n "${DIR}" ] && set -- "$@" "${DIR}" |
| 423 | 509 | ||
| @@ -429,7 +515,6 @@ findinstalldir() { | |||
| 429 | set -- "$@" "${LUA_PATH}/../../share/lua/${V_DIR}" | 515 | set -- "$@" "${LUA_PATH}/../../share/lua/${V_DIR}" |
| 430 | fi | 516 | fi |
| 431 | 517 | ||
| 432 | ARRAY="${1}" | ||
| 433 | shift | 518 | shift |
| 434 | 519 | ||
| 435 | if [ $# -eq 0 ]; then | 520 | if [ $# -eq 0 ]; then |
| @@ -576,13 +661,11 @@ findversion() { | |||
| 576 | 661 | ||
| 577 | if [ $# -gt 0 ]; then | 662 | if [ $# -gt 0 ]; then |
| 578 | for D; do | 663 | for D; do |
| 579 | for F in $(find "${D}" ${MAXDEPTH} ${XDEV} -name lua.h -print 2>>/dev/null); do | 664 | glob "${D}/lua.h" "${MAXDEPTH}" tryluainclude || : |
| 580 | tryluainclude "${F}" | ||
| 581 | 665 | ||
| 582 | if foundversion; then | 666 | if foundversion; then |
| 583 | return 0 | 667 | return 0 |
| 584 | fi | 668 | fi |
| 585 | done | ||
| 586 | done | 669 | done |
| 587 | fi | 670 | fi |
| 588 | 671 | ||
| @@ -594,13 +677,11 @@ findversion() { | |||
| 594 | 677 | ||
| 595 | if [ $# -gt 0 ]; then | 678 | if [ $# -gt 0 ]; then |
| 596 | for D; do | 679 | for D; do |
| 597 | for F in $(find "${D}/." ${MAXDEPTH} ${XDEV} -name lua.h -print 2>>/dev/null); do | 680 | glob "${D}/lua.h" "${MAXDEPTH}" tryluainclude || : |
| 598 | tryluainclude "${F}" | ||
| 599 | 681 | ||
| 600 | if foundversion; then | 682 | if foundversion; then |
| 601 | return 0 | 683 | return 0 |
| 602 | fi | 684 | fi |
| 603 | done | ||
| 604 | done | 685 | done |
| 605 | fi | 686 | fi |
| 606 | 687 | ||
| @@ -612,13 +693,11 @@ findversion() { | |||
| 612 | D="${D%/*}/include" | 693 | D="${D%/*}/include" |
| 613 | 694 | ||
| 614 | if [ -d "${D}" ]; then | 695 | if [ -d "${D}" ]; then |
| 615 | for F in $(find "${D}" ${MAXDEPTH} ${XDEV} -name lua.h -print 2>>/dev/null); do | 696 | glob "${D}/lua.h" "${MAXDEPTH}" tryluainclude || : |
| 616 | tryluainclude "${F}" | ||
| 617 | 697 | ||
| 618 | if foundversion; then | 698 | if foundversion; then |
| 619 | return 0 | 699 | return 0 |
| 620 | fi | 700 | fi |
| 621 | done | ||
| 622 | fi | 701 | fi |
| 623 | fi | 702 | fi |
| 624 | 703 | ||
| @@ -631,9 +710,10 @@ findversion() { | |||
| 631 | # compatible. | 710 | # compatible. |
| 632 | # | 711 | # |
| 633 | trylib() { | 712 | trylib() { |
| 634 | if ! testsym "${1}" "lua_newstate"; then | 713 | testsym "${1}" "lua_newstate" || return 1 |
| 635 | return 0 | 714 | |
| 636 | fi | 715 | # exclude C++ |
| 716 | [ "${1#*++}" = "${1}" ] || return 1 | ||
| 637 | 717 | ||
| 638 | V=0 | 718 | V=0 |
| 639 | J=0 | 719 | J=0 |
| @@ -662,16 +742,20 @@ trylib() { | |||
| 662 | if testsym "${1}" "lua_getfenv"; then | 742 | if testsym "${1}" "lua_getfenv"; then |
| 663 | V=501 | 743 | V=501 |
| 664 | elif testsym "${1}" "lua_yieldk"; then | 744 | elif testsym "${1}" "lua_yieldk"; then |
| 665 | V=502 | 745 | if testsym "${1}" "lua_getctx"; then |
| 746 | V=502 | ||
| 747 | else | ||
| 748 | V=503 | ||
| 749 | fi | ||
| 666 | else | 750 | else |
| 667 | return 0 | 751 | return 1 |
| 668 | fi | 752 | fi |
| 669 | 753 | ||
| 670 | [ "$V" -gt 0 -a "$V" -ge "${LIBLUA_VER:-0}" ] || return 0 | 754 | [ "$V" -gt 0 -a "$V" -ge "${LIBLUA_VER:-0}" ] || return 1 |
| 671 | 755 | ||
| 672 | [ "$V" -gt "${LIBLUA_VER:-0}" -o "${#D}" -lt "${#LIBLUA_DIR}" -o \( "${JIT_REQ}" = "yes" -a "${LIBJIT_VER:-0}" -lt "${JIT_MAX}" \) ] || return 0 | 756 | [ "$V" -gt "${LIBLUA_VER:-0}" -o "${#D}" -lt "${#LIBLUA_DIR}" -o \( "${JIT_REQ}" = "yes" -a "${LIBJIT_VER:-0}" -lt "${JIT_MAX}" \) ] || return 1 |
| 673 | 757 | ||
| 674 | [ "$V" -ge "${API_MIN}" -a "$V" -le "${API_MAX}" ] || return 0 | 758 | [ "$V" -ge "${API_MIN}" -a "$V" -le "${API_MAX}" ] || return 1 |
| 675 | 759 | ||
| 676 | 760 | ||
| 677 | if [ -n "${JIT_REQ}" ]; then | 761 | if [ -n "${JIT_REQ}" ]; then |
| @@ -681,12 +765,12 @@ trylib() { | |||
| 681 | fi | 765 | fi |
| 682 | 766 | ||
| 683 | if [ "${JIT_REQ}" = "skip" ]; then | 767 | if [ "${JIT_REQ}" = "skip" ]; then |
| 684 | [ "${J}" -eq 0 ] || return 0 | 768 | [ "${J}" -eq 0 ] || return 1 |
| 685 | elif [ "${JIT_REQ}" = "yes" ]; then | 769 | elif [ "${JIT_REQ}" = "yes" ]; then |
| 686 | [ "$J" -ge "${LIBJIT_VER:-0}" ] || return 0 | 770 | [ "$J" -ge "${LIBJIT_VER:-0}" ] || return 1 |
| 687 | [ "$J" -gt "${LIBJIT_VER:-0}" -o "${#D}" -lt "${#LIBJIT_DIR}" ] || return 0 | 771 | [ "$J" -gt "${LIBJIT_VER:-0}" -o "${#D}" -lt "${#LIBJIT_DIR}" ] || return 1 |
| 688 | [ "$J" -ge ${JIT_MIN} ] || return 0 | 772 | [ "$J" -ge ${JIT_MIN} ] || return 1 |
| 689 | [ "$J" -le "${JIT_MAX}" ] || return 0 | 773 | [ "$J" -le "${JIT_MAX}" ] || return 1 |
| 690 | 774 | ||
| 691 | LIBJIT_VER="$J" | 775 | LIBJIT_VER="$J" |
| 692 | LIBJIT_DIR="$D" | 776 | LIBJIT_DIR="$D" |
| @@ -745,15 +829,17 @@ findlib() { | |||
| 745 | 829 | ||
| 746 | #printf -- "I=$I K=$K $findlib_L/lib$findlib_l*.*\n" | 830 | #printf -- "I=$I K=$K $findlib_L/lib$findlib_l*.*\n" |
| 747 | 831 | ||
| 748 | for findlib_R in no ${RECURSE}; do | 832 | glob "${findlib_L}/lib${findlib_l}*.*" 0 trylib || : |
| 749 | for findlib_lib in $(findpath "lib${findlib_l}*.*" ${findlib_R} "${findlib_L}"); do | ||
| 750 | trylib "${findlib_lib}" | ||
| 751 | done | ||
| 752 | 833 | ||
| 753 | if foundlib; then | 834 | if foundlib; then |
| 754 | return 0 | 835 | return 0; |
| 755 | fi | 836 | fi |
| 756 | done | 837 | |
| 838 | glob "${findlib_L}/lib${findlib_l}*.*" ${MAXDEPTH} trylib || : | ||
| 839 | |||
| 840 | if foundlib; then | ||
| 841 | return 0; | ||
| 842 | fi | ||
| 757 | 843 | ||
| 758 | K=$(($K + 1)) | 844 | K=$(($K + 1)) |
| 759 | done | 845 | done |
| @@ -768,48 +854,73 @@ findlib() { | |||
| 768 | unset IFS | 854 | unset IFS |
| 769 | 855 | ||
| 770 | for findlib_D; do | 856 | for findlib_D; do |
| 771 | for findlib_R in no ${RECURSE}; do | 857 | glob "${findlib_D}/liblua*.*" "${MAXDEPTH}" trylib || : |
| 772 | for findlib_lib in $(findpath "liblua*.*" ${findlib_R} "${findlib_D}"); do | 858 | |
| 773 | trylib "${findlib_lib}" | 859 | if foundlib; then |
| 774 | done | 860 | return 0 |
| 861 | fi | ||
| 862 | done | ||
| 863 | |||
| 864 | # if we can find the lua interpreter, use it as a reference for | ||
| 865 | # library locations. | ||
| 866 | if findlua; then | ||
| 867 | findlib_D="${LUA_PATH%/*}" | ||
| 868 | findlib_D="${findlib_D%/*}/lib" | ||
| 869 | |||
| 870 | if [ -d "${findlib_D}" ]; then | ||
| 871 | glob "${findlib_D}/liblua*.*" "${MAXDEPTH}" trylib || : | ||
| 775 | 872 | ||
| 776 | if foundlib; then | 873 | if foundlib; then |
| 777 | return 0 | 874 | return 0 |
| 778 | fi | 875 | fi |
| 779 | done | 876 | fi |
| 780 | done | 877 | fi |
| 781 | } | 878 | } |
| 782 | 879 | ||
| 783 | 880 | ||
| 784 | findpath() { | 881 | # check setuid and setgid mode |
| 785 | NAME="$1" | 882 | safeperm() { |
| 786 | WHERE="$3" | 883 | [ -f "$1" -a ! -u "$1" -a ! -g "$1" ] |
| 884 | } | ||
| 787 | 885 | ||
| 788 | PRUNE= | ||
| 789 | 886 | ||
| 790 | if [ "${2}" = "no" ]; then | 887 | tryluac() { |
| 791 | PRUNE="-name . -o -type d -prune -o" | 888 | tryluac_F="${1}" |
| 792 | fi | ||
| 793 | 889 | ||
| 794 | [ ${#WHERE} -gt 0 ] || return 0 | 890 | [ -x "${tryluac_F}" ] && safeperm "${tryluac_F}" || return 0 |
| 795 | 891 | ||
| 796 | IFS=: | 892 | tryluac_V="$("${tryluac_F}" -v </dev/null 2>&1 | head -n1 | sed -ne 's/^Lua \([0123456789][0123456789]*\.[0123456789][0123456789]*\).*/\1/p')" |
| 797 | set -- ${WHERE} | 893 | : ${tryluac_V:=0} |
| 798 | unset IFS | 894 | tryluac_V="$((${tryluac_V%%.*} * 100 + ${tryluac_V##*.} % 100))" |
| 799 | 895 | ||
| 800 | if [ $# -gt 0 ]; then | 896 | [ "${tryluac_V}" -gt 0 -a "${tryluac_V}" -ge "${LUAC_VER:-0}" ] || return 0 |
| 801 | for findpath_D; do | ||
| 802 | find "${findpath_D}/." ${MAXDEPTH} ${XDEV} ${PRUNE} -name "${NAME}" -print 2>>/dev/null | sed -e 's/\/\.//' | ||
| 803 | done | ||
| 804 | fi | ||
| 805 | } | ||
| 806 | 897 | ||
| 898 | [ "${tryluac_V}" -gt "${LUAC_VER:-0}" -o "${#tryluac_F}" -lt "${#LUAC_PATH}" ] || return 0 | ||
| 807 | 899 | ||
| 808 | # check setuid and setgid mode | 900 | [ "${tryluac_V}" -ge "${API_MIN}" -a "${tryluac_V}" -le "${API_MAX}" ] || return 0 |
| 809 | safeperm() { | 901 | |
| 810 | [ -f "$1" -a ! -u "$1" -a ! -g "$1" ] | 902 | printf "return true" 2>>/dev/null | ${tryluac_F} -p - </dev/null >>/dev/null 2>&1 || return 0 |
| 903 | |||
| 904 | LUAC_PATH="${tryluac_F}" | ||
| 905 | LUAC_VER="${tryluac_V}" | ||
| 811 | } | 906 | } |
| 812 | 907 | ||
| 908 | # | ||
| 909 | # foundluac | ||
| 910 | # | ||
| 911 | # true if found the best (maximum) possible version, false otherwise | ||
| 912 | # | ||
| 913 | foundluac() { | ||
| 914 | if [ "${LUAC_VER:-0}" -lt "${API_MAX}" ]; then | ||
| 915 | return 1 | ||
| 916 | fi | ||
| 917 | |||
| 918 | if [ "${SHORTEST}" = "yes" ]; then | ||
| 919 | return 1 | ||
| 920 | fi | ||
| 921 | |||
| 922 | return 0 | ||
| 923 | } | ||
| 813 | 924 | ||
| 814 | findluac() { | 925 | findluac() { |
| 815 | if [ $# -eq 0 ]; then | 926 | if [ $# -eq 0 ]; then |
| @@ -818,36 +929,33 @@ findluac() { | |||
| 818 | unset IFS | 929 | unset IFS |
| 819 | fi | 930 | fi |
| 820 | 931 | ||
| 821 | while [ $# -gt 0 ]; do | 932 | for findluac_G; do |
| 822 | for F in $(findpath "${1}" no "${PATH}"; findpath "${1}" "${RECURSE}" "${BINDIRS}"); do | 933 | IFS=: |
| 823 | [ -x "$F" ] && safeperm "$F" || continue | 934 | for findluac_D in ${PATH}; do |
| 824 | 935 | unset IFS | |
| 825 | V="$("$F" -v </dev/null 2>&1 | head -n1 | sed -ne 's/^Lua \([0123456789][0123456789]*\.[0123456789][0123456789]*\).*/\1/p')" | ||
| 826 | : ${V:=0} | ||
| 827 | V="$((${V%%.*} * 100 + ${V##*.} % 100))" | ||
| 828 | |||
| 829 | [ "${V}" -gt 0 -a "${V}" -ge "${LUAC_VER:-0}" ] || continue | ||
| 830 | 936 | ||
| 831 | [ "${V}" -gt "${LUAC_VER:-0}" -o "${#F}" -lt "${#LUAC_PATH}" ] || continue | 937 | glob "${findluac_D}/${findluac_G}" 0 tryluac || : |
| 832 | 938 | ||
| 833 | [ "${V}" -ge "${API_MIN}" -a "${V}" -le "${API_MAX}" ] || continue | 939 | if foundluac; then |
| 940 | return 0 | ||
| 941 | fi | ||
| 942 | done | ||
| 834 | 943 | ||
| 835 | printf "return true" 2>>/dev/null | ${F} -p - </dev/null >>/dev/null 2>&1 || continue | 944 | IFS=: |
| 945 | for findluac_D in ${BINDIRS}; do | ||
| 946 | unset IFS | ||
| 836 | 947 | ||
| 837 | LUAC_PATH="$F" | 948 | glob "${findluac_D}/${findluac_G}" "${MAXDEPTH}" tryluac || : |
| 838 | LUAC_VER="$V" | ||
| 839 | 949 | ||
| 840 | [ "${SHORTEST}" = "yes" -o "${LUAC_VER}" -lt "${API_MAX}" ] || break 2 | 950 | if foundluac; then |
| 951 | return 0 | ||
| 952 | fi | ||
| 841 | done | 953 | done |
| 842 | 954 | ||
| 843 | shift | 955 | unset IFS |
| 844 | done | 956 | done |
| 845 | 957 | ||
| 846 | if [ -n "${LUAC_PATH}" -a -n "${LUAC_VER}" ]; then | 958 | [ "${LUAC_VER:-0}" -gt 0 ] && [ "${#LUAC_PATH}" -gt 0 ] |
| 847 | return 0 | ||
| 848 | else | ||
| 849 | return 1 | ||
| 850 | fi | ||
| 851 | } | 959 | } |
| 852 | 960 | ||
| 853 | 961 | ||
| @@ -871,7 +979,7 @@ isinteger() { | |||
| 871 | checkints() { | 979 | checkints() { |
| 872 | while [ $# -gt 0 ]; do | 980 | while [ $# -gt 0 ]; do |
| 873 | if ! isinteger "${1}"; then | 981 | if ! isinteger "${1}"; then |
| 874 | printf -- "${0##*/}: ${1}: not a number\n" >&2 | 982 | warn "%s: not a number" "${1}" |
| 875 | return 1 | 983 | return 1 |
| 876 | fi | 984 | fi |
| 877 | 985 | ||
| @@ -946,6 +1054,54 @@ mmp2num() { | |||
| 946 | } | 1054 | } |
| 947 | 1055 | ||
| 948 | 1056 | ||
| 1057 | trylua() { | ||
| 1058 | trylua_F="${1}" | ||
| 1059 | [ -x "${trylua_F}" ] && safeperm "${trylua_F}" || return 0 | ||
| 1060 | |||
| 1061 | trylua_V="$("${trylua_F}" -e 'print(string.match(_VERSION, [[[%d.]+]]))' </dev/null 2>>/dev/null | head -n1 | sed -ne 's/^\([0123456789][0123456789]*\.[0123456789][0123456789]*\).*/\1/p')" | ||
| 1062 | : ${trylua_V:=0} | ||
| 1063 | trylua_V="$((${trylua_V%%.*} * 100 + ${trylua_V##*.} % 100))" | ||
| 1064 | |||
| 1065 | [ "${trylua_V}" -gt 0 -a "${trylua_V}" -ge "${LUA_VER:-0}" ] || return 0 | ||
| 1066 | |||
| 1067 | [ "${trylua_V}" -gt "${LUA_VER:-0}" -o "${#trylua_F}" -lt "${#LUA_PATH}" ] || return 0 | ||
| 1068 | |||
| 1069 | [ "${trylua_V}" -ge "${API_MIN}" -a "${trylua_V}" -le "${API_MAX}" ] || return 0 | ||
| 1070 | |||
| 1071 | if [ -n "${JIT_REQ}" ]; then | ||
| 1072 | J="$("${trylua_F}" -v </dev/null 2>&1 | head -n1 | sed -ne 's/^LuaJIT \([0123456789][0123456789]*\.[0123456789][0123456789]*\.[0123456789][0123456789]*\).*/\1/p')" | ||
| 1073 | J="$(jit2num ${J:-0})" | ||
| 1074 | |||
| 1075 | if [ "${JIT_REQ}" = "skip" ]; then | ||
| 1076 | [ "${J}" -eq 0 ] || return 0 | ||
| 1077 | elif [ "${JIT_REQ}" = "yes" ]; then | ||
| 1078 | [ "${J}" -gt 0 ] || return 0 | ||
| 1079 | [ "${J}" -ge "${JIT_MIN}" ] || return 0 | ||
| 1080 | [ "${J}" -le "${JIT_MAX}" ] || return 0 | ||
| 1081 | fi | ||
| 1082 | fi | ||
| 1083 | |||
| 1084 | LUA_PATH="${trylua_F}" | ||
| 1085 | LUA_VER="${trylua_V}" | ||
| 1086 | } | ||
| 1087 | |||
| 1088 | # | ||
| 1089 | # foundlua | ||
| 1090 | # | ||
| 1091 | # true if found the best (maximum) possible version, false otherwise | ||
| 1092 | # | ||
| 1093 | foundlua() { | ||
| 1094 | if [ "${LUA_VER:-0}" -lt "${API_MAX}" ]; then | ||
| 1095 | return 1 | ||
| 1096 | fi | ||
| 1097 | |||
| 1098 | if [ "${SHORTEST}" = "yes" ]; then | ||
| 1099 | return 1 | ||
| 1100 | fi | ||
| 1101 | |||
| 1102 | return 0 | ||
| 1103 | } | ||
| 1104 | |||
| 949 | findlua() { | 1105 | findlua() { |
| 950 | if [ $# -eq 0 ]; then | 1106 | if [ $# -eq 0 ]; then |
| 951 | IFS=: | 1107 | IFS=: |
| @@ -953,52 +1109,38 @@ findlua() { | |||
| 953 | unset IFS | 1109 | unset IFS |
| 954 | fi | 1110 | fi |
| 955 | 1111 | ||
| 956 | while [ $# -gt 0 ]; do | 1112 | for findlua_G; do |
| 957 | for F in $(findpath "${1}" no "${PATH}"; findpath "${1}" "${RECURSE}" "${BINDIRS}"); do | 1113 | IFS=: |
| 958 | [ -x "$F" ] && safeperm "$F" || continue | 1114 | for findlua_D in ${PATH}; do |
| 959 | 1115 | unset IFS | |
| 960 | V="$("$F" -e 'print(string.match(_VERSION, [[[%d.]+]]))' </dev/null 2>>/dev/null | head -n1 | sed -ne 's/^\([0123456789][0123456789]*\.[0123456789][0123456789]*\).*/\1/p')" | ||
| 961 | : ${V:=0} | ||
| 962 | V="$((${V%%.*} * 100 + ${V##*.} % 100))" | ||
| 963 | 1116 | ||
| 964 | [ "${V}" -gt 0 -a "${V}" -ge "${LUA_VER:-0}" ] || continue | 1117 | glob "${findlua_D}/${findlua_G}" 0 trylua || : |
| 965 | 1118 | ||
| 966 | [ "${V}" -gt "${LUA_VER:-0}" -o "${#F}" -lt "${#LUA_PATH}" ] || continue | 1119 | if foundlua; then |
| 1120 | return 0 | ||
| 1121 | fi | ||
| 1122 | done | ||
| 967 | 1123 | ||
| 968 | [ "${V}" -ge "${API_MIN}" -a "${V}" -le "${API_MAX}" ] || continue | 1124 | IFS=: |
| 1125 | for findlua_D in ${BINDIRS}; do | ||
| 1126 | unset IFS | ||
| 969 | 1127 | ||
| 970 | if [ -n "${JIT_REQ}" ]; then | 1128 | glob "${findlua_D}/${findlua_G}" "${MAXDEPTH}" trylua || : |
| 971 | J="$("$F" -v </dev/null 2>&1 | head -n1 | sed -ne 's/^LuaJIT \([0123456789][0123456789]*\.[0123456789][0123456789]*\.[0123456789][0123456789]*\).*/\1/p')" | ||
| 972 | J="$(jit2num ${J:-0})" | ||
| 973 | 1129 | ||
| 974 | if [ "${JIT_REQ}" = "skip" ]; then | 1130 | if foundlua; then |
| 975 | [ "${J}" -eq 0 ] || continue | 1131 | return 0 |
| 976 | elif [ "${JIT_REQ}" = "yes" ]; then | ||
| 977 | [ "${J}" -gt 0 ] || continue | ||
| 978 | [ "${J}" -ge "${JIT_MIN}" ] || continue | ||
| 979 | [ "${J}" -le "${JIT_MAX}" ] || continue | ||
| 980 | fi | ||
| 981 | fi | 1132 | fi |
| 982 | |||
| 983 | LUA_PATH="$F" | ||
| 984 | LUA_VER="$V" | ||
| 985 | |||
| 986 | [ "${SHORTEST}" = "yes" -o "${LUA_VER}" -lt "${API_MAX}" ] || break 2 | ||
| 987 | done | 1133 | done |
| 988 | 1134 | ||
| 989 | shift | 1135 | unset IFS |
| 990 | done | 1136 | done |
| 991 | 1137 | ||
| 992 | if [ -n "${LUA_PATH}" -a -n "${LUA_VER}" ]; then | 1138 | [ "${LUA_VER:-0}" -gt 0 ] && [ "${#LUA_PATH}" -gt 0 ] |
| 993 | return 0 | ||
| 994 | else | ||
| 995 | return 1 | ||
| 996 | fi | ||
| 997 | } | 1139 | } |
| 998 | 1140 | ||
| 999 | 1141 | ||
| 1000 | ccname() { | 1142 | ccname() { |
| 1001 | "${CC}" -E - <<-EOF | awk '/sunpro/||/clang/||/gcc/||/other/{ print $1; exit; }' | 1143 | runcc -E - <<-EOF | awk '/sunpro/||/clang/||/gcc/||/other/{ print $1; exit; }' |
| 1002 | #if defined __SUNPRO_C | 1144 | #if defined __SUNPRO_C |
| 1003 | sunpro | 1145 | sunpro |
| 1004 | #elif defined __clang__ | 1146 | #elif defined __clang__ |
| @@ -1026,8 +1168,7 @@ usage() { | |||
| 1026 | -e GLOB glob pattern for finding utilities (lua, luac, etc) | 1168 | -e GLOB glob pattern for finding utilities (lua, luac, etc) |
| 1027 | -k query pkg-config if available | 1169 | -k query pkg-config if available |
| 1028 | -r recursively search directories | 1170 | -r recursively search directories |
| 1029 | -m MAXDEPTH limit recursion to MAXDEPTH (only for GNU and BSD find) | 1171 | -m MAXDEPTH limit recursion to MAXDEPTH |
| 1030 | -x do not cross device mounts when recursing | ||
| 1031 | -s find shortest pathname, otherwise print first best match | 1172 | -s find shortest pathname, otherwise print first best match |
| 1032 | -v VERSION require specific Lua version or range | 1173 | -v VERSION require specific Lua version or range |
| 1033 | (e.g. "5.1" or "5.1-5.2") | 1174 | (e.g. "5.1" or "5.1-5.2") |
| @@ -1038,8 +1179,10 @@ usage() { | |||
| 1038 | -h print this usage message | 1179 | -h print this usage message |
| 1039 | 1180 | ||
| 1040 | cppflags print derived additional CPPFLAGS necessary | 1181 | cppflags print derived additional CPPFLAGS necessary |
| 1182 | version print derived Lua API version from cppflags discovery | ||
| 1041 | ldflags print derived additional LDFLAGS necessary (TODO) | 1183 | ldflags print derived additional LDFLAGS necessary (TODO) |
| 1042 | version print derived Lua API version | 1184 | libs print derived additional LIBS necessary (TODO) |
| 1185 | libversion print derived Lua API version from ldflags/libs discovery | ||
| 1043 | luac print path to luac utility ($(printf "${GLOB_LUA}" | tr ':' ' ')) | 1186 | luac print path to luac utility ($(printf "${GLOB_LUA}" | tr ':' ' ')) |
| 1044 | lua print path to lua interpreter ($(printf "${GLOB_LUAC}" | tr ':' ' ')) | 1187 | lua print path to lua interpreter ($(printf "${GLOB_LUAC}" | tr ':' ' ')) |
| 1045 | package.path print preferred module install path | 1188 | package.path print preferred module install path |
| @@ -1114,20 +1257,21 @@ while getopts I:L:P:d:De:krm:xsv:j:JVh OPT; do | |||
| 1114 | RECURSE=yes | 1257 | RECURSE=yes |
| 1115 | ;; | 1258 | ;; |
| 1116 | m) | 1259 | m) |
| 1117 | if [ -n "${OPTARG##[0123456789]}" ]; then | 1260 | if [ "${#OPTARG}" -eq 0 -o -n "${OPTARG##[0123456789]}" ]; then |
| 1118 | printf -- "${0##*/}: ${OPTARG}: invalid maxdepth\n" >&2 | 1261 | panic "%s: invalid maxdepth" "${OPTARG}" |
| 1119 | exit 1 | ||
| 1120 | fi | ||
| 1121 | |||
| 1122 | if find "${TMPDIR:-/tmp}" -maxdepth ${OPTARG} -prune >>/dev/null 2>&1; then | ||
| 1123 | MAXDEPTH="-maxdepth ${OPTARG}" | ||
| 1124 | else | ||
| 1125 | printf -- "${0##*/}: $(command -v find): -maxdepth unsupported\n" >&2 | ||
| 1126 | fi | 1262 | fi |
| 1127 | 1263 | ||
| 1264 | MAXDEPTH="${OPTARG}" | ||
| 1128 | ;; | 1265 | ;; |
| 1129 | x) | 1266 | x) |
| 1130 | XDEV="-xdev" | 1267 | # |
| 1268 | # NOTE: This option was | ||
| 1269 | # | ||
| 1270 | # -x do not cross device mounts when recursing | ||
| 1271 | # | ||
| 1272 | # but is currently unsupported as our built-in glob function | ||
| 1273 | # does not implement this functionality. Previously this | ||
| 1274 | # option caused -xdev to be added to invocations of find(1). | ||
| 1131 | ;; | 1275 | ;; |
| 1132 | s) | 1276 | s) |
| 1133 | SHORTEST=yes | 1277 | SHORTEST=yes |
| @@ -1140,8 +1284,7 @@ while getopts I:L:P:d:De:krm:xsv:j:JVh OPT; do | |||
| 1140 | API_MAX="$(lua2num ${MAX:-99} 99)" | 1284 | API_MAX="$(lua2num ${MAX:-99} 99)" |
| 1141 | 1285 | ||
| 1142 | if [ "${API_MIN}" -gt "${API_MAX}" ]; then | 1286 | if [ "${API_MIN}" -gt "${API_MAX}" ]; then |
| 1143 | printf -- "${0##*/}: ${OPTARG}: invalid version range\n" >&2 | 1287 | panic "%s: invalid version range" "${OPTARG}" |
| 1144 | exit 1 | ||
| 1145 | fi | 1288 | fi |
| 1146 | 1289 | ||
| 1147 | ;; | 1290 | ;; |
| @@ -1153,8 +1296,7 @@ while getopts I:L:P:d:De:krm:xsv:j:JVh OPT; do | |||
| 1153 | JIT_MAX="$(jit2num ${MAX:-99} 99 99)" | 1296 | JIT_MAX="$(jit2num ${MAX:-99} 99 99)" |
| 1154 | 1297 | ||
| 1155 | if [ "${JIT_MIN}" -gt "${JIT_MAX}" ]; then | 1298 | if [ "${JIT_MIN}" -gt "${JIT_MAX}" ]; then |
| 1156 | printf -- "${0##*/}: ${OPTARG}: invalid version range\n" >&2 | 1299 | panic "%s: invalid version range" "${OPTARG}" |
| 1157 | exit 1 | ||
| 1158 | fi | 1300 | fi |
| 1159 | 1301 | ||
| 1160 | JIT_REQ=yes | 1302 | JIT_REQ=yes |
| @@ -1180,10 +1322,16 @@ done | |||
| 1180 | shift $(($OPTIND - 1)) | 1322 | shift $(($OPTIND - 1)) |
| 1181 | 1323 | ||
| 1182 | 1324 | ||
| 1183 | for U in "${CC:-cc}" find grep od rm rmdir sed xargs; do | 1325 | [ "${RECURSE}" = "yes" ] || MAXDEPTH=0 |
| 1184 | if ! command -v "${U}" >>/dev/null 2>&1; then | 1326 | |
| 1185 | printf -- "${0##*/}: ${U}: command not found\n" >&2 | 1327 | |
| 1186 | fi | 1328 | for U in "${CC}" grep od rm rmdir sed xargs; do |
| 1329 | ! command -v "${U}" >>/dev/null 2>&1 || continue | ||
| 1330 | |||
| 1331 | # ${CC} might have trailing flags or invoke the compiler through env | ||
| 1332 | ! command -v "${U%% *}" >>/dev/null 2>&1 || continue | ||
| 1333 | |||
| 1334 | warn "%s: command not found" "${U}" | ||
| 1187 | done | 1335 | done |
| 1188 | 1336 | ||
| 1189 | 1337 | ||
| @@ -1191,15 +1339,13 @@ if [ -n "${SANDBOX}" ]; then | |||
| 1191 | if [ "${SANDBOX}" = "${SANDBOX%/}" ]; then | 1339 | if [ "${SANDBOX}" = "${SANDBOX%/}" ]; then |
| 1192 | if [ ! -c "${DEVRANDOM}" ]; then | 1340 | if [ ! -c "${DEVRANDOM}" ]; then |
| 1193 | # TODO: expand DEVRANDOM into set of different possibilities to check | 1341 | # TODO: expand DEVRANDOM into set of different possibilities to check |
| 1194 | printf -- "${0##*/}: ${DEVRANDDOM}: no character random device available\n" >&2 | 1342 | panic "%s: no character random device available" "${DEVRANDOM}" |
| 1195 | exit 1 | ||
| 1196 | fi | 1343 | fi |
| 1197 | 1344 | ||
| 1198 | TMP="${SANDBOX}$(od -An -N8 -tx1 < ${DEVRANDOM} 2>>/dev/null | tr -d ' ')" | 1345 | TMP="${SANDBOX}$(od -An -N8 -tx1 < ${DEVRANDOM} 2>>/dev/null | tr -d ' ')" |
| 1199 | 1346 | ||
| 1200 | if [ ${#TMP} -ne $((${#SANDBOX} + 16)) ]; then | 1347 | if [ ${#TMP} -ne $((${#SANDBOX} + 16)) ]; then |
| 1201 | printf -- "${0##*/}: ${SANDBOX}: unable to generate random suffix\n" >&2 | 1348 | panic "%s: unable to generate random suffix" "${SANDBOX}" |
| 1202 | exit 1 | ||
| 1203 | fi | 1349 | fi |
| 1204 | 1350 | ||
| 1205 | SANDBOX="${TMP}" | 1351 | SANDBOX="${TMP}" |
| @@ -1241,18 +1387,28 @@ cppflags) | |||
| 1241 | [ -z "${API_DIR:-}" ] || printf -- "-I${API_DIR}\n" | 1387 | [ -z "${API_DIR:-}" ] || printf -- "-I${API_DIR}\n" |
| 1242 | 1388 | ||
| 1243 | ;; | 1389 | ;; |
| 1390 | version) | ||
| 1391 | findversion || exit 1 | ||
| 1392 | |||
| 1393 | printf "$(((${API_VER} / 100) % 100)).$((($API_VER) % 100))\n" | ||
| 1394 | |||
| 1395 | ;; | ||
| 1244 | ldflags) | 1396 | ldflags) |
| 1245 | findlib | 1397 | findlib |
| 1246 | 1398 | ||
| 1247 | [ "${LIBLUA_VER:-0}" -gt 0 ] || exit 1 | 1399 | [ "${LIBLUA_VER:-0}" -gt 0 ] || exit 1 |
| 1248 | 1400 | ||
| 1249 | printf -- "-L${LIBLUA_DIR} -l${LIBLUA_LIB}\n" | 1401 | if [ "${#LIBLUA_DIR}" -gt 0 ]; then |
| 1402 | printf -- "-L%s\n" "${LIBLUA_DIR}" | ||
| 1403 | fi | ||
| 1250 | 1404 | ||
| 1251 | ;; | 1405 | ;; |
| 1252 | version) | 1406 | libs) |
| 1253 | findversion || exit 1 | 1407 | findlib |
| 1254 | 1408 | ||
| 1255 | printf "$(((${API_VER} / 100) % 100)).$((($API_VER) % 100))\n" | 1409 | [ "${LIBLUA_VER:-0}" -gt 0 ] || exit 1 |
| 1410 | |||
| 1411 | printf -- "-l%s\n" "${LIBLUA_LIB}" | ||
| 1256 | 1412 | ||
| 1257 | ;; | 1413 | ;; |
| 1258 | libv*) | 1414 | libv*) |
| @@ -1288,21 +1444,38 @@ lua) | |||
| 1288 | 1444 | ||
| 1289 | ;; | 1445 | ;; |
| 1290 | ldir|cdir) | 1446 | ldir|cdir) |
| 1291 | printf -- "${0##*/}: ${1}: deprecated command\n" >&2 | 1447 | # |
| 1292 | MODE="${1}" | 1448 | # ldir and cdir were deprecated on 2014-12-18. On 2016-03-25 they |
| 1293 | shift | 1449 | # were revived because their names are more intuitive than |
| 1450 | # package.path and package.cpath. For now try to support the | ||
| 1451 | # semantics of both by assuming interpreter glob patterns only match | ||
| 1452 | # file names, while preferred install directory string.match | ||
| 1453 | # expressions have directory components. | ||
| 1454 | # | ||
| 1455 | if true; then | ||
| 1456 | MODE="${1}" | ||
| 1457 | |||
| 1458 | # move command to end; rotates to ${1} after loop | ||
| 1459 | set -- "$@" "${1}" | ||
| 1460 | shift | ||
| 1294 | 1461 | ||
| 1295 | if [ $# -gt 0 ]; then | 1462 | cdir_I=0 |
| 1296 | append GLOB $* | 1463 | cdir_N="$(($# - 1))" |
| 1464 | while [ "${cdir_I}" -lt "${cdir_N}" ]; do | ||
| 1465 | if [ "${1#*/}" = "${1}" ]; then | ||
| 1466 | append GLOB "${1}" | ||
| 1467 | warn "%s: passing glob patterns to %s is deprecated" "${1}" "${MODE}" | ||
| 1468 | else | ||
| 1469 | set -- "$@" "${1}" | ||
| 1470 | fi | ||
| 1471 | shift | ||
| 1472 | cdir_I=$((${cdir_I} + 1)) | ||
| 1473 | done | ||
| 1297 | fi | 1474 | fi |
| 1298 | 1475 | ||
| 1299 | findlua || exit 1 | 1476 | findlua || exit 1 |
| 1300 | 1477 | ||
| 1301 | if [ "${MODE}" = "cdir" ]; then | 1478 | findinstalldir "$@" || exit 1 |
| 1302 | findinstalldir package.cpath | ||
| 1303 | else | ||
| 1304 | findinstalldir package.path | ||
| 1305 | fi | ||
| 1306 | 1479 | ||
| 1307 | ;; | 1480 | ;; |
| 1308 | package.path|package.cpath) | 1481 | package.path|package.cpath) |
| @@ -1333,9 +1506,9 @@ testsym) | |||
| 1333 | ;; | 1506 | ;; |
| 1334 | *) | 1507 | *) |
| 1335 | if [ -n "${1:-}" ]; then | 1508 | if [ -n "${1:-}" ]; then |
| 1336 | printf -- "${0##*/}: ${1}: unknown command\n" >&2 | 1509 | warn "%s: unknown command" "${1}" |
| 1337 | else | 1510 | else |
| 1338 | printf -- "${0##*/}: no command specified\n" >&2 | 1511 | warn "no command specified" |
| 1339 | fi | 1512 | fi |
| 1340 | 1513 | ||
| 1341 | exit 1 | 1514 | exit 1 |
diff --git a/src/GNUmakefile b/src/GNUmakefile index f0eefde..34d9cd2 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile | |||
| @@ -18,7 +18,7 @@ include $(d)/../GNUmakefile | |||
| 18 | # | 18 | # |
| 19 | OS_$(d) = $(shell $(d)/../mk/vendor.os) | 19 | OS_$(d) = $(shell $(d)/../mk/vendor.os) |
| 20 | CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc) | 20 | CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc) |
| 21 | LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/lua.path -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) | 21 | LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/luapath -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) |
| 22 | 22 | ||
| 23 | CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) -DLUA_COMPAT_APIINTCASTS | 23 | CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) -DLUA_COMPAT_APIINTCASTS |
| 24 | CFLAGS_$(d) = $(CFLAGS_$(abspath $(@D)/../..)) | 24 | CFLAGS_$(d) = $(CFLAGS_$(abspath $(@D)/../..)) |
