diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc8232a3f..1a979d174 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -103,8 +103,10 @@ jobs: uarch-pristine-ram.c uarch-pristine-hash.c machine-c-version.h - cartesi-machine-v${{ env.MACHINE_EMULATOR_VERSION }}_amd64.deb - cartesi-machine-v${{ env.MACHINE_EMULATOR_VERSION }}_arm64.deb + cartesi-machine-dev-v${{ env.MACHINE_EMULATOR_VERSION }}_amd64.deb + cartesi-machine-dev-v${{ env.MACHINE_EMULATOR_VERSION }}_arm64.deb + cartesi-machine0-v${{ env.MACHINE_EMULATOR_VERSION }}_amd64.deb + cartesi-machine0-v${{ env.MACHINE_EMULATOR_VERSION }}_arm64.deb test_amd64: name: Test (linux/amd64) diff --git a/Dockerfile b/Dockerfile index 7ebdb6963..62f567f7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,24 +4,22 @@ ARG RELEASE=no ARG COVERAGE=no ARG SANITIZE=no -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \ - build-essential vim wget git clang-tidy-16 clang-format-16 lcov \ - libboost1.81-dev libssl-dev libslirp-dev \ - ca-certificates pkg-config lua5.4 liblua5.4-dev \ - luarocks xxd procps && \ - update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 120 && \ - update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-16 120 && \ - rm -rf /var/lib/apt/lists/* - - -RUN luarocks install --lua-version=5.4 luasocket && \ - luarocks install --lua-version=5.4 luasec && \ - luarocks install --lua-version=5.4 luaposix && \ - luarocks install --lua-version=5.4 lpeg && \ - luarocks install --lua-version=5.4 dkjson && \ - luarocks install --lua-version=5.4 luacheck && \ - cargo install stylua@0.20.0 --features lua54 +# Install dependencies +COPY debian debian +RUN </dev/null || echo amd64) PREFIX= /usr MACHINE_EMULATOR_VERSION= $(shell make -sC src version) MACHINE_EMULATOR_SO_VERSION= $(shell make -sC src so-version) -DEB_FILENAME= cartesi-machine-v$(MACHINE_EMULATOR_VERSION)_$(DEB_ARCH).deb +DEB_FILENAME_DEV= cartesi-machine-dev-v$(MACHINE_EMULATOR_VERSION)_$(DEB_ARCH).deb +DEB_FILENAME0= cartesi-machine0-v$(MACHINE_EMULATOR_VERSION)_$(DEB_ARCH).deb BIN_RUNTIME_PATH= $(PREFIX)/bin LIB_RUNTIME_PATH= $(PREFIX)/lib DOC_RUNTIME_PATH= $(PREFIX)/doc/cartesi-machine @@ -272,7 +273,8 @@ copy-tests-debian-packages: copy: docker create --name uarch-ram-bin $(DOCKER_PLATFORM) $(DEBIAN_IMG) - docker cp uarch-ram-bin:/usr/src/emulator/$(DEB_FILENAME) . + docker cp uarch-ram-bin:/usr/src/emulator/../$(DEB_FILENAME0) . + docker cp uarch-ram-bin:/usr/src/emulator/../$(DEB_FILENAME_DEV) . docker cp uarch-ram-bin:/usr/src/emulator/src/machine-c-version.h . docker cp uarch-ram-bin:/usr/src/emulator/uarch/uarch-ram.bin . docker cp uarch-ram-bin:/usr/src/emulator/uarch/uarch-pristine-ram.c . @@ -352,12 +354,6 @@ install: install-headers install-static-libs install-shared-libs install-lua-lib install-uarch: install $(UARCH_INSTALL_PATH) $(INSTALL_FILE) uarch/$(UARCH_TO_SHARE) $(UARCH_INSTALL_PATH) -debian-package: install - mkdir -p $(DESTDIR)/DEBIAN $(DOC_INSTALL_PATH) - $(INSTALL_FILE) COPYING $(DOC_INSTALL_PATH)/copyright - sed 's|ARG_VERSION|$(MACHINE_EMULATOR_VERSION)|g;s|ARG_ARCH|$(DEB_ARCH)|g' tools/template/control.template > $(DESTDIR)/DEBIAN/control - dpkg-deb -Zxz --root-owner-group --build $(DESTDIR) $(DEB_FILENAME) - install-tests-data: | $(TESTS_DATA_INSTALL_PATH) $(INSTALL_DIR) $(TESTS_DATA_TO_TESTS_DATA_PATH) $(TESTS_DATA_INSTALL_PATH) diff --git a/debian/cartesi-machine-dev.dirs b/debian/cartesi-machine-dev.dirs new file mode 100644 index 000000000..44188162e --- /dev/null +++ b/debian/cartesi-machine-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include diff --git a/debian/cartesi-machine-dev.install b/debian/cartesi-machine-dev.install new file mode 100644 index 000000000..2756d5d88 --- /dev/null +++ b/debian/cartesi-machine-dev.install @@ -0,0 +1,13 @@ +usr/bin/cartesi-machine +usr/bin/cartesi-machine-stored-hash +usr/bin/jsonrpc-remote-cartesi-machine +usr/bin/merkle-tree-hash +usr/include/cartesi-machine/* +usr/lib/lib*.a +usr/share/cartesi-machine/* +usr/share/cartesi-machine/gdb/gdbinit +usr/share/lua/5.4/cartesi-machine-stored-hash.lua +usr/share/lua/5.4/cartesi-machine.lua +usr/share/lua/5.4/cartesi/gdbstub.lua +usr/share/lua/5.4/cartesi/proof.lua +usr/share/lua/5.4/cartesi/util.lua diff --git a/debian/cartesi-machine0.dirs b/debian/cartesi-machine0.dirs new file mode 100644 index 000000000..68457717b --- /dev/null +++ b/debian/cartesi-machine0.dirs @@ -0,0 +1 @@ +usr/lib diff --git a/debian/cartesi-machine0.install b/debian/cartesi-machine0.install new file mode 100644 index 000000000..26f4321c3 --- /dev/null +++ b/debian/cartesi-machine0.install @@ -0,0 +1,3 @@ +usr/lib/lib*.so +usr/lib/lua/5.4/cartesi.so +usr/lib/lua/5.4/cartesi/jsonrpc.so diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..a038a5ad1 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cartesi-machine (0.17.0) UNRELEASED; urgency=medium + + * Initial release. + + -- root Fri, 28 Jun 2024 15:46:07 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..114bc4f55 --- /dev/null +++ b/debian/control @@ -0,0 +1,54 @@ +Source: cartesi-machine +Section: libs +Priority: optional +Maintainer: root +Rules-Requires-Root: no +Build-Depends: + build-essential, + ca-certificates, + clang-format-16, + clang-tidy-16, + debhelper, + debhelper-compat (= 13), + devscripts, + git, + lcov, + libboost1.81-dev, + liblua5.4-dev, + libslirp-dev, + libslirp-dev, + lua5.4, + luarocks, + pkg-config, + procps, + vim, + wget, + xxd, +Standards-Version: 4.6.2 +Homepage: +#Vcs-Browser: https://salsa.debian.org/debian/cartesi-machine +#Vcs-Git: https://salsa.debian.org/debian/cartesi-machine.git + +Package: cartesi-machine-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: + libboost1.81-dev, + liblua5.4-dev, + libslirp-dev, + lua5.4, + cartesi-machine0 (= ${binary:Version}), +Description: The Cartesi Machine Emulator is the reference off-chain implementation of the Cartesi Machine Specification. + It's written in C/C++ with POSIX dependencies restricted to the terminal, process, and memory-mapping facilities. + It is distributed as a library and scriptable in the Lua programming language. + +Package: cartesi-machine0 +Architecture: any +Multi-Arch: same +Depends: + lua5.4, + libslirp0, +Description: The Cartesi Machine Emulator is the reference off-chain implementation of the Cartesi Machine Specification. + It's written in C/C++ with POSIX dependencies restricted to the terminal, process, and memory-mapping facilities. + It is distributed as a library and scriptable in the Lua programming language. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..8fb5eadf5 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,35 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Source: +Upstream-Name: cartesi-machine +Upstream-Contact: + +Files: + * +Copyright: + + +License: + + + . + + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: + debian/* +Copyright: + 2024 root +License: LGPL-3 + . +Comment: + . + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. +# +# If you need, there are some extra license texts available in two places: +# /usr/share/debhelper/dh_make/licenses/ +# /usr/share/common-licenses/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..f1532b93f --- /dev/null +++ b/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_auto_test: # skip +override_dh_auto_build: + make -j$(nproc) uarch all diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000..89ae9db8f --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/src/Makefile b/src/Makefile index 482d28a01..cbd795260 100644 --- a/src/Makefile +++ b/src/Makefile @@ -543,7 +543,7 @@ uarch-pristine-hash.o: $(UARCH_PRISTINE_HASH_C) generate-uarch-pristine: ifeq (,$(wildcard ../uarch/uarch-pristine-hash.c)) - @if [ "$(DEV_ENV_HAS_TOOLCHAIN)" = "yes" ]; then \ + @if [ "$(shell which riscv64-cartesi-linux-gnu-gcc)" -o "$(DEV_ENV_HAS_TOOLCHAIN)" = "yes" ]; then \ $(MAKE) -C .. uarch; \ else \ $(MAKE) -C .. uarch-with-linux-env; \