diff --git a/.cargo/config.toml b/.cargo/config.toml index 9037819ed..96522a110 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,11 +4,9 @@ rustflags = ["-C", "link-args=-rdynamic"] [target.x86_64-unknown-linux-gnu] rustflags = ["-C", "link-args=-rdynamic"] -# Since autotools sets this and we are *not* forcing it here, this will not +# Since autotools sets these and we are *not* forcing them here, this will not # affect release builds. It will affect `cargo run` and make it easier to test # locally since the Lua loader path will be relative to the current sources. -# For debug builds it is assumed you configured `--without-system-luarocks`, -# this convenience won't enable you to use system packages in debug builds. [env] SILE_PATH = { value = "", relative = true } @@ -18,6 +16,6 @@ rustflags = [ # This is a workaround to configure lints for the entire workspace, pending the ability to configure this via TOML. # See: `https://github.com/rust-lang/cargo/issues/5034` # `https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395` - "-Aclippy::clone_double_ref", + "-Asuspicious_double_ref_op", "-Aclippy::ptr_arg", ] diff --git a/Makefile-luarocks b/Makefile-luarocks index 7ea0dc624..c4ded991d 100644 --- a/Makefile-luarocks +++ b/Makefile-luarocks @@ -17,7 +17,7 @@ $(LUAMODLOCK): lua_modules $(LUAMODSPEC) $(genrockslock) > $@ else LUAMODLOCK := -LUA_PATH := $(shell lua$(LUA_VERSION) -e 'print(package.path)') -LUA_CPATH := $(shell lua$(LUA_VERSION) -e 'print(package.cpath)') +LUA_PATH := $(shell $(LUA) -e 'print(package.path)') +LUA_CPATH := $(shell $(LUA) -e 'print(package.cpath)') export LUA_PATH LUA_CPATH endif diff --git a/configure.ac b/configure.ac index a8556081b..330d6e2fc 100644 --- a/configure.ac +++ b/configure.ac @@ -158,15 +158,7 @@ AM_COND_IF([DEPENDENCY_CHECKS], [ fi ]) - case $host_os in - msys) - LUA_VERSION=5.3 # By fiat. This is obviously not good. - ;; - *) - AX_PROG_LUA([5.1]) - ;; - esac - + AX_PROG_LUA([5.1]) AX_LUA_HEADERS AX_LUA_LIBS @@ -308,16 +300,23 @@ AX_SUBST_TRANSFORMED_PACKAGE_NAME # Avoid need for `--datarootdir=$(cd ..; pwd)` hack to run locally for # tests/manual build when developer mode is enabled AM_COND_IF([DEVELOPER], [ - AC_DEFINE_UNQUOTED([SILE_PATH],["$(pwd)"],[Path for SILE packages and classes]) + adl_RECURSIVE_EVAL(["$(pwd)"], [SILE_PATH]) + AC_DEFINE_UNQUOTED([SILE_PATH], ["${SILE_PATH}"], [Path for SILE packages and classes]) + adl_RECURSIVE_EVAL(["$(${LUA} -e 'print(package.path)')"], [LUA_PATH]) + AC_DEFINE_UNQUOTED([LUA_PATH], ["${LUA_PATH}"],[System Lua package path]) + adl_RECURSIVE_EVAL(["$(${LUA} -e 'print(package.cpath)')"], [LUA_CPATH]) + AC_DEFINE_UNQUOTED([LUA_CPATH], ["${LUA_CPATH}"], [System Lua package cpath]) ],[ adl_RECURSIVE_EVAL(["${datadir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_PATH]) - AC_DEFINE_UNQUOTED([SILE_PATH],["${SILE_PATH}"],[Path for SILE packages and classes]) + AC_DEFINE_UNQUOTED([SILE_PATH], ["${SILE_PATH}"], [Path for SILE packages and classes]) ]) AC_SUBST([SILE_PATH]) +AC_SUBST([LUA_PATH]) +AC_SUBST([LUA_CPATH]) adl_RECURSIVE_EVAL(["${libdir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_LIB_PATH]) -AC_DEFINE_UNQUOTED([SILE_LIB_PATH],["${SILE_LIB_PATH}"],[Path for SILE libraries]) +AC_DEFINE_UNQUOTED([SILE_LIB_PATH],["${SILE_LIB_PATH}"], [Path for SILE libraries]) AC_SUBST([SILE_LIB_PATH]) AC_SUBST([ROCKSPECWARNING], ["DO NOT EDIT! Modify template sile.rockspec.in"]) diff --git a/core/pathsetup.lua.in b/core/pathsetup.lua.in index b9ef4bc29..413d3ce65 100644 --- a/core/pathsetup.lua.in +++ b/core/pathsetup.lua.in @@ -1,3 +1,9 @@ +-- Allow autoconf to setup system lua paths at compile time, not run time (only used in developer mode) +if "@LUA_PATH@" ~= "" then + package.path = "@LUA_PATH@" + package.cpath = "@LUA_CPATH@" +end + local executable = debug.getinfo(3, "S").source local luaversion = _VERSION:match("%d+%.%d+")