Skip to content

Commit 3e50b28

Browse files
committed
Merge branch 'mlua-v010' into cargo-workspace-inplace
2 parents c0c9b9f + b9716f0 commit 3e50b28

37 files changed

+1061
-1011
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ jobs:
6363
run: |
6464
make dist
6565
- name: Upload source dist artifact
66-
if: ${{ matrix.configuration[0] == 'dynamic' && !contains(github.ref, 'refs/tags/v') }}
66+
if: matrix.configuration[0] == 'dynamic' && !startsWith(github.ref, 'refs/tags/v')
6767
uses: actions/upload-artifact@v4
6868
with:
6969
name: sile-${{ env.VERSION }}
7070
path: sile-${{ env.VERSION }}.zip
7171
- name: Append architecture to static binary
72-
if: ${{ matrix.configuration[0] == 'static' }}
72+
if: matrix.configuration[0] == 'static'
7373
run: |
7474
cp sile sile-${{ env.CARCH }}
7575
sha256sum sile-${{ env.CARCH }} | tee -a sile-${{ env.VERSION }}.sha256.txt
7676
- name: Upload static binary artifact
77-
if: ${{ matrix.configuration[0] == 'static' && !contains(github.ref, 'refs/tags/v') }}
77+
if: matrix.configuration[0] == 'static' && !startsWith(github.ref, 'refs/tags/v')
7878
uses: actions/upload-artifact@v4
7979
with:
8080
name: sile-${{ env.CARCH }}
@@ -124,7 +124,7 @@ jobs:
124124
run: |
125125
make fake-manual
126126
make distdir
127-
- name: Build from package
127+
- name: Build from dist tree
128128
run: |
129129
make docker-test-dist
130130
@@ -144,9 +144,9 @@ jobs:
144144
.sources
145145
key: fonts-${{ hashFiles('Makefile-fonts') }}
146146
- name: Install Nix
147-
uses: DeterminateSystems/nix-installer-action@v13
147+
uses: DeterminateSystems/nix-installer-action@v14
148148
- name: Cache Nix dependencies
149-
uses: DeterminateSystems/magic-nix-cache-action@v7
149+
uses: DeterminateSystems/magic-nix-cache-action@v8
150150
- name: Setup developer environment
151151
run: |
152152
nix develop --command ./bootstrap.sh

.github/workflows/nix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
with:
1717
fetch-depth: 0
1818
- name: Install Nix
19-
uses: DeterminateSystems/nix-installer-action@v13
19+
uses: DeterminateSystems/nix-installer-action@v14
2020
- name: Cache Nix dependencies
21-
uses: DeterminateSystems/magic-nix-cache-action@v7
21+
uses: DeterminateSystems/magic-nix-cache-action@v8
2222
# Upstream package sometimes has flags set that disable flake checking
2323
- name: Setup test env
2424
run: |

Cargo.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ zsh = [ "completions" ]
107107
[profile.release]
108108
lto = true
109109

110+
[workspace.dependencies.mlua]
111+
version = "0.10.0-beta.2"
112+
110113
[dependencies.anyhow]
111114
version = "1.0"
112115

@@ -116,7 +119,7 @@ optional = true
116119
features = [ "derive", "string", "wrap_help" ]
117120

118121
[dependencies.mlua]
119-
version = "0.9"
122+
workspace = true
120123
features = [ "macros" ]
121124

122125
# [dependencies.rusile]

Dockerfile

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
ARG ARCHTAG
44

5-
FROM docker.io/library/archlinux:base-devel$ARCHTAG AS builder
5+
FROM docker.io/library/archlinux:$ARCHTAG AS base
6+
7+
# Initialize keys so we can do package management
8+
RUN pacman-key --init && pacman-key --populate
9+
10+
# This hack can convince Docker its cache is obsolete; e.g. when the contents
11+
# of downloaded resources have changed since being fetched. It's helpful to have
12+
# this as a separate layer because it saves time for local builds. Incrementing
13+
# this when pushing dependency updates to Caleb's Arch user repository or just
14+
# when the remote Docker Hub builds die should be enough.
15+
ARG DOCKER_HUB_CACHE=1
616

717
ARG RUNTIME_DEPS
8-
ARG BUILD_DEPS
918

1019
# Enable system locales for everything we have localizations for so tools like
1120
# `date` will output matching localized strings. By default Arch Docker images
@@ -14,60 +23,70 @@ ARG BUILD_DEPS
1423
RUN sed -i -e '/^NoExtract.*locale/d' /etc/pacman.conf
1524

1625
# Freshen all base system packages
17-
RUN pacman-key --init
18-
RUN pacman --needed --noconfirm -Syq archlinux-keyring
19-
RUN pacman --needed --noconfirm -Suq
26+
RUN pacman --needed --noconfirm -Syuq && yes | pacman -Sccq
2027

