Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SDIST builds on non-Linux #2209

Merged
merged 5 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ target_link_options(svg PUBLIC /EXPORT:luaopen_svg)
set(LUA "luajit.exe")
set(SILE_PATH "debug.getinfo(1, 'S').source:match('@?.*[/\\\\]') or '.'")
set(SILE_LIB_PATH "debug.getinfo(1, 'S').source:match('@?.*[/\\\\]') or '.'")
set(SHARED_LIB_EXT "dll")
set(LIBEXT "dll")
configure_file(sile.in sile.lua)

if (WIN32)
Expand Down
27 changes: 14 additions & 13 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ BUILT_SOURCES_LUA = core/features.lua core/pathsetup.lua core/version.lua

bin_PROGRAMS = sile
bin_SCRIPTS = sile-lua
pkglib_LIBRARIES =
nodist_man_MANS =
dist_man_MANS = sile-lua.1
sile_SOURCES = src/bin/sile.rs src/lib.rs src/cli.rs src/types.rs src/types/semver.rs
Expand Down Expand Up @@ -133,9 +134,6 @@ $(CARGO_BIN): justenough/.libs/justenoughicu.a
$(CARGO_BIN): justenough/.libs/justenoughlibtexpdf.a
$(CARGO_BIN): justenough/.libs/svg.a
$(CARGO_BIN): libtexpdf/.libs/libtexpdf.a
if !EMBEDDED_RESOURCES
$(CARGO_BIN): rusile.$(SHARED_LIB_EXT)
endif !EMBEDDED_RESOURCES

