Vendor GLFW

This commit is contained in:
TheBrokenRail 2022-03-09 21:23:41 -05:00
parent c33a27b2ea
commit 742ead51e1
15 changed files with 104 additions and 38 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ CMakeLists.txt.user
AppImageBuilder.yml
appimage-builder-cache
AppDir
*.zsync

4
.gitmodules vendored
View File

@ -6,3 +6,7 @@
path = dependencies/zlib/src
url = https://github.com/madler/zlib.git
shallow = true
[submodule "dependencies/glfw/src"]
path = dependencies/glfw/src
url = https://github.com/glfw/glfw.git
shallow = true

View File

@ -74,10 +74,8 @@ endif()
# PIC
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
# Buld LibPNG + ZLib + Download Minecraft: Pi Edition
if(BUILD_ARM_COMPONENTS)
add_subdirectory(dependencies)
endif()
# Buld Dependencies
add_subdirectory(dependencies)
# Warnings
add_compile_options(-Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference)

View File

@ -5,7 +5,6 @@ RUN \
apt-get update && \
apt-get install -y tini sed && \
apt-get --fix-broken install -y && \
rm -f /root/*.deb && \
rm -rf /var/lib/apt/lists/*
# Copy AppImage

12
Dockerfile.build Normal file
View File

@ -0,0 +1,12 @@
FROM buildpack-deps:bullseye
# Setup
ENV ARM_PACKAGES_SUPPORTED=1
# Install
ADD ./scripts/install-dependencies.sh /
RUN \
apt-get update && \
apt-get install --no-install-recommends -y sudo && \
/install-dependencies.sh && \
rm -rf /var/lib/apt/lists/*

4
Jenkinsfile vendored
View File

@ -4,7 +4,7 @@ pipeline {
stage('Debian Bullseye') {
agent {
docker {
image 'buildpack-deps:bullseye'
filename 'Dockerfile.build'
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
@ -15,7 +15,7 @@ pipeline {
}
post {
success {
archiveArtifacts artifacts: 'out/*.deb', fingerprint: true
archiveArtifacts artifacts: 'out/*.AppImage*', fingerprint: true
}
}
}

View File

@ -1,10 +1,18 @@
project(dependencies)
# ZLib
add_subdirectory(zlib)
if(BUILD_ARM_COMPONENTS)
add_subdirectory(zlib)
endif()
# LibPNG
add_subdirectory(libpng)
if(BUILD_ARM_COMPONENTS)
add_subdirectory(libpng)
endif()
# GLFW
if(BUILD_NATIVE_COMPONENTS)
add_subdirectory(glfw)
endif()
# Minecraft: Pi Edition
if(NOT MCPI_OPEN_SOURCE_ONLY)
if(BUILD_ARM_COMPONENTS AND NOT MCPI_OPEN_SOURCE_ONLY)
add_subdirectory(minecraft-pi)
endif()

22
dependencies/glfw/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,22 @@
project(glfw)
# Silence Warnings
add_compile_options(-w)
## GLFW
# Download
set(BUILD_SHARED_LIBS FALSE)
set(GLFW_BUILD_EXAMPLES FALSE)
set(GLFW_BUILD_TESTS FALSE)
set(GLFW_BUILD_DOCS FALSE)
set(GLFW_INSTALL FALSE)
set(GLFW_BUILD_WIN32 FALSE)
set(GLFW_BUILD_COCOA FALSE)
set(GLFW_BUILD_X11 TRUE)
set(GLFW_BUILD_WAYLAND TRUE)
set(GLFW_LIBRARY_TYPE "STATIC")
add_subdirectory(src EXCLUDE_FROM_ALL)
# Ensure Build
add_custom_target(glfw-build ALL DEPENDS glfw)

1
dependencies/glfw/src vendored Submodule

@ -0,0 +1 @@
Subproject commit adc202d2c3182ca6ad8344624941e56d8e0bc493

View File

@ -22,8 +22,6 @@ if(TARGET media-layer-core)
# Link
target_link_libraries(media-layer-core media-layer-headers reborn-headers pthread dl)
if(NOT MCPI_HEADLESS_MODE)
# Find GLFW
find_package(glfw3 3.3 REQUIRED)
# Find FreeImage
find_library(FREEIMAGE_LIBRARY NAMES freeimage libfreeimage.so.3 REQUIRED)
# OpenAL

View File

@ -2,17 +2,6 @@
set -e
# Install sudo
apt-get update
apt-get install -y sudo
# Prepare
export ARM_PACKAGES_SUPPORTED=1
# Install Dependencies
echo '==== Installing Dependencies ===='
./scripts/install-dependencies.sh
# Build/Package
echo '==== Building & Packaging ===='
./scripts/package-all.sh

View File

@ -2,5 +2,8 @@
set -e
# Build Docker Image
docker build -f Dockerfile.build -t minecraft-pi-reborn-build .
# Run
docker run --rm -v "$(pwd):/data" buildpack-deps:bullseye sh -c "cd /data; ./scripts/ci/run.sh"
docker run --rm -v "$(pwd):/data" -w '/data' -u '1000:1000' minecraft-pi-reborn-build ./scripts/ci/run.sh

View File

@ -10,6 +10,7 @@ const arch = process.argv[3];
// Data
const id = `com.thebrokenrail.MCPIReborn${mode === 'server' ? 'Server' : ''}`;
const name = `minecraft-pi-reborn-${mode}`;
const updateURL = `https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/${name}-latest-${arch}.AppImage.zsync`;
// APT Data
const apt_distribution = 'bullseye';
@ -26,10 +27,10 @@ const packages = [
'libstdc++6'
];
if (mode === 'client') {
// GLFW's Dependencies Aren't Included As They Should Be Provided By The Host System
packages.push(
'zenity',
'libcanberra-gtk3-module',
'libglfw3',
'libfreeimage3',
'libopenal1'
);
@ -170,7 +171,8 @@ if (!appImageArch) {
}
const appImage = {
arch: appImageArch,
file_name: `./out/${name}-${version}-${arch}.AppImage`
file_name: `./out/${name}-${version}-${arch}.AppImage`,
'update-information': `zsync|${updateURL}`
};
// Root

View File

@ -24,29 +24,54 @@ queue_pkg() {
PKG_QUEUE="${PKG_QUEUE} $@"
}
# Install
# Build Tools
queue_pkg \
git \
cmake \
ninja-build \
libglfw3 libglfw3-dev \
libfreeimage3 libfreeimage-dev \
crossbuild-essential-armhf \
gcc g++ \
nodejs \
nodejs
# Dependencies
queue_pkg \
libfreeimage3 libfreeimage-dev \
libopenal-dev \
qemu-user
# Install ARM Dependencies
# GLFW Dependencies
queue_pkg \
libwayland-dev \
libxkbcommon-dev \
wayland-protocols \
libx11-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
libxext-dev
# ARM Packages
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
# Build Tools
queue_pkg \
libglfw3:armhf libglfw3-dev:armhf \
libfreeimage3:armhf \
libopenal-dev:armhf \
libglfw3:arm64 libglfw3-dev:arm64 \
libfreeimage3:arm64 \
libopenal-dev:arm64 \
crossbuild-essential-arm64
# Dependencies
queue_pkg \
libfreeimage3:armhf libfreeimage3:arm64 \
libopenal-dev:armhf libopenal-dev:arm64
# GLFW Dependencies
queue_pkg \
libwayland-dev:armhf libwayland-dev:arm64 \
libxkbcommon-dev:armhf libxkbcommon-dev:arm64 \
libx11-dev:armhf libx11-dev:arm64 \
libxcursor-dev:armhf libxcursor-dev:arm64 \
libxi-dev:armhf libxi-dev:arm64 \
libxinerama-dev:armhf libxinerama-dev:arm64 \
libxrandr-dev:armhf libxrandr-dev:arm64 \
libxext-dev:armhf libxext-dev:arm64
fi
# Install appimagetool Dependencies
@ -68,8 +93,9 @@ sudo apt-get install --no-install-recommends -y ${PKG_QUEUE}
sudo mkdir -p /opt
sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /opt/appimagetool
# Workaround AppImage Issues With Docker
cd /opt; sudo chmod +x ./appimagetool; sed -i '0,/AI\x02/{s|AI\x02|\x00\x00\x00|}' ./appimagetool; sudo ./appimagetool --appimage-extract
cd /opt; sudo chmod +x ./appimagetool; sudo sed -i '0,/AI\x02/{s|AI\x02|\x00\x00\x00|}' ./appimagetool; sudo ./appimagetool --appimage-extract
sudo mv /opt/squashfs-root /opt/appimagetool.AppDir
sudo rm -f /usr/local/bin/appimagetool
sudo ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool
# Install appimage-builder

View File

@ -7,3 +7,6 @@ set -e
# Build/Package
appimage-builder --recipe AppImageBuilder.yml
# Move ZSync
mv "./minecraft-pi-reborn-$1-$(cat VERSION)-$2.AppImage.zsync" "./out/minecraft-pi-reborn-$1-latest-$2.AppImage.zsync"