From 1be02b63d65f49acef01a5f972384da2d2df302f Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 30 Dec 2024 06:21:50 +0000 Subject: [PATCH 1/7] poco: 1.13.3 -> 1.14.1 Changes: - https://github.com/pocoproject/poco/releases/tag/poco-1.14.0-release - https://github.com/pocoproject/poco/releases/tag/poco-1.14.1-release --- pkgs/by-name/po/poco/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/po/poco/package.nix b/pkgs/by-name/po/poco/package.nix index 86a8eba7aff37..da238688ca0c9 100644 --- a/pkgs/by-name/po/poco/package.nix +++ b/pkgs/by-name/po/poco/package.nix @@ -16,12 +16,12 @@ stdenv.mkDerivation rec { pname = "poco"; - version = "1.13.3"; + version = "1.14.1"; src = fetchFromGitHub { owner = "pocoproject"; repo = "poco"; - sha256 = "sha256-ryBQjzg1DyYd/LBZzjHxq8m/7ZXRSKNNGRkIII0eHK0="; + hash = "sha256-acq2eja61sH/QHwMPmiDNns2jvXRTk0se/tHj9XRSiU="; rev = "poco-${version}-release"; }; From 4b5c68cc150ebb2f049cdc74c03b977b15669707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sat, 15 Feb 2025 20:15:24 +0100 Subject: [PATCH 2/7] pothos: fix the build against poco-1.14 --- pkgs/applications/radio/pothos/cstring.patch | 50 ++++++++++++++++++++ pkgs/applications/radio/pothos/default.nix | 5 ++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/applications/radio/pothos/cstring.patch diff --git a/pkgs/applications/radio/pothos/cstring.patch b/pkgs/applications/radio/pothos/cstring.patch new file mode 100644 index 0000000000000..4e8957c3f122b --- /dev/null +++ b/pkgs/applications/radio/pothos/cstring.patch @@ -0,0 +1,50 @@ +Submodule blocks contains modified content +diff --git a/blocks/file/BinaryFileSink.cpp b/blocks/file/BinaryFileSink.cpp +index 31c9a41..0083b0d 100644 +--- a/blocks/file/BinaryFileSink.cpp ++++ b/blocks/file/BinaryFileSink.cpp +@@ -13,6 +13,7 @@ + #endif //_MSC_VER + #include + #include ++#include + + #ifndef O_BINARY + #define O_BINARY 0 +diff --git a/blocks/file/BinaryFileSource.cpp b/blocks/file/BinaryFileSource.cpp +index 0151231..379d383 100644 +--- a/blocks/file/BinaryFileSource.cpp ++++ b/blocks/file/BinaryFileSource.cpp +@@ -13,6 +13,7 @@ + #endif //_MSC_VER + #include + #include ++#include + + #ifndef O_BINARY + #define O_BINARY 0 +diff --git a/blocks/file/TextFileSink.cpp b/blocks/file/TextFileSink.cpp +index b4b2f08..2be66e2 100644 +--- a/blocks/file/TextFileSink.cpp ++++ b/blocks/file/TextFileSink.cpp +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + + /*********************************************************************** + * |PothosDoc Text File Sink +Submodule soapy contains modified content +diff --git a/soapy/DemoController.cpp b/soapy/DemoController.cpp +index 4ce8ead..9a4e742 100644 +--- a/soapy/DemoController.cpp ++++ b/soapy/DemoController.cpp +@@ -6,6 +6,7 @@ + #include + #include + #include //min/max ++#include + + /*********************************************************************** + * |PothosDoc SDR Demo Controller diff --git a/pkgs/applications/radio/pothos/default.nix b/pkgs/applications/radio/pothos/default.nix index 641df521c7fd8..0cb55472d3428 100644 --- a/pkgs/applications/radio/pothos/default.nix +++ b/pkgs/applications/radio/pothos/default.nix @@ -41,8 +41,13 @@ mkDerivation rec { url = "https://github.com/pothosware/PothosCore/commit/092d1209b0fd0aa8a1733706c994fa95e66fd017.patch"; hash = "sha256-bZXG8kD4+1LgDV8viZrJ/DMjg8UvW7b5keJQDXurfkA="; }) + # various source files are missing imports of + ./cstring.patch ]; + # poco 1.14 requires c++17 + NIX_CFLAGS_COMPILE = [ "-std=gnu++17" ]; + nativeBuildInputs = [ cmake pkg-config From 75eabbefbf6f647ba58bbd8d4343040c08432c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sat, 15 Feb 2025 22:30:40 +0100 Subject: [PATCH 3/7] poco: use the nix provided dependencies, fix the static build --- ...nal-pcre-files-for-non-static-builds.patch | 23 +++++++++++++++++++ pkgs/by-name/po/poco/package.nix | 13 +++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/po/poco/disable-internal-pcre-files-for-non-static-builds.patch diff --git a/pkgs/by-name/po/poco/disable-internal-pcre-files-for-non-static-builds.patch b/pkgs/by-name/po/poco/disable-internal-pcre-files-for-non-static-builds.patch new file mode 100644 index 0000000000000..bdc57a6ce8e3f --- /dev/null +++ b/pkgs/by-name/po/poco/disable-internal-pcre-files-for-non-static-builds.patch @@ -0,0 +1,23 @@ +diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index d5f3b267d..dfaf99a10 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -31,11 +31,13 @@ if(POCO_UNBUNDLED) + find_package(ZLIB REQUIRED) + find_package(Utf8Proc REQUIRED) + +- #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library +- POCO_SOURCES(SRCS RegExp +- src/pcre2_ucd.c +- src/pcre2_tables.c +- ) ++ if(NOT POCO_STATIC AND BUILD_SHARED_LIBS) ++ #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library ++ POCO_SOURCES(SRCS RegExp ++ src/pcre2_ucd.c ++ src/pcre2_tables.c ++ ) ++ endif() + + else() + # pcre2 diff --git a/pkgs/by-name/po/poco/package.nix b/pkgs/by-name/po/poco/package.nix index da238688ca0c9..ba4777666ec89 100644 --- a/pkgs/by-name/po/poco/package.nix +++ b/pkgs/by-name/po/poco/package.nix @@ -10,6 +10,7 @@ sqlite, openssl, unixODBC, + utf8proc, libmysqlclient, }: @@ -32,6 +33,7 @@ stdenv.mkDerivation rec { buildInputs = [ unixODBC + utf8proc libmysqlclient ]; propagatedBuildInputs = [ @@ -50,8 +52,15 @@ stdenv.mkDerivation rec { MYSQL_DIR = libmysqlclient; MYSQL_INCLUDE_DIR = "${MYSQL_DIR}/include/mysql"; - configureFlags = [ - "--unbundled" + cmakeFlags = [ + # use nix provided versions of sqlite, zlib, pcre, expat, ... instead of bundled versions + "-DPOCO_UNBUNDLED=ON" + ]; + + patches = [ + # poco builds its own version of pcre, disable it + # https://github.com/pocoproject/poco/issues/4871 + ./disable-internal-pcre-files-for-non-static-builds.patch ]; postFixup = '' From e2d9689fa7de9c9cbdf19e32de13f9fc714d29eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sun, 16 Feb 2025 15:53:54 +0100 Subject: [PATCH 4/7] Rename file to better represent what it actually does --- ...atch => disable-internal-pcre-files-for-static-builds.patch} | 0 pkgs/by-name/po/poco/package.nix | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/by-name/po/poco/{disable-internal-pcre-files-for-non-static-builds.patch => disable-internal-pcre-files-for-static-builds.patch} (100%) diff --git a/pkgs/by-name/po/poco/disable-internal-pcre-files-for-non-static-builds.patch b/pkgs/by-name/po/poco/disable-internal-pcre-files-for-static-builds.patch similarity index 100% rename from pkgs/by-name/po/poco/disable-internal-pcre-files-for-non-static-builds.patch rename to pkgs/by-name/po/poco/disable-internal-pcre-files-for-static-builds.patch diff --git a/pkgs/by-name/po/poco/package.nix b/pkgs/by-name/po/poco/package.nix index ba4777666ec89..e3f25df3edd14 100644 --- a/pkgs/by-name/po/poco/package.nix +++ b/pkgs/by-name/po/poco/package.nix @@ -60,7 +60,7 @@ stdenv.mkDerivation rec { patches = [ # poco builds its own version of pcre, disable it # https://github.com/pocoproject/poco/issues/4871 - ./disable-internal-pcre-files-for-non-static-builds.patch + ./disable-internal-pcre-files-for-static-builds.patch ]; postFixup = '' From f0af64eee34a7c5ecc4f7e2fcfe40614c871ac46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sun, 16 Feb 2025 15:56:40 +0100 Subject: [PATCH 5/7] Better comment --- pkgs/by-name/po/poco/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/po/poco/package.nix b/pkgs/by-name/po/poco/package.nix index e3f25df3edd14..3f1c71b535149 100644 --- a/pkgs/by-name/po/poco/package.nix +++ b/pkgs/by-name/po/poco/package.nix @@ -36,6 +36,7 @@ stdenv.mkDerivation rec { utf8proc libmysqlclient ]; + propagatedBuildInputs = [ zlib pcre2 @@ -58,7 +59,7 @@ stdenv.mkDerivation rec { ]; patches = [ - # poco builds its own version of pcre, disable it + # poco builds its own version of pcre, disable it for static builds # https://github.com/pocoproject/poco/issues/4871 ./disable-internal-pcre-files-for-static-builds.patch ]; From c162e317e4b07cd5858b9470a275ec1287003617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sun, 16 Feb 2025 20:03:29 +0100 Subject: [PATCH 6/7] Fix craftos-pc build. 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](https://github.com/MCJack123/craftos2/issues/391]. --- .../craftos-pc/fix-poco-header-includes.patch | 37 ++++++++++++ pkgs/by-name/cr/craftos-pc/package.nix | 59 +++++++++++++------ 2 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 pkgs/by-name/cr/craftos-pc/fix-poco-header-includes.patch diff --git a/pkgs/by-name/cr/craftos-pc/fix-poco-header-includes.patch b/pkgs/by-name/cr/craftos-pc/fix-poco-header-includes.patch new file mode 100644 index 0000000000000..6eba17581e0ba --- /dev/null +++ b/pkgs/by-name/cr/craftos-pc/fix-poco-header-includes.patch @@ -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 + #include + #include ++#include + #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 + #include + #include ++#include + #ifndef __EMSCRIPTEN__ + #include + #include +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 + #include + #include ++#include ++#include + #include + #include + #include diff --git a/pkgs/by-name/cr/craftos-pc/package.nix b/pkgs/by-name/cr/craftos-pc/package.nix index 535b50b0f138b..2afa972efe407 100644 --- a/pkgs/by-name/cr/craftos-pc/package.nix +++ b/pkgs/by-name/cr/craftos-pc/package.nix @@ -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 @@ -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 = '' @@ -57,6 +70,10 @@ stdenv.mkDerivation rec { runHook postBuild ''; + patches = [ + ./fix-poco-header-includes.patch + ]; + dontStrip = true; installPhase = '' @@ -87,9 +104,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"; }; } From aca5476a9faca726988775bb1829d03f5a325d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sun, 16 Feb 2025 21:04:01 +0100 Subject: [PATCH 7/7] Note pull request --- pkgs/by-name/cr/craftos-pc/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/cr/craftos-pc/package.nix b/pkgs/by-name/cr/craftos-pc/package.nix index 2afa972efe407..f9774c9f20863 100644 --- a/pkgs/by-name/cr/craftos-pc/package.nix +++ b/pkgs/by-name/cr/craftos-pc/package.nix @@ -71,6 +71,8 @@ stdenv.mkDerivation rec { ''; patches = [ + # fix includes of poco headers + # https://github.com/trofi/nixpkgs/pull/5 ./fix-poco-header-includes.patch ];