fltk 1.3.8 -> 1.3.11, clean up (#446331)

This commit is contained in:
K900
2025-09-27 08:45:18 +00:00
committed by GitHub
3 changed files with 98 additions and 64 deletions
+61 -27
View File
@@ -25,19 +25,34 @@
withCairo ? true,
cairo,
withPango ? stdenv.hostPlatform.isLinux,
# pango depends on Xft, and implicitly enables cairo.
# So only enable pango if cairo is enabled too.
withPango ? withXorg && withCairo,
pango,
withDocs ? true,
doxygen,
graphviz,
withXorg ? stdenv.hostPlatform.isLinux,
withWayland ? stdenv.hostPlatform.isLinux && withCairo,
wayland,
wayland-protocols,
libxkbcommon,
wayland-scanner,
withExamples ? (stdenv.buildPlatform == stdenv.hostPlatform),
nix-update-script,
}:
let
onOff = value: if value then "ON" else "OFF";
in
# pango support depends on Xft
assert withPango -> withXorg;
# wayland support depends on cairo
assert withWayland -> withCairo;
stdenv.mkDerivation (finalAttrs: {
pname = "fltk";
version = "1.4.4";
@@ -62,6 +77,9 @@ stdenv.mkDerivation (finalAttrs: {
cmake
pkg-config
]
++ lib.optionals withWayland [
wayland-scanner
]
++ lib.optionals withDocs [
doxygen
graphviz
@@ -86,6 +104,8 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals stdenv.hostPlatform.isLinux [
freetype
]
++ lib.optionals withXorg [
libX11
libXext
libXinerama
@@ -94,6 +114,11 @@ stdenv.mkDerivation (finalAttrs: {
libXft
libXrender
]
++ lib.optionals withWayland [
wayland
wayland-protocols
libxkbcommon
]
++ lib.optionals withCairo [
cairo
]
@@ -103,43 +128,45 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
# Common
"-DFLTK_BUILD_SHARED_LIBS=${onOff (!stdenv.hostPlatform.isStatic)}"
"-DFLTK_USE_SYSTEM_LIBDECOR=ON"
"-DFLTK_USE_SYSTEM_LIBJPEG=ON"
"-DFLTK_USE_SYSTEM_LIBPNG=ON"
"-DFLTK_USE_SYSTEM_ZLIB=ON"
(lib.cmakeBool "FLTK_BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "FLTK_USE_SYSTEM_LIBDECOR" true)
(lib.cmakeBool "FLTK_USE_SYSTEM_LIBJPEG" true)
(lib.cmakeBool "FLTK_USE_SYSTEM_LIBPNG" true)
(lib.cmakeBool "FLTK_USE_SYSTEM_ZLIB" true)
# X11
"-DFLTK_USE_XINERAMA=${onOff stdenv.hostPlatform.isLinux}"
"-DFLTK_USE_XFIXES=${onOff stdenv.hostPlatform.isLinux}"
"-DFLTK_USE_XCURSOR=${onOff stdenv.hostPlatform.isLinux}"
"-DFLTK_USE_XFT=${onOff stdenv.hostPlatform.isLinux}"
"-DFLTK_USE_XRENDER=${onOff stdenv.hostPlatform.isLinux}"
(lib.cmakeBool "FLTK_USE_XINERAMA" withXorg)
(lib.cmakeBool "FLTK_USE_XFIXES" withXorg)
(lib.cmakeBool "FLTK_USE_XCURSOR" withXorg)
(lib.cmakeBool "FLTK_USE_XFT" withXorg)
(lib.cmakeBool "FLTK_USE_XRENDER" withXorg)
# Wayland
(lib.cmakeBool "FLTK_BACKEND_WAYLAND" withWayland)
# GL
"-DFLTK_BUILD_GL=${onOff withGL}"
"-DOpenGL_GL_PREFERENCE=GLVND"
(lib.cmakeBool "FLTK_BUILD_GL" withGL)
# Cairo
"-DFLTK_OPTION_CAIRO_WINDOW=${onOff withCairo}"
"-DFLTK_OPTION_CAIRO_EXT=${onOff withCairo}"
(lib.cmakeBool "FLTK_OPTION_CAIRO_WINDOW" withCairo)
(lib.cmakeBool "FLTK_OPTION_CAIRO_EXT" withCairo)
# Pango
"-DFLTK_USE_PANGO=${onOff withPango}"
(lib.cmakeBool "FLTK_USE_PANGO" withPango)
# Examples & Tests
"-DFLTK_BUILD_EXAMPLES=${onOff withExamples}"
"-DFLTK_BUILD_TEST=${onOff withExamples}"
(lib.cmakeBool "FLTK_BUILD_EXAMPLES" withExamples)
(lib.cmakeBool "FLTK_BUILD_TEST" withExamples)
# Docs
"-DFLTK_BUILD_HTML_DOCS=${onOff withDocs}"
"-DFLTK_BUILD_PDF_DOCS=OFF"
"-DFLTK_INSTALL_HTML_DOCS=${onOff withDocs}"
"-DFLTK_INSTALL_PDF_DOCS=OFF"
"-DFLTK_INCLUDE_DRIVER_DOCS=${onOff withDocs}"
(lib.cmakeBool "FLTK_BUILD_HTML_DOCS" withDocs)
(lib.cmakeBool "FLTK_INSTALL_HTML_DOCS" withDocs)
(lib.cmakeBool "FLTK_INCLUDE_DRIVER_DOCS" withDocs)
(lib.cmakeBool "FLTK_BUILD_PDF_DOCS" false)
(lib.cmakeBool "FLTK_INSTALL_PDF_DOCS" false)
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
"-DCMAKE_SKIP_BUILD_RPATH=ON"
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
];
postBuild = lib.optionalString withDocs ''
@@ -174,6 +201,13 @@ stdenv.mkDerivation (finalAttrs: {
--replace-fail "/$out/" "/"
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"release-(1\\.4\\.[0-9.]+)"
];
};
meta = {
description = "C++ cross-platform lightweight GUI library";
homepage = "https://www.fltk.org";
+37 -36
View File
@@ -25,29 +25,27 @@
withCairo ? true,
cairo,
withPango ? false,
pango,
withDocs ? true,
doxygen,
graphviz,
withXorg ? stdenv.hostPlatform.isLinux,
withExamples ? (stdenv.buildPlatform == stdenv.hostPlatform),
withShared ? true,
nix-update-script,
}:
let
onOff = value: if value then "ON" else "OFF";
in
stdenv.mkDerivation (finalAttrs: {
pname = "fltk";
version = "1.3.8";
version = "1.3.11";
src = fetchFromGitHub {
owner = "fltk";
repo = "fltk";
rev = "release-${finalAttrs.version}";
hash = "sha256-OQWyOV3EeyFhwFg/eOX66QtFUxaDR1x4ZyHnZHmzhN8=";
hash = "sha256-aN0WdHDjxb9O4OgTfBncIj12tRYfeltKev6pgSMu6/E=";
};
outputs = [ "out" ] ++ lib.optional withExamples "bin" ++ lib.optional withDocs "doc";
@@ -91,6 +89,8 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals stdenv.hostPlatform.isLinux [
freetype
]
++ lib.optionals withXorg [
libX11
libXext
libXinerama
@@ -101,50 +101,44 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals withCairo [
cairo
]
++ lib.optionals withPango [
pango
];
cmakeFlags = [
# Common
"-DOPTION_BUILD_SHARED_LIBS=${onOff withShared}"
"-DOPTION_USE_SYSTEM_ZLIB=ON"
"-DOPTION_USE_SYSTEM_LIBJPEG=ON"
"-DOPTION_USE_SYSTEM_LIBPNG=ON"
(lib.cmakeBool "OPTION_BUILD_SHARED_LIBS" withShared)
(lib.cmakeBool "OPTION_USE_SYSTEM_ZLIB" true)
(lib.cmakeBool "OPTION_USE_SYSTEM_LIBJPEG" true)
(lib.cmakeBool "OPTION_USE_SYSTEM_LIBPNG" true)
# X11
"-DOPTION_USE_XINERAMA=${onOff stdenv.hostPlatform.isLinux}"
"-DOPTION_USE_XFIXES=${onOff stdenv.hostPlatform.isLinux}"
"-DOPTION_USE_XCURSOR=${onOff stdenv.hostPlatform.isLinux}"
"-DOPTION_USE_XFT=${onOff stdenv.hostPlatform.isLinux}"
"-DOPTION_USE_XRENDER=${onOff stdenv.hostPlatform.isLinux}"
"-DOPTION_USE_XDBE=${onOff stdenv.hostPlatform.isLinux}"
(lib.cmakeBool "OPTION_USE_XINERAMA" withXorg)
(lib.cmakeBool "OPTION_USE_XFIXES" withXorg)
(lib.cmakeBool "OPTION_USE_XCURSOR" withXorg)
(lib.cmakeBool "OPTION_USE_XFT" withXorg)
(lib.cmakeBool "OPTION_USE_XRENDER" withXorg)
(lib.cmakeBool "OPTION_USE_XDBE" withXorg)
# GL
"-DOPTION_USE_GL=${onOff withGL}"
(lib.cmakeBool "OPTION_USE_GL" withGL)
"-DOpenGL_GL_PREFERENCE=GLVND"
# Cairo
"-DOPTION_CAIRO=${onOff withCairo}"
"-DOPTION_CAIROEXT=${onOff withCairo}"
# Pango
"-DOPTION_USE_PANGO=${onOff withPango}"
(lib.cmakeBool "OPTION_CAIRO" withCairo)
(lib.cmakeBool "OPTION_CAIROEXT" withCairo)
# Examples & Tests
"-DFLTK_BUILD_EXAMPLES=${onOff withExamples}"
"-DFLTK_BUILD_TEST=${onOff withExamples}"
(lib.cmakeBool "FLTK_BUILD_EXAMPLES" withExamples)
(lib.cmakeBool "FLTK_BUILD_TEST" withExamples)
# Docs
"-DOPTION_BUILD_HTML_DOCUMENTATION=${onOff withDocs}"
"-DOPTION_BUILD_PDF_DOCUMENTATION=OFF"
"-DOPTION_INSTALL_HTML_DOCUMENTATION=${onOff withDocs}"
"-DOPTION_INSTALL_PDF_DOCUMENTATION=OFF"
"-DOPTION_INCLUDE_DRIVER_DOCUMENTATION=${onOff withDocs}"
(lib.cmakeBool "OPTION_BUILD_HTML_DOCUMENTATION" withDocs)
(lib.cmakeBool "OPTION_INSTALL_HTML_DOCUMENTATION" withDocs)
(lib.cmakeBool "OPTION_INCLUDE_DRIVER_DOCUMENTATION" withDocs)
(lib.cmakeBool "OPTION_BUILD_PDF_DOCUMENTATION" false)
(lib.cmakeBool "OPTION_INSTALL_PDF_DOCUMENTATION" false)
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
"-DCMAKE_SKIP_BUILD_RPATH=ON"
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
];
preBuild = lib.optionalString (withCairo && withShared && stdenv.hostPlatform.isDarwin) ''
@@ -185,9 +179,16 @@ stdenv.mkDerivation (finalAttrs: {
postFixup = ''
substituteInPlace $out/bin/fltk-config \
--replace "/$out/" "/"
--replace-fail "/$out/" "/"
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"release-(1\\.3\\.[0-9.]+)"
];
};
meta = {
description = "C++ cross-platform lightweight GUI library";
homepage = "https://www.fltk.org";
-1
View File
@@ -7451,7 +7451,6 @@ with pkgs;
fltk13-minimal = fltk13.override {
withGL = false;
withCairo = false;
withPango = false;
withExamples = false;
withDocs = false;
};