nixpkgs/pkgs/development/tools/wxformbuilder/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

69 lines
1.9 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, darwin
, makeWrapper
, shared-mime-info
, boost
, wxGTK32
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wxformbuilder";
version = "4.2.1";
src = fetchFromGitHub {
owner = "wxFormBuilder";
repo = "wxFormBuilder";
rev = "v${finalAttrs.version}";
fetchSubmodules = true;
leaveDotGit = true;
postFetch = ''
substituteInPlace $out/.git-properties \
--replace-fail "\$Format:%h\$" "$(git -C $out rev-parse --short HEAD)" \
--replace-fail "\$Format:%(describe)\$" "$(git -C $out rev-parse --short HEAD)"
rm -rf $out/.git
'';
hash = "sha256-e0oYyUv8EjGDVj/TWx2jGaj22YyFJf1xa6lredV1J0Y=";
};
postPatch = ''
substituteInPlace third_party/tinyxml2/cmake/tinyxml2.pc.in \
--replace-fail '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace-fail '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
sed -i '/fixup_bundle/d' cmake/macros.cmake
'';
nativeBuildInputs = [
cmake
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.sigtool
makeWrapper
] ++ lib.optionals stdenv.hostPlatform.isLinux [
shared-mime-info
];
buildInputs = [
boost
wxGTK32
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.Cocoa
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
mv $out/wxFormBuilder.app $out/Applications
makeWrapper $out/Applications/wxFormBuilder.app/Contents/MacOS/wxFormBuilder $out/bin/wxformbuilder
'';
meta = with lib; {
description = "RAD tool for wxWidgets GUI design";
homepage = "https://github.com/wxFormBuilder/wxFormBuilder";
license = licenses.gpl2Only;
mainProgram = "wxformbuilder";
maintainers = with maintainers; [ matthuszagh wegank ];
platforms = platforms.unix;
};
})