From 94262d3bc1d1f3b718a2260261138dbf53950771 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Tue, 4 Jun 2024 17:46:28 -0400 Subject: [PATCH 1/3] fix dockerfile, tune up and setup proper dockerfile with all features * you can build from dockerfile with `docker build -t mc .` * later run with `docker run -p 40000:40000/udp -p 40000:40000/tcp -i -t mc` * The docker by default copy the game from minenux and runs 40000 port * fixed https://codeberg.org/minenux/minetest-engine-multicraft2/issues/52 cos already provides linux support with all features (but by docker, puach) * closes https://github.com/MultiCraft/MultiCraft/issues/59 --- Dockerfile | 79 +++++++++++------------------------------ src/defaultsettings.cpp | 2 +- 2 files changed, 21 insertions(+), 60 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d235cc70..ef4435c3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,68 +1,29 @@ -FROM alpine:3.14 - -ENV MINETEST_GAME_VERSION master - -COPY .git /usr/src/multicraft/.git -COPY CMakeLists.txt /usr/src/multicraft/CMakeLists.txt -COPY README.md /usr/src/multicraft/README.md -COPY multicraft.conf.example /usr/src/multicraft/multicraft.conf.example -COPY builtin /usr/src/multicraft/builtin -COPY cmake /usr/src/multicraft/cmake -COPY doc /usr/src/multicraft/doc -COPY fonts /usr/src/multicraft/fonts -COPY lib /usr/src/multicraft/lib -COPY misc /usr/src/multicraft/misc -COPY po /usr/src/multicraft/po -COPY src /usr/src/multicraft/src -COPY textures /usr/src/multicraft/textures - -WORKDIR /usr/src/multicraft - -RUN apk add --no-cache git build-base irrlicht-dev cmake bzip2-dev libpng-dev \ - jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev \ - libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev \ - gmp-dev jsoncpp-dev postgresql-dev luajit-dev ca-certificates && \ - git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \ - rm -fr ./games/minetest_game/.git - -WORKDIR /usr/src/ -RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \ - mkdir prometheus-cpp/build && \ - cd prometheus-cpp/build && \ - cmake .. \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_TESTING=0 && \ - make -j2 && \ - make install +FROM alpine:3.18 +RUN apk add --no-cache git build-base cmake pkgconf gettext-dev bzip2-dev curl-dev libnl3-dev rtmpdump-dev libidn-dev ncurses-dev freetype-dev mesa-dev gmp-dev irrlicht-dev libjpeg-turbo-dev jsoncpp-dev leveldb-dev luajit-dev lua5.1-dev libogg-dev openal-soft-dev libpng-dev postgresql-dev hiredis-dev sqlite-dev libvorbis-dev libxi-dev zlib-dev doxygen libxrandr-dev libx11-dev zstd-dev openssl-dev samurai +WORKDIR /usr/src +RUN cd /usr/src && \ + git clone --depth=1 -b minenux https://gitlab.com/minenux/minetest-engine-multicraft2 multicraft && \ + cd multicraft && \ + git clone --depth=1 -b stable-5.2 https://codeberg.org/minenux/minetest-game-minetest ./games/minetest && \ + rm -fr ./games/minetest/.git WORKDIR /usr/src/multicraft RUN mkdir build && \ cd build && \ cmake .. \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SERVER=TRUE \ - -DENABLE_PROMETHEUS=TRUE \ - -DBUILD_UNITTESTS=FALSE \ - -DBUILD_CLIENT=FALSE && \ - make -j2 && \ + -DCMAKE_INSTALL_PREFIX=/usr/ -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF -DRUN_IN_PLACE=OFF -DENABLE_CURL=ON -DENABLE_SOUND=ON -DENABLE_LUAJIT=ON -DENABLE_GETTEXT=ON -DENABLE_FREETYPE=ON -DENABLE_SYSTEM_GMP=ON -DENABLE_SYSTEM_JSONCPP=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_POSTGRESQL=ON \ + -DRUN_IN_PLACE=OFF -DCUSTOM_BINDIR=/usr/games -DCUSTOM_LOCALEDIR=/usr/share/locale -DCUSTOM_SHAREDIR=/usr/share/games/multicraft -DCUSTOM_EXAMPLE_CONF_DIR=/etc/multicraft .. \ + make && \ make install -FROM alpine:3.14 - -RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq luajit && \ - adduser -D multicraft --uid 30000 -h /var/lib/multicraft && \ - chown -R multicraft:multicraft /var/lib/multicraft - -WORKDIR /var/lib/multicraft - -COPY --from=0 /usr/local/share/multicraft /usr/local/share/multicraft -COPY --from=0 /usr/local/bin/multicraftserver /usr/local/bin/multicraftserver -COPY --from=0 /usr/local/share/doc/multicraft/multicraft.conf.example /etc/multicraft/multicraft.conf +FROM alpine:3.18 +RUN apk add --no-cache libstdc++ libgcc bzip2 curl libnl3 librtmp libidn libintl libncursesw freetype mesa-gl gmp irrlicht libjpeg-turbo jsoncpp leveldb luajit lua5.1 libogg openal-soft-libs libpng libpq hiredis sqlite-libs libvorbis libxi zlib-dev libxrandr libx11 zstd && \ + mkdir -p /var/games/multicraft && adduser -D multicraft --uid 30000 -h /var/games/multicraft && chown -R multicraft:multicraft /var/games/multicraft +COPY --from=0 /usr/share/games/multicraft /usr/share/games/multicraft +COPY --from=0 /usr/games/multicraftserver /usr/games/multicraftserver +COPY --from=0 /etc/multicraft/multicraft.conf /etc/multicraft/multicraft.conf USER multicraft:multicraft - -EXPOSE 30000/udp 30000/tcp - -CMD ["/usr/local/bin/multicraftserver", "--config", "/etc/multicraft/multicraft.conf"] +EXPOSE 40000/udp 40000/tcp +WORKDIR /var/games/multicraft +CMD ["/usr/games/multicraftserver", "--port", "40000", "--config", "/etc/multicraft/multicraft.conf", "--gameid", "minetest", "--world", "minetest"] diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index b84c69a9d..d4cd2521a 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -393,7 +393,7 @@ void set_default_settings() settings->setDefault("max_simultaneous_block_sends_per_client", "40"); settings->setDefault("time_send_interval", "5"); - settings->setDefault("default_game", "default"); + settings->setDefault("default_game", "minetest"); settings->setDefault("motd", ""); settings->setDefault("max_users", "15"); settings->setDefault("creative_mode", "false"); From 60a4940be85b2b1cd3bc4ea485fcd7819a7ff97f Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 5 Jun 2024 14:55:08 -0400 Subject: [PATCH 2/3] MAC portage porfile add .. limited tested --- Portfile | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 Portfile diff --git a/Portfile b/Portfile new file mode 100644 index 000000000..28da27f3d --- /dev/null +++ b/Portfile @@ -0,0 +1,103 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# por file for MAC ports.. currently only tested in older versions of MACOS(X) + +PortSystem 1.0 +PortGroup github 1.0 +PortGroup cmake 1.1 + +compiler.cxx_standard 2011 +compiler.thread_local_storage yes + +github.setup multicraft multicraft 2.0.6 +revision 1 + +# the game version could be different from the multicraft version +set game_version 2.0.6 + +# to add on more files to a github portgroup download +# have to cache the preset distfiles from the github PG +set main_distfile ${distfiles} + +# then add another distfile, with a direct URL as can't use the github PG again +# set game_distfile ${game_version}${extract.suffix} +# set game_mastersite https://codeberg.org/minenux/minetest-game-minetest/archive/ + +distfiles ${main_distfile}:main + +master_sites ${github.master_sites}:main + +checksums ${main_distfile} \ + rmd160 550fd4c6767cce4bb5dd79f9d907b233e21b9b2c \ + sha256 8a320b3355381ba7ed4b6a41bfb0f39cb2858eb7bae0f6fc5935b329a53bde56 \ + size 10116355 + +# rename directory - from github portgroup +post-extract { + if {[file exists [glob -nocomplain ${workpath}/${github.author}-${github.project}-*]] && \ + [file isdirectory [glob -nocomplain ${workpath}/${github.author}-${github.project}-*]]} { + move [glob ${workpath}/${github.author}-${github.project}-*] ${workpath}/${distname} + } +} + +license LGPL-2.1+ +categories games +platforms darwin +maintainers @mckaygerhard openmaintainer +description Survival Craft Build Sandbox Game STOLEN from MINETEST +long_description ${description} - the multipprotocol version enhanched for play in older or newer servers + +homepage https://www.minetest.org + +depends_build-append path:bin/doxygen:doxygen \ + port:mesa + +depends_lib-append port:irrlichtmt \ + path:include/turbojpeg.h:libjpeg-turbo \ + port:libogg \ + port:libvorbis \ + port:freetype \ + port:gettext \ + port:leveldb \ + port:sqlite3 \ + port:zstd \ + path:lib/libluajit-5.1.2.dylib:luajit \ + port:gmp \ + port:curl \ + port:jsoncpp \ + port:spatialindex \ + port:xorg-libX11 \ + port:xorg-libXxf86vm + +# see https://trac.macports.org/ticket/58315 - possibly fixable? +universal_variant no +supported_archs x86_64 x86 + +# 001. the original build calls fixup_bundle to move all the deps into the app bundle. +# this doesn't work correctly with macports destrooting, and isn't necessary for a macports install so deleted it +# patchfiles-append 001-patch-src-CMakeLists-disable-bundlefixup.diff + +configure.args-append -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SERVER=ON -DBUILD_CLIENT=ON \ + -DENABLE_CURL=ON \ + -DENABLE_SOUND=ON \ + -DENABLE_LUAJIT=ON \ + -DENABLE_GETTEXT=ON \ + -DENABLE_FREETYPE=ON \ + -DENABLE_SYSTEM_GMP=ON \ + -DENABLE_SYSTEM_JSONCPP=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_POSTGRESQL=ON \ + -DENABLE_REDIS=OFF -DCURSES_INCLUDE_PATH:FILEPATH=${prefix}/include \ + -DCMAKE_INSTALL_PREFIX:PATH=${applications_dir} \ + -DBUILD_UNITTESTS=OFF \ + -DENABLE_UPDATE_CHECKER=OFF \ + -DENABLE_SPATIAL=ON \ + -DINSTALL_DEVTEST=ON \ + -DLUA_INCLUDE_DIR:PATH=${prefix}/include/luajit-2.1 \ + -DLUA_LIBRARY:FILEPATH=${prefix}/lib/libluajit-5.1.dylib \ + -DVERSION_EXTRA=MacPorts-rev${revision} + +post-destroot { + move ${workpath}/multicraft_game-${game_version} ${destroot}${applications_dir}/multicraft.app/Contents/Resources/games/multicraft_game +} From a261b4edc0abccb78093ed0d70a6b89608b00ac5 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 5 Jun 2024 14:57:00 -0400 Subject: [PATCH 3/3] game as submodule for easy instalation and distribution.. * minetest developers were so stupid or what? why not a simple submodule from git? so easy! * do as: * `sed s#.*games/minetest#!games/minetest#g .gitignore` * `git add .gitignore && git commit -m "submodule step 1"` * `git submodule add -b stable-5.2 https://codeberg.org/minenux/minetest-game-minetest game/minetest` * `git add --all && git commit --amend -m "ubmodule step 2` * `sed s#.*games/minetest#games/minetest#g .gitignore` * `git add --all && git commit --amend -m "ubmodule step 3 final` * update CI for gitlab to use the submodule and setup the game also --- .gitignore | 1 + .gitlab-ci.yml | 5 +++++ .gitmodules | 4 ++++ games/minetest | 1 + 4 files changed, 11 insertions(+) create mode 100644 .gitmodules create mode 160000 games/minetest diff --git a/.gitignore b/.gitignore index 0be7d139b..157350346 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ build/.cmake/ /bin/ /games/* !/games/devtest/ +!/games/minetest /cache /textures/* !/textures/base/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25ed09ce7..773b5a2bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,11 @@ # packages moved to https://build.opensuse.org/project/show/home:venenux:minenux # in future we only build here, or made apk packs for alpine +variables: + GIT_SUBMODULE_STRATEGY: recursive + GIT_SUBMODULE_DEPTH: 1 + GIT_STRATEGY: clone + stages: - build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..55a8d59f6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "games/minetest"] + path = games/minetest + url = https://codeberg.org/minenux/minetest-game-minetest + branch = stable-5.2 diff --git a/games/minetest b/games/minetest new file mode 160000 index 000000000..6dac4d264 --- /dev/null +++ b/games/minetest @@ -0,0 +1 @@ +Subproject commit 6dac4d264b5ad50b83499a0927196c935d844885