src/embed-includes.rs: Makefile-distfiles
{
Expand All @@ -153,7 +151,10 @@ src/embed.rs: src/embed.rs.in src/embed-includes.rs
-e '/@EMBEDDED_INCLUDE_LIST@/r $(word 2,$^)' \
-e '/@EMBEDDED_INCLUDE_LIST@/d' \
$< > $@
endif EMBEDDED_RESOURCES

else !EMBEDDED_RESOURCES
$(CARGO_BIN): $(pkglib_LIBRARIES)
endif !EMBEDDED_RESOURCES

if LUAJIT
MLUAVER = luajit
Expand Down Expand Up @@ -268,13 +269,13 @@ _DOCS_DEPS = $(and $$(filter documentation/%,$@),$(addprefix .fonts/,$(DOCSFONTF
_SUBDIR_TELLS =

if SHARED
_SUBDIR_TELLS += justenough/.libs/fontmetrics.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughfontconfig.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughharfbuzz.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughicu.$(SHARED_LIB_EXT) \
justenough/.libs/justenoughlibtexpdf.$(SHARED_LIB_EXT) \
justenough/.libs/svg.$(SHARED_LIB_EXT) \
libtexpdf/.libs/libtexpdf.$(SHARED_LIB_EXT).0.0.0
_SUBDIR_TELLS += justenough/.libs/fontmetrics$(LIBEXT) \
justenough/.libs/justenoughfontconfig$(LIBEXT) \
justenough/.libs/justenoughharfbuzz$(LIBEXT) \
justenough/.libs/justenoughicu$(LIBEXT) \
justenough/.libs/justenoughlibtexpdf$(LIBEXT) \
justenough/.libs/svg$(LIBEXT) \
libtexpdf/.libs/libtexpdf$(LIBEXT).0.0.0
endif

if STATIC
Expand Down Expand Up @@ -382,10 +383,10 @@ typos:
busted: $(SILELUA) $(addprefix .fonts/,$(TESTFONTFILES)) $(BUSTEDSPECS)
set -f; IFS=';'
packagepath=(./{,lua-libraries/}?{,/init}.lua)
packagecpath=(./{,core/,{libtexpdf,justenough}/.libs/}?.$(SHARED_LIB_EXT))
packagecpath=(./{,core/,{libtexpdf,justenough}/.libs/}?$(LIBEXT))
if !SYSTEM_LUAROCKS
packagepath+=(./lua_modules/share/lua/$(LUA_VERSION)/?{,/init}.lua)
packagecpath+=(./lua_modules/lib/lua/$(LUA_VERSION)/?.$(SHARED_LIB_EXT))
packagecpath+=(./lua_modules/lib/lua/$(LUA_VERSION)/?$(LIBEXT))
endif
# Note: Busted tests can't run with out static build since the Rusile module is
# only available embedded into it. We can test on the dynamic builds where it
Expand Down
9 changes: 0 additions & 9 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,4 @@ touch aminclude.am

autoreconf --install

# See discussion in https://github.com/sile-typesetter/sile/issues/82 and
# https://web.archive.org/web/20170111053341/http://blog.gaku.net/autoconf/
case $(uname) in
Darwin*)
glibtoolize -W none
autoreconf --force -W none
;;
esac

build-aux/decore-automake.sh
18 changes: 18 additions & 0 deletions build-aux/que_libext.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dnl Note: requires AC_CANONICAL_TARGET to run before AC_INIT
AC_DEFUN_ONCE([QUE_LIBEXT], [
case $target_os in
darwin*)
LIBEXT=.dylib
;;
cygwin*|mingw*)
LIBEXT=.dll
;;
*)
LIBEXT=.so
;;
esac
AM_CONDITIONAL([LIB_IS_SO], [test $LIBEXT = .so])
AM_CONDITIONAL([LIB_IS_DYLIB], [test $LIBEXT = .dylib])
AM_CONDITIONAL([LIB_IS_DLL], [test $LIBEXT = .dll])
AC_SUBST([LIBEXT])
])
4 changes: 3 additions & 1 deletion build-aux/que_rust_boilerplate.m4
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ $($SED -E "s/@PACKAGE_VAR@/$PACKAGE_VAR/g;s/@PACKAGE_NAME@/$PACKAGE_NAME/g" buil

AC_DEFUN([QUE_RUST_MODULE], [

QUE_LIBEXT
AC_REQUIRE([AX_AM_MACROS])

AX_ADD_AM_MACRO([dnl
EXTRA_DIST += build-aux/que_rust_module.am

$($SED -E "s/@MODULE@/$1/g;s/@SHARED_LIB_EXT@/$SHARED_LIB_EXT/g" build-aux/que_rust_module.am)
$($SED -E "s/@MODULE@/$1/g" build-aux/que_rust_module.am)
])dnl

])
40 changes: 36 additions & 4 deletions build-aux/que_rust_module.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
pkglib_LIBRARIES = @MODULE@.@SHARED_LIB_EXT@
@MODULE@_@SHARED_LIB_EXT@_SOURCES = @MODULE@/Cargo.toml @MODULE@/src/lib.rs @MODULE@/build.rs
@MODULE@_srcs = @MODULE@/Cargo.toml @MODULE@/src/lib.rs @MODULE@/build.rs

@builddir@/target/@RUST_TARGET_SUBDIR@/lib@MODULE@.@SHARED_LIB_EXT@: $(@MODULE@_@SHARED_LIB_EXT@_SOURCES)
if LIB_IS_SO
pkglib_LIBRARIES += rusile.so
@MODULE@_so_SOURCES = $(@MODULE@_srcs)
endif

if LIB_IS_DYLIB
pkglib_LIBRARIES += rusile.dylib
@MODULE@_dylib_SOURCES = $(@MODULE@_srcs)
endif

if LIB_IS_DLL
pkglib_LIBRARIES += rusile.dll
@MODULE@_dll_SOURCES = $(@MODULE@_srcs)
endif

@MODULE@_so_AR = :
@MODULE@_so_RANLIB = :
@MODULE@_so_LINK = :

@MODULE@_dylib_AR = :
@MODULE@_dylib_RANLIB = :
@MODULE@_dylib_LINK = :

@MODULE@_dll_AR = :
@MODULE@_dll_RANLIB = :
@MODULE@_dll_LINK = :

@builddir@/target/@RUST_TARGET_SUBDIR@/lib@[email protected] @builddir@/target/@RUST_TARGET_SUBDIR@/lib@[email protected] @builddir@/target/@RUST_TARGET_SUBDIR@/lib@[email protected]: $(@MODULE@_srcs)
$(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) --target $(CARGO_TARGET_TRIPLE) $(@MODULE@_FEATURE_ARGS) $(CARGO_RELEASE_ARGS) -p @MODULE@

@MODULE@.@SHARED_LIB_EXT@: @builddir@/target/@RUST_TARGET_SUBDIR@/lib@MODULE@.@SHARED_LIB_EXT@
@[email protected]: @builddir@/target/@RUST_TARGET_SUBDIR@/lib@[email protected]
$(INSTALL) $< $@

@[email protected]: @builddir@/target/@RUST_TARGET_SUBDIR@/lib@[email protected]
$(INSTALL) $< $@

@[email protected]: @builddir@/target/@RUST_TARGET_SUBDIR@/lib@[email protected]
$(INSTALL) $< $@
19 changes: 3 additions & 16 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ AC_INIT([sile], [m4_esyscmd(build-aux/git-version-gen .tarball-version)], [caleb
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign tar-pax dist-zstd dist-zip no-dist-gzip color-tests subdir-objects])
AM_INIT_AUTOMAKE([foreign tar-pax dist-zstd dist-zip no-dist-gzip no-dependencies color-tests subdir-objects])
AM_SILENT_RULES([yes])

# Load up re-usable m4 bits shared across Caleb's projects
QUE_GIT_VERSION
QUE_TRANSFORM_PACKAGE_NAME
QUE_DEVELOPER_MODE
QUE_DIST_CHECKSUMS
QUE_LIBEXT

# Extend the QUE checksums feature with support for the PDF manual
SILE_DIST_CHECKSUMS
Expand Down Expand Up @@ -38,22 +39,8 @@ RANLIB=:
LT_PREREQ([2.2])
LT_INIT([dlopen])

QUE_RUST_BOILERPLATE
QUE_DOCKER_BOILERPLATE

# Load Rust module bits, early since it stuffs rules in aminclude.am
case $target_os in
darwin*)
SHARED_LIB_EXT="dylib"
;;
cygwin*|mingw*)
SHARED_LIB_EXT="dll"
;;
*)
SHARED_LIB_EXT="so"
;;
esac
AC_SUBST([SHARED_LIB_EXT])
QUE_RUST_BOILERPLATE
QUE_RUST_MODULE([rusile])

AM_CONDITIONAL([SHARED], [test "x$enable_shared" = "xyes"])
Expand Down
4 changes: 2 additions & 2 deletions core/pathsetup.lua.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ end

-- Prepend paths specifically for C modules.
local function prependCPath (path)
package.cpath = prepend_and_dedup(path .. "/?.@SHARED_LIB_EXT@", package.cpath)
if "@SHARED_LIB_EXT@" ~= "so" then
package.cpath = prepend_and_dedup(path .. "/?@LIBEXT@", package.cpath)
if "@LIBEXT@" ~= "so" then
package.cpath = prepend_and_dedup(path .. "/?.so", package.cpath)
end
end
Expand Down
Loading