Skip to content

Commit 42b219e

Browse files
authored
add fedora builds (lapce#3204)
1 parent b066d16 commit 42b219e

File tree

5 files changed

+130
-50
lines changed

5 files changed

+130
-50
lines changed

.dockerignore

+9-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
/target
1+
.github
2+
.vscode
3+
.lapce
4+
docs
5+
extra/linux/docker
6+
extra/macos
7+
extra/windows
8+
target
9+
lapce.spec

.github/workflows/release.yml

+34
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,38 @@ jobs:
183183
./target/linux_*/*
184184
retention-days: 1
185185

186+
rpm:
187+
runs-on: ubuntu-latest
188+
needs: tagname
189+
env:
190+
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
191+
strategy:
192+
fail-fast: false
193+
matrix:
194+
include:
195+
- os-name: fedora
196+
os-version: 39
197+
- os-name: fedora
198+
os-version: 40
199+
# - os-name: fedora
200+
# os-version: 41
201+
# - os-name: fedora
202+
# os-version: rawhide
203+
steps:
204+
- uses: actions/checkout@v4
205+
206+
- name: Build rpm packages
207+
run: |
208+
docker buildx create --driver=docker-container --use
209+
docker buildx bake --pull ${{ matrix.os-name }}-${{ matrix.os-version }}-package
210+
211+
- uses: actions/upload-artifact@v4
212+
with:
213+
name: lapce-${{ matrix.os-name }}-${{ matrix.os-version }}
214+
path: |
215+
./target/*
216+
retention-days: 1
217+
186218
linux-musl:
187219
name: Build lapce-proxy for ${{ matrix.platform }}
188220
runs-on: ubuntu-latest
@@ -335,6 +367,7 @@ jobs:
335367
- linux
336368
- linux-musl
337369
- deb
370+
- rpm
338371
- windows
339372
- macos
340373
runs-on: ubuntu-latest
@@ -391,5 +424,6 @@ jobs:
391424
lapce-linux/* \
392425
lapce-debian*/*/* \
393426
lapce-ubuntu*/*/* \
427+
lapce-fedora*/*/* \
394428
lapce-proxy-linux-*/* \
395429
lapce-windows/*

docker-bake.hcl

+12-11
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,25 @@ variable "RHEL_FAMILY_PACKAGES" {
160160
}
161161

162162
target "fedora" {
163-
inherits = ["package"]
164-
name = "${os_name}-${build.os_version}"
165-
dockerfile = "extra/linux/docker/${os_name}/Dockerfile"
163+
inherits = [build.type]
164+
name = "${name}-${build.version}-${build.type}"
165+
dockerfile = "extra/linux/docker/${name}/Dockerfile"
166166
args = {
167167
XX_VERSION = "test"
168168

169-
DISTRIBUTION_NAME = os_name
170-
DISTRIBUTION_VERSION = build.os_version
169+
DISTRIBUTION_NAME = name
170+
DISTRIBUTION_VERSION = build.version
171171
DISTRIBUTION_PACKAGES = join(" ", coalesce(build.packages, RHEL_FAMILY_PACKAGES))
172172
}
173-
platforms = coalesce(build.platforms, platforms)
173+
// platforms = coalesce(build.platforms, platforms)
174+
platforms = ["linux/amd64"]
174175
matrix = {
175-
os_name = ["fedora"]
176+
name = ["fedora"]
176177
build = [
177-
{ os_version = "39", packages = null, platforms = null },
178-
{ os_version = "40", packages = null, platforms = null },
179-
{ os_version = "41", packages = null, platforms = null },
180-
{ os_version = "rawhide", packages = null, platforms = null },
178+
{ packages = null, platforms = null, type = "package", version = "39" },
179+
{ packages = null, platforms = null, type = "package", version = "40" },
180+
{ packages = null, platforms = null, type = "package", version = "41" },
181+
{ packages = null, platforms = null, type = "package", version = "rawhide" },
181182
]
182183
}
183184
}

extra/linux/docker/fedora/Dockerfile

+70-32
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ FROM build-prep AS build
8080
ARG PACKAGE_NAME
8181
ENV PACKAGE_NAME="${PACKAGE_NAME}"
8282

83-
ARG OUTPUT_DIR="/output"
84-
ENV OUTPUT_DIR="${OUTPUT_DIR}"
85-
8683
ARG CARGO_BUILD_INCREMENTAL='false'
8784

8885
ENV CC='xx-clang'
@@ -95,58 +92,99 @@ ARG RELEASE_TAG_NAME
9592
ENV RELEASE_TAG_NAME="${RELEASE_TAG_NAME}"
9693

9794
RUN \
98-
--mount=type=cache,target=/cargo/git/db,sharing=locked,readonly=true \
99-
--mount=type=cache,target=/cargo/registry/cache,sharing=locked,readonly=true \
100-
--mount=type=cache,target=/cargo/registry/index,sharing=locked,readonly=true \
95+
--mount=type=cache,target=/cargo/git/db,readonly=true \
96+
--mount=type=cache,target=/cargo/registry/cache,readonly=true \
97+
--mount=type=cache,target=/cargo/registry/index,readonly=true \
10198
--mount=type=cache,target=/root/.cache,sharing=private \
10299
<<EOF
103100
#!/usr/bin/env bash
104101
set -euxo pipefail
105102

103+
LAPCE_VERSION=$(cargo pkgid | cut -d'#' -f2 | cut -d'@' -f2 | cut -d':' -f2)
104+
105+
case "${RELEASE_TAG_NAME}" in
106+
nightly-*)
107+
commit=$(echo "${RELEASE_TAG_NAME}" | cut -d'-' -f2)
108+
RELEASE_TAG_NAME="${LAPCE_VERSION}+${commit}"
109+
;;
110+
debug|nightly)
111+
date=$(date +%Y%m%d%H%M)
112+
RELEASE_TAG_NAME="${LAPCE_VERSION}+${date}"
113+
;;
114+
*)
115+
RELEASE_TAG_NAME="${RELEASE_TAG_NAME//v/}"
116+
;;
117+
esac
118+
119+
. /etc/os-release
120+
export DISTRO_ID="$(echo $ID | tr - _)"
121+
export DISTRO_VERSION="$(echo $VERSION_ID | tr - _)"
122+
123+
cat > lapce.spec <<EOL
124+
Name: ${PACKAGE_NAME}
125+
Version: ${RELEASE_TAG_NAME}
126+
Release: 1.${DISTRO_ID}${DISTRO_VERSION}
127+
Summary: Lightning-fast and Powerful Code Editor written in Rust
128+
License: Apache-2.0
129+
URL: https://github.com/lapce/lapce
130+
Packager: Jakub Panek
131+
132+
%description
133+
Lapce is written in pure Rust with a UI in Druid (which is also written in Rust).
134+
It is designed with Rope Science from the Xi-Editor which makes for lightning-fast computation, and leverages OpenGL for rendering.
135+
136+
%build
106137
xx-clang --setup-target-triple
107138
xx-clang --wrap
108-
109139
export RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=/usr/bin/ld.lld"
110140
export PKG_CONFIG="$(xx-clang --print-prog-name=pkg-config)"
111-
export CARGO_BUILD_TARGET="$(xx-cargo --print-target-triple)"
112-
113141
rustup target add "$(xx-cargo --print-target-triple)"
142+
export RELEASE_TAG_NAME="${RELEASE_TAG_NAME}"
114143
xx-cargo build --profile release-lto --bin lapce --frozen
115144
xx-verify "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce
116145

117-
mkdir -p /target
118-
mv -v "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce /target/
146+
%install
147+
install -Dm755 "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce %{buildroot}%{_bindir}/lapce
148+
install -Dm644 extra/linux/dev.lapce.lapce.desktop %{buildroot}/usr/share/applications/dev.lapce.lapce.desktop
149+
install -Dm644 extra/linux/dev.lapce.lapce.metainfo.xml %{buildroot}/usr/share/metainfo/dev.lapce.lapce.metainfo.xml
150+
install -Dm644 extra/images/logo.png %{buildroot}/usr/share/pixmaps/dev.lapce.lapce.png
151+
152+
%files
153+
%license LICENSE*
154+
%doc *.md
155+
%{_bindir}/lapce
156+
/usr/share/applications/dev.lapce.lapce.desktop
157+
/usr/share/metainfo/dev.lapce.lapce.metainfo.xml
158+
/usr/share/pixmaps/dev.lapce.lapce.png
159+
160+
%changelog
161+
* Thu Apr 25 2024 Jakub Panek
162+
- See GitHub for full changelog
163+
EOL
164+
165+
/usr/bin/rpmbuild --build-in-place --noclean --noprep -bb --rmspec lapce.spec --verbose
166+
ls -lahR $HOME/rpmbuild
119167
EOF
120168

121-
WORKDIR /output
122-
RUN <<EOF
169+
RUN \
170+
<<EOF
123171
#!/usr/bin/env bash
124172
set -euxo pipefail
125173

126-
export _PACKAGE_ARCHITECTURE=$(xx-info rhel-arch)
127-
128-
mkdir -v -p ${PACKAGE_NAME}/{etc,usr/bin}
129-
cd ${PACKAGE_NAME}
130-
131-
mv /target/lapce ./usr/bin/
132-
133-
if [ "${PACKAGE_NAME}" = "lapce" ]; then
134-
conflicts="lapce-nightly"
135-
else
136-
conflicts="lapce"
137-
fi
138-
139-
if [ "${RELEASE_TAG_NAME}" = "nightly" ]; then
140-
RELEASE_TAG_NAME="v0.0.1"
141-
fi
142-
174+
mv -v $HOME/rpmbuild/RPMS/* /output/
143175
EOF
144176

145177
FROM build-base AS dev
146178
COPY . ./dev
147179

148180
FROM scratch AS binary
149-
COPY --from=build /output/*.deb .
181+
COPY --from=build /output/lapce .
150182

151183
FROM scratch AS cross-binary
152-
COPY --from=build /output/*.deb .
184+
COPY --from=build /output/lapce .
185+
186+
FROM scratch AS package
187+
COPY --from=build /output/*.rpm .
188+
189+
FROM scratch AS cross-package
190+
COPY --from=build /output/*.rpm .

lapce.spec

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ URL: https://github.com/lapce/lapce
88
VCS: {{{ git_dir_vcs }}}
99
Source: {{{ git_dir_pack }}}
1010

11-
BuildRequires: cargo perl-FindBin cairo-devel cairo-gobject-devel atk-devel gdk-pixbuf2-devel pango-devel gtk3-devel perl-lib perl-File-Compare mold clang libxkbcommon-x11-devel
11+
BuildRequires: cargo libxkbcommon-x11-devel libxcb-devel vulkan-loader-devel wayland-devel openssl-devel pkgconf libxkbcommon-x11-devel
1212

1313
%description
1414
Lapce is written in pure Rust with a UI in Druid (which is also written in Rust).
1515
It is designed with Rope Science from the Xi-Editor which makes for lightning-fast computation, and leverages OpenGL for rendering.
1616

1717
%prep
1818
{{{ git_dir_setup_macro }}}
19+
cargo fetch --locked
1920

2021
%build
21-
RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold" cargo build --profile release-lto
22+
cargo build --profile release-lto --package lapce-app --frozen
2223

2324
%install
2425
install -Dm755 target/release-lto/lapce %{buildroot}%{_bindir}/lapce
25-
install -Dm755 target/release-lto/lapce-proxy %{buildroot}%{_bindir}/lapce-proxy
2626
install -Dm644 extra/linux/dev.lapce.lapce.desktop %{buildroot}/usr/share/applications/dev.lapce.lapce.desktop
2727
install -Dm644 extra/linux/dev.lapce.lapce.metainfo.xml %{buildroot}/usr/share/metainfo/dev.lapce.lapce.metainfo.xml
2828
install -Dm644 extra/images/logo.png %{buildroot}/usr/share/pixmaps/dev.lapce.lapce.png
@@ -31,11 +31,10 @@ install -Dm644 extra/images/logo.png %{buildroot}/usr/share/pixmaps/dev.lapce.la
3131
%license LICENSE*
3232
%doc *.md
3333
%{_bindir}/lapce
34-
%{_bindir}/lapce-proxy
3534
/usr/share/applications/dev.lapce.lapce.desktop
3635
/usr/share/metainfo/dev.lapce.lapce.metainfo.xml
3736
/usr/share/pixmaps/dev.lapce.lapce.png
3837

3938
%changelog
40-
* Sat Jul 16 2022 Simon Garding <[email protected]> - test
41-
- test
39+
* Mon Jan 01 2024 Jakub Panek
40+
- See full changelog on GitHub

0 commit comments

Comments
 (0)