From 941572063e951ee6962b1602a92dd9cc0cc38b1f Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 11 Nov 2021 20:12:16 -0500 Subject: [PATCH] Revert To Binary Packaging --- .gitmodules | 8 +++++ cmake/i386-toolchain.cmake | 7 ---- cmake/i686-toolchain.cmake | 9 ++++++ debian/.gitignore | 6 ---- debian/client-amd64 | 7 ++++ debian/client-arm64 | 7 ++++ debian/client-armhf | 7 ++++ debian/control | 21 ------------ debian/copyright | 21 ------------ debian/rules | 24 -------------- debian/server-amd64 | 7 ++++ debian/server-arm64 | 7 ++++ debian/server-armhf | 7 ++++ dependencies/libpng/CMakeLists.txt | 17 +++------- dependencies/libpng/src | 1 + dependencies/minecraft-pi/CMakeLists.txt | 1 - dependencies/zlib/CMakeLists.txt | 16 ++------- dependencies/zlib/src | 1 + scripts/build-all.sh | 14 ++++++++ scripts/ci/run.sh | 11 ++++--- scripts/install-dependencies.sh | 5 --- scripts/package.sh | 41 +++++++++++++++++------- scripts/test.sh | 2 +- 23 files changed, 117 insertions(+), 130 deletions(-) create mode 100644 .gitmodules delete mode 100644 cmake/i386-toolchain.cmake create mode 100644 cmake/i686-toolchain.cmake delete mode 100644 debian/.gitignore create mode 100644 debian/client-amd64 create mode 100644 debian/client-arm64 create mode 100644 debian/client-armhf delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100755 debian/rules create mode 100644 debian/server-amd64 create mode 100644 debian/server-arm64 create mode 100644 debian/server-armhf create mode 160000 dependencies/libpng/src create mode 160000 dependencies/zlib/src create mode 100755 scripts/build-all.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..82965c68f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "dependencies/libpng/src"] + path = dependencies/libpng/src + url = https://github.com/glennrp/libpng.git + shallow = true +[submodule "dependencies/zlib/src"] + path = dependencies/zlib/src + url = https://github.com/madler/zlib.git + shallow = true diff --git a/cmake/i386-toolchain.cmake b/cmake/i386-toolchain.cmake deleted file mode 100644 index 5ae205469..000000000 --- a/cmake/i386-toolchain.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# Compile For i386 -include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake") -# Use i386 Cross-Compiler -setup_toolchain("i386-linux-gnu") -# Details -set(CMAKE_SYSTEM_NAME "Linux") -set(CMAKE_SYSTEM_PROCESSOR "i386") diff --git a/cmake/i686-toolchain.cmake b/cmake/i686-toolchain.cmake new file mode 100644 index 000000000..a8f0f945d --- /dev/null +++ b/cmake/i686-toolchain.cmake @@ -0,0 +1,9 @@ +# Warning +message(WARNING "i686 Builds Are Unsupported, Proceed At Your Own Risk") +# Compile For i686 +include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake") +# Use i686 Cross-Compiler +setup_toolchain("i686-linux-gnu") +# Details +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_PROCESSOR "i686") diff --git a/debian/.gitignore b/debian/.gitignore deleted file mode 100644 index 3d8b8cacd..000000000 --- a/debian/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -* -!control -!copyright -!rules -!source -!.gitignore diff --git a/debian/client-amd64 b/debian/client-amd64 new file mode 100644 index 000000000..59d8eafc4 --- /dev/null +++ b/debian/client-amd64 @@ -0,0 +1,7 @@ +Package: minecraft-pi-reborn-client +Version: ${VERSION} +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: amd64 +Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libopenal1, qemu-user-static diff --git a/debian/client-arm64 b/debian/client-arm64 new file mode 100644 index 000000000..d89a362a0 --- /dev/null +++ b/debian/client-arm64 @@ -0,0 +1,7 @@ +Package: minecraft-pi-reborn-client +Version: ${VERSION} +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: arm64 +Depends: libc6, libstdc++6, libc6:armhf, libstdc++6:armhf, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libopenal1 diff --git a/debian/client-armhf b/debian/client-armhf new file mode 100644 index 000000000..7d98f9695 --- /dev/null +++ b/debian/client-armhf @@ -0,0 +1,7 @@ +Package: minecraft-pi-reborn-client +Version: ${VERSION} +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: armhf +Depends: libc6, libstdc++6, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libopenal1 diff --git a/debian/control b/debian/control deleted file mode 100644 index 6e266710c..000000000 --- a/debian/control +++ /dev/null @@ -1,21 +0,0 @@ -Source: minecraft-pi-reborn -Section: games -Priority: optional -Maintainer: TheBrokenRail -Build-Depends: debhelper-compat (= 12), clang:native, lld:native, cmake, git, make:native, libglfw3, libglfw3-dev, libfreeimage3, libfreeimage-dev:native, libopenal1, libopenal-dev, crossbuild-essential-armhf -Standards-Version: 4.4.1 -Homepage: https://www.minecraft.net/en-us/edition/pi -Vcs-Browser: https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn -Vcs-Git: https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn.git - -Package: minecraft-pi-reborn-client -Architecture: amd64 i386 arm64 armhf -Multi-Arch: foreign -Depends: libc6, libstdc++6, libc6-armhf-cross [!arm64 !armhf], libstdc++6-armhf-cross [!arm64 !armhf], zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libopenal1, qemu-user-static [!arm64 !armhf] -Description: Fun with Blocks - -Package: minecraft-pi-reborn-server -Architecture: amd64 i386 arm64 armhf -Multi-Arch: foreign -Depends: libc6, libstdc++6, libc6-armhf-cross [!arm64 !armhf], libstdc++6-armhf-cross [!arm64 !armhf], qemu-user-static [!arm64 !armhf] -Description: Fun with Blocks (Dedicated Server) diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 2bad0ca1a..000000000 --- a/debian/copyright +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 TheBrokenRail - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 1bd4e2613..000000000 --- a/debian/rules +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/make -f - -DEB_CUSTOM_OUTPUT_DIR ?= .. -include /usr/share/dpkg/architecture.mk - -%: - dh $@ - -override_dh_auto_configure: -override_dh_strip: -override_dh_dwz: -override_dh_makeshlibs: -override_dh_shlibdeps: - -override_dh_auto_build: - ./scripts/build.sh client $(DEB_HOST_ARCH) - ./scripts/build.sh server $(DEB_HOST_ARCH) - -override_dh_auto_install: - cp -ar out/client-$(DEB_HOST_ARCH)/. debian/minecraft-pi-reborn-client - cp -ar out/server-$(DEB_HOST_ARCH)/. debian/minecraft-pi-reborn-server - -override_dh_builddeb: - dh_builddeb --destdir=${DEB_CUSTOM_OUTPUT_DIR} diff --git a/debian/server-amd64 b/debian/server-amd64 new file mode 100644 index 000000000..5c9e71b24 --- /dev/null +++ b/debian/server-amd64 @@ -0,0 +1,7 @@ +Package: minecraft-pi-reborn-server +Version: ${VERSION} +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: amd64 +Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, qemu-user-static diff --git a/debian/server-arm64 b/debian/server-arm64 new file mode 100644 index 000000000..5bd4d13f9 --- /dev/null +++ b/debian/server-arm64 @@ -0,0 +1,7 @@ +Package: minecraft-pi-reborn-server +Version: ${VERSION} +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: arm64 +Depends: libc6, libstdc++6, libc6:armhf, libstdc++6:armhf diff --git a/debian/server-armhf b/debian/server-armhf new file mode 100644 index 000000000..697b4ec37 --- /dev/null +++ b/debian/server-armhf @@ -0,0 +1,7 @@ +Package: minecraft-pi-reborn-server +Version: ${VERSION} +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: armhf +Depends: libc6, libstdc++6 diff --git a/dependencies/libpng/CMakeLists.txt b/dependencies/libpng/CMakeLists.txt index ce78ef14a..ddc8934f4 100644 --- a/dependencies/libpng/CMakeLists.txt +++ b/dependencies/libpng/CMakeLists.txt @@ -1,29 +1,20 @@ project(libpng) -include(FetchContent) - # Silence Warnings add_compile_options(-w) ## LibPNG # Download -FetchContent_Declare( - libpng - GIT_REPOSITORY "https://github.com/glennrp/libpng.git" - GIT_TAG "v1.2.59" -) -FetchContent_Populate(libpng) -set(ZLIB_LIBRARY zlib) -set(ZLIB_INCLUDE_DIR "${zlib_SOURCE_DIR}" "${zlib_BINARY_DIR}") +set(ZLIB_LIBRARY zlibstatic) +set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../zlib" "${CMAKE_CURRENT_BINARY_DIR}/../zlib") set(CMAKE_POLICY_DEFAULT_CMP0054 OLD) # Silence Warning -add_subdirectory("${libpng_SOURCE_DIR}" "${libpng_BINARY_DIR}" EXCLUDE_FROM_ALL) +add_subdirectory(src EXCLUDE_FROM_ALL) set(CMAKE_POLICY_DEFAULT_CMP0054 NEW) # Re-Enable New Behavior -set_target_properties(png12 PROPERTIES LINK_FLAGS "-Wl,--version-script='${CMAKE_CURRENT_SOURCE_DIR}/libpng.vers'") # Use Symbol Versioning +set_target_properties(png12 PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libpng.vers") # Use Symbol Versioning set_target_properties(png12 PROPERTIES DEBUG_POSTFIX "") # Fix LibPNG Suffix In Debug Mode # Ensure Build add_custom_target(png12-build ALL DEPENDS png12) # Install install(TARGETS png12 DESTINATION "${MCPI_LIB_DIR}") - diff --git a/dependencies/libpng/src b/dependencies/libpng/src new file mode 160000 index 000000000..5bb5bf345 --- /dev/null +++ b/dependencies/libpng/src @@ -0,0 +1 @@ +Subproject commit 5bb5bf345aef1e62adcfe30791f4364730a2aede diff --git a/dependencies/minecraft-pi/CMakeLists.txt b/dependencies/minecraft-pi/CMakeLists.txt index 9deea304d..647410dfc 100644 --- a/dependencies/minecraft-pi/CMakeLists.txt +++ b/dependencies/minecraft-pi/CMakeLists.txt @@ -13,4 +13,3 @@ FetchContent_Populate(minecraft-pi) # Install install(DIRECTORY "${minecraft-pi_SOURCE_DIR}/" DESTINATION "${MCPI_INSTALL_DIR}" USE_SOURCE_PERMISSIONS) - diff --git a/dependencies/zlib/CMakeLists.txt b/dependencies/zlib/CMakeLists.txt index d3500a5fd..591ed9aba 100644 --- a/dependencies/zlib/CMakeLists.txt +++ b/dependencies/zlib/CMakeLists.txt @@ -1,24 +1,12 @@ project(zlib) -include(FetchContent) - # Silence Warnings add_compile_options(-w) ## zlib # Download -FetchContent_Declare( - zlib - GIT_REPOSITORY "https://github.com/madler/zlib.git" - GIT_TAG "v1.2.11" -) -FetchContent_Populate(zlib) -include_directories("${zlib_SOURCE_DIR}" "${zlib_BINARY_DIR}") # Fix ZLib Build -add_subdirectory("${zlib_SOURCE_DIR}" "${zlib_BINARY_DIR}" EXCLUDE_FROM_ALL) +add_subdirectory(src EXCLUDE_FROM_ALL) # Ensure Build -add_custom_target(zlib-build ALL DEPENDS zlib) -# Install -install(TARGETS zlib DESTINATION "${MCPI_LIB_DIR}") - +add_custom_target(zlib-build ALL DEPENDS zlibstatic) diff --git a/dependencies/zlib/src b/dependencies/zlib/src new file mode 160000 index 000000000..cacf7f1d4 --- /dev/null +++ b/dependencies/zlib/src @@ -0,0 +1 @@ +Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f diff --git a/scripts/build-all.sh b/scripts/build-all.sh new file mode 100755 index 000000000..674d780ee --- /dev/null +++ b/scripts/build-all.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# Clean Prefix +rm -rf out + +# Build +./scripts/build.sh client amd64 +./scripts/build.sh server amd64 +./scripts/build.sh client arm64 +./scripts/build.sh server arm64 +./scripts/build.sh client armhf +./scripts/build.sh server armhf diff --git a/scripts/ci/run.sh b/scripts/ci/run.sh index 61017d4e9..937904f5a 100755 --- a/scripts/ci/run.sh +++ b/scripts/ci/run.sh @@ -14,12 +14,13 @@ echo '==== Installing Dependencies ====' ./scripts/install-dependencies.sh # Build -echo '==== Building & Packaging ====' -rm -rf out build -./scripts/package.sh amd64 -./scripts/package.sh arm64 -./scripts/package.sh armhf +echo '==== Building ====' +./scripts/build-all.sh # Test echo '==== Testing ====' ./scripts/test.sh + +# Package +echo '==== Packaging ====' +./scripts/package.sh diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 4577bb1e5..003b86f4a 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -20,7 +20,6 @@ sudo apt-get dist-upgrade -y # Install sudo apt-get install --no-install-recommends -y \ - build-essential \ ca-certificates \ lsb-release \ git \ @@ -28,10 +27,6 @@ sudo apt-get install --no-install-recommends -y \ lld \ cmake \ make \ - dpkg-dev \ - debhelper \ - devscripts \ - libdistro-info-perl \ libglfw3 libglfw3-dev \ libfreeimage3 libfreeimage-dev \ crossbuild-essential-armhf \ diff --git a/scripts/package.sh b/scripts/package.sh index fd3fe1e32..a99cf141b 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -3,18 +3,35 @@ set -e # Prepare -rm -f debian/changelog -PACKAGE='minecraft-pi-reborn' VERSION="$(cat VERSION)" -DISTRO="$(lsb_release -cs)" -EDITOR='true' NAME='TheBrokenRail' EMAIL='connor24nolan@live.com' dch -u low -v "${VERSION}" --create --distribution "${DISTRO}" --package "${PACKAGE}" "Release ${VERSION}" -# Custom Architecture -ARCH="$(dpkg-architecture -qDEB_BUILD_ARCH)" -if [ -z "$1" ]; then - ARCH="$1" -fi +# Common +package() { + local dir="out/$1" + + # Create DEBIAN Dir + rm -rf "${dir}/DEBIAN" + mkdir -p "${dir}/DEBIAN" + cp "debian/$1" "${dir}/DEBIAN/control" + + # Format DEBIAN/control + sed -i "s/\${VERSION}/${VERSION}/g" "${dir}/DEBIAN/control" + + # Fix Permissions On Jenkins + chmod -R g-s "${dir}" + + # Package + dpkg-deb --root-owner-group --build "${dir}" out +} -# Build -export DEB_CUSTOM_OUTPUT_DIR='out' -debuild --no-lintian -a"${ARCH}" -us -uc --buildinfo-option=-u"${DEB_CUSTOM_OUTPUT_DIR}" --changes-option=-u"${DEB_CUSTOM_OUTPUT_DIR}" -b +# Find And Package +for dir in out/*; do + # Check If Directory Exists + if [ -d "${dir}" ]; then + # Check If Debian Package Exists + pkg="$(basename ${dir})" + if [ -f "debian/${pkg}" ]; then + package "${pkg}" + fi + fi +done diff --git a/scripts/test.sh b/scripts/test.sh index c57235f96..d5c7cbe9a 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -3,7 +3,7 @@ set -e # Add minecraft-pi-reborn-server To PATH -export PATH="$(pwd)/out/server-$(dpkg-architecture -qDEB_HOST_ARCH)/usr/bin:${PATH}" +export PATH="$(pwd)/out/server-x86_64/usr/bin:${PATH}" # Create Test Directory rm -rf build/test