From 5a65a419627fa1746fac2d8b1a7219a47908e781 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 26 Feb 2023 14:54:26 -0800 Subject: [PATCH 1/6] libre: use cmake for configurePhase Although libre is a cmake-based project, our expression for this library does not currently use cmake for the configurePhase. This commit causes it to do so. This is necessary to get downstream libre and baresip to cross-compile. --- pkgs/development/libraries/libre/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libre/default.nix b/pkgs/development/libraries/libre/default.nix index 7ed03f0af1179..bc33f5d2e0453 100644 --- a/pkgs/development/libraries/libre/default.nix +++ b/pkgs/development/libraries/libre/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, fetchFromGitHub, zlib, openssl }: +{ lib, stdenv, fetchFromGitHub, zlib, openssl +, cmake }: + stdenv.mkDerivation rec { version = "2.9.0"; pname = "libre"; @@ -9,6 +11,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-YNAfHmohMqGGF8N/VdndJJ32PF/GMBoNtjo/t2lt6HA="; }; buildInputs = [ zlib openssl ]; + nativeBuildInputs = [ cmake ]; makeFlags = [ "USE_ZLIB=1" "USE_OPENSSL=1" "PREFIX=$(out)" ] ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}" ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${lib.getDev stdenv.cc.libc}" From 67f93ae299730480bd4a7bfd77a1b10322b682c6 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 26 Feb 2023 14:59:04 -0800 Subject: [PATCH 2/6] librem: use cmake for configurePhase Although librem is a cmake-based project, our expression for this library does not currently use cmake for the configurePhase. This commit causes it to do so. This is necessary to get downstream libre and baresip to cross-compile. --- pkgs/development/libraries/librem/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/librem/default.nix b/pkgs/development/libraries/librem/default.nix index f343c4383c4ab..3d393997a32ef 100644 --- a/pkgs/development/libraries/librem/default.nix +++ b/pkgs/development/libraries/librem/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, fetchFromGitHub, zlib, openssl, libre }: +{ lib, stdenv, fetchFromGitHub, zlib, openssl, libre +, cmake }: + stdenv.mkDerivation rec { version = "2.10.0"; pname = "librem"; @@ -8,10 +10,13 @@ stdenv.mkDerivation rec { rev = "v${version}"; sha256 = "sha256-wyzpx0WjQLA8UKx4S6QOETMehf51Af5napZsxMXttmM="; }; + nativeBuildInputs = [ cmake ]; buildInputs = [ zlib openssl libre ]; + cmakeFlags = [ + "-DRE_INCLUDE_DIR=${libre}/include/re" + ]; makeFlags = [ "LIBRE_MK=${libre}/share/re/re.mk" - "LIBRE_INC=${libre}/include/re" "PREFIX=$(out)" ] ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${lib.getDev stdenv.cc.cc}" From 060baa5e1c412201f0ac0748021c794deb5788ac Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 26 Feb 2023 15:02:56 -0800 Subject: [PATCH 3/6] libre: enableParallelBuilding=true --- pkgs/development/libraries/libre/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/libre/default.nix b/pkgs/development/libraries/libre/default.nix index bc33f5d2e0453..bfcdb2d5287cb 100644 --- a/pkgs/development/libraries/libre/default.nix +++ b/pkgs/development/libraries/libre/default.nix @@ -16,6 +16,7 @@ stdenv.mkDerivation rec { ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}" ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${lib.getDev stdenv.cc.libc}" ; + enableParallelBuilding = true; meta = { description = "A library for real-time communications with async IO support and a complete SIP stack"; homepage = "https://github.com/baresip/re"; From 258e046c4279b09c5fa6601ff6091b302362a417 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 26 Feb 2023 15:03:02 -0800 Subject: [PATCH 4/6] librem: enableParallelBuilding=true --- pkgs/development/libraries/librem/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/librem/default.nix b/pkgs/development/libraries/librem/default.nix index 3d393997a32ef..2e9a2f1fa31b1 100644 --- a/pkgs/development/libraries/librem/default.nix +++ b/pkgs/development/libraries/librem/default.nix @@ -22,6 +22,7 @@ stdenv.mkDerivation rec { ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${lib.getDev stdenv.cc.cc}" ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${lib.getDev stdenv.cc.libc}" ; + enableParallelBuilding = true; meta = { description = "A library for real-time audio and video processing"; homepage = "https://github.com/baresip/rem"; From 4fff590562e9c767493eedcae18b5219e716da4c Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 26 Feb 2023 15:05:55 -0800 Subject: [PATCH 5/6] baresip: enableParallelBuilding=true --- .../networking/instant-messengers/baresip/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/applications/networking/instant-messengers/baresip/default.nix b/pkgs/applications/networking/instant-messengers/baresip/default.nix index d0fe18e1538ae..f76a4c984d5ed 100644 --- a/pkgs/applications/networking/instant-messengers/baresip/default.nix +++ b/pkgs/applications/networking/instant-messengers/baresip/default.nix @@ -107,6 +107,8 @@ stdenv.mkDerivation rec { ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.cc.libc}" ; + enableParallelBuilding = true; + env.NIX_CFLAGS_COMPILE = '' -I${librem}/include/rem -I${gsm}/include/gsm -DHAVE_INTTYPES_H -D__GLIBC__ -D__need_timeval -D__need_timespec -D__need_time_t ''; From 1682265db7feb0720277802902a85b6fcca27e2c Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 26 Feb 2023 15:07:10 -0800 Subject: [PATCH 6/6] baresip: use cmake for configurePhase, fixes cross Although baresip is a cmake-based project, our expression was not using cmake for the configurePhase. This commit causes it to do so, which fixes cross-compilation for this package. Incorporates: - https://github.com/NixOS/nixpkgs/pull/218518 - https://github.com/NixOS/nixpkgs/pull/218520 - https://github.com/NixOS/nixpkgs/pull/218522 - https://github.com/NixOS/nixpkgs/pull/218521 - https://github.com/NixOS/nixpkgs/pull/218523 --- .../instant-messengers/baresip/default.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/baresip/default.nix b/pkgs/applications/networking/instant-messengers/baresip/default.nix index f76a4c984d5ed..5aa3629bd38e0 100644 --- a/pkgs/applications/networking/instant-messengers/baresip/default.nix +++ b/pkgs/applications/networking/instant-messengers/baresip/default.nix @@ -23,6 +23,8 @@ , spandsp3 , libuuid , libvpx +, cmake +, dbusSupport ? true }: stdenv.mkDerivation rec { version = "2.9.0"; @@ -33,7 +35,10 @@ stdenv.mkDerivation rec { rev = "v${version}"; sha256 = "sha256-B4d8D4IfLYAIYVN80Lrh5bywD5iacSnUVwEzbc6Xq7g="; }; - nativeBuildInputs = [ pkg-config ]; + prePatch = lib.optionalString (!dbusSupport) '' + substituteInPlace cmake/modules.cmake --replace 'list(APPEND MODULES ctrl_dbus)' "" + ''; + nativeBuildInputs = [ pkg-config cmake ]; buildInputs = [ zlib openssl @@ -56,9 +61,14 @@ stdenv.mkDerivation rec { libuuid libvpx ] ++ (with gst_all_1; [ gstreamer gst-libav gst-plugins-base gst-plugins-bad gst-plugins-good ]); + + cmakeFlags = [ + "-DCMAKE_SKIP_BUILD_RPATH=ON" + "-Dre_DIR=${libre}/include/re" + ]; + makeFlags = [ "LIBRE_MK=${libre}/share/re/re.mk" - "LIBRE_INC=${libre}/include/re" "LIBRE_SO=${libre}/lib" "LIBREM_PATH=${librem}" "PREFIX=$(out)"