Skip to content

Commit

Permalink
feat(build): Make vendoring Lua sources controlable at build time
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 11, 2023
1 parent f05d8a6 commit 773245b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ required-features = [ "cli" ]

[dependencies.mlua]
version = "0.9"
features = [ "macros", "vendored" ]
features = [ "macros" ]

[build-dependencies]

Expand Down Expand Up @@ -59,6 +59,7 @@ lua53 = [ "mlua/lua53" ]
lua52 = [ "mlua/lua52" ]
lua51 = [ "mlua/lua51" ]
luajit = [ "mlua/luajit" ]
vendored = [ "mlua/vendored" ]
completions = [ "cli", "clap_complete" ]
cli = [ "clap" ]
bash = [ "completions" ]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ WORKDIR /src
RUN build-aux/docker-bootstrap.sh

RUN ./bootstrap.sh
RUN ./configure --without-manual
RUN ./configure --with-system-lua-sources --without-manual
RUN make
RUN make check
RUN make install DESTDIR=/pkgdir
Expand Down
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ MLUAVER = lua$(LUA_SHORT_VERSION)
endif
CARGO_FEATURE_ARGS = --features $(MLUAVER)

if !SYSTEM_LUA_SOURCES
CARGO_FEATURE_ARGS += --features vendored
endif

DEPDIR := .deps
LOCALFONTS := FONTCONFIG_FILE=$(PWD)/fontconfig.conf
LOCALPATHS := SILE_PATH="$(PWD);libtexpdf/.libs;justenough/.libs"
Expand Down
1 change: 1 addition & 0 deletions build-aux/pkg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ in stdenv.mkDerivation (finalAttrs: {
configureFlags = [
# Nix will supply all the Lua dependencies, so stop the build system from
# bundling vendored copies of them.
"--with-system-lua-sources"
"--with-system-luarocks"
# The automake check target uses pdfinfo to confirm the output of a test
# run, and uses autotools to discover it. This flake build eschews that
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ AC_ARG_WITH([system-luarocks],
AM_CONDITIONAL([SYSTEM_LUAROCKS], [test "x$with_system_luarocks" = "xyes"])
AC_SUBST([SYSTEM_LUAROCKS])

AC_ARG_WITH([system-lua-sources],
AS_HELP_STRING([--with-system-lua-sources],
[Don’t compile against vendored Lua sources, use system headers]))
AM_CONDITIONAL([SYSTEM_LUA_SOURCES], [test "x$with_system_lua_sources" = "xyes"])
AC_SUBST([SYSTEM_LUA_SOURCES])

AC_ARG_WITH([luajit],
AS_HELP_STRING([--without-luajit],
[Prefer LuaJIT over PUC Lua, even if the latter is newer]))
Expand Down

0 comments on commit 773245b

Please sign in to comment.