2128
# Make sure *at least* glibc actually got reinstalled after enabling
22-
# extraaction of locale files even if the version was fresh so we can use the
29+
# extraction of locale files even if the version was fresh so we can use the
2330
# locale support out of it later.
2431
RUN pacman --noconfirm -Sq glibc && yes | pacman -Sccq
2532

2633
# Install run-time dependencies
27-
RUN pacman --needed --noconfirm -Sq $RUNTIME_DEPS $BUILD_DEPS
34+
RUN pacman --needed --noconfirm -Sq $RUNTIME_DEPS && yes | pacman -Sccq
35+
36+
# Setup LuaRocks for use with LuaJIT roughly matching SILE's internal VM
37+
RUN luarocks config lua_version 5.1 && \
38+
luarocks config lua_interpreter luajit && \
39+
luarocks config variables.LUA "$(command -v luajit)" && \
40+
luarocks config variables.LUA_INCDIR /usr/include/luajit-2.1/
41+
42+
# Setup separate image for build so we don’t bloat the final image
43+
FROM base AS builder
44+
45+
ARG BUILD_DEPS
46+
47+
# Install build time dependencies
48+
RUN pacman --needed --noconfirm -Sq $BUILD_DEPS && yes | pacman -Sccq
2849

2950
# Set at build time, forces Docker’s layer caching to reset at this point
3051
ARG REVISION
3152

3253
COPY ./ /src
3354
WORKDIR /src
3455

35-
# Rebuild locale database after having added our supported locales.
56+
# Take note of SILE's supported locales so the final system can build localized messages
3657
RUN ls i18n/ | sed 's/[.-].*$/_/;s/^/^/' | sort -u | grep -Ef - /usr/share/i18n/SUPPORTED > /etc/locale.gen
37-
RUN locale-gen
3858

3959
# GitHub Actions builder stopped providing git history :(
4060
# See feature request at https://github.com/actions/runner/issues/767
4161
RUN build-aux/docker-bootstrap.sh
4262

63+
# Use clang and mold instead of gcc and ld for speed
64+
ENV RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold"
65+
4366
RUN ./bootstrap.sh
44-
RUN ./configure --with-system-lua-sources --without-manual
67+
RUN ./configure \
68+
--disable-embeded-resources \
69+
--with-system-lua-sources \
70+
--without-system-luarocks \
71+
--without-manual
4572
RUN make
4673
RUN make install DESTDIR=/pkgdir
4774

48-
# Work around BuiltKit / buildx bug, they can’t copy to symlinks only dirs
49-
RUN mv /pkgdir/usr/local/{share/,}/man
50-
51-
FROM docker.io/library/archlinux:base$ARCHTAG AS final
75+
FROM base AS final
5276

5377
# Same args as above, repeated because they went out of scope with FROM
54-
ARG RUNTIME_DEPS
55-
ARG VERSION
5678
ARG REVISION
79+
ARG VERSION
5780

5881
# Allow `su` with no root password so non-priv users can install dependencies
5982
RUN sed -i -e '/.so$/s/$/ nullok/' /etc/pam.d/su
6083

6184
# Set system locale to something other than 'C' that resolves to a real language
6285
ENV LANG=en_US.UTF-8
6386

64-
# Freshen all base system packages (and cleanup cache)
65-
RUN pacman-key --init
66-
RUN pacman --needed --noconfirm -Syq archlinux-keyring && yes | pacman -Sccq
67-
RUN pacman --needed --noconfirm -Suq && yes | pacman -Sccq
68-
69-
# Install run-time dependencies
70-
RUN pacman --needed --noconfirm -Sq $RUNTIME_DEPS && yes | pacman -Sccq
87+
# Rebuild locale database so system apps have localized messages for SILE's supported locales
88+
COPY --from=builder /etc/locale.gen /etc
89+
RUN locale-gen
7190

7291
LABEL org.opencontainers.image.title="SILE"
7392
LABEL org.opencontainers.image.description="A containerized version of the SILE typesetter"
@@ -80,8 +99,19 @@ LABEL org.opencontainers.image.revision="$REVISION"
8099

81100
COPY build-aux/docker-fontconfig.conf /etc/fonts/conf.d/99-docker.conf
82101

