Skip to content

Commit

Permalink
refactor: remove libcmt debian packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Jan 15, 2025
1 parent 15f606d commit 77867f9
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 115 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,39 +91,19 @@ jobs:
path: |
${{ env.TOOLS_ROOTFS }}.html
- name: Build libcmt
id: docker_build_libcmt
uses: docker/build-push-action@v5
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ env.TOOLS_IMAGE }}-libcmt
push: false
load: true
build-args: |
VERSION=${{ env.VERSION }}
target: libcmt-debian-packager
cache-from: type=gha,scope=regular,mode=max
cache-to: type=gha,scope=regular

- name: Retrieve artifacts
run: make copy-libcmt

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: |
${{ env.TOOLS_DEB }}
${{ env.TOOLS_ROOTFS }}
libcmt/deb/*
- name: Checksum artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: |
sha512sum ${{ env.TOOLS_DEB }} > ${{ env.TOOLS_DEB }}.sha512
sha512sum ${{ env.TOOLS_ROOTFS }} > ${{ env.TOOLS_ROOTFS }}.sha512
for f in libcmt/deb/*; do sha512sum $f > $f.sha512; done
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ control
machine-emulator-tools-*.tar.gz
machine-emulator-tools-*.deb
rootfs.*
libcmt-*.*
package.json
*.bin

Expand Down
24 changes: 0 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,6 @@ RUN make -C ${BUILD_BASE}/tools/sys-utils -j$(nproc) all
RUN make -C ${BUILD_BASE}/tools/sys-utils install \
DESTDIR=${BUILD_BASE}/tools/sys-utils_staging PREFIX=/usr

# build libcmt debian package
# ------------------------------------------------------------------------------
FROM c-builder AS libcmt-debian-packager
ARG VERSION=0.0.0
USER root

RUN make -C ${BUILD_BASE}/tools/sys-utils/libcmt \
ARG_VERSION=${VERSION} \
PREFIX=/usr \
DESTDIR=${BUILD_BASE}/install/run \
install-run libcmt-v${VERSION}.deb

RUN make -C ${BUILD_BASE}/tools/sys-utils/libcmt \
ARG_VERSION=${VERSION} \
PREFIX=/usr \
DESTDIR=${BUILD_BASE}/install/dev \
install-dev libcmt-dev-v${VERSION}.deb

RUN make -C ${BUILD_BASE}/tools/sys-utils/libcmt \
ARG_VERSION=${VERSION} \
PREFIX=/usr/riscv64-linux-gnu \
DESTDIR=${BUILD_BASE}/install/cross \
install libcmt-dev-riscv64-cross-v${VERSION}.deb

# build rust tools
# ------------------------------------------------------------------------------
FROM c-builder AS rust-env
Expand Down
21 changes: 2 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,6 @@ fs-license:
.
TMPFILE=$$(mktemp) && (cd fs/third-party/repo-info/; ./scan-local.sh $(TOOLS_ROOTFS_IMAGE) linux/riscv64) | tee $$TMPFILE && pandoc -s -f markdown -t html5 -o $(TOOLS_ROOTFS).html $$TMPFILE && rm -f $$TMPFILE

libcmt:
@mkdir $@

build-libcmt:
@docker buildx build --load \
--target libcmt-debian-packager \
--build-arg VERSION=$(VERSION) \
-t $(TOOLS_IMAGE)-libcmt \
-f Dockerfile \
.
$(MAKE) copy-libcmt

copy-libcmt: libcmt
@ID=`docker create $(TOOLS_IMAGE)-libcmt` && \
docker cp $$ID:/opt/cartesi/tools/sys-utils/libcmt/build/deb/ libcmt && \
docker rm $$ID

env:
@echo VERSION=$(VERSION)
@echo TOOLS_DEB=$(TOOLS_DEB)
Expand Down Expand Up @@ -142,7 +125,7 @@ clean-image:
@(docker rmi $(TOOLS_IMAGE) > /dev/null 2>&1 || true)

clean:
@rm -f $(TOOLS_DEB) control rootfs* libcmt*
@rm -f $(TOOLS_DEB) control rootfs*
@$(MAKE) -C sys-utils clean

distclean: clean clean-image
Expand All @@ -161,4 +144,4 @@ help:
@echo ' env - print useful Makefile variables as a KEY=VALUE list'
@echo ' clean - remove the generated artifacts'

.PHONY: build fs fs-license deb build-libcmt env setup setup-required help distclean
.PHONY: build fs fs-license deb env setup setup-required help distclean
43 changes: 0 additions & 43 deletions sys-utils/libcmt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,49 +86,6 @@ install-dev: $(libcmt_LIB) build/ffi.h

install: install-run install-dev

# requires either install-run or install
debian-package:
mkdir -p $(dir $(DEB_FILENAME))
dpkg-deb -Zxz --root-owner-group --build $(DESTDIR) $(DEB_FILENAME)

$(DESTDIR)/DEBIAN/control: tools/control.in
mkdir -p $(@D)
sed -e 's|@PACKAGE@|$(ARG_PACKAGE)|' \
-e 's|@VERSION@|$(ARG_VERSION)|' \
-e 's|@ARCHITECTURE@|$(ARG_ARCHITECTURE)|' \
-e 's|@SECTION@|$(ARG_SECTION)|' \
-e 's|@PROVIDES@|$(ARG_PROVIDES)|' \
-e 's|@DESCRIPTION@|$(ARG_DESCRIPTION)|' \
$< > $@

# debian package variants
libcmt-v$(ARG_VERSION).deb:
$(MAKE) $(DESTDIR)/DEBIAN/control \
ARG_PACKAGE=libcmt \
ARG_ARCHITECTURE=riscv64 \
ARG_PROVIDES=libcmt \
ARG_SECTION=libs \
ARG_DESCRIPTION="Cartesi Machine Tools"
$(MAKE) debian-package DEB_FILENAME=build/deb/$@

libcmt-dev-v$(ARG_VERSION).deb:
$(MAKE) $(DESTDIR)/DEBIAN/control \
ARG_PACKAGE=libcmt-dev \
ARG_ARCHITECTURE=riscv64 \
ARG_PROVIDES=libcmt-dev \
ARG_SECTION=devel \
ARG_DESCRIPTION="Cartesi Machine Tools - (development files)"
$(MAKE) debian-package DEB_FILENAME=build/deb/$@

libcmt-dev-riscv64-cross-v$(ARG_VERSION).deb:
$(MAKE) $(DESTDIR)/DEBIAN/control \
ARG_PACKAGE=libcmt-riscv64-cross \
ARG_ARCHITECTURE=all \
ARG_PROVIDES=libcmt-dev-riscv64-cross \
ARG_SECTION=devel \
ARG_DESCRIPTION="Cartesi Machine Tools - (development files) (riscv64)"
$(MAKE) debian-package DEB_FILENAME=build/deb/$@

#-------------------------------------------------------------------------------
mock_SRC := \
src/abi.c \
Expand Down
8 changes: 0 additions & 8 deletions sys-utils/libcmt/tools/control.in

This file was deleted.

0 comments on commit 77867f9

Please sign in to comment.