{ lib, fetchFromGitHub, makeWrapper, pkg-config, stdenv, # pkg-config dependencies libpng, freetype, fontconfig, xorg, expat, gtk3, libnotify, # other dependencies libclang, openssl, }: let buildMethod = if stdenv.cc.isClang then "CLANG" else "GCC"; in stdenv.mkDerivation (self: let selfBootstrap = self.overrideAttrs (selfAttrs: superAttrs: { passthru = superAttrs.passthru // { bootstrap = true; }; }); in { pname = "ultimatepp"; version = "2025.1"; src = fetchFromGitHub { owner = "ultimatepp"; repo = "ultimatepp"; tag = "2025.1"; hash = "sha256-/hsjQvc5+HxyaytZ5kryhSxbuaAx0eXuH285q7NPiiw="; }; enableParallelBuilding = true; nativeBuildInputs = [ makeWrapper pkg-config ]; buildInputs = [ # in the same order as in the Makefile libpng freetype fontconfig xorg.libX11 xorg.libxcb expat xorg.libXinerama xorg.libXrender xorg.libXft xorg.libXdmcp xorg.libXext gtk3 libnotify # not in the Makefile openssl ] ++ lib.optional (!self.passthru.bootstrap) libclang; patches = [ ./no-build-info.patch ./remove-inline-from-HighlightSetup-InitOnce.patch ]; postPatch = '' patchShebangs ./configure_makefile echo "#define IDE_VERSION \"${self.version}\"" > uppsrc/ide/version.h '' + lib.optionalString (!self.passthru.bootstrap) '' mkdir -p .home export HOME=$(realpath .home) ''; NIX_LDFLAGS = [ "-L${libclang.lib}/lib" "-lclang" ]; NIX_CFLAGS_COMPILE = [ "-DflagLCLANG" ]; UPP_NO_BUILD_INFO = true; buildPhase = '' runHook preBuild '' + ( # Don't build theide in bootstrap to save resources if self.passthru.bootstrap then '' make -f umkMakefile -j $NIX_BUILD_CORES "$makeFlagsArray" '' else '' ${lib.getExe' selfBootstrap "umk"} uppsrc ide ${buildMethod} -rvs ${lib.getExe' selfBootstrap "umk"} uppsrc umk ${buildMethod} -rvs '') + '' runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/bin '' + (if self.passthru.bootstrap then '' mv ./umk $out/bin/umk '' else '' mv $HOME/.cache/upp.out/umk/${buildMethod}.Main.Shared/umk $out/bin/umk mv $HOME/.cache/upp.out/ide/${buildMethod}.Gui.Main.Shared/ide $out/bin/theide wrapProgram $out/bin/theide \ --unset WAYLAND_DISPLAY '') + '' runHook postInstall ''; passthru = { bootstrap = false; }; meta = { homepage = "https://www.ultimatepp.org"; description = "C++ cross-platform rapid application development framework"; license = lib.licenses.bsd2; mainProgram = "umk"; }; })