102+
# Inform the system Lua manifest where SILE's vendored modules are so they are
103+
# available to 3rd party packages even outside of SILE's runtime. Most notably
104+
# useful so that luarocks can find them as existing dependencies when
105+
# installing 3rd party modules. We replace the user tree instead of inserting
106+
# a new one because it doesn't make sense in Docker anyway and the default
107+
# priority works out better having it first.
108+
RUN luarocks config rocks_trees[1].root /usr/local/share/sile/lua_modules && \
109+
luarocks config rocks_trees[1].name sile && \
110+
luarocks config deps_mode all
111+
83112
COPY --from=builder /pkgdir /
84113
COPY --from=builder /src/src/sile-entry.sh /usr/local/bin
114+
85115
RUN sile --version
86116

87117
WORKDIR /data

Makefile-fonts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ if FONT_DOWNLOAD_TOOLS
99
[ -h .sources ] || mkdir -p $@
1010

1111
fonttooling:
12-
$(if $(BSDTAR),,$(error Please set BSDTAR with path or `./configure --enable-developer`))
13-
$(if $(CURL),,$(error Please set CURL with path or `./configure --enable-developer`))
12+
$(if $(BSDTAR),,$(error Please set BSDTAR with path or `./configure --enable-developer-mode`))
13+
$(if $(CURL),,$(error Please set CURL with path or `./configure --enable-developer-mode`))
1414

1515
# Don't let make delete things we had to download
1616
.PRECIOUS: .fonts/% .sources/%
@@ -101,7 +101,7 @@ notobase = $(shell echo $(notdir $1) | sed -e 's/-.*//')
101101
.sources/LateefGR-1.200.zip: | .sources
102102
$(CURL) -fsSL https://software.sil.org/downloads/r/lateef/$(notdir $@) -o $@
103103

104-
.sources/Libertinus-%.tar.xz: | .sources
104+
.sources/Libertinus-%.tar.zst: | .sources
105105
$(CURL) -fsSL https://github.com/alerque/libertinus/releases/download/v$*/$(notdir $@) -o $@
106106

107107
.sources/roboto-unhinted.zip: | .sources
@@ -138,7 +138,7 @@ notobase = $(shell echo $(notdir $1) | sed -e 's/-.*//')
138138
$(BSDTAR) -x -f $< -C $(dir $@) $(notdir $@) && \
139139
touch $@
140140

141-
.fonts/Libertinus%: .sources/Libertinus-7.020.tar.xz | .fonts
141+
.fonts/Libertinus%: .sources/Libertinus-7.050.tar.zst | .fonts
142142
$(BSDTAR) -x -f $< -C $(dir $@) --strip-components 3 $(basename $(basename $(<F)))/static/OTF/$(notdir $@) && \
143143
touch $@
144144

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,6 @@ gource.webm:
487487
else !DEVELOPER_MODE
488488

489489
$(PHONY_DEVELOPER_TARGETS):
490-
@: $(error "Please reconfigure using --enable-developer to use developer tooling")
490+
@: $(error "Please reconfigure using --enable-developer-mode to use developer tooling")
491491

492492
endif !DEVELOPER_MODE

core/pathsetup.lua.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ local function extendPaths (path, silesourcedir)
6767
prependPath(path .. "/sile")
6868
end
6969
-- These paths are *only* used in developer mode for build testing
70-
if "@DEVELOPER_FALSE@" ~= "" then -- see ./configure --(en|dis)able-developer
70+
if "@DEVELOPER_MODE_TRUE@" == "" then -- see ./configure --(en|dis)able-developer-mode
7171
prependCPath(path .. "/libtexpdf/.libs")
7272
prependCPath(path .. "/justenough/.libs")
7373
end

hooks/build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env sh
22
set -e
33

4-
: "${ARCHTAG:=}"
4+
: "${ARCHTAG:=latest}"
55
: "${DOCKERFILE:=Dockerfile}"
66

77
REVISION=$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
88

99
RUNTIME_DEPS='fontconfig freetype2 gentium-plus-font glibc harfbuzz icu libpng luajit zlib'\
10-
' libertinus-font luarocks noto-fonts-cjk ttf-hack'
11-
BUILD_DEPS='cargo git jq lua51 poppler'
10+
' otf-libertinus luarocks noto-fonts-cjk ttf-hack'
11+
BUILD_DEPS='base-devel cargo clang git jq mold poppler'
1212

1313
: "${DOCKER_BUILDKIT:=1}"
1414
export DOCKER_BUILDKIT

outputters/text.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ function outputter:setCursor (x, y, relative)
5757
if newy - cursorY > bs then
5858
outfile:write("\n")
5959
else
60-
outfile:write("")
60+
outfile:write("\u{202b}")
6161
end
6262
elseif newx > cursorX then
6363
if newx:tonumber() - cursorX:tonumber() > spc then
6464
outfile:write(" ")
6565
else
66-
outfile:write("")
66+
outfile:write("\u{202b}")
6767
end
6868
end
6969
end

0 commit comments

Comments
 (0)