Skip to content

Commit

Permalink
craftos-pc: fix the build against poco-1.14
Browse files Browse the repository at this point in the history
Upstream seems to have errors, where it doesn't
include all the poco headers it requires for it
to build. I've provided a patch and
opened a pull request upstream to get it
merged: MCJack123/craftos2#391
  • Loading branch information
dwt committed Feb 21, 2025
1 parent dbe5797 commit a82c5f1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 18 deletions.
37 changes: 37 additions & 0 deletions pkgs/by-name/cr/craftos-pc/fix-poco-header-includes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 2196121..0c5cf27 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -11,6 +11,7 @@
#include <fstream>
#include <unordered_map>
#include <configuration.hpp>
+#include <Poco/JSON/JSONException.h>
#include "platform.hpp"
#include "runtime.hpp"
#include "terminal/SDLTerminal.hpp"
diff --git a/src/main.cpp b/src/main.cpp
index 9ab0814..38976a2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,6 +34,7 @@ static void* releaseNotesThread(void* data);
#include <Poco/URI.h>
#include <Poco/Checksum.h>
#include <Poco/JSON/Parser.h>
+#include <Poco/JSON/JSONException.h>
#ifndef __EMSCRIPTEN__
#include <Poco/Net/HTTPSClientSession.h>
#include <Poco/Net/HTTPRequest.h>
diff --git a/src/util.hpp b/src/util.hpp
index b8ab2d1..c643b96 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -21,6 +21,8 @@ extern "C" {
#include <string>
#include <vector>
#include <Poco/JSON/JSON.h>
+#include <Poco/JSON/Object.h>
+#include <Poco/JSON/Array.h>
#include <Poco/JSON/Parser.h>
#include <Poco/Net/HTTPResponse.h>
#include <Computer.hpp>
61 changes: 43 additions & 18 deletions pkgs/by-name/cr/craftos-pc/package.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{ lib
, stdenv
, fetchFromGitHub
, callPackage
, patchelf
, unzip
, poco
, openssl
, SDL2
, SDL2_mixer
, ncurses
, libpng
, pngpp
, libwebp
{
lib,
stdenv,
fetchFromGitHub,
callPackage,
patchelf,
unzip,
poco,
openssl,
SDL2,
SDL2_mixer,
ncurses,
libpng,
pngpp,
libwebp,
}:

let
Expand Down Expand Up @@ -41,8 +42,20 @@ stdenv.mkDerivation rec {
hash = "sha256-DbxAsXxpsa42dF6DaLmgIa+Hs/PPqJ4dE97PoKxG2Ig=";
};

nativeBuildInputs = [ patchelf unzip ];
buildInputs = [ poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ];
nativeBuildInputs = [
patchelf
unzip
];
buildInputs = [
poco
openssl
SDL2
SDL2_mixer
ncurses
libpng
pngpp
libwebp
];
strictDeps = true;

preBuild = ''
Expand All @@ -57,6 +70,12 @@ stdenv.mkDerivation rec {
runHook postBuild
'';

patches = [
# fix includes of poco headers
# https://github.com/MCJack123/craftos2/issues/391
./fix-poco-header-includes.patch
];

dontStrip = true;

installPhase = ''
Expand Down Expand Up @@ -87,9 +106,15 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Implementation of the CraftOS-PC API written in C++ using SDL";
homepage = "https://www.craftos-pc.cc";
license = with licenses; [ mit free ];
license = with licenses; [
mit
free
];
platforms = platforms.linux;
maintainers = with maintainers; [ siraben tomodachi94 ];
maintainers = with maintainers; [
siraben
tomodachi94
];
mainProgram = "craftos";
};
}

0 comments on commit a82c5f1

Please sign in to comment.