libsForQt5.libopenshot: refactor

- Use file patches instead of postPatch
- finalAttrs design pattern
- set strictDeps
- remove nested with
This commit is contained in:
Anderson Torres
2023-11-30 11:48:34 -03:00
parent eeed18452e
commit f65b9438ff
3 changed files with 37 additions and 26 deletions
@@ -0,0 +1,12 @@
diff -Naur source/src/CMakeLists.txt source-new/src/CMakeLists.txt
--- source/src/CMakeLists.txt 1969-12-31 21:00:01.000000000 -0300
+++ source-new/src/CMakeLists.txt 2023-11-30 09:39:45.442332463 -0300
@@ -231,7 +231,7 @@
target_compile_definitions(openshot PUBLIC USE_IMAGEMAGICK=1)
# Link with ImageMagick library
- target_link_libraries(openshot PUBLIC ImageMagick::Magick++)
+ target_link_libraries(openshot PUBLIC ImageMagick::Magick++ ImageMagick::MagickCore)
set(HAVE_IMAGEMAGICK TRUE CACHE BOOL "Building with ImageMagick support" FORCE)
mark_as_advanced(HAVE_IMAGEMAGICK)
@@ -18,28 +18,23 @@
, zeromq
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "libopenshot";
version = "0.3.2";
src = fetchFromGitHub {
owner = "OpenShot";
repo = "libopenshot";
rev = "v${version}";
sha256 = "sha256-axFGNq+Kg8atlaSlG8EKvxj/FwLfpDR8/e4otmnyosM=";
rev = "v${finalAttrs.version}";
hash = "sha256-axFGNq+Kg8atlaSlG8EKvxj/FwLfpDR8/e4otmnyosM=";
};
postPatch = ''
sed -i 's/{UNITTEST++_INCLUDE_DIR}/ENV{UNITTEST++_INCLUDE_DIR}/g' tests/CMakeLists.txt
'' + lib.optionalString stdenv.isDarwin ''
# Darwin requires both Magick++ and MagickCore or it will fail to link.
substituteInPlace src/CMakeLists.txt \
--replace 'target_link_libraries(openshot PUBLIC ImageMagick::Magick++)' 'target_link_libraries(openshot PUBLIC ImageMagick::Magick++ ImageMagick::MagickCore)'
'';
patches = lib.optionals stdenv.isDarwin [
# Darwin requires both Magick++ and MagickCore for a successful linkage
./0001-link-magickcore.diff
];
nativeBuildInputs = lib.optionals stdenv.isLinux [
alsa-lib
] ++ [
nativeBuildInputs = [
cmake
doxygen
pkg-config
@@ -56,20 +51,28 @@ stdenv.mkDerivation rec {
qtbase
qtmultimedia
zeromq
] ++ lib.optionals stdenv.isLinux [
alsa-lib
] ++ lib.optionals stdenv.isDarwin [
llvmPackages.openmp
];
strictDeps = true;
dontWrapQtApps = true;
doCheck = false;
doCheck = true;
cmakeFlags = [
"-DENABLE_RUBY=OFF"
"-DPYTHON_MODULE_PATH=${python3.sitePackages}"
(lib.cmakeBool "ENABLE_RUBY" false)
(lib.cmakeOptionType "filepath" "PYTHON_MODULE_PATH" python3.sitePackages)
];
meta = with lib; {
passthru = {
inherit libopenshot-audio;
};
meta = {
homepage = "http://openshot.org/";
description = "Free, open-source video editor library";
longDescription = ''
@@ -77,12 +80,8 @@ stdenv.mkDerivation rec {
delivering high quality video editing, animation, and playback solutions
to the world. API currently supports C++, Python, and Ruby.
'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ AndersonTorres ];
platforms = platforms.unix;
license = with lib.licenses; [ gpl3Plus ];
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.unix;
};
passthru = {
inherit libopenshot-audio;
};
}
})
+1 -1
View File
@@ -140,7 +140,7 @@ in (noExtraAttrs (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdP
liblastfm = callPackage ../development/libraries/liblastfm { };
libopenshot = callPackage ../applications/video/openshot-qt/libopenshot.nix {
libopenshot = callPackage ../applications/video/openshot-qt/libopenshot {
stdenv = if pkgs.stdenv.isDarwin then pkgs.overrideSDK pkgs.stdenv "11.0" else pkgs.stdenv;
};