Unverified Commit 70d968fd authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

linphonePackages: update & refactor (#444603)

parents 481d74dc d999f683
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
# Linphone

Linphone is a SIP softphone application developed by Belledonne Communications.

The main application is located in the [`linphone-desktop`](https://gitlab.linphone.org/BC/public/linphone-desktop) repository, and depends on many bespoke libraries, as well as third-party libraries with custom patches.
This scope provides all libraries and patches needed for Linphone to build.

BC-developed libraries are housed within the [`linphone-sdk`](https://gitlab.linphone.org/BC/public/linphone-sdk) monorepo.
Current stable versions of the monorepo utilize git submodules to link the respective package repos, but BC has since integrated all of their libraries into the monorepo proper, which is why we're already using a single source for the entire repo.
An auxiliary function `mkLinphoneDerivation` is provided in this scope, to streamline building libraries from that repository.

Other third-party libraries for which BC has provided custom patches, and are not included in the monorepo, are prefixed with `bc-`.

All libraries and packages are exposed in nixpkgs under the `linphonePackage` scope via `pkgs/all-packages.nix`.

## Updating

Updating is done in 3 steps:

1. Update the main Linphone application in the derivation directly
2. Update all libraries derived from the `linphone-sdk` monorepo, by updating the monorepo version and hash in `./default.nix`
3. Update all custom versions of third-party libraries individually (those prefixed with `bc-`)
4. Verify that the build is working by building (and running) `linphonePackages.linphone-desktop`.

> [!TIP]
>
> When testing, run the app with `./result/bin/linphone --verbose` to get useful logs in `stdout`.

## Adding new libraries

To add a new package to this scope, simply add a new subdirectory containing a `default.nix` file with the appropriate package name. The scope automatically picks up any directories and adds an according toplevel package.

If the package you are adding is contained within the `linphone-sdk` monorepo, it makes sense to use the `mkLinphoneDerivation` function to streamline the build process.

If the package you are adding is a third-party libary with custom patches from BC, it should be prefixed with `bc-` for easy recognizability, so e.g. if BC were to patch `ffmpeg`, you would call the package `bc-ffmpeg`.

## Notes for the future

As mentioned before, currently most libraries within `linphone-sdk` are simply git submodules, but in the future, they will be properly integrated into the monorepo (this is already the case for their main branch).

Also, currently the build relies on Qt5, but starting with Linphone 6.0.0, which as of 2025-09-20 is in its RC phase, the build will involve Qt6.
+12 −9
Original line number Diff line number Diff line
@@ -5,10 +5,10 @@
  python3,
  stdenv,
}:

stdenv.mkDerivation {
  pname = "bc-decaf";
  version = "unstable-2022-07-20";
  # version retrieved from `HISTORY.txt`
  version = "1.0.2-unstable-2025-06-25";

  nativeBuildInputs = [ cmake ];
  buildInputs = [
@@ -20,21 +20,24 @@ stdenv.mkDerivation {
    group = "BC";
    owner = "public/external";
    repo = "decaf";
    rev = "876ddb4d465c94f97beba1be450e8538d866cc5d";
    sha256 = "sha256-QFOAgLiPbG2ZdwKoCOrVD5/sPq9IH4rtAWnnk/rZWcs=";
    rev = "e5cc6240690d3ffdfcbdb1e4e851954b789cd5d9";
    sha256 = "sha256-4oZtpdelyKbd2k4LAhtsLkL5Y84C1Qb02fpVywYorr8=";
  };

  # Do not build static libraries and do not enable -Werror
  cmakeFlags = [
    "-DENABLE_STATIC=NO"
    "-DBUILD_SHARED_LIBS=ON"
    "-DENABLE_STRICT=NO"
  ];

  meta = with lib; {
  meta = {
    description = "Elliptic curve library supporting Ed448-Goldilocks and Curve25519. Belledonne Communications' fork for Linphone";
    homepage = "https://gitlab.linphone.org/BC/public/bctoolbox";
    license = licenses.mit;
    maintainers = with maintainers; [ thibaultlemaire ];
    platforms = platforms.linux;
    homepage = "https://gitlab.linphone.org/BC/public/external/decaf";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      naxdy
    ];
    platforms = lib.platforms.linux;
  };
}
+59 −0
Original line number Diff line number Diff line
{
  cmake,
  fetchFromGitLab,
  lib,
  stdenv,

  # tests
  testers,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "bc-ispell";
  # version retrieved from `CHANGES`
  version = "3.4.02-unstable-2025-05-05";

  src = fetchFromGitLab {
    domain = "gitlab.linphone.org";
    group = "BC";
    owner = "public/external";
    repo = "ispell";
    rev = "05574fe160222c3d0b6283c1433c9b087271fad1";
    sha256 = "sha256-YoRLiMjk2BxoI27xc2nzucxfHV9UbouFRSECb3RdHGo=";
  };

  patches = [
    # linphone has custom find modules that look for this package,
    # but they do not work in nix, so we need to patch this library to
    # install regular cmake config files
    ./install-config-files.patch
  ];

  cmakeFlags = [
    "-DENABLE_STATIC=NO"
    "-DBUILD_SHARED_LIBS=ON"
  ];

  nativeBuildInputs = [ cmake ];

  passthru.tests = {
    cmake-config = testers.hasCmakeConfigModules {
      package = finalAttrs.finalPackage;
      moduleNames = [
        "ISpell"
      ];
    };
  };

  meta = {
    description = "Interactive spelling checker";
    homepage = "https://gitlab.linphone.org/BC/public/external/ispell";
    platforms = lib.platforms.all;
    # NOTE: ISpell itself does not explicitly provide a license. From its
    # 'Contributors' file, it can be deduced that it is distributed under
    # "some" open source license, but the details are not clear.
    license = lib.licenses.free;
    maintainers = with lib.maintainers; [
      naxdy
    ];
  };
})
+90 −0
Original line number Diff line number Diff line
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6edcc88..6f5601d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,11 +47,62 @@ set(ISPELL_SOURCES
 	xgets.c
 )
 
+set(ISPELL_HEADERS
+  config.h
+  defhash.h
+  exp_table.h
+  fields.h
+  ispell.h
+  libispell.h
+  local.h
+  msgs.h
+  proto.h
+  version.h
+)
+
 add_library(${ISPELL_TARGET_NAME} SHARED ${ISPELL_SOURCES})
 
+install(
+  FILES
+  ${ISPELL_HEADERS}
+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(TARGETS ${ISPELL_TARGET_NAME}
+  EXPORT ${ISPELL_TARGET_NAME}Targets
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
 install(TARGETS ${ISPELL_TARGET_NAME}
   EXPORT ${ISPELL_TARGET_NAME}LibraryDepends
   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
 )
+
+install(
+  EXPORT ${ISPELL_TARGET_NAME}Targets
+  FILE ${ISPELL_TARGET_NAME}Targets.cmake
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/${ISPELL_TARGET_NAME}/cmake"
+  NAMESPACE ${ISPELL_TARGET_NAME}::
+)
+
+install(
+  EXPORT ${ISPELL_TARGET_NAME}LibraryDepends
+  FILE ${ISPELL_TARGET_NAME}LibraryDepends.cmake
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/${ISPELL_TARGET_NAME}/cmake"
+  NAMESPACE ${ISPELL_TARGET_NAME}::
+)
+
+configure_package_config_file(
+  ${ISPELL_TARGET_NAME}Config.cmake.in
+  "${CMAKE_CURRENT_BINARY_DIR}/${ISPELL_TARGET_NAME}Config.cmake"
+  INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/${ISPELL_TARGET_NAME}/cmake"
+)
+
+install(
+  FILES "${CMAKE_CURRENT_BINARY_DIR}/${ISPELL_TARGET_NAME}Config.cmake"
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/${ISPELL_TARGET_NAME}/cmake"
+)
diff --git a/ISpellConfig.cmake.in b/ISpellConfig.cmake.in
index 052194b..cb71737 100644
--- a/ISpellConfig.cmake.in
+++ b/ISpellConfig.cmake.in
@@ -6,13 +6,13 @@
 
 @PACKAGE_INIT@
 
-include("${CMAKE_CURRENT_LIST_DIR}/@ISPELL_TARGET_NAME@LibraryDepends.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/ISpellLibraryDepends.cmake")
 
-set(ISPELL_LIBRARIES "@ISPELL_TARGET_NAME@")
-get_target_property(ISPELL_INCLUDE_DIRS "@ISPELL_TARGET_NAME@" INTERFACE_INCLUDE_DIRECTORIES)
+set(ISPELL_LIBRARIES "ISpell")
+get_target_property(ISPELL_INCLUDE_DIRS "ISpell::ISpell" INTERFACE_INCLUDE_DIRECTORIES)
 
 if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.18.0)
-    add_library(@ISpell_TARGET_NAME@::@ISpell_TARGET_NAME@ ALIAS @ISpell_TARGET_NAME@)
+  add_library(ISpell ALIAS ISpell::ISpell)
 endif()
 
-check_required_components(@ISpell_TARGET_NAME@)
+check_required_components(ISpell)
+10 −7
Original line number Diff line number Diff line
@@ -10,15 +10,16 @@

stdenv.mkDerivation {
  pname = "bc-soci";
  version = "linphone-4.4.1";
  # version retrieved from `CHANGELOG.md`
  version = "3.2.3-unstable-2025-05-05";

  src = fetchFromGitLab {
    domain = "gitlab.linphone.org";
    group = "BC";
    owner = "public/external";
    repo = "soci";
    rev = "bc8ce0c5628dd48eca6ef5ce0a0a2f52547d88b6";
    sha256 = "sha256-qo26aYp/G2C6UkGA1qkHQwTKD5go7TQ9JWxb9xtbe6M=";
    rev = "3a9c79088212941d0175c22cd2da8fe1bdd639df";
    sha256 = "sha256-7aSTFD4yk1i6c9cEGqdo/eJtuqoOUZUTJlZijgjuYpM=";
  };

  patches = [
@@ -44,11 +45,13 @@ stdenv.mkDerivation {
    boost
  ];

  meta = with lib; {
  meta = {
    description = "Database access library for C++. Belledonne Communications' fork for Linphone";
    homepage = "https://gitlab.linphone.org/BC/public/external/soci";
    license = licenses.boost;
    platforms = platforms.all;
    maintainers = with maintainers; [ thibaultlemaire ];
    license = lib.licenses.boost;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [
      naxdy
    ];
  };
}
